Files
aios/scripts/validate_roles_and_domains.py
T

22 lines
810 B
Python

#!/usr/bin/env python3
import sys, pathlib, os
runtime=pathlib.Path(sys.argv[1] if len(sys.argv)>1 else os.environ.get('AIOS_RUNTIME_ROOT','.')).resolve()
candidates=[
runtime/'webops/config/domains.env',
runtime/'webops/config/roles.yaml',
runtime/'AIOS_ACTIVE_ROLE_MODEL_OWNER_ADMIN_USER',
runtime/'config/domains.env',
runtime/'config/roles.yaml',
runtime/'config/nodes.yaml',
runtime/'config/routing.yaml',
]
text=''
for p in candidates:
if p.exists():
text += p.read_text(errors='ignore')+'\n'
required=['owner','admin','user','server-hw','server-local','https://cnnetmkt.top','https://ops.cnnetmkt.top']
missing=[x for x in required if x not in text]
if missing:
raise SystemExit('VALIDATE_ROLES_DOMAINS_FAIL '+str(missing))
print('VALIDATE_ROLES_DOMAINS_OK')