mandatory_if_in only for variables
This commit is contained in:
parent
86ec629ce3
commit
6d571d8cac
5 changed files with 25 additions and 2 deletions
|
@ -62,12 +62,15 @@ class TargetAnnotator:
|
|||
f'is not allowed')
|
||||
raise DictConsistencyError(msg, 8, obj.xmlfiles)
|
||||
if target.type == 'family':
|
||||
if obj.name not in ['disabled_if_in', 'disabled_if_not_in', "hidden_if_in", "hidden_if_not_in"]:
|
||||
msg = _(f'target "{target.type}" not allow with "{obj.name}"')
|
||||
raise DictConsistencyError(msg, 51, target.xmlfiles)
|
||||
target.name = self.objectspace.paths.get_family(target.name,
|
||||
obj.namespace,
|
||||
)
|
||||
elif target.type.endswith('list') and \
|
||||
obj.name not in ['disabled_if_in', 'disabled_if_not_in']:
|
||||
msg = _(f'target "{target.type}" not allow')
|
||||
msg = _(f'target "{target.type}" not allow with "{obj.name}"')
|
||||
raise DictConsistencyError(msg, 10, target.xmlfiles)
|
||||
except DictConsistencyError as err:
|
||||
if err.errno != 42:
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<!ATTLIST param optional (True|False) "False">
|
||||
|
||||
<!ELEMENT target (#PCDATA)>
|
||||
<!ATTLIST target type (family|variable|filelist|iplist|portlist) "variable">
|
||||
<!ATTLIST target type (variable|family|filelist|iplist|portlist) "variable">
|
||||
<!ATTLIST target optional (True|False) "False">
|
||||
|
||||
<!ELEMENT group (follower+)>
|
||||
|
|
20
tests/dictionaries/80load_mandatoryifin_family/00-base.xml
Normal file
20
tests/dictionaries/80load_mandatoryifin_family/00-base.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="condition" type="boolean"/>
|
||||
</family>
|
||||
<family name="general2">
|
||||
<variable name="my_variable"/>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<condition name="mandatory_if_in" source="condition">
|
||||
<param>oui</param>
|
||||
<target type="family">general2</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
0
tests/dictionaries/80load_mandatoryifin_family/errno_51
Normal file
0
tests/dictionaries/80load_mandatoryifin_family/errno_51
Normal file
Loading…
Reference in a new issue