From 7e58b825ea71670c2a6733c30295a0688a00219e Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 21 Jul 2025 10:36:51 +0200 Subject: [PATCH] Changed pgadmin to web-app-pgadmin --- group_vars/all/09_ports.yml | 4 ++-- group_vars/all/10_networks.yml | 2 +- roles/web-app-pgadmin/vars/main.yml | 2 +- .../test_application_id_deprecation.py | 22 +++++++++++++------ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/group_vars/all/09_ports.yml b/group_vars/all/09_ports.yml index 2810ad9c..fe904b11 100644 --- a/group_vars/all/09_ports.yml +++ b/group_vars/all/09_ports.yml @@ -13,7 +13,7 @@ ports: web-app-lam: 4182 web-app-openproject: 4183 web-app-yourls: 4184 - pgadmin: 4185 + web-app-pgadmin: 4185 phpldapadmin: 4186 fusiondirectory: 4187 web-app-gitea: 4188 @@ -37,7 +37,7 @@ ports: roulette-wheel: 8013 web-app-joomla: 8014 attendize: 8015 - pgadmin: 8016 + web-app-pgadmin: 8016 web-app-baserow: 8017 web-app-matomo: 8018 web-app-listmonk: 8019 diff --git a/group_vars/all/10_networks.yml b/group_vars/all/10_networks.yml index 320cc9d8..ca06547b 100644 --- a/group_vars/all/10_networks.yml +++ b/group_vars/all/10_networks.yml @@ -60,7 +60,7 @@ defaults_networks: subnet: 192.168.102.112/28 web-app-pixelfed: subnet: 192.168.102.128/28 - pgadmin: + web-app-pgadmin: subnet: 192.168.102.144/28 web-app-snipe-it: subnet: 192.168.102.160/28 diff --git a/roles/web-app-pgadmin/vars/main.yml b/roles/web-app-pgadmin/vars/main.yml index 7996d7ff..b8b72bb9 100644 --- a/roles/web-app-pgadmin/vars/main.yml +++ b/roles/web-app-pgadmin/vars/main.yml @@ -1,4 +1,4 @@ -application_id: "pgadmin" +application_id: "web-app-pgadmin" database_type: "postgres" database_host: "{{ applications | get_app_conf('svc-db-postgres', 'docker.services.postgres.name', True) if applications | get_app_conf(application_id, 'features.central_database', False) }}" pgadmin_user: 5050 diff --git a/tests/integration/application_id/test_application_id_deprecation.py b/tests/integration/application_id/test_application_id_deprecation.py index bfda93ee..1e292599 100644 --- a/tests/integration/application_id/test_application_id_deprecation.py +++ b/tests/integration/application_id/test_application_id_deprecation.py @@ -1,7 +1,6 @@ import os import unittest import yaml -import warnings # Dynamically determine the path to the roles directory ROLES_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'roles')) @@ -10,7 +9,10 @@ class TestApplicationIdDeprecation(unittest.TestCase): def test_application_id_matches_role_name(self): """ Deprecation: application_id in vars/main.yml must match the role name. + This test fails if any role violates this rule, listing all violations. """ + errors = [] + for role in os.listdir(ROLES_DIR): role_path = os.path.join(ROLES_DIR, role) vars_main_yml = os.path.join(role_path, 'vars', 'main.yml') @@ -20,17 +22,23 @@ class TestApplicationIdDeprecation(unittest.TestCase): try: data = yaml.safe_load(f) except Exception as e: - self.fail(f"Could not parse {vars_main_yml}: {e}") + errors.append(f"Could not parse {vars_main_yml}: {e}") + continue if not isinstance(data, dict): continue app_id = data.get('application_id') if app_id is not None and app_id != role: - warnings.warn( - f"[DEPRECATION WARNING] application_id '{app_id}' in {vars_main_yml} " - f"does not match its role directory '{role}'.\n" - f"Please update 'application_id' to match the role name for future compatibility.", - DeprecationWarning + errors.append( + f"[DEPRECATION] application_id '{app_id}' in {vars_main_yml} " + f"does not match its role directory '{role}'." ) + if errors: + self.fail( + "application_id mismatch found in one or more roles:\n\n" + + "\n".join(errors) + + "\n\nPlease update 'application_id' to match the role name for future compatibility." + ) + if __name__ == "__main__": unittest.main()