This commit is contained in:
2021-02-19 12:31:12 +01:00
parent 41620cc92e
commit ac0e510e40
17 changed files with 42 additions and 15 deletions

View File

@ -36,6 +36,7 @@ ERASED_ATTRIBUTES = ('redefine', 'exists', 'optional', 'remove_check', 'namespac
'remove_condition', 'path', 'instance_mode', 'index',
'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name',
'reflector_object',)
ALLOW_ATTRIBUT_NOT_MANAGE = ['file']
class ServiceAnnotator:
@ -71,7 +72,13 @@ class ServiceAnnotator:
for elttype, values in dict(vars(service)).items():
if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES:
continue
eltname = elttype + 's'
if not service.manage and elttype not in ALLOW_ATTRIBUT_NOT_MANAGE:
msg = _(f'unmanage service cannot have "{elttype}"')
raise DictConsistencyError(msg, 66, service.xmlfiles)
if elttype != 'ip':
eltname = elttype + 's'
else:
eltname = elttype
path = '.'.join(['services', normalize_family(service_name), eltname])
family = self._gen_family(eltname,
path,