mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Restructured server config
This commit is contained in:
@@ -25,7 +25,7 @@ class TestDomainUniqueness(unittest.TestCase):
|
||||
domain_to_apps = defaultdict(set)
|
||||
|
||||
for app_name, app_cfg in apps.items():
|
||||
domains_cfg = app_cfg.get('domains', {})
|
||||
domains_cfg = app_cfg.get('server',{}).get('domains',{})
|
||||
|
||||
# canonical entries may be a list or a mapping
|
||||
canonical = domains_cfg.get('canonical', [])
|
||||
|
@@ -20,17 +20,17 @@ class TestWebRolesDomains(unittest.TestCase):
|
||||
|
||||
self.assertIsInstance(data, dict, f"YAML root is not a dict in {path}")
|
||||
|
||||
domains = data.get("domains")
|
||||
domains = data.get('server',{}).get('domains',{})
|
||||
self.assertIsNotNone(domains, f"'domains' section missing in {path}")
|
||||
self.assertIsInstance(domains, dict, f"'domains' must be a dict in {path}")
|
||||
|
||||
canonical = domains.get("canonical")
|
||||
self.assertIsNotNone(canonical, f"'domains.canonical' missing in {path}")
|
||||
self.assertIsNotNone(canonical, f"'server.domains.canonical' missing in {path}")
|
||||
|
||||
# Check for emptiness
|
||||
empty_values = [{}, [], ""]
|
||||
self.assertNotIn(canonical, empty_values,
|
||||
f"'domains.canonical' in {path} must not be empty dict, list, or empty string")
|
||||
f"'server.domains.canonical' in {path} must not be empty dict, list, or empty string")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
@@ -33,7 +33,7 @@ class TestDomainsStructure(unittest.TestCase):
|
||||
if 'domains' not in data:
|
||||
continue
|
||||
|
||||
domains = data['domains']
|
||||
domains = data.get('server',{}).get('domains')
|
||||
if not isinstance(domains, dict):
|
||||
failed_roles.append((role_path.name, vars_file.name, "'domains' should be a dict"))
|
||||
continue
|
||||
|
Reference in New Issue
Block a user