update tests
This commit is contained in:
parent
71b9b70755
commit
13b1e9bf54
|
@ -46,8 +46,6 @@ class ConstrainteAnnotator:
|
|||
self.remove_constraints()
|
||||
|
||||
def convert_auto_freeze(self): # pylint: disable=C0111
|
||||
if not hasattr(self.objectspace.space, 'variables'):
|
||||
return
|
||||
def _convert_auto_freeze(variable, namespace):
|
||||
if variable.auto_freeze:
|
||||
if namespace != Config['variable_namespace']:
|
||||
|
@ -129,52 +127,14 @@ class ConstrainteAnnotator:
|
|||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable "{check.target}" in {xmlfiles}'), 4)
|
||||
variable = self.objectspace.paths.get_variable_obj(check.target)
|
||||
values = self.load_params_in_valid_enum(check.param,
|
||||
variable.name,
|
||||
variable.type,
|
||||
)
|
||||
self._set_valid_enum(variable,
|
||||
values,
|
||||
variable.type,
|
||||
check.target,
|
||||
check.xmlfiles,
|
||||
check,
|
||||
)
|
||||
remove_indexes.append(idx)
|
||||
remove_indexes.sort(reverse=True)
|
||||
for idx in remove_indexes:
|
||||
del self.objectspace.space.constraints.check[idx]
|
||||
|
||||
def load_params_in_valid_enum(self,
|
||||
params,
|
||||
variable_name,
|
||||
variable_type,
|
||||
):
|
||||
has_variable = None
|
||||
values = []
|
||||
for param in params:
|
||||
if param.type == 'variable':
|
||||
if has_variable is not None:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 5)
|
||||
has_variable = True
|
||||
variable = self.objectspace.paths.get_variable_obj(param.text)
|
||||
if not variable.multi:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 6)
|
||||
values = param.text
|
||||
else:
|
||||
if has_variable:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'only one parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 7)
|
||||
if not hasattr(param, 'text'):
|
||||
if param.type == 'number':
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'param type is number, so value is mandatory for valid_enum of variable "{variable_name}" in {xmlfiles}'), 8)
|
||||
values.append(None)
|
||||
else:
|
||||
values.append(param.text)
|
||||
return values
|
||||
|
||||
def check_change_warning(self):
|
||||
#convert level to "warnings_only"
|
||||
for check in self.objectspace.space.constraints.check:
|
||||
|
@ -201,7 +161,8 @@ class ConstrainteAnnotator:
|
|||
def check_params_target(self):
|
||||
for condition in self.objectspace.space.constraints.condition:
|
||||
if not hasattr(condition, 'target'):
|
||||
raise DictConsistencyError(_('target is mandatory in condition'), 9)
|
||||
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
|
||||
raise DictConsistencyError(_(f'target is mandatory in a condition for source "{condition.source}" in {xmlfiles}'), 9)
|
||||
for target in condition.target:
|
||||
if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(target.xmlfiles)
|
||||
|
@ -217,9 +178,10 @@ class ConstrainteAnnotator:
|
|||
try:
|
||||
target_names = [normalize_family(name) for name in target.name.split('.')]
|
||||
target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace)
|
||||
except DictConsistencyError:
|
||||
except DictConsistencyError as err:
|
||||
# for optional variable
|
||||
pass
|
||||
if not target.optional or err.errno != 42:
|
||||
raise err
|
||||
elif target.type == 'family':
|
||||
try:
|
||||
target_names = [normalize_family(name) for name in target.name.split('.')]
|
||||
|
@ -305,9 +267,17 @@ class ConstrainteAnnotator:
|
|||
remove_conditions = []
|
||||
for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition):
|
||||
namespace = condition.namespace
|
||||
condition.source = self.objectspace.paths.get_variable_path(condition.source, namespace, allow_source=True)
|
||||
condition.source, suffix = self.objectspace.paths.get_variable_path(condition.source,
|
||||
namespace,
|
||||
allow_source=True,
|
||||
with_suffix=True,
|
||||
)
|
||||
if suffix:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
|
||||
raise DictConsistencyError(_(f'the source "{condition.source}" in condition cannot be a dynamic variable in {xmlfiles}'), 20)
|
||||
src_variable = self.objectspace.paths.get_variable_obj(condition.source)
|
||||
valid_enum = None
|
||||
# FIXME only string?
|
||||
if condition.source in self.valid_enums and self.valid_enums[condition.source]['type'] == 'string':
|
||||
valid_enum = self.valid_enums[condition.source]['values']
|
||||
if valid_enum is not None:
|
||||
|
@ -319,7 +289,6 @@ class ConstrainteAnnotator:
|
|||
for idx in remove_param:
|
||||
del condition.param[idx]
|
||||
if condition.param == []:
|
||||
remove_targets = []
|
||||
for target in condition.target:
|
||||
leader_or_variable, variables = self._get_family_variables_from_target(target)
|
||||
if condition.name == 'disabled_if_not_in':
|
||||
|
@ -330,11 +299,7 @@ class ConstrainteAnnotator:
|
|||
variable.frozen = True
|
||||
variable.force_default_on_freeze = True
|
||||
elif condition.name == 'mandatory_if_not_in':
|
||||
variable.mandatory = True
|
||||
remove_targets = list(set(remove_targets))
|
||||
remove_targets.sort(reverse=True)
|
||||
for target_idx in remove_targets:
|
||||
condition.target.pop(target_idx)
|
||||
leader_or_variable.mandatory = True
|
||||
remove_conditions.append(condition_idx)
|
||||
remove_conditions = list(set(remove_conditions))
|
||||
remove_conditions.sort(reverse=True)
|
||||
|
@ -342,11 +307,8 @@ class ConstrainteAnnotator:
|
|||
self.objectspace.space.constraints.condition.pop(idx)
|
||||
|
||||
def remove_condition_with_empty_target(self):
|
||||
remove_conditions = []
|
||||
for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition):
|
||||
if not condition.target:
|
||||
remove_conditions.append(condition_idx)
|
||||
remove_conditions = list(set(remove_conditions))
|
||||
# optional target are remove, condition could be empty
|
||||
remove_conditions = [condition_idx for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition) if not condition.target]
|
||||
remove_conditions.sort(reverse=True)
|
||||
for idx in remove_conditions:
|
||||
self.objectspace.space.constraints.condition.pop(idx)
|
||||
|
@ -391,58 +353,72 @@ class ConstrainteAnnotator:
|
|||
|
||||
def _set_valid_enum(self,
|
||||
variable,
|
||||
values,
|
||||
type_,
|
||||
target: str,
|
||||
xmlfiles: List[str],
|
||||
check,
|
||||
):
|
||||
type_ = variable.type
|
||||
target = check.target
|
||||
# value for choice's variable is mandatory
|
||||
variable.mandatory = True
|
||||
# build choice
|
||||
variable.choice = []
|
||||
if isinstance(values, str):
|
||||
variable.type = 'choice'
|
||||
|
||||
has_variable = False
|
||||
values = []
|
||||
for param in check.param:
|
||||
if has_variable:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable "{variable.name}" in {xmlfiles}'), 5)
|
||||
param_type = type_
|
||||
if param.type == 'variable':
|
||||
has_variable = True
|
||||
param_variable = self.objectspace.paths.get_variable_obj(param.text)
|
||||
if param.optional is True:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'optional parameter in valid_enum for variable "{variable.name}" is not allowed in {xmlfiles}'), 14)
|
||||
if not param_variable.multi:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable "{variable.name}" in {xmlfiles}'), 6)
|
||||
param_type = 'calculation'
|
||||
value = param.text
|
||||
else:
|
||||
if 'type' in vars(param) and type_ != param.type:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'parameter in valid_enum has incompatible type "{param.type}" with type of the variable "{variable.name}" ("{type_}") in {xmlfiles}'), 7)
|
||||
if hasattr(param, 'text'):
|
||||
try:
|
||||
value = CONVERT_OPTION[type_].get('func', str)(param.text)
|
||||
except:
|
||||
raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{param.text}" is not a valid "{type_}" for "{variable.name}"'), 13)
|
||||
else:
|
||||
if param.type == 'number':
|
||||
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
|
||||
raise DictConsistencyError(_(f'param type is number, so value is mandatory for valid_enum of variable "{variable.name}" in {xmlfiles}'), 8)
|
||||
value = None
|
||||
values.append(value)
|
||||
choice = self.objectspace.choice(variable.xmlfiles)
|
||||
choice.type = 'calculation'
|
||||
choice.name = values
|
||||
choice.name = value
|
||||
choice.type = param_type
|
||||
variable.choice.append(choice)
|
||||
else:
|
||||
if has_variable:
|
||||
return
|
||||
|
||||
# FIXME really?
|
||||
if param_type != 'calculation':
|
||||
self.valid_enums[target] = {'type': type_,
|
||||
'values': values,
|
||||
'xmlfiles': xmlfiles,
|
||||
'xmlfiles': check.xmlfiles,
|
||||
}
|
||||
choices = []
|
||||
for value in values:
|
||||
choice = self.objectspace.choice(variable.xmlfiles)
|
||||
try:
|
||||
if value is not None:
|
||||
choice.name = CONVERT_OPTION[type_].get('func', str)(value)
|
||||
else:
|
||||
choice.name = value
|
||||
except:
|
||||
raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"'), 13)
|
||||
if choice.name == '':
|
||||
choice.name = None
|
||||
choices.append(choice.name)
|
||||
choice.type = type_
|
||||
variable.choice.append(choice)
|
||||
# check value or set first choice value has default value
|
||||
if hasattr(variable, 'value'):
|
||||
for value in variable.value:
|
||||
value.type = type_
|
||||
try:
|
||||
cvalue = CONVERT_OPTION[type_].get('func', str)(value.name)
|
||||
except:
|
||||
raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'), 14)
|
||||
if cvalue not in choices:
|
||||
raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices), 15)
|
||||
else:
|
||||
new_value = self.objectspace.value(variable.xmlfiles)
|
||||
new_value.name = choices[0]
|
||||
new_value.type = type_
|
||||
variable.value = [new_value]
|
||||
if not variable.choice:
|
||||
raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name), 16)
|
||||
variable.type = 'choice'
|
||||
# check value or set first choice value has default value
|
||||
if hasattr(variable, 'value'):
|
||||
for value in variable.value:
|
||||
if value.name not in values:
|
||||
raise DictConsistencyError(_(f'value "{value.name}" of variable "{variable.name}" is not in list of all expected values ({values})'), 15)
|
||||
else:
|
||||
new_value = self.objectspace.value(check.xmlfiles)
|
||||
new_value.name = values[0]
|
||||
new_value.type = type_
|
||||
variable.value = [new_value]
|
||||
|
||||
def convert_check(self):
|
||||
for check in self.objectspace.space.constraints.check:
|
||||
|
@ -452,39 +428,18 @@ class ConstrainteAnnotator:
|
|||
if not hasattr(check, 'param'):
|
||||
raise DictConsistencyError(_('{} must have, at least, 1 param').format(name), 17)
|
||||
for param in check.param:
|
||||
if param.type not in ['string', 'number']:
|
||||
raise DictConsistencyError(_(f'param in "valid_entier" must not be a "{param.type}"'), 18)
|
||||
if param.type != 'number':
|
||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
raise DictConsistencyError(_(f'param in "valid_entier" must be an "integer", not "{param.type}" in {xmlfiles}'), 18)
|
||||
if param.name == 'mini':
|
||||
variable.min_number = int(param.text)
|
||||
elif param.name == 'maxi':
|
||||
variable.max_number = int(param.text)
|
||||
else:
|
||||
raise DictConsistencyError(_(f'unknown parameter {param.text} in check "valid_entier" for variable {check.target}'), 19)
|
||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
raise DictConsistencyError(_(f'unknown parameter "{param.name}" in check "valid_entier" for variable "{check.target}" in {xmlfiles}'), 19)
|
||||
else:
|
||||
check_ = self.objectspace.check(variable.xmlfiles)
|
||||
if name == 'valid_differ':
|
||||
name = 'valid_not_equal'
|
||||
elif name == 'valid_network_netmask':
|
||||
params_len = 1
|
||||
if len(check.param) != params_len:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 20)
|
||||
elif name == 'valid_ipnetmask':
|
||||
params_len = 1
|
||||
if len(check.param) != params_len:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 21)
|
||||
name = 'valid_ip_netmask'
|
||||
elif name == 'valid_broadcast':
|
||||
params_len = 2
|
||||
if len(check.param) != params_len:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 22)
|
||||
elif name == 'valid_in_network':
|
||||
if len(check.param) not in (1, 2):
|
||||
params_len = 2
|
||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 23)
|
||||
check_.name = name
|
||||
check_.warnings_only = check.warnings_only
|
||||
if hasattr(check, 'param'):
|
||||
|
@ -510,7 +465,7 @@ class ConstrainteAnnotator:
|
|||
#
|
||||
if fill.name not in self.functions:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
|
||||
raise DictConsistencyError(_(f'cannot find fill function {fill.name} in {xmlfiles}'), 25)
|
||||
raise DictConsistencyError(_(f'cannot find fill function "{fill.name}" in {xmlfiles}'), 25)
|
||||
|
||||
namespace = fill.namespace
|
||||
# let's replace the target by the path
|
||||
|
@ -520,7 +475,7 @@ class ConstrainteAnnotator:
|
|||
)
|
||||
if suffix is not None:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
|
||||
raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}" in {xmlfiles}'), 26)
|
||||
raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only for the suffix "{suffix}" in {xmlfiles}'), 26)
|
||||
variable = self.objectspace.paths.get_variable_obj(fill.target)
|
||||
value = self.objectspace.value(variable.xmlfiles)
|
||||
value.type = 'calculation'
|
||||
|
@ -534,7 +489,7 @@ class ConstrainteAnnotator:
|
|||
if param.type == 'suffix':
|
||||
if hasattr(param, 'text'):
|
||||
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
|
||||
raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target} in {xmlfiles}"), 28)
|
||||
raise DictConsistencyError(_(f'"{param.type}" variables must not have a value in order to calculate "{fill.target}" in {xmlfiles}'), 28)
|
||||
if not self.objectspace.paths.variable_is_dynamic(fill.target):
|
||||
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
|
||||
raise DictConsistencyError(_(f'Cannot set suffix target to the none dynamic variable "{fill.target}" in {xmlfiles}'), 53)
|
||||
|
@ -570,7 +525,6 @@ class ConstrainteAnnotator:
|
|||
del self.objectspace.space.constraints.index
|
||||
del self.objectspace.space.constraints.namespace
|
||||
del self.objectspace.space.constraints.xmlfiles
|
||||
if vars(self.objectspace.space.constraints):
|
||||
if vars(self.objectspace.space.constraints): # pragma: no cover
|
||||
raise Exception('constraints again?')
|
||||
del self.objectspace.space.constraints
|
||||
|
||||
|
|
|
@ -73,6 +73,10 @@ class FamilyAnnotator:
|
|||
if 'dynamic' in vars(family):
|
||||
namespace = self.objectspace.paths.get_variable_namespace(family.dynamic)
|
||||
varpath = self.objectspace.paths.get_variable_path(family.dynamic, namespace)
|
||||
obj = self.objectspace.paths.get_variable_obj(varpath)
|
||||
if not obj.multi:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
|
||||
raise DictConsistencyError(_(f'dynamic family "{family.name}" must be linked to multi variable in {xmlfiles}'), 16)
|
||||
family.dynamic = varpath
|
||||
|
||||
def annotate_variable(self, variable, family_mode, path, is_follower=False):
|
||||
|
|
|
@ -27,43 +27,46 @@ class Path:
|
|||
self.full_paths_families[name] = full_name
|
||||
else:
|
||||
full_name = name
|
||||
if full_name in self.families and self.families[full_name]['variableobj'] != variableobj:
|
||||
raise DictConsistencyError(_(f'Duplicate family name {name}'), 37)
|
||||
if full_name in self.families and self.families[full_name]['variableobj'] != variableobj: # pragma: no cover
|
||||
raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 37)
|
||||
self.families[full_name] = dict(name=name,
|
||||
namespace=namespace,
|
||||
variableobj=variableobj,
|
||||
)
|
||||
|
||||
def _get_family(self,
|
||||
name: str,
|
||||
namespace: str=None,
|
||||
):
|
||||
# if main namespace, get full_path
|
||||
if '.' not in name and namespace in [None, Config['variable_namespace']] and name in self.full_paths_families:
|
||||
name = self.full_paths_families[name]
|
||||
dico = self.families[name]
|
||||
if namespace and dico['namespace'] != Config['variable_namespace'] and namespace != dico['namespace']:
|
||||
raise DictConsistencyError(_(f'A family located in the "{dico["namespace"]}" namespace shall not be used in the "{namespace}" namespace'), 38)
|
||||
return dico
|
||||
|
||||
def get_family_path(self,
|
||||
name: str,
|
||||
current_namespace: str,
|
||||
namespace: str,
|
||||
) -> str: # pylint: disable=C0111
|
||||
#name = normalize_family(name)
|
||||
if '.' not in name and current_namespace == Config['variable_namespace'] and name in self.full_paths_families:
|
||||
name = self.full_paths_families[name]
|
||||
if current_namespace is None: # pragma: no cover
|
||||
raise OperationError('current_namespace must not be None')
|
||||
dico = self.families[name]
|
||||
if dico['namespace'] != Config['variable_namespace'] and current_namespace != dico['namespace']:
|
||||
raise DictConsistencyError(_(f'A family located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 38)
|
||||
return dico['name']
|
||||
return self._get_family(name,
|
||||
namespace,
|
||||
)['name']
|
||||
|
||||
def get_family_obj(self,
|
||||
name: str,
|
||||
) -> 'Family': # pylint: disable=C0111
|
||||
if '.' not in name and name in self.full_paths_families:
|
||||
name = self.full_paths_families[name]
|
||||
if name not in self.families:
|
||||
raise DictConsistencyError(_('unknown family {}').format(name), 39)
|
||||
dico = self.families[name]
|
||||
return dico['variableobj']
|
||||
return self._get_family(name)['variableobj']
|
||||
|
||||
def family_is_defined(self,
|
||||
name: str,
|
||||
) -> str: # pylint: disable=C0111
|
||||
if '.' not in name and name not in self.families and name in self.full_paths_families:
|
||||
name: str,
|
||||
) -> str: # pylint: disable=C0111
|
||||
try:
|
||||
self._get_family(name)
|
||||
return True
|
||||
return name in self.families
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
# Leadership
|
||||
def set_leader(self,
|
||||
|
@ -74,24 +77,11 @@ class Path:
|
|||
) -> None: # pylint: disable=C0111
|
||||
# need rebuild path and move object in new path
|
||||
old_path = namespace + '.' + leader_family_name + '.' + name
|
||||
dico = self._get_variable(old_path)
|
||||
del self.variables[old_path]
|
||||
new_path = namespace + '.' + leader_family_name + '.' + leader_name + '.' + name
|
||||
self.add_variable(namespace,
|
||||
new_path,
|
||||
dico['family'],
|
||||
False,
|
||||
dico['variableobj'],
|
||||
)
|
||||
self.variables[new_path] = self.variables.pop(old_path)
|
||||
self.variables[new_path]['leader'] = leader_name
|
||||
if namespace == Config['variable_namespace']:
|
||||
self.full_paths_variables[name] = new_path
|
||||
else:
|
||||
name = new_path
|
||||
dico = self._get_variable(name)
|
||||
if dico['leader'] != None:
|
||||
raise DictConsistencyError(_('Already defined leader {} for variable'
|
||||
' {}'.format(dico['leader'], name)), 40)
|
||||
dico['leader'] = leader_name
|
||||
|
||||
def get_leader(self, name): # pylint: disable=C0111
|
||||
return self._get_variable(name)['leader']
|
||||
|
@ -109,14 +99,13 @@ class Path:
|
|||
self.full_paths_variables[name] = full_name
|
||||
else:
|
||||
full_name = name
|
||||
if namespace == Config['variable_namespace']:
|
||||
name = name.rsplit('.', 1)[1]
|
||||
self.variables[full_name] = dict(name=name,
|
||||
family=family,
|
||||
namespace=namespace,
|
||||
leader=None,
|
||||
is_dynamic=is_dynamic,
|
||||
variableobj=variableobj)
|
||||
variableobj=variableobj,
|
||||
)
|
||||
|
||||
def get_variable_name(self,
|
||||
name,
|
||||
|
@ -152,17 +141,13 @@ class Path:
|
|||
)
|
||||
else:
|
||||
dico = self._get_variable(name)
|
||||
if not allow_source:
|
||||
if dico['namespace'] not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']:
|
||||
if not allow_source and dico['namespace'] not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']:
|
||||
raise DictConsistencyError(_(f'A variable located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 41)
|
||||
if '.' in dico['name']:
|
||||
value = dico['name']
|
||||
else:
|
||||
list_path = [dico['namespace'], dico['family']]
|
||||
if dico['leader'] is not None:
|
||||
list_path.append(dico['leader'])
|
||||
list_path.append(dico['name'])
|
||||
value = '.'.join(list_path)
|
||||
list_path = [dico['namespace'], dico['family']]
|
||||
if dico['leader'] is not None:
|
||||
list_path.append(dico['leader'])
|
||||
list_path.append(dico['name'])
|
||||
value = '.'.join(list_path)
|
||||
if with_suffix:
|
||||
return value, suffix
|
||||
return value
|
||||
|
@ -184,24 +169,16 @@ class Path:
|
|||
with_suffix: bool=False,
|
||||
) -> str:
|
||||
if name not in self.variables:
|
||||
if name not in self.variables:
|
||||
if '.' not in name and name in self.full_paths_variables:
|
||||
name = self.full_paths_variables[name]
|
||||
if name not in self.variables:
|
||||
for var_name, variable in self.variables.items():
|
||||
if variable['is_dynamic'] and name.startswith(var_name):
|
||||
if not with_suffix:
|
||||
raise Exception('This option is dynamic, should use "with_suffix" attribute')
|
||||
return variable, name[len(var_name):]
|
||||
if '.' not in name:
|
||||
for var_name, path in self.full_paths_variables.items():
|
||||
if name.startswith(var_name):
|
||||
variable = self.variables[self.full_paths_variables[var_name]]
|
||||
if variable['is_dynamic']:
|
||||
if not with_suffix:
|
||||
raise Exception('This option is dynamic, should use "with_suffix" attribute')
|
||||
return variable, name[len(var_name):]
|
||||
raise DictConsistencyError(_('unknown option {}').format(name), 42)
|
||||
if '.' not in name and name in self.full_paths_variables:
|
||||
name = self.full_paths_variables[name]
|
||||
elif with_suffix:
|
||||
for var_name, full_path in self.full_paths_variables.items():
|
||||
if name.startswith(var_name):
|
||||
variable = self._get_variable(full_path)
|
||||
if variable['is_dynamic']:
|
||||
return variable, name[len(var_name):]
|
||||
if name not in self.variables:
|
||||
raise DictConsistencyError(_('unknown option {}').format(name), 42)
|
||||
if with_suffix:
|
||||
return self.variables[name], None
|
||||
return self.variables[name]
|
||||
|
|
|
@ -17,8 +17,8 @@ from Cheetah.NameMapper import NotFound as CheetahNotFound
|
|||
|
||||
try:
|
||||
from tiramisu3 import Config
|
||||
from tiramisu3.error import PropertiesOptionError
|
||||
except:
|
||||
from tiramisu3.error import PropertiesOptionError # pragma: no cover
|
||||
except: # pragma: no cover
|
||||
from tiramisu import Config
|
||||
from tiramisu.error import PropertiesOptionError
|
||||
|
||||
|
@ -32,28 +32,6 @@ log = logging.getLogger(__name__)
|
|||
log.addHandler(logging.NullHandler())
|
||||
|
||||
|
||||
class IsDefined:
|
||||
"""
|
||||
filtre permettant de ne pas lever d'exception au cas où
|
||||
la variable Creole n'est pas définie
|
||||
"""
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
def __call__(self, varname):
|
||||
if '.' in varname:
|
||||
splitted_var = varname.split('.')
|
||||
if len(splitted_var) != 2:
|
||||
msg = _("Group variables must be of type leader.follower")
|
||||
raise KeyError(msg)
|
||||
leader, follower = splitted_var
|
||||
if leader in self.context:
|
||||
return follower in self.context[leader].follower.keys()
|
||||
return False
|
||||
else:
|
||||
return varname in self.context
|
||||
|
||||
|
||||
@classmethod
|
||||
def cl_compile(kls, *args, **kwargs):
|
||||
kwargs['compilerSettings'] = {'directiveStartToken' : '%',
|
||||
|
@ -83,8 +61,7 @@ class CheetahTemplate(ChtTemplate):
|
|||
):
|
||||
"""Initialize Creole CheetahTemplate
|
||||
"""
|
||||
extra_context = {'is_defined' : IsDefined(context),
|
||||
'normalize_family': normalize_family,
|
||||
extra_context = {'normalize_family': normalize_family,
|
||||
'rougail_filename': destfilename
|
||||
}
|
||||
if variable:
|
||||
|
@ -93,7 +70,7 @@ class CheetahTemplate(ChtTemplate):
|
|||
file=filename,
|
||||
searchList=[context, eosfunc, extra_context])
|
||||
|
||||
# FORK of Cheetah fonction, do not replace '\\' by '/'
|
||||
# FORK of Cheetah function, do not replace '\\' by '/'
|
||||
def serverSidePath(self,
|
||||
path=None,
|
||||
normpath=normpath,
|
||||
|
@ -105,119 +82,103 @@ class CheetahTemplate(ChtTemplate):
|
|||
path = self
|
||||
if path:
|
||||
return normpath(abspath(path))
|
||||
# return normpath(abspath(path.replace("\\", '/')))
|
||||
elif hasattr(self, '_filePath') and self._filePath:
|
||||
# original code return normpath(abspath(path.replace("\\", '/')))
|
||||
elif hasattr(self, '_filePath') and self._filePath: # pragma: no cover
|
||||
return normpath(abspath(self._filePath))
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
return None
|
||||
|
||||
|
||||
class CreoleLeader:
|
||||
def __init__(self, value, follower=None, index=None):
|
||||
"""
|
||||
On rend la variable itérable pour pouvoir faire:
|
||||
for ip in iplist:
|
||||
print(ip.network)
|
||||
print(ip.netmask)
|
||||
print(ip)
|
||||
index is used for CreoleLint
|
||||
"""
|
||||
class CreoleValue:
|
||||
def __str__(self):
|
||||
return str(self._value)
|
||||
|
||||
|
||||
class CreoleLeaderIndex(CreoleValue):
|
||||
def __init__(self,
|
||||
value,
|
||||
follower,
|
||||
index,
|
||||
) -> None:
|
||||
self._value = value
|
||||
if follower is not None:
|
||||
self.follower = follower
|
||||
else:
|
||||
self.follower = {}
|
||||
self._follower = follower
|
||||
self._index = index
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""Get follower variable or attribute of leader value.
|
||||
if name not in self._follower:
|
||||
raise AttributeError()
|
||||
value = self._follower[name]
|
||||
if isinstance(value, PropertiesOptionError):
|
||||
raise AttributeError()
|
||||
return value
|
||||
|
||||
If the attribute is a name of a follower variable, return its value.
|
||||
Otherwise, returns the requested attribute of leader value.
|
||||
"""
|
||||
if name in self.follower:
|
||||
value = self.follower[name]
|
||||
if isinstance(value, PropertiesOptionError):
|
||||
raise AttributeError()
|
||||
return value
|
||||
else:
|
||||
return getattr(self._value, name)
|
||||
def __lt__(self, value):
|
||||
return self._value.__lt__(value)
|
||||
|
||||
def __le__(self, value):
|
||||
return self._value.__le__(value)
|
||||
|
||||
def __eq__(self, value):
|
||||
return self._value.__eq__(value)
|
||||
|
||||
def __ne__(self, value):
|
||||
return self._value.__ne__(value)
|
||||
|
||||
def __gt__(self, value):
|
||||
return self._value.__gt__(value)
|
||||
|
||||
def __ge__(self, value):
|
||||
return self._value >= value
|
||||
|
||||
def __add__(self, value):
|
||||
return self._value.__add__(value)
|
||||
|
||||
def __radd__(self, value):
|
||||
return value + self._value
|
||||
|
||||
|
||||
class CreoleLeader(CreoleValue):
|
||||
def __init__(self,
|
||||
value,
|
||||
) -> None:
|
||||
self._value = value
|
||||
self._follower = {}
|
||||
|
||||
def __getitem__(self, index):
|
||||
"""Get a leader.follower at requested index.
|
||||
"""
|
||||
ret = {}
|
||||
for key, values in self.follower.items():
|
||||
ret[key] = values[index]
|
||||
return CreoleLeader(self._value[index], ret, index)
|
||||
followers = {key: values[index] for key, values in self._follower.items()}
|
||||
return CreoleLeaderIndex(self._value[index],
|
||||
followers,
|
||||
index,
|
||||
)
|
||||
|
||||
def __iter__(self):
|
||||
"""Iterate over leader.follower.
|
||||
|
||||
Return synchronised value of leader.follower.
|
||||
"""
|
||||
for i in range(len(self._value)):
|
||||
ret = {}
|
||||
for key, values in self.follower.items():
|
||||
ret[key] = values[i]
|
||||
yield CreoleLeader(self._value[i], ret, i)
|
||||
for index in range(len(self._value)):
|
||||
yield self.__getitem__(index)
|
||||
|
||||
def __len__(self):
|
||||
"""Delegate to leader value
|
||||
"""
|
||||
return len(self._value)
|
||||
|
||||
def __repr__(self):
|
||||
"""Show CreoleLeader as dictionary.
|
||||
def __contains__(self, value):
|
||||
return self._value.__contains__(value)
|
||||
|
||||
The leader value is stored under 'value' key.
|
||||
The followers are stored under 'follower' key.
|
||||
"""
|
||||
return repr({'value': self._value, 'follower': self.follower})
|
||||
|
||||
def __eq__(self, value):
|
||||
return value == self._value
|
||||
|
||||
def __ne__(self, value):
|
||||
return value != self._value
|
||||
|
||||
def __lt__(self, value):
|
||||
return self._value < value
|
||||
|
||||
def __le__(self, value):
|
||||
return self._value <= value
|
||||
|
||||
def __gt__(self, value):
|
||||
return self._value > value
|
||||
|
||||
def __ge__(self, value):
|
||||
return self._value >= value
|
||||
|
||||
def __str__(self):
|
||||
"""Delegate to leader value
|
||||
"""
|
||||
return str(self._value)
|
||||
|
||||
def __add__(self, val):
|
||||
return self._value.__add__(val)
|
||||
|
||||
def __radd__(self, val):
|
||||
return val + self._value
|
||||
|
||||
def __contains__(self, item):
|
||||
return item in self._value
|
||||
|
||||
async def add_follower(self, config, name, path):
|
||||
if isinstance(self._value, list):
|
||||
values = []
|
||||
for idx in range(len(self._value)):
|
||||
try:
|
||||
values.append(await config.option(path, idx).value.get())
|
||||
except PropertiesOptionError as err:
|
||||
values.append(err)
|
||||
else:
|
||||
raise Exception('hu?')
|
||||
self.follower[name] = values
|
||||
async def add_follower(self,
|
||||
config,
|
||||
name: str,
|
||||
path: str,
|
||||
):
|
||||
self._follower[name] = []
|
||||
for index in range(len(self._value)):
|
||||
try:
|
||||
value = await config.option(path, index).value.get()
|
||||
except PropertiesOptionError as err:
|
||||
value = err
|
||||
self._follower[name].append(value)
|
||||
|
||||
|
||||
class CreoleExtra:
|
||||
|
@ -229,9 +190,6 @@ class CreoleExtra:
|
|||
key: str) -> Any:
|
||||
return self.suboption[key]
|
||||
|
||||
def __repr__(self):
|
||||
return self.suboption.__str__()
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.suboption.values())
|
||||
|
||||
|
@ -260,7 +218,8 @@ class CreoleTemplateEngine:
|
|||
self.rougail_variables_dict = {}
|
||||
|
||||
async def load_eole_variables_rougail(self,
|
||||
optiondescription):
|
||||
optiondescription,
|
||||
):
|
||||
for option in await optiondescription.list('all'):
|
||||
if await option.option.isoptiondescription():
|
||||
if await option.option.isleadership():
|
||||
|
@ -270,8 +229,9 @@ class CreoleTemplateEngine:
|
|||
self.rougail_variables_dict[await suboption.option.name()] = leader
|
||||
else:
|
||||
await leader.add_follower(self.config,
|
||||
await suboption.option.name(),
|
||||
await suboption.option.path())
|
||||
await suboption.option.name(),
|
||||
await suboption.option.path(),
|
||||
)
|
||||
else:
|
||||
await self.load_eole_variables_rougail(option)
|
||||
else:
|
||||
|
@ -292,8 +252,9 @@ class CreoleTemplateEngine:
|
|||
leader_name = await suboption.option.name()
|
||||
else:
|
||||
await leader.add_follower(self.config,
|
||||
await suboption.option.name(),
|
||||
await suboption.option.path())
|
||||
await suboption.option.name(),
|
||||
await suboption.option.path(),
|
||||
)
|
||||
variables[leader_name] = leader
|
||||
else:
|
||||
subfamilies = await self.load_eole_variables(await variable.option.name(),
|
||||
|
@ -320,7 +281,7 @@ class CreoleTemplateEngine:
|
|||
log.info(_("Patching template '{filename}' with '{patch_file}'"))
|
||||
rel_patch_file = relpath(patch_file, tmp_dir)
|
||||
ret = call(patch_cmd + patch_no_debug + ['-i', rel_patch_file])
|
||||
if ret:
|
||||
if ret: # pragma: no cover
|
||||
patch_cmd_err = ' '.join(patch_cmd + ['-i', rel_patch_file])
|
||||
log.error(_(f"Error applying patch: '{rel_patch_file}'\nTo reproduce and fix this error {patch_cmd_err}"))
|
||||
copy(join(self.distrib_dir, filename), tmp_dir)
|
||||
|
@ -355,10 +316,10 @@ class CreoleTemplateEngine:
|
|||
variable,
|
||||
)
|
||||
data = str(cheetah_template)
|
||||
except CheetahNotFound as err:
|
||||
except CheetahNotFound as err: # pragma: no cover
|
||||
varname = err.args[0][13:-1]
|
||||
raise TemplateError(_(f"Error: unknown variable used in template {source} to {destfilename} : {varname}"))
|
||||
except Exception as err:
|
||||
except Exception as err: # pragma: no cover
|
||||
raise TemplateError(_(f"Error while instantiating template {source} to {destfilename}: {err}"))
|
||||
|
||||
with open(destfilename, 'w') as file_h:
|
||||
|
@ -424,7 +385,7 @@ class CreoleTemplateEngine:
|
|||
for fill_obj in await fills.list('all'):
|
||||
fill = await fill_obj.value.dict()
|
||||
filename = fill['source']
|
||||
if not isfile(filename):
|
||||
if not isfile(filename): # pragma: no cover
|
||||
raise FileNotFound(_(f"File {filename} does not exist."))
|
||||
if fill.get('activate', False):
|
||||
self.instance_file(fill,
|
||||
|
|
|
@ -7,7 +7,7 @@ from .error import LoaderError
|
|||
from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
|
||||
|
||||
|
||||
FUNC_TO_DICT = ['valid_not_equal']
|
||||
FUNC_TO_DICT = []
|
||||
FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage']
|
||||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
||||
|
||||
|
@ -395,7 +395,7 @@ class Variable(Common):
|
|||
self.attrib['default'].append(value)
|
||||
if not self.is_leader:
|
||||
self.attrib['default_multi'] = value
|
||||
elif isinstance(value, (int, float)):
|
||||
elif isinstance(value, (int, float)) or value is None:
|
||||
self.attrib['default'].append(value)
|
||||
else:
|
||||
self.attrib['default'].append("'" + value + "'")
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
<constraints>
|
||||
<check name="valid_entier" target="int">
|
||||
<param name="mini">0</param>
|
||||
<param name="maxi">100</param>
|
||||
<param name="mini" type="number">0</param>
|
||||
<param name="maxi" type="number">100</param>
|
||||
</check>
|
||||
</constraints>
|
||||
</rougail>
|
||||
|
|
|
@ -10,7 +10,7 @@ except:
|
|||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='b')
|
||||
option_5 = IntOption(properties=frozenset({'normal'}), name='int2', doc='No change', multi=False)
|
||||
option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False)
|
||||
option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False)
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||
|
|
|
@ -9,7 +9,7 @@ except:
|
|||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||
|
|
|
@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
|
|||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
||||
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||
|
|
|
@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
|
|||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
||||
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||
|
|
|
@ -10,7 +10,7 @@ except:
|
|||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_4 = IPOption(private_only=True, warnings_only=True, properties=frozenset({'basic', 'mandatory'}), name='adresse_ip_eth0', doc='Adresse IP de la carte', multi=False)
|
||||
option_5 = NetmaskOption(properties=frozenset({'basic', 'mandatory'}), validators=[Calculation(func.valid_ip_netmask, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=True)], name='adresse_netmask_eth0', doc='Masque de sous réseau de la carte', multi=False)
|
||||
option_5 = NetmaskOption(properties=frozenset({'basic', 'mandatory'}), validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=True)], name='adresse_netmask_eth0', doc='Masque de sous réseau de la carte', multi=False)
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": [], "rougail.general1.leader.follower3": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": [], "rougail.general.leader.follower3": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.nut_monitor_netmask.nut_monitor_netmask": [], "rougail.general.nut_monitor_netmask.nut_monitor_host": []}
|
||||
{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.nut_monitor_netmask.nut_monitor_netmask": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": [], "rougail.general1.leader1.leader1": [], "rougail.general1.leader1.follower11": [], "rougail.general1.leader1.follower21": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader1.leader1": []}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="condition" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<condition name="hidden_if_not_in" source="condition">
|
||||
<param>oui</param>
|
||||
<target type="variable">mode_conteneur_actif</target>
|
||||
<target type="variable">mode_conteneur_actif2</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"}
|
|
@ -0,0 +1,16 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail>
|
||||
|
||||
<variables>
|
||||
<family name='general'>
|
||||
<variable name='condition' type='string' description="No change">
|
||||
<value>tous</value>
|
||||
</variable>
|
||||
<variable name='mode_conteneur_actif' type='oui/non' description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name='mode_conteneur_actif2' type='oui/non' description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<check name="valid_enum" target="condition">
|
||||
<param>tous</param>
|
||||
<param>authentifié</param>
|
||||
<param>aucun</param>
|
||||
</check>
|
||||
<condition name='hidden_if_not_in' source='condition'>
|
||||
<param>oui</param>
|
||||
<param>non</param>
|
||||
<target type='variable'>mode_conteneur_actif</target>
|
||||
<target type='variable'>mode_conteneur_actif2</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"}
|
|
@ -0,0 +1,16 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='tous', values=('tous', 'authentifié', 'aucun'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": ["leader"], "rougail.general.leader.follower1": [["value"]], "rougail.general.leader.follower2": [["value1", "value2"]]}
|
||||
{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [{"rougail.general.leader.leader": "leader", "rougail.general.leader.follower1": ["value"], "rougail.general.leader.follower2": ["value1", "value2"]}]}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": ["value"], "rougail.general.leader.follower1": [null], "rougail.general.leader.follower2": [null]}
|
||||
{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [{"rougail.general.leader.leader": "value", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}]}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.other_name.leader": [], "rougail.general1.other_name.follower1": [], "rougail.general1.other_name.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general_1.leader.leader": [], "rougail.general_1.leader.follower1": [], "rougail.general_1.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general_1.leader.leader": []}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail>
|
||||
|
||||
<variables>
|
||||
<family name='general'>
|
||||
<variable name='condition' type='string' description="No change">
|
||||
<value>tous</value>
|
||||
</variable>
|
||||
<variable name='mode_conteneur_actif' type='oui/non' description="No change" hidden="True">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name='mode_conteneur_actif2' type='oui/non' description="No change" hidden="True">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<check name="valid_enum" target="condition">
|
||||
<param>tous</param>
|
||||
<param>authentifié</param>
|
||||
<param>aucun</param>
|
||||
</check>
|
||||
<condition name='mandatory_if_not_in' source='condition'>
|
||||
<param>oui</param>
|
||||
<param>non</param>
|
||||
<target type='variable'>mode_conteneur_actif</target>
|
||||
<target type='variable'>mode_conteneur_actif2</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"}
|
|
@ -0,0 +1,16 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='tous', values=('tous', 'authentifié', 'aucun'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="general" mode="expert">
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<family name="enumfam" mode="expert">
|
||||
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<check name="valid_enum" target="enumvar">
|
||||
<param></param>
|
||||
</check>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": null}
|
|
@ -0,0 +1,17 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3])
|
||||
option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, values=(None,))
|
||||
option_5.impl_set_information("help", "bla bla bla")
|
||||
option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="general" mode="expert">
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<family name="enumfam" mode="expert">
|
||||
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<check name="valid_enum" target="enumvar">
|
||||
<param/>
|
||||
</check>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": null}
|
|
@ -0,0 +1,17 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3])
|
||||
option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, values=(None,))
|
||||
option_5.impl_set_information("help", "bla bla bla")
|
||||
option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -0,0 +1,26 @@
|
|||
<?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">
|
||||
<value>val</value>
|
||||
</variable>
|
||||
</family>
|
||||
<family name='new'>
|
||||
<variable name='newvar' type='string' description="No change"/>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<condition name="hidden_if_in" source="newvar">
|
||||
<param>non</param>
|
||||
<target type="family">dyn</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": null}
|
|
@ -0,0 +1,18 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['val1', 'val2'], default_multi='val2')
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||
option_7 = StrOption(properties=frozenset({'normal'}), name='newvar', doc='No change', multi=False)
|
||||
option_5 = StrOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('non')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('non')}))}), name='vardyn', doc='No change', multi=False, default='val')
|
||||
option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('non')}))}), children=[option_5])
|
||||
option_6 = OptionDescription(name='new', doc='new', properties=frozenset({'normal'}), children=[option_7])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4, option_6])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="condition" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif1" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<condition fallback="True" name="disabled_if_in" source="condition">
|
||||
<param>oui</param>
|
||||
<target type="variable" optional="True">mode_conteneur_actif2</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non"}
|
|
@ -0,0 +1,16 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": ["non"], "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": ["non"]}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": [{"rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": "non"}]}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": []}
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<services>
|
||||
<service name='test'>
|
||||
<file name='/etc/mailname'/>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="condition" type="oui/non" description="condition"/>
|
||||
<variable name="leader" type="string" description="leader" multi="True"/>
|
||||
<variable name="leader" type="string" description="leader" multi="True">
|
||||
<value>a</value>
|
||||
</variable>
|
||||
<variable name="follower1" type="string" description="follower1" hidden="True"/>
|
||||
<variable name="follower2" type="string" description="follower2"/>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<group leader="leader">
|
||||
<follower>follower1</follower>
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [], "rougail.general.leader.follower2": []}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
leader: a
|
||||
follower2:
|
|
@ -10,10 +10,22 @@ except:
|
|||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='condition', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_6 = StrOption(name='leader', doc='leader', multi=True)
|
||||
option_6 = StrOption(properties=frozenset({'mandatory'}), name='leader', doc='leader', multi=True, default=['a'])
|
||||
option_7 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})))
|
||||
option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True)
|
||||
option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8])
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||
option_13 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||
option_14 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||
option_15 = StrOption(name='name', doc='name', multi=False, default='/etc/mailname')
|
||||
option_16 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||
option_17 = StrOption(name='source', doc='source', multi=False, default='mailname')
|
||||
option_18 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||
option_19 = BoolOption(name='activate', doc='activate', multi=False, 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', properties=frozenset({'hidden'}), children=[option_10])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_9])
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
%for %%lead in %%leader
|
||||
leader: %%lead
|
||||
%if %%hasattr(%%lead, 'follower1')
|
||||
follower1: %%lead.follower1
|
||||
%end if
|
||||
%if %%hasattr(%%lead, 'follower2')
|
||||
follower2: %%lead.follower2
|
||||
%end if
|
||||
%end for
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<services>
|
||||
<service name='test'>
|
||||
<file name='/etc/mailname'/>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="condition" type="oui/non" description="condition"/>
|
||||
<variable name="leader" type="string" description="leader" multi="True">
|
||||
<value>a</value>
|
||||
<value>b</value>
|
||||
</variable>
|
||||
<variable name="follower1" type="string" description="follower1"/>
|
||||
<variable name="follower2" type="string" description="follower2"/>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<group leader="leader">
|
||||
<follower>follower1</follower>
|
||||
<follower>follower2</follower>
|
||||
</group>
|
||||
<fill name="calc_val" target="follower1">
|
||||
<param name="valeur">valfill</param>
|
||||
</fill>
|
||||
<condition name="disabled_if_in" source="leader">
|
||||
<param>a</param>
|
||||
<target type="variable">follower1</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}, {"rougail.general.leader.leader": "b", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true}
|
|
@ -0,0 +1,5 @@
|
|||
leader: a
|
||||
follower2:
|
||||
leader: b
|
||||
follower1:
|
||||
follower2:
|
|
@ -0,0 +1,31 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='condition', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_6 = StrOption(properties=frozenset({'mandatory'}), name='leader', doc='leader', multi=True, default=['a', 'b'])
|
||||
option_7 = StrOption(properties=frozenset({'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_6, todict=True), 'expected': ParamValue('a')}))}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})))
|
||||
option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True)
|
||||
option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8])
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_13 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||
option_14 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||
option_15 = StrOption(name='name', doc='name', multi=False, default='/etc/mailname')
|
||||
option_16 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||
option_17 = StrOption(name='source', doc='source', multi=False, default='mailname')
|
||||
option_18 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||
option_19 = BoolOption(name='activate', doc='activate', multi=False, 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', properties=frozenset({'hidden'}), children=[option_10])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_9])
|
|
@ -0,0 +1,9 @@
|
|||
%for %%lead in %%leader
|
||||
leader: %%lead
|
||||
%if %%hasattr(%%lead, 'follower1')
|
||||
follower1: %%lead.follower1
|
||||
%end if
|
||||
%if %%hasattr(%%lead, 'follower2')
|
||||
follower2: %%lead.follower2
|
||||
%end if
|
||||
%end for
|
|
@ -1 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": ["test"], "extra.ejabberd.description.mode": ["pre"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": [{"extra.ejabberd.description.description": "test", "extra.ejabberd.description.mode": "pre"}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true}
|
||||
|
|
|
@ -1 +1,11 @@
|
|||
pre
|
||||
contain test
|
||||
1
|
||||
leader: test
|
||||
follower: pre
|
||||
supeq
|
||||
sup
|
||||
diff
|
||||
testpre
|
||||
pretest
|
||||
leader2: test
|
||||
follower2: pre
|
||||
|
|
|
@ -1,3 +1,35 @@
|
|||
%if 'test' in %%extra.ejabberd.description
|
||||
contain test
|
||||
%end if
|
||||
%%len(%%extra.ejabberd.description)
|
||||
%if 'a' in %%extra.ejabberd.description
|
||||
contain a
|
||||
%end if
|
||||
%for %%description in %%extra.ejabberd.description
|
||||
%%description.mode
|
||||
leader: %%description
|
||||
follower: %%description.mode
|
||||
%if %%description <= %%description.mode
|
||||
infeq
|
||||
%end if
|
||||
%if %%description >= %%description.mode
|
||||
supeq
|
||||
%end if
|
||||
%if %%description < %%description.mode
|
||||
inf
|
||||
%end if
|
||||
%if %%description > %%description.mode
|
||||
sup
|
||||
%end if
|
||||
%if %%description == %%description.mode
|
||||
eq
|
||||
%end if
|
||||
%if %%description != %%description.mode
|
||||
diff
|
||||
%end if
|
||||
%set %%var = %%description + %%description.mode
|
||||
%%var
|
||||
%set %%var = %%description.mode + %%description
|
||||
%%var
|
||||
%end for
|
||||
leader2: %%extra.ejabberd.description[0]
|
||||
follower2: %%extra.ejabberd.description[0].mode
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="général">
|
||||
<variable name="varname" type="string" description="No change" multi="True">
|
||||
<value>a</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name='ejabberd' dynamic="varname">
|
||||
<variable name="mode" type="string"/>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.varname": ["a"], "extra.ejabberda.modea": null}
|
|
@ -0,0 +1,17 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['a'], default_multi='a')
|
||||
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_6 = StrOption(properties=frozenset({'normal'}), name='mode', doc='mode', multi=False)
|
||||
option_5 = ConvertDynOptionDescription(name='ejabberd', doc='ejabberd', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_6])
|
||||
option_4 = OptionDescription(name='extra', doc='extra', children=[option_5])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="général">
|
||||
<variable name="varname" type="string" description="No change" multi="True">
|
||||
<value>a</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="général">
|
||||
<variable name="varname" type="string" description="No change" multi="True">
|
||||
<value>a</value>
|
||||
</variable>
|
||||
</family>
|
||||
<family name='ejabberd' dynamic="extra.general.varname">
|
||||
<variable name="mode" type="string"/>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.varname": ["a"], "extra.general.varname": ["a"], "extra.ejabberda.modea": null}
|
|
@ -0,0 +1,19 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['a'], default_multi='a')
|
||||
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['a'], default_multi='a')
|
||||
option_5 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_6])
|
||||
option_8 = StrOption(properties=frozenset({'normal'}), name='mode', doc='mode', multi=False)
|
||||
option_7 = ConvertDynOptionDescription(name='ejabberd', doc='ejabberd', suffixes=Calculation(func.calc_value, Params((ParamOption(option_6)))), properties=frozenset({'normal'}), children=[option_8])
|
||||
option_4 = OptionDescription(name='extra', doc='extra', children=[option_5, option_7])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
|
@ -1,6 +1,6 @@
|
|||
%if %%is_defined('mode_conteneur_actif')
|
||||
%if %%varExists('mode_conteneur_actif')
|
||||
%%mode_conteneur_actif
|
||||
%end if
|
||||
%if %%is_defined('mode_conteneur_actif3')
|
||||
%if %%varExists('mode_conteneur_actif3')
|
||||
%%mode_conteneur_actif3
|
||||
%end if
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rougail>
|
||||
<services>
|
||||
<service name='test'>
|
||||
<file name='file_name' file_type="variable" source="mailname" variable="var"/>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<family name='général'>
|
||||
<variable name='mode_conteneur_actif' type='oui/non' description="No change" hidden="True">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
<variable name='file_name' type='string'>
|
||||
<value>/etc/mailname</value>
|
||||
</variable>
|
||||
<variable name='var' type='string'>
|
||||
<value>mailname</value>
|
||||
</variable>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
</rougail>
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": "/etc/mailname", "rougail.general.var": "mailname", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true}
|
|
@ -0,0 +1 @@
|
|||
mailname
|
|
@ -0,0 +1,29 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
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 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||
option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='file_name', doc='file_name', multi=False, default='/etc/mailname')
|
||||
option_5 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='var', doc='var', multi=False, default='mailname')
|
||||
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_10 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||
option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||
option_12 = SymLinkOption(name='name', opt=option_4)
|
||||
option_13 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||
option_14 = StrOption(name='source', doc='source', multi=False, default='mailname')
|
||||
option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||
option_16 = SymLinkOption(name='variable', opt=option_5)
|
||||
option_17 = BoolOption(name='activate', doc='activate', multi=False, 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', properties=frozenset({'hidden'}), children=[option_7])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6])
|
|
@ -0,0 +1 @@
|
|||
%%rougail_variable
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue