Solved bug which existed due to user structure refactoring

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-09 12:31:37 +02:00
parent e7322a239e
commit 73329506a9
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
3 changed files with 6 additions and 4 deletions

View File

@ -7,9 +7,10 @@ INCLUDES_OUT := ./tasks/utils/server-roles.yml
INCLUDES_SCRIPT := ./cli/generate_playbook.py
EXTRA_USERS := $(shell \
find $(ROLES_DIR) -maxdepth 1 -type d -name 'web-app*' -printf '%f\n' \
| sed -E 's/^web-app[_-]?//' \
find $(ROLES_DIR) -maxdepth 1 -type d -name '*' -printf '%f\n' \
| sed -E 's/.*-//' \
| grep -E -x '[a-z0-9]+' \
| sort -u \
| paste -sd, - \
)

View File

@ -80,7 +80,7 @@ def main():
sys.exit(1)
config_data["group_id"] = gid_number
result["defaults_applications"][application_id] = config_data
users_meta_file = role_dir / "meta" / "users.yml"
users_meta_file = role_dir / "users" / "main.yml"
transformed_users = {}
if users_meta_file.exists():
users_meta = load_yaml_file(users_meta_file)

View File

@ -18,6 +18,7 @@ class TestGenerateDefaultApplicationsUsers(unittest.TestCase):
(self.role / "vars").mkdir(parents=True)
(self.role / "config").mkdir(parents=True)
(self.role / "meta").mkdir(parents=True)
(self.role / "users").mkdir(parents=True)
# Write application_id and configuration
(self.role / "vars" / "main.yml").write_text("application_id: app_with_users\n")
@ -30,7 +31,7 @@ class TestGenerateDefaultApplicationsUsers(unittest.TestCase):
'bob': {'uid': 2002, 'gid': 2002}
}
}
with (self.role / "meta" / "users.yml").open('w', encoding='utf-8') as f:
with (self.role / "users" / "main.yml").open('w', encoding='utf-8') as f:
yaml.dump(users_meta, f)
# Output file path