support family in family
This commit is contained in:
parent
e9b4bfb990
commit
ce507a84f9
71 changed files with 363 additions and 226 deletions
|
@ -33,11 +33,12 @@ from ..config import Config
|
|||
|
||||
from .target import TargetAnnotator
|
||||
from .param import ParamAnnotator
|
||||
from .variable import Walk
|
||||
|
||||
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
||||
|
||||
|
||||
class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||
class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
||||
"""Annotate condition
|
||||
"""
|
||||
def __init__(self,
|
||||
|
@ -66,15 +67,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
|||
"""convert auto_freeze
|
||||
only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen
|
||||
"""
|
||||
for variables in self.objectspace.space.variables.values():
|
||||
for family in variables.family.values():
|
||||
if not hasattr(family, 'variable'):
|
||||
continue
|
||||
for variable in family.variable.values():
|
||||
if isinstance(variable, self.objectspace.leadership):
|
||||
for follower in variable.variable:
|
||||
self._convert_auto_freeze(follower)
|
||||
else:
|
||||
for variable in self.get_variables():
|
||||
self._convert_auto_freeze(variable)
|
||||
|
||||
def _convert_auto_freeze(self,
|
||||
|
|
|
@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
from ..i18n import _
|
||||
from ..error import DictConsistencyError
|
||||
from ..utils import normalize_family
|
||||
from .variable import Walk
|
||||
|
||||
|
||||
#mode order is important
|
||||
|
@ -52,7 +53,7 @@ class Mode: # pylint: disable=R0903
|
|||
modes = {name: Mode(name, idx) for idx, name in enumerate(modes_level)}
|
||||
|
||||
|
||||
class FamilyAnnotator:
|
||||
class FamilyAnnotator(Walk):
|
||||
"""Annotate family
|
||||
"""
|
||||
def __init__(self,
|
||||
|
@ -67,26 +68,39 @@ class FamilyAnnotator:
|
|||
self.dynamic_families()
|
||||
self.convert_help()
|
||||
|
||||
def _has_variable(self,
|
||||
family: 'self.objectspace.family',
|
||||
) -> bool:
|
||||
if hasattr(family, 'variable'):
|
||||
for variable in family.variable.values():
|
||||
if isinstance(variable, self.objectspace.family):
|
||||
if self._has_variable(variable):
|
||||
return True
|
||||
else:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
||||
def remove_empty_families(self) -> None:
|
||||
"""Remove all families without any variable
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
removed_families = []
|
||||
for family_name, family in families.family.items():
|
||||
if not hasattr(family, 'variable') or len(family.variable) == 0:
|
||||
for family_name, family in families.variable.items():
|
||||
if isinstance(family, self.objectspace.family) and not self._has_variable(family):
|
||||
removed_families.append(family_name)
|
||||
for family_name in removed_families:
|
||||
del families.family[family_name]
|
||||
del families.variable[family_name]
|
||||
|
||||
def family_names(self) -> None:
|
||||
"""Set doc, path, ... to family
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
families.doc = families.name
|
||||
families.path = families.name
|
||||
for family in families.family.values():
|
||||
for family in self.get_families():
|
||||
if not hasattr(family, 'description'):
|
||||
family.description = family.name
|
||||
if not hasattr(family, 'path'):
|
||||
family.path = family.name
|
||||
family.doc = family.description
|
||||
del family.description
|
||||
family.name = normalize_family(family.name)
|
||||
|
@ -94,23 +108,46 @@ class FamilyAnnotator:
|
|||
def change_modes(self):
|
||||
"""change the mode of variables
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
for family in families.family.values():
|
||||
family_mode = family.mode
|
||||
# default is high level
|
||||
new_family_mode = modes_level[-1]
|
||||
for variable in family.variable.values():
|
||||
if not isinstance(variable, self.objectspace.leadership):
|
||||
func = self._change_variabe_mode
|
||||
for family in self.objectspace.space.variables.values():
|
||||
self.change_family_mode(family,
|
||||
new_family_mode,
|
||||
first=True,
|
||||
)
|
||||
|
||||
def change_family_mode(self,
|
||||
family: 'self.objectspace.family',
|
||||
new_family_mode: str,
|
||||
first: bool=False,
|
||||
) -> str:
|
||||
if hasattr(family, 'mode'):
|
||||
family_mode = family.mode
|
||||
else:
|
||||
family_mode = new_family_mode
|
||||
if hasattr(family, 'variable'):
|
||||
# change variable mode, but not if variables are not in a family
|
||||
for variable in family.variable.values():
|
||||
if isinstance(variable, self.objectspace.family):
|
||||
new_family_mode = self.change_family_mode(variable,
|
||||
new_family_mode,
|
||||
)
|
||||
continue
|
||||
if first:
|
||||
continue
|
||||
if isinstance(variable, self.objectspace.leadership):
|
||||
func = self._change_variable_mode_leader
|
||||
else:
|
||||
func = self._change_variabe_mode
|
||||
func(variable,
|
||||
family_mode,
|
||||
)
|
||||
if modes[new_family_mode] > modes[variable.mode]:
|
||||
new_family_mode = variable.mode
|
||||
if not first:
|
||||
# set the lower variable mode to family
|
||||
family.mode = new_family_mode
|
||||
return new_family_mode
|
||||
|
||||
def _change_variabe_mode(self,
|
||||
variable,
|
||||
|
@ -160,8 +197,7 @@ class FamilyAnnotator:
|
|||
def dynamic_families(self):
|
||||
"""link dynamic families to object
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
for family in families.family.values():
|
||||
for family in self.get_families():
|
||||
if 'dynamic' not in vars(family):
|
||||
continue
|
||||
family.suffixes = self.objectspace.paths.get_variable(family.dynamic)
|
||||
|
@ -170,12 +206,15 @@ class FamilyAnnotator:
|
|||
msg = _(f'dynamic family "{family.name}" must be linked '
|
||||
f'to multi variable')
|
||||
raise DictConsistencyError(msg, 16, family.xmlfiles)
|
||||
for variable in family.variable.values():
|
||||
if isinstance(variable, self.objectspace.family):
|
||||
msg = _(f'dynamic family "{family.name}" cannot contains another family')
|
||||
raise DictConsistencyError(msg, 2, family.xmlfiles)
|
||||
|
||||
def convert_help(self):
|
||||
"""Convert variable help
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
for family in families.family.values():
|
||||
for family in self.get_families():
|
||||
if not hasattr(family, 'help'):
|
||||
continue
|
||||
if not hasattr(family, 'information'):
|
||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
"""
|
||||
from ..i18n import _
|
||||
from ..error import DictConsistencyError
|
||||
from .variable import Walk
|
||||
|
||||
|
||||
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
||||
|
@ -35,7 +36,7 @@ CONVERT_PROPERTIES = {'auto_save': ['force_store_value'],
|
|||
}
|
||||
|
||||
|
||||
class PropertyAnnotator:
|
||||
class PropertyAnnotator(Walk):
|
||||
"""Annotate properties
|
||||
"""
|
||||
def __init__(self, objectspace):
|
||||
|
@ -43,7 +44,8 @@ class PropertyAnnotator:
|
|||
if hasattr(self.objectspace.space, 'services'):
|
||||
self.convert_services()
|
||||
if hasattr(self.objectspace.space, 'variables'):
|
||||
self.convert_variables()
|
||||
self.convert_family()
|
||||
self.convert_variable()
|
||||
|
||||
def convert_property(self,
|
||||
variable,
|
||||
|
@ -92,15 +94,15 @@ class PropertyAnnotator:
|
|||
for variable in family.variable:
|
||||
self.convert_property(variable)
|
||||
|
||||
def convert_variables(self) -> None:
|
||||
def convert_family(self) -> None:
|
||||
"""convert variables
|
||||
"""
|
||||
for variables in self.objectspace.space.variables.values():
|
||||
for family in variables.family.values():
|
||||
for family in self.get_families():
|
||||
self.convert_property(family)
|
||||
for variable in family.variable.values():
|
||||
self.convert_property(variable)
|
||||
if not isinstance(variable, self.objectspace.leadership):
|
||||
continue
|
||||
|
||||
def convert_variable(self) -> None:
|
||||
for variable in self.get_variables(with_leadership=True):
|
||||
if isinstance(variable, self.objectspace.leadership):
|
||||
for follower in variable.variable:
|
||||
self.convert_property(follower)
|
||||
self.convert_property(variable)
|
||||
|
|
|
@ -35,7 +35,7 @@ from ..error import DictConsistencyError
|
|||
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
||||
'remove_condition', 'path', 'instance_mode', 'index',
|
||||
'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name',
|
||||
'reflector_object', 'manage')
|
||||
'reflector_object',)
|
||||
|
||||
|
||||
KEY_TYPE = {'variable': 'symlink',
|
||||
|
@ -76,8 +76,6 @@ class ServiceAnnotator:
|
|||
self.objectspace.space.services.path = 'services'
|
||||
for service_name, service in self.objectspace.space.services.service.items():
|
||||
service.information = self.objectspace.information(service.xmlfiles)
|
||||
service.information.manage = service.manage
|
||||
service.manage = None
|
||||
for elttype, values in dict(vars(service)).items():
|
||||
if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES:
|
||||
continue
|
||||
|
|
|
@ -24,8 +24,9 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from .variable import Walk
|
||||
|
||||
class ValueAnnotator: # pylint: disable=R0903
|
||||
class ValueAnnotator(Walk): # pylint: disable=R0903
|
||||
"""Annotate value
|
||||
"""
|
||||
def __init__(self,
|
||||
|
@ -39,11 +40,7 @@ class ValueAnnotator: # pylint: disable=R0903
|
|||
def convert_value(self) -> None:
|
||||
"""convert value
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
for family in families.family.values():
|
||||
if not hasattr(family, 'variable'):
|
||||
continue
|
||||
for variable in family.variable.values():
|
||||
for variable in self.get_variables(with_leadership=True):
|
||||
if isinstance(variable, self.objectspace.leadership):
|
||||
variable_type = 'leader'
|
||||
for follower in variable.variable:
|
||||
|
|
|
@ -63,7 +63,52 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'],
|
|||
}
|
||||
|
||||
|
||||
class VariableAnnotator: # pylint: disable=R0903
|
||||
class Walk:
|
||||
"""Walk to objectspace to find variable or family
|
||||
"""
|
||||
def get_variables(self,
|
||||
with_leadership: bool=False,
|
||||
):
|
||||
"""Iter all variables from the objectspace
|
||||
"""
|
||||
for family in self.objectspace.space.variables.values():
|
||||
yield from self._get_variables(family, with_leadership)
|
||||
|
||||
def _get_variables(self,
|
||||
family: 'self.objectspace.family',
|
||||
with_leadership: bool
|
||||
):
|
||||
if hasattr(family, 'variable'):
|
||||
for variable in family.variable.values():
|
||||
if isinstance(variable, self.objectspace.family):
|
||||
yield from self._get_variables(variable, with_leadership)
|
||||
continue
|
||||
if not with_leadership and isinstance(variable, self.objectspace.leadership):
|
||||
for follower in variable.variable:
|
||||
yield follower
|
||||
continue
|
||||
yield variable
|
||||
# if hasattr(family, 'family'):
|
||||
# for fam in family.family.values():
|
||||
# yield from self._get_variables(fam, with_leadership)
|
||||
|
||||
def get_families(self):
|
||||
"""Iter all families from the objectspace
|
||||
"""
|
||||
for family in self.objectspace.space.variables.values():
|
||||
yield from self._get_families(family)
|
||||
|
||||
def _get_families(self,
|
||||
family: 'self.objectspace.family',
|
||||
):
|
||||
yield family
|
||||
if hasattr(family, 'variable'):
|
||||
for fam in family.variable.values():
|
||||
if isinstance(fam, self.objectspace.family):
|
||||
yield from self._get_families(fam)
|
||||
|
||||
|
||||
class VariableAnnotator(Walk): # pylint: disable=R0903
|
||||
"""Annotate variable
|
||||
"""
|
||||
def __init__(self,
|
||||
|
@ -79,28 +124,21 @@ class VariableAnnotator: # pylint: disable=R0903
|
|||
def convert_variable(self):
|
||||
"""convert variable
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
for family in families.family.values():
|
||||
if not hasattr(family, 'variable'):
|
||||
continue
|
||||
for variable in family.variable.values():
|
||||
for variable in self.get_variables(with_leadership=True):
|
||||
if isinstance(variable, self.objectspace.leadership):
|
||||
# first variable is a leader, others are follower
|
||||
variable_type = 'leader'
|
||||
for follower in variable.variable:
|
||||
self._convert_variable(families.name,
|
||||
follower,
|
||||
self._convert_variable(follower,
|
||||
variable_type,
|
||||
)
|
||||
variable_type = 'follower'
|
||||
else:
|
||||
self._convert_variable(families.name,
|
||||
variable,
|
||||
self._convert_variable(variable,
|
||||
'variable',
|
||||
)
|
||||
|
||||
def _convert_variable(self,
|
||||
namespace: str,
|
||||
variable,
|
||||
variable_type: str,
|
||||
) -> None:
|
||||
|
@ -127,12 +165,9 @@ class VariableAnnotator: # pylint: disable=R0903
|
|||
variable.multi = 'submulti'
|
||||
else:
|
||||
variable.multi = True
|
||||
self._convert_valid_enum(namespace,
|
||||
variable,
|
||||
)
|
||||
self._convert_valid_enum(variable)
|
||||
|
||||
def _convert_valid_enum(self,
|
||||
namespace,
|
||||
variable,
|
||||
):
|
||||
"""some types are, in fact, choices
|
||||
|
@ -142,7 +177,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
|||
if not hasattr(self.objectspace.space, 'constraints'):
|
||||
xmlfiles = variable.xmlfiles
|
||||
self.objectspace.space.constraints = self.objectspace.constraints(xmlfiles)
|
||||
self.objectspace.space.constraints.namespace = namespace
|
||||
self.objectspace.space.constraints.namespace = variable.namespace
|
||||
if not hasattr(self.objectspace.space.constraints, 'check'):
|
||||
self.objectspace.space.constraints.check = []
|
||||
check = self.objectspace.check(variable.xmlfiles)
|
||||
|
@ -150,7 +185,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
|||
target = self.objectspace.target(variable.xmlfiles)
|
||||
target.name = variable.path
|
||||
check.target = [target]
|
||||
check.namespace = namespace
|
||||
check.namespace = variable.namespace
|
||||
check.param = []
|
||||
for value in FORCE_CHOICE[variable.type]:
|
||||
param = self.objectspace.param(variable.xmlfiles)
|
||||
|
@ -162,15 +197,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
|||
def convert_test(self):
|
||||
"""Convert variable tests value
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
for family in families.family.values():
|
||||
if not hasattr(family, 'variable'):
|
||||
continue
|
||||
for variable in family.variable.values():
|
||||
if isinstance(variable, self.objectspace.leadership):
|
||||
for follower in variable.variable:
|
||||
self._convert_test(follower)
|
||||
else:
|
||||
for variable in self.get_variables():
|
||||
self._convert_test(variable)
|
||||
|
||||
def _convert_test(self,
|
||||
|
@ -194,15 +221,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
|||
def convert_help(self):
|
||||
"""Convert variable help
|
||||
"""
|
||||
for families in self.objectspace.space.variables.values():
|
||||
for family in families.family.values():
|
||||
if not hasattr(family, 'variable'):
|
||||
continue
|
||||
for variable in family.variable.values():
|
||||
if isinstance(variable, self.objectspace.leadership):
|
||||
for follower in variable.variable:
|
||||
self._convert_help(follower)
|
||||
else:
|
||||
for variable in self.get_variables():
|
||||
self._convert_help(variable)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
|
||||
<!ELEMENT service ((port*|ip*|file*|override*)*)>
|
||||
<!ATTLIST service name CDATA #REQUIRED>
|
||||
<!ATTLIST service manage (True|False) "True">
|
||||
|
||||
<!ELEMENT port (#PCDATA)>
|
||||
<!ATTLIST port port_type (PortOption|variable) "PortOption">
|
||||
|
@ -79,9 +78,9 @@
|
|||
<!ATTLIST override source CDATA #IMPLIED>
|
||||
<!ATTLIST override templating (True|False) "True">
|
||||
|
||||
<!ELEMENT variables (family*)>
|
||||
<!ELEMENT variables ((variable*|family*)*)>
|
||||
|
||||
<!ELEMENT family (variable*)>
|
||||
<!ELEMENT family ((variable*|family*)*)>
|
||||
<!ATTLIST family name CDATA #REQUIRED>
|
||||
<!ATTLIST family description CDATA #IMPLIED>
|
||||
<!ATTLIST family help CDATA #IMPLIED>
|
||||
|
@ -127,7 +126,7 @@
|
|||
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
|
||||
|
||||
<!ELEMENT param (#PCDATA)>
|
||||
<!ATTLIST param type (string|number|nil|variable|information|suffix) "string">
|
||||
<!ATTLIST param type (string|number|nil|boolean|variable|information|suffix) "string">
|
||||
<!ATTLIST param name CDATA #IMPLIED>
|
||||
<!ATTLIST param propertyerror (True|False) "True">
|
||||
<!ATTLIST param optional (True|False) "False">
|
||||
|
|
|
@ -43,7 +43,9 @@ UNREDEFINABLE = ('multi', 'type')
|
|||
# RougailObjSpace's elements that did not created automaticly
|
||||
FORCE_ELEMENTS = ('choice', 'property_', 'leadership', 'information')
|
||||
# XML text are convert has name
|
||||
FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target')
|
||||
FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value',)
|
||||
|
||||
FORCE_TAG = {'family': 'variable'}
|
||||
|
||||
|
||||
# _____________________________________________________________________________
|
||||
|
@ -236,7 +238,8 @@ class RougailObjSpace:
|
|||
"""
|
||||
retrieves or creates Rougail Object Subspace objects
|
||||
"""
|
||||
obj = getattr(self, child.tag)
|
||||
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||
obj = getattr(self, tag)
|
||||
name = self._get_name(child, namespace)
|
||||
if Redefinable in obj.__mro__:
|
||||
return self.create_or_update_redefinable_object(xmlfile,
|
||||
|
@ -314,8 +317,9 @@ class RougailObjSpace:
|
|||
# cannot redefine an inexistant object
|
||||
msg = _(f'Redefined object: "{name}" does not exist yet')
|
||||
raise DictConsistencyError(msg, 46, xmlfile)
|
||||
if child.tag not in vars(space):
|
||||
setattr(space, child.tag, {})
|
||||
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||
if tag not in vars(space):
|
||||
setattr(space, tag, {})
|
||||
return getattr(self, child.tag)(xmlfile, name)
|
||||
|
||||
def get_existed_obj(self,
|
||||
|
@ -328,7 +332,7 @@ class RougailObjSpace:
|
|||
"""
|
||||
if child.tag in ['variable', 'family']:
|
||||
name = normalize_family(name)
|
||||
if isinstance(space, self.family): # pylint: disable=E1101
|
||||
if child.tag == 'variable': # pylint: disable=E1101
|
||||
if namespace != Config['variable_namespace']:
|
||||
name = space.path + '.' + name
|
||||
if not self.paths.path_is_defined(name):
|
||||
|
@ -340,7 +344,8 @@ class RougailObjSpace:
|
|||
raise DictConsistencyError(msg, 47, space.xmlfiles)
|
||||
return self.paths.get_variable(name)
|
||||
# it's not a family
|
||||
children = getattr(space, child.tag, {})
|
||||
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||
children = getattr(space, tag, {})
|
||||
if name in children:
|
||||
return children[name]
|
||||
return None
|
||||
|
@ -458,7 +463,10 @@ class RougailObjSpace:
|
|||
"""Fill self.paths attributes
|
||||
"""
|
||||
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
||||
if 'name' in document.attrib:
|
||||
family_name = normalize_family(document.attrib['name'])
|
||||
else:
|
||||
family_name = namespace
|
||||
self.paths.add_variable(namespace,
|
||||
normalize_family(variableobj.name),
|
||||
namespace + '.' + family_name,
|
||||
|
@ -485,9 +493,10 @@ class RougailObjSpace:
|
|||
variableobj.namespace = namespace
|
||||
if isinstance(variableobj, Redefinable):
|
||||
name = variableobj.name
|
||||
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||
if child.tag in ['family', 'variable']:
|
||||
name = normalize_family(name)
|
||||
getattr(space, child.tag)[name] = variableobj
|
||||
getattr(space, tag)[name] = variableobj
|
||||
elif isinstance(variableobj, UnRedefinable):
|
||||
getattr(space, child.tag).append(variableobj)
|
||||
else:
|
||||
|
|
|
@ -62,11 +62,11 @@ class XMLReflector:
|
|||
try:
|
||||
document = parse(xmlfile)
|
||||
except XMLSyntaxError as err:
|
||||
raise DictConsistencyError(_(f'not an XML file: {err}'), 52, xmlfile) from err
|
||||
raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err
|
||||
if not self.dtd.validate(document):
|
||||
dtd_error = self.dtd.error_log.filter_from_errors()[0]
|
||||
msg = _(f'not a valid XML file: {dtd_error}')
|
||||
raise DictConsistencyError(msg, 43, xmlfile)
|
||||
raise DictConsistencyError(msg, 43, [xmlfile])
|
||||
return document.getroot()
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -13,6 +13,5 @@ except:
|
|||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_2 = OptionDescription(name="tata", doc="tata", children=[])
|
||||
option_2.impl_set_information('manage', True)
|
||||
option_1 = OptionDescription(name="services", doc="services", children=[option_2], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||
|
|
|
@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="systemd_makefs@dev_disk_by\\x2dpartlabel", doc="systemd-makefs@dev-disk-by\\x2dpartlabel", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -26,6 +26,5 @@ option_15 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15])
|
||||
option_7 = OptionDescription(name="files", doc="files", children=[option_8])
|
||||
option_6 = OptionDescription(name="test", doc="test", children=[option_7])
|
||||
option_6.impl_set_information('manage', True)
|
||||
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<services>
|
||||
<service name="test">
|
||||
<file name="/tmp/file1" filelist="afilllist"/>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="condition" type="boolean"/>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<condition name="disabled_if_in" source="condition">
|
||||
<param type="boolean">True</param>
|
||||
<target type="filelist">afilllist</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.condition": true, "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true}
|
|
@ -0,0 +1,29 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
from importlib.util import spec_from_loader, module_from_spec
|
||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
spec = spec_from_loader(loader.name, loader)
|
||||
func = module_from_spec(spec)
|
||||
loader.exec_module(func)
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_8 = StrOption(name="group", doc="group", default="root")
|
||||
option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_10 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||
option_11 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_12 = StrOption(name="source", doc="source", default="file1")
|
||||
option_13 = BoolOption(name="templating", doc="templating", default=True)
|
||||
option_14 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)})))
|
||||
option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -35,6 +35,5 @@ option_24 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_17 = OptionDescription(name="file2", doc="file2", children=[option_18, option_19, option_20, option_21, option_22, option_23, option_24])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_17])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func
|
|||
option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -26,6 +26,5 @@ option_15 = BoolOption(name="activate", doc="activate", default=False)
|
|||
option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15])
|
||||
option_7 = OptionDescription(name="files", doc="files", children=[option_8])
|
||||
option_6 = OptionDescription(name="test", doc="test", children=[option_7])
|
||||
option_6.impl_set_information('manage', True)
|
||||
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
||||
|
|
|
@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -30,6 +30,5 @@ option_19 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19])
|
||||
option_11 = OptionDescription(name="files", doc="files", children=[option_12])
|
||||
option_10 = OptionDescription(name="test", doc="test", children=[option_11])
|
||||
option_10.impl_set_information('manage', True)
|
||||
option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9])
|
||||
|
|
|
@ -30,6 +30,5 @@ option_19 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19])
|
||||
option_11 = OptionDescription(name="files", doc="files", children=[option_12])
|
||||
option_10 = OptionDescription(name="test", doc="test", children=[option_11])
|
||||
option_10.impl_set_information('manage', True)
|
||||
option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9])
|
||||
|
|
12
tests/dictionaries/45multi_family/00-base.xml
Normal file
12
tests/dictionaries/45multi_family/00-base.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="base">
|
||||
<family name="subfamily">
|
||||
<variable name="variable"/>
|
||||
</family>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
0
tests/dictionaries/45multi_family/__init__.py
Normal file
0
tests/dictionaries/45multi_family/__init__.py
Normal file
1
tests/dictionaries/45multi_family/makedict/base.json
Normal file
1
tests/dictionaries/45multi_family/makedict/base.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"rougail.base.subfamily.variable": null}
|
|
@ -12,10 +12,8 @@ try:
|
|||
except:
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_4 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"}))
|
||||
option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"normal"}))
|
||||
option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[])
|
||||
option_5.impl_set_information('manage', False)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
15
tests/dictionaries/45multi_family_order/00-base.xml
Normal file
15
tests/dictionaries/45multi_family_order/00-base.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<variable name="variable1"/>
|
||||
<family name="base">
|
||||
<variable name="variable2"/>
|
||||
<family name="subfamily">
|
||||
<variable name="variable3"/>
|
||||
</family>
|
||||
<variable name="variable4"/>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
0
tests/dictionaries/45multi_family_order/__init__.py
Normal file
0
tests/dictionaries/45multi_family_order/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
{"rougail.variable1": null, "rougail.base.variable2": null, "rougail.base.subfamily.variable3": null, "rougail.base.variable4": null}
|
22
tests/dictionaries/45multi_family_order/tiramisu/base.py
Normal file
22
tests/dictionaries/45multi_family_order/tiramisu/base.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
from importlib.util import spec_from_loader, module_from_spec
|
||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
spec = spec_from_loader(loader.name, loader)
|
||||
func = module_from_spec(spec)
|
||||
loader.exec_module(func)
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_2 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal"}))
|
||||
option_4 = StrOption(name="variable2", doc="variable2", properties=frozenset({"normal"}))
|
||||
option_6 = StrOption(name="variable3", doc="variable3", properties=frozenset({"normal"}))
|
||||
option_5 = OptionDescription(name="subfamily", doc="subfamily", children=[option_6], properties=frozenset({"normal"}))
|
||||
option_7 = StrOption(name="variable4", doc="variable4", properties=frozenset({"normal"}))
|
||||
option_3 = OptionDescription(name="base", doc="base", children=[option_4, option_5, option_7], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
8
tests/dictionaries/45without_family/00-base.xml
Normal file
8
tests/dictionaries/45without_family/00-base.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<variable name="variable"/>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
0
tests/dictionaries/45without_family/__init__.py
Normal file
0
tests/dictionaries/45without_family/__init__.py
Normal file
1
tests/dictionaries/45without_family/makedict/base.json
Normal file
1
tests/dictionaries/45without_family/makedict/base.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"rougail.variable": null}
|
17
tests/dictionaries/45without_family/tiramisu/base.py
Normal file
17
tests/dictionaries/45without_family/tiramisu/base.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
from importlib.util import spec_from_loader, module_from_spec
|
||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
spec = spec_from_loader(loader.name, loader)
|
||||
func = module_from_spec(spec)
|
||||
loader.exec_module(func)
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_2 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
|
@ -31,6 +31,5 @@ option_20 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20])
|
||||
option_12 = OptionDescription(name="files", doc="files", children=[option_13])
|
||||
option_11 = OptionDescription(name="test", doc="test", children=[option_12])
|
||||
option_11.impl_set_information('manage', True)
|
||||
option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10])
|
||||
|
|
|
@ -32,6 +32,5 @@ option_20 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20])
|
||||
option_12 = OptionDescription(name="files", doc="files", children=[option_13])
|
||||
option_11 = OptionDescription(name="test", doc="test", children=[option_12])
|
||||
option_11.impl_set_information('manage', True)
|
||||
option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10])
|
||||
|
|
|
@ -33,6 +33,5 @@ option_22 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_15 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -26,6 +26,5 @@ option_15 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_8 = OptionDescription(name="mailname", doc="mailname", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15])
|
||||
option_7 = OptionDescription(name="files", doc="files", children=[option_8])
|
||||
option_6 = OptionDescription(name="test", doc="test", children=[option_7])
|
||||
option_6.impl_set_information('manage', True)
|
||||
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
||||
|
|
|
@ -28,6 +28,5 @@ option_17 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -28,6 +28,5 @@ option_17 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -41,6 +41,5 @@ option_30 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_23 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_24, option_25, option_26, option_27, option_28, option_29, option_30])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15, option_23])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -33,6 +33,5 @@ option_22 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_15 = OptionDescription(name="mailname2", doc="mailname2", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="mailname_new", doc="mailname.new", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -16,6 +16,5 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui"
|
|||
option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -16,6 +16,5 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non"
|
|||
option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -17,6 +17,5 @@ option_4 = IPOption(name="adresse_ip_test", doc="No change", allow_reserved=True
|
|||
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_6 = OptionDescription(name="test", doc="test", children=[])
|
||||
option_6.impl_set_information('manage', True)
|
||||
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
||||
|
|
|
@ -24,6 +24,5 @@ option_13 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_9 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_10, option_11, option_12, option_13])
|
||||
option_8 = OptionDescription(name="ips", doc="ips", children=[option_9])
|
||||
option_7 = OptionDescription(name="nut", doc="nut", children=[option_8])
|
||||
option_7.impl_set_information('manage', True)
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||
|
|
|
@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_10 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_11, option_12, option_13, option_14])
|
||||
option_9 = OptionDescription(name="ips", doc="ips", children=[option_10])
|
||||
option_8 = OptionDescription(name="ntp", doc="ntp", children=[option_9])
|
||||
option_8.impl_set_information('manage', True)
|
||||
option_7 = OptionDescription(name="services", doc="services", children=[option_8], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_7])
|
||||
|
|
|
@ -21,6 +21,5 @@ option_10 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="123", doc="123", children=[option_8, option_9, option_10])
|
||||
option_6 = OptionDescription(name="ports", doc="ports", children=[option_7])
|
||||
option_5 = OptionDescription(name="ntp", doc="ntp", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -22,6 +22,5 @@ option_11 = BoolOption(name="activate", doc="activate", default=True)
|
|||
option_7 = OptionDescription(name="192_168_1_1", doc="192.168.1.1", children=[option_8, option_9, option_10, option_11])
|
||||
option_6 = OptionDescription(name="ips", doc="ips", children=[option_7])
|
||||
option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[option_6])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -16,6 +16,5 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui"
|
|||
option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[])
|
||||
option_5.impl_set_information('manage', True)
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail>
|
||||
|
||||
<services>
|
||||
<service name='testsrv' manage='False'>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
|
||||
<variables>
|
||||
<family name='général'>
|
||||
<variable name='mode_conteneur_actif' type='string' description="No change" hidden="True">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -1 +0,0 @@
|
|||
{"rougail.general.mode_conteneur_actif": "oui"}
|
16
tests/dictionaries/80family_dynamic_with_family/00-base.xml
Normal file
16
tests/dictionaries/80family_dynamic_with_family/00-base.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name='general'>
|
||||
<variable name='varname' type='string' description="No change" multi="True">
|
||||
<value>val1</value>
|
||||
<value>val2</value>
|
||||
</variable>
|
||||
</family>
|
||||
<family name='dyn' dynamic="varname">
|
||||
<variable name='vardyn' type='string' description="No change"/>
|
||||
<family name="my_family"/>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
0
tests/dictionaries/80family_dynamic_with_family/errno_2
Normal file
0
tests/dictionaries/80family_dynamic_with_family/errno_2
Normal file
Loading…
Reference in a new issue