Compare commits

...

11 Commits

191 changed files with 663 additions and 607 deletions

View File

@ -52,6 +52,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
self.functions.extend(INTERNAL_FUNCTIONS)
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
self.target_is_uniq = False
self.allow_function = True
self.convert_target(self.objectspace.space.constraints.check)
self.convert_param(self.objectspace.space.constraints.check)
self.check_check()
@ -132,11 +133,23 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
has_variable = False
values = []
has_nil = False
is_function = False
for param in check.param:
if has_variable:
msg = _(f'only one "variable" parameter is allowed for valid_enum '
f'of variable "{variable.name}"')
raise DictConsistencyError(msg, 5, param.xmlfiles)
if param.type == 'function':
is_function = True
choice = self.objectspace.choice(variable.xmlfiles)
choice.name = param.text
choice.type = 'function'
choice.param = []
variable.values.append(choice)
continue
if is_function:
variable.values[0].param.append(param)
continue
param_type = variable.ori_type
if param.type == 'variable':
has_variable = True
@ -148,7 +161,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
msg = _(f'only multi "variable" parameter is allowed for valid_enum '
f'of variable "{variable.name}"')
raise DictConsistencyError(msg, 6, param.xmlfiles)
param_type = 'calculation'
param_type = 'variable'
elif param.type == 'nil':
has_nil = True
values.append(param.text)
@ -156,6 +169,8 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
choice.name = param.text
choice.type = param_type
variable.values.append(choice)
if is_function:
return None
if 'mandatory' not in vars(variable):
variable.mandatory = not has_nil
elif variable.mandatory is False:

View File

@ -50,6 +50,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
return
self.target_is_uniq = False
self.only_variable = False
self.allow_function = False
self.convert_target(self.objectspace.space.constraints.condition)
self.check_condition_optional()
self.convert_condition_source()
@ -74,9 +75,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
for variable in self.get_variables():
if not variable.auto_freeze and not variable.auto_save:
continue
if variable.namespace != self.objectspace.rougailconfig['variable_namespace']:
msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
raise DictConsistencyError(msg, 49, variable.xmlfiles)
#if variable.namespace != self.objectspace.rougailconfig['variable_namespace']:
# msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
# raise DictConsistencyError(msg, 49, variable.xmlfiles)
variable.force_store_value = True
if variable.auto_save:
continue
@ -89,7 +90,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
new_condition.param = [new_param]
new_target = self.objectspace.target(variable.xmlfiles)
new_target.type = 'variable'
new_target.name = variable.name
new_target.name = variable.path
new_condition.target = [new_target]
if not hasattr(self.objectspace.space, 'constraints'):
self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles)

View File

@ -26,7 +26,6 @@ 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
@ -91,7 +90,6 @@ class FamilyAnnotator(Walk):
family.description = family.name
family.doc = family.description
del family.description
family.name = normalize_family(family.name)
def change_modes(self):
"""change the mode of variables

View File

@ -32,6 +32,9 @@ from .target import TargetAnnotator
from .param import ParamAnnotator
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename')
class FillAnnotator(TargetAnnotator, ParamAnnotator):
"""Fill annotator
"""
@ -44,13 +47,23 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
not hasattr(self.objectspace.space.constraints, 'fill'):
return
self.functions = dir(load_modules(eosfunc_file))
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
self.target_is_uniq = True
self.only_variable = True
self.allow_function = False
self.convert_target(self.objectspace.space.constraints.fill)
self.convert_param(self.objectspace.space.constraints.fill)
self.fill_to_value()
del self.objectspace.space.constraints.fill
def calc_is_multi(self, variable: 'self.objectspace.variable') -> bool:
multi = variable.multi
if multi is False:
return multi
if multi == 'submulti':
return True
return not self.objectspace.paths.is_follower(variable.path)
def fill_to_value(self) -> None:
"""valid and manage <fill>
"""
@ -65,6 +78,11 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
value = self.objectspace.value(fill.xmlfiles)
value.type = 'calculation'
value.name = fill.name
if fill.name not in CALC_MULTI:
is_calc_multi = self.calc_is_multi(target.name)
else:
is_calc_multi = False
value.calc_multi = is_calc_multi
if target.name.namespace == 'services':
target.name.default = value
else:

View File

@ -24,7 +24,10 @@ 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
"""
import tiramisu
try:
import tiramisu3 as tiramisu
except ModuleNotFoundError:
import tiramisu
from .variable import CONVERT_OPTION
@ -82,6 +85,16 @@ class ParamAnnotator:
if err.errno != 42 or not param.optional:
raise err
param_to_delete.append(param_idx)
elif param.type == 'function':
if not self.allow_function:
msg = _(f'cannot use "function" type')
raise DictConsistencyError(msg, 74, param.xmlfiles)
if not param.text in self.functions:
msg = _(f'cannot find function "{param.text}"')
raise DictConsistencyError(msg, 67, param.xmlfiles)
if param_idx != 0:
msg = _(f'function "{param.text}" must only set has first parameter')
raise DictConsistencyError(msg, 75, param.xmlfiles)
elif variable_type:
self._convert_with_variable_type(variable_type, param)
continue

View File

@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from ..i18n import _
from ..error import DictConsistencyError
from ..objspace import convert_boolean
from ..utils import normalize_family
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
@ -50,7 +49,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
'broadcast': dict(opttype="BroadcastOption"),
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios',
'warnings_only': True}),
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname',
'domainname': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname',
'allow_ip': False}),
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname',
'allow_ip': False}),
@ -171,7 +170,6 @@ class VariableAnnotator(Walk): # pylint: disable=R0903
if not variable.value:
del variable.value
variable.doc = variable.description
variable.name = normalize_family(variable.name)
del variable.description
if variable_type == 'follower':
if variable.multi is True:

View File

@ -86,7 +86,7 @@
<!ELEMENT variable (value*)>
<!ATTLIST variable name CDATA #REQUIRED>
<!ATTLIST variable type (number|float|string|password|mail|boolean|filename|date|unix_user|ip|local_ip|netmask|network|broadcast|netbios|domain|hostname|web_address|port|mac|cidr|network_cidr|schedule|schedulemod) "string">
<!ATTLIST variable type (number|float|string|password|mail|boolean|filename|date|unix_user|ip|local_ip|netmask|network|broadcast|netbios|domainname|hostname|web_address|port|mac|cidr|network_cidr|schedule|schedulemod) "string">
<!ATTLIST variable description CDATA #IMPLIED>
<!ATTLIST variable help CDATA #IMPLIED>
<!ATTLIST variable hidden (True|False) "False">
@ -121,7 +121,7 @@
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
<!ELEMENT param (#PCDATA)>
<!ATTLIST param type (string|number|nil|boolean|variable|information|target_information|suffix|index) "string">
<!ATTLIST param type (string|number|nil|boolean|variable|function|information|target_information|suffix|index) "string">
<!ATTLIST param name CDATA #IMPLIED>
<!ATTLIST param propertyerror (True|False) "True">
<!ATTLIST param optional (True|False) "False">

View File

@ -29,7 +29,7 @@ from typing import Optional
from .i18n import _
from .xmlreflector import XMLReflector
from .utils import normalize_family
from .utils import valid_variable_family_name
from .error import SpaceObjShallNotBeUpdated, DictConsistencyError
from .path import Path
@ -197,7 +197,7 @@ class RougailObjSpace:
if child.tag == 'family':
if child.attrib['name'] in family_names:
msg = _(f'Family "{child.attrib["name"]}" is set several times')
raise DictConsistencyError(msg, 44, xmlfile)
raise DictConsistencyError(msg, 44, [xmlfile])
family_names.append(child.attrib['name'])
try:
# variable objects creation
@ -296,6 +296,7 @@ class RougailObjSpace:
"""A redefinable object could be created or updated
"""
existed_var = self.get_existed_obj(name,
xmlfile,
space,
child,
namespace,
@ -337,6 +338,7 @@ class RougailObjSpace:
def get_existed_obj(self,
name: str,
xmlfile: str,
space: str,
child,
namespace: str,
@ -344,7 +346,7 @@ class RougailObjSpace:
"""if an object exists, return it
"""
if child.tag in ['variable', 'family']:
name = normalize_family(name)
valid_variable_family_name(name, [xmlfile])
if child.tag == 'variable': # pylint: disable=E1101
if namespace != self.rougailconfig['variable_namespace']:
name = space.path + '.' + name
@ -468,18 +470,18 @@ class RougailObjSpace:
"""
if isinstance(variableobj, self.variable): # pylint: disable=E1101
if 'name' in document.attrib:
family_name = normalize_family(document.attrib['name'])
family_name = document.attrib['name']
else:
family_name = namespace
self.paths.add_variable(namespace,
normalize_family(variableobj.name),
variableobj.name,
space.path,
document.attrib.get('dynamic') is not None,
variableobj,
)
elif isinstance(variableobj, self.family): # pylint: disable=E1101
family_name = normalize_family(variableobj.name)
family_name = variableobj.name
if namespace != self.rougailconfig['variable_namespace']:
family_name = namespace + '.' + family_name
self.paths.add_family(namespace,
@ -502,8 +504,6 @@ class RougailObjSpace:
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, tag)[name] = variableobj
elif isinstance(variableobj, UnRedefinable):
getattr(space, child.tag).append(variableobj)

View File

@ -166,11 +166,14 @@ class RougailExtra:
try:
return self.suboption[key]
except KeyError:
raise AttributeError
raise AttributeError(f'unable to find extra "{key}"')
def __iter__(self):
return iter(self.suboption.values())
def items(self):
return self.suboption.items()
class RougailBaseTemplate:
"""Engine to process Creole cheetah template
@ -231,7 +234,7 @@ class RougailBaseTemplate:
def instance_file(self,
filevar: Dict,
type: str,
type_: str,
service_name: str,
) -> None:
"""Run templatisation on one file
@ -253,7 +256,7 @@ class RougailBaseTemplate:
var = variable[idx]
else:
var = None
func = f'_instance_{type}'
func = f'_instance_{type_}'
data = getattr(self, func)(filevar,
filename,
service_name,

View File

@ -74,6 +74,27 @@ class IsDefined:
return varname in self.context
class CreoleClient():
def get(self, path):
path = path.replace('/', '.')
if path.startswith('.'):
path = path[1:]
if '.' not in path:
return self.context[path]
else:
root, path = path.split('.', 1)
obj = self.context[root]
for var in path.split('.'):
obj = getattr(obj, var)
return obj
def is_empty(data):
if str(data) in ['', '""', "''", "[]", "['']", '[""]', "None"]:
return True
return False
class CheetahTemplate(oriCheetahTemplate):
def __init__(self,
filename: str,
@ -82,7 +103,12 @@ class CheetahTemplate(oriCheetahTemplate):
eosfunc: Dict,
extra_context: Dict,
):
creole_client = CreoleClient()
creole_client.context=context
extra_context['is_defined'] = IsDefined(context)
extra_context['creole_client'] = creole_client
extra_context['is_empty'] = is_empty
extra_context['_creole_filename'] = extra_context['rougail_filename']
super().__init__(filename, source, context, eosfunc, extra_context)

View File

@ -58,7 +58,8 @@ z %%filename - - - - -
%end if
%end for
%end if
%end for"""
%end for
"""
class RougailSystemdTemplate(RougailBaseTemplate):

View File

@ -296,9 +296,11 @@ class Variable(Common):
keys['opt'] = self.elt.opt.reflector_object.get()
if hasattr(self.elt, 'values'):
values = self.elt.values
if values[0].type == 'calculation':
if values[0].type == 'variable':
value = values[0].name.reflector_object.get()
keys['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
elif values[0].type == 'function':
keys['values'] = self.calculation_value(self.elt.values[0], [])
else:
keys['values'] = str(tuple([val.name for val in values]))
if hasattr(self.elt, 'multi') and self.elt.multi:
@ -309,11 +311,11 @@ class Variable(Common):
if isinstance(value, str):
value = self.convert_str(value)
elif isinstance(value, self.objectspace.value):
value = self.calculation_value(value, [])
value = self.calculation_value(value, [], calc_multi=value.calc_multi)
keys[key] = value
if hasattr(self.elt, 'validators'):
keys['validators'] = '[' + ', '.join([self.calculation_value(val,
['ParamSelfOption()']) for val in self.elt.validators]) + ']'
['ParamSelfOption(whole=False)']) for val in self.elt.validators]) + ']'
for key in ['min_number', 'max_number']:
if hasattr(self.elt, key):
keys[key] = getattr(self.elt, key)
@ -325,6 +327,7 @@ class Variable(Common):
def calculation_value(self,
child,
args,
calc_multi=False,
) -> str:
"""Generate calculated value
"""
@ -336,11 +339,9 @@ class Variable(Common):
for param in child.param:
value = self.populate_param(param)
if not hasattr(param, 'name'):
# args.append(str(value))
new_args.append(str(value))
else:
kwargs.append(f"'{param.name}': " + value)
# ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')'
if function == 'valid_network_netmask':
new_args.extend(args)
else:
@ -352,7 +353,10 @@ class Variable(Common):
ret += ')'
if hasattr(child, 'warnings_only'):
ret += f', warnings_only={child.warnings_only}'
return ret + ')'
ret = ret + ')'
if calc_multi:
ret = '[' + ret + ']'
return ret
class Family(Common):
@ -383,5 +387,5 @@ class Family(Common):
) -> None:
if hasattr(self.elt, 'suffixes'):
dyn = self.elt.suffixes.reflector_object.get()
keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}))))"
keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}, notraisepropertyerror=True))))"
keys['children'] = '[' + ', '.join([child.get() for child in self.children]) + ']'

View File

@ -25,10 +25,13 @@ from os.path import join, isfile, basename
from os import listdir
from lxml.etree import DTD, parse, XMLParser, XMLSyntaxError # pylint: disable=E0611
from lxml.etree import Element, SubElement, tostring
from ast import parse as ast_parse
from .i18n import _
from .error import UpgradeError
from .utils import normalize_family
VERSIONS = {'creole': ['1'],
'rougail': ['0.9'],
@ -40,7 +43,7 @@ def get_function_name(root, version):
return f'update_{root}_{version}'
FUNCTION_VERSIONS = [get_function_name(root, version) for root, versions in VERSIONS.items() for version in versions]
FUNCTION_VERSIONS = [(root, version, get_function_name(root, version)) for root, versions in VERSIONS.items() for version in versions]
class RougailUpgrade:
@ -53,6 +56,7 @@ class RougailUpgrade:
def load_xml_from_folders(self,
srcfolder: str,
dstfolder: str,
namespace: str,
):
"""Loads all the XML files located in the xmlfolders' list
@ -71,10 +75,13 @@ class RougailUpgrade:
root = document.getroot()
search_function_name = get_function_name(root.tag, root.attrib.get('version', '1'))
function_found = False
for function_version in FUNCTION_VERSIONS:
for root_name, version, function_version in FUNCTION_VERSIONS:
if function_found and hasattr(self, function_version):
print(f' - convert {filename} to version {version}')
upgrade_help = self.upgrade_help.get(function_version, {}).get(filename, {})
root = getattr(self, function_version)(root, upgrade_help)
if upgrade_help.get('remove') is True:
continue
root = getattr(self, function_version)(root, upgrade_help, namespace)
if function_version == search_function_name:
function_found = True
with open(xmldst, 'wb') as xmlfh:
@ -90,6 +97,7 @@ class RougailUpgrade:
def update_rougail_0_9(self,
root: 'Element',
upgrade_help: dict,
namespace: str,
) -> 'Element':
# rename root
root.tag = 'rougail'
@ -111,6 +119,9 @@ class RougailUpgrade:
if not isinstance(subelement.tag, str):
# XML comment
continue
if subelement.tag == 'family_action':
root.remove(subelement)
continue
for subsubelement in subelement:
if not isinstance(subsubelement.tag, str):
# XML comment
@ -130,16 +141,27 @@ class RougailUpgrade:
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('remove', []):
self.remove(subsubsubelement, 'hidden', optional=True)
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('remove', []):
self.remove(subsubsubelement, 'mandatory', optional=True)
variables[subsubsubelement.attrib['name']] = subsubsubelement
self.remove(subsubsubelement, 'mandatory')
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('add', []):
subsubsubelement.attrib['mandatory'] = 'True'
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}):
subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {})[subsubsubelement.attrib['name']]
if namespace == 'configuration':
path = subsubsubelement.attrib['name']
npath = normalize_family(subsubsubelement.attrib['name'])
else:
path = namespace + '.' + subsubelement.attrib['name'] + '.' + subsubsubelement.attrib['name']
npath = normalize_family(namespace) + '.' + normalize_family(subsubelement.attrib['name']) + '.' + normalize_family(subsubsubelement.attrib['name'])
variables[path] = subsubsubelement
variables[npath] = subsubsubelement
type = subsubsubelement.attrib.get('type')
if type in ['oui/non', 'yes/no', 'on/off']:
variables_auto_valid_enum.setdefault(subsubsubelement.attrib['type'], []).append(subsubsubelement.attrib['name'])
variables_auto_valid_enum.setdefault(subsubsubelement.attrib['type'], []).append(path)
del subsubsubelement.attrib['type']
elif type == 'hostname_strict':
subsubsubelement.attrib['type'] = 'hostname'
elif type == 'domain_strict':
subsubsubelement.attrib['type'] = 'domain'
elif type in ['domain', 'domain_strict']:
subsubsubelement.attrib['type'] = 'domainname'
elif type == 'string':
del subsubsubelement.attrib['type']
if self.test and subsubsubelement.attrib.get('auto_freeze') == 'True':
@ -153,17 +175,36 @@ class RougailUpgrade:
subsubsubelement.attrib['remove_check'] = 'True'
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mode', {}).get('modify', {}):
subsubsubelement.attrib['mode'] = upgrade_help.get('variables', {}).get('mode', {}).get('modify', {})[subsubsubelement.attrib['name']]
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}).get('modify', {}):
subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {}).get('modify', {})[subsubsubelement.attrib['name']]
type = subsubsubelement.attrib['type']
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('test', {}):
subsubsubelement.attrib['test'] = upgrade_help.get('variables', {}).get('test', {})[subsubsubelement.attrib['name']]
# for value in subsubsubelement:
# if value.text is None:
# value.attrib['type'] = 'nil'
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove_value', []):
for value in subsubsubelement:
subsubsubelement.remove(value)
if subsubsubelement.attrib['name'] != normalize_family(subsubsubelement.attrib['name']):
if "description" not in subsubsubelement.attrib:
subsubsubelement.attrib['description'] = subsubsubelement.attrib['name']
subsubsubelement.attrib['name'] = normalize_family(subsubsubelement.attrib['name'])
elif subsubsubelement.tag == 'param':
if subsubelement.tag == 'check' and subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('remove', []):
continue
type = subsubsubelement.attrib.get('type')
if type == 'eole':
subsubsubelement.attrib['type'] = 'variable'
type = 'variable'
elif type in ('container', 'context', 'python'):
if type == 'python':
subsubsubelement.attrib['type'] = 'function'
if subsubsubelement.text.startswith('range('):
func_ast = ast_parse(subsubsubelement.text)
subsubsubelement.text = 'range'
for arg in func_ast.body[0].value.args:
SubElement(subsubelement, 'param', type='number').text = str(arg.value)
else:
raise Exception(f'{subsubsubelement.text} is not a supported function')
type = 'function'
elif type in ('container', 'context'):
raise UpgradeError(_(f'cannot convert param with type "{type}"'))
if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib:
subsubsubelement.attrib['type'] = 'number'
@ -172,7 +213,11 @@ class RougailUpgrade:
continue
if subsubelement.attrib['name'] == 'valid_enum' and not type:
if subsubsubelement.attrib.get('name') == 'checkval':
if subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('valid_enums', {}).get('checkval', {}).get('remove', []):
subsubelement.remove(subsubsubelement)
continue
raise UpgradeError(_('checkval in valid_enum is no more supported'))
if subsubsubelement.text.startswith('['):
for val in eval(subsubsubelement.text):
SubElement(subsubelement, 'param').text = str(val)
subsubelement.remove(subsubsubelement)
@ -189,16 +234,18 @@ class RougailUpgrade:
type = subsubsubelement.attrib.get('type')
if type in ['service_accesslist', 'service_restrictionlist', 'interfacelist', 'hostlist']:
subsubelement.remove(subsubsubelement)
# elif self.test and type in ['filelist', 'variable', 'servicelist']:
# subsubsubelement.attrib['optional'] = "True"
elif (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
subsubelement.remove(subsubsubelement)
elif type == 'family' and subsubsubelement.text in upgrade_help.get('families', {}).get('remove', []):
subsubelement.remove(subsubsubelement)
up = upgrade_help.get('targets', {}).get(subsubsubelement.text)
if up:
if 'optional' in up:
subsubsubelement.attrib['optional'] = up['optional']
elif type == 'actionlist':
# for family in root.find('variables'):
# family_list = SubElement(subsubelement, 'target')
# family_list.attrib['type'] = 'family'
# family_list.text = namespace + '.' + family.attrib['name']
subsubelement.remove(subsubsubelement)
if upgrade_help.get('targets', {}).get(subsubsubelement.text, {}).get('optional'):
subsubsubelement.attrib['optional'] = upgrade_help.get('targets', {}).get(subsubsubelement.text, {}).get('optional')
has_target = False
for target in subsubelement:
if target.tag == 'target':
@ -208,7 +255,11 @@ class RougailUpgrade:
subelement.remove(subsubelement)
continue
elif subsubsubelement.tag == 'slave':
if subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
subsubelement.remove(subsubsubelement)
continue
subsubsubelement.tag = 'follower'
subsubsubelement.text = normalize_family(subsubsubelement.text)
if subelement.tag == 'containers':
current_service = self.upgrade_container(subsubsubelement, current_service, files, ips, servicelists, upgrade_help)
subsubelement.remove(subsubsubelement)
@ -283,6 +334,12 @@ class RougailUpgrade:
subelement.remove(subsubelement)
else:
self.move(subsubelement, 'master', 'leader')
for follower in subsubelement:
if '.' in subsubelement.attrib['leader']:
path = subsubelement.attrib['leader'].rsplit('.', 1)[0] + '.' + follower.text
else:
path = follower.text
self.remove(variables[path], 'multi', optional=True)
if subsubelement.attrib['leader'] in upgrade_help.get('groups', {}).get('reorder', {}):
for follower in subsubelement:
subsubelement.remove(follower)
@ -302,6 +359,10 @@ class RougailUpgrade:
continue
if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('hidden', {}).get('add', []):
subsubelement.attrib['hidden'] = 'True'
if subsubelement.attrib['name'] != normalize_family(subsubelement.attrib['name']):
if "description" not in subsubelement.attrib:
subsubelement.attrib['description'] = subsubelement.attrib['name']
subsubelement.attrib['name'] = normalize_family(subsubelement.attrib['name'])
families[subsubelement.attrib['name']] = subsubelement
# if empty, remove
if is_empty(subelement) or subelement.tag in ['containers', 'files', 'help']:
@ -394,7 +455,9 @@ class RougailUpgrade:
for name, text in variables_help.items():
variables[name].attrib['help'] = text
for name, text in families_help.items():
families[name].attrib['help'] = text
if name in upgrade_help.get('families', {}).get('rename', {}):
name = upgrade_help.get('families', {}).get('rename', {})[name]
families[normalize_family(name)].attrib['help'] = text
for auto in autos:
if auto in variables:
variables[auto].attrib['hidden'] = 'True'
@ -436,6 +499,8 @@ class RougailUpgrade:
service.attrib['name'] = service_name
if service_name == 'unknown':
service.attrib['manage'] = 'False'
if service_name in upgrade_help.get('services', {}).get('unmanage', []):
service.attrib['manage'] = 'False'
service_elt[service_name] = service
if upgrade_help.get('servicelists', {}).get(service_name):
service.attrib['servicelist'] = upgrade_help.get('servicelists', {}).get(service_name)
@ -450,7 +515,15 @@ class RougailUpgrade:
elt.attrib['engine'] = 'creole_legacy'
if (not 'instance_mode' in elt.attrib or elt.attrib['instance_mode'] != 'when_container') and \
elt.text not in upgrade_help.get('files', {}).get('remove', {}):
files[current_service][elt.text] = elt
if elt.attrib.get('filelist') in upgrade_help.get('services', {}).get('filelist_service', {}):
elt_service = upgrade_help.get('services', {}).get('filelist_service', {})[elt.attrib['filelist']]
if elt_service in files:
service = elt_service
else:
service = current_service
else:
service = current_service
files[service][elt.text] = elt
elif elt.tag in ['host', 'disknod', 'fstab', 'interface', 'package', 'service_access']:
pass
elif elt.tag == 'service_restriction':
@ -458,7 +531,15 @@ class RougailUpgrade:
if restriction.tag == 'ip' and restriction.text != '0.0.0.0':
self.remove(restriction, 'ip_type', optional=True)
self.remove(restriction, 'netmask_type', optional=True)
ips[current_service].append(restriction)
if elt.attrib['service'] in upgrade_help.get('services', {}).get('rename', {}):
elt_service = upgrade_help.get('services', {}).get('rename', {})[elt.attrib['service']]
else:
elt_service = elt.attrib['service']
if elt_service in ips:
service = elt_service
else:
service = current_service
ips[service].append(restriction)
elif elt.tag == 'service':
new_name = elt.text
if current_service == 'unknown':

View File

@ -26,10 +26,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
from typing import List
from unicodedata import normalize, combining
import re
from importlib.machinery import SourceFileLoader
from importlib.util import spec_from_loader, module_from_spec
from .i18n import _
from .error import DictConsistencyError
NAME_REGEXP = re.compile(r"^[a-z0-9_]*$")
def valid_variable_family_name(name: str,
xmlfiles: List[str],
) -> None:
match = NAME_REGEXP.search(name)
if not match:
msg = _(f'invalid variable or family name "{name}" must only contains '
'lowercase ascii character, number or _')
raise DictConsistencyError(msg, 76, xmlfiles)
def normalize_family(family_name: str) -> str:
"""replace space, accent, uppercase, ... by valid character

View File

@ -2,7 +2,7 @@
<rougail version="0.9">
<variables>
<variable name="server_deployed" type="boolean"/>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True">
<value>non</value>
</variable>

View File

@ -2,7 +2,7 @@
<rougail version="0.9">
<variables>
<variable name="server_deployed" type="boolean"/>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True" mode="expert">
<value>non</value>
</variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<!-- this is a comment -->
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -2,7 +2,7 @@
<rougail version="0.9">
<variables>
<family name='général'>
<family name="general" description="général">
<variable name='mode_conteneur_actif1' type='string' description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -2,7 +2,7 @@
<rougail version="0.9">
<variables>
<family name="general">
<variable name="domain" type="domain" description="Description">
<variable name="domain" type="domainname" description="Description">
<value>my.domain.name</value>
</variable>
</family>

View File

@ -1,4 +0,0 @@
{
"rougail.general.mode_conteneur_actif": "non",
"rougail.general.mode_conteneur_actif1": "non"
}

View File

@ -2,7 +2,7 @@
<rougail version="0.9">
<variables>
<variable name="server_deployed" type="boolean"/>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<variable name="var1">
<value>no</value>
</variable>
<variable name="var2" multi='True'/>
</variables>
<constraints>
<fill name="calc_value">
<param type="variable">var1</param>
<param type="boolean" name="multi">True</param>
<target>var2</target>
</fill>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1,12 @@
{
"rougail.var1": {
"owner": "default",
"value": "no"
},
"rougail.var2": {
"owner": "default",
"value": [
"no"
]
}
}

View File

@ -0,0 +1,6 @@
{
"rougail.var1": "no",
"rougail.var2": [
"no"
]
}

View File

@ -0,0 +1,12 @@
{
"rougail.var1": {
"owner": "default",
"value": "no"
},
"rougail.var2": {
"owner": "default",
"value": [
"no"
]
}
}

View 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 *
option_2 = StrOption(name="var1", doc="var1", default="no", properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="var2", doc="var2", multi=True, default=Calculation(func.calc_value, Params((ParamOption(option_2)), kwargs={'multi': ParamValue(True)})), 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])

View File

@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<variable name="var1" multi='True'>
<value>no</value>
<value>yes</value>
<value>maybe</value>
</variable>
<variable name="var2" multi='True'/>
</variables>
<constraints>
<fill name="calc_value">
<param type="variable">var1</param>
<target>var2</target>
</fill>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1,18 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"no",
"yes",
"maybe"
]
},
"rougail.var2": {
"owner": "default",
"value": [
"no",
"yes",
"maybe"
]
}
}

View File

@ -0,0 +1,12 @@
{
"rougail.var1": [
"no",
"yes",
"maybe"
],
"rougail.var2": [
"no",
"yes",
"maybe"
]
}

View File

@ -0,0 +1,18 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"no",
"yes",
"maybe"
]
},
"rougail.var2": {
"owner": "default",
"value": [
"no",
"yes",
"maybe"
]
}
}

View 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 *
option_2 = StrOption(name="var1", doc="var1", multi=True, default=['no', 'yes', 'maybe'], default_multi="no", properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="var2", doc="var2", multi=True, default=Calculation(func.calc_value, Params((ParamOption(option_2)))), 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])

View File

@ -2,7 +2,7 @@
<rougail version="0.9">
<variables>
<variable name="server_deployed" type="boolean"/>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -12,7 +12,7 @@ try:
except:
from tiramisu import *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption())), warnings_only=False)], properties=frozenset({"normal"}))
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption(whole=False))), warnings_only=False)], properties=frozenset({"normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -13,7 +13,7 @@ except:
from tiramisu import *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
option_4 = IntOption(name="int2", doc="No change", default=100, properties=frozenset({"mandatory", "normal"}))
option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption()), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"}))
option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption(whole=False)), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -13,7 +13,7 @@ except:
from tiramisu import *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
option_5 = IntOption(name="int2", doc="No change", properties=frozenset({"normal"}))
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"normal"}))
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -12,7 +12,7 @@ try:
except:
from tiramisu import *
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -14,7 +14,7 @@ except:
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -14,7 +14,7 @@ except:
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -14,7 +14,7 @@ except:
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", properties=frozenset({"basic", "mandatory"}))
option_6 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(), ParamOption(option_4), ParamOption(option_5))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
option_6 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(whole=False), ParamOption(option_4), ParamOption(option_5))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -13,7 +13,7 @@ except:
from tiramisu import *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", cidr=True, properties=frozenset({"basic", "mandatory"}))
option_5 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
option_5 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -13,7 +13,7 @@ except:
from tiramisu import *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], properties=frozenset({"basic", "mandatory"}))
option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=True)], properties=frozenset({"basic", "mandatory"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general1.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general1.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general1.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,4 +0,0 @@
{
"rougail.general.mode_conteneur_actif": "non",
"rougail.general1.leader.leader": []
}

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general1.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general1.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general1.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,22 +0,0 @@
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 *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_6 = StrOption(name="leader", doc="leader", multi=True)
option_7 = StrOption(name="follower1", doc="Followér1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"}))
option_8 = StrOption(name="follower2", doc="Followér2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"}))
option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"}))
option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general1.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general1.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general1.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general1.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general1.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general1.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,22 +0,0 @@
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 *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_6 = StrOption(name="leader", doc="Léader", multi=True)
option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"}))
option_8 = StrOption(name="follower2", doc="follower2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"}))
option_5 = Leadership(name="leader", doc="Léader", children=[option_6, option_7, option_8], properties=frozenset({"normal"}))
option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,4 +0,0 @@
{
"rougail.general.mode_conteneur_actif": "non",
"rougail.general.leader.leader": []
}

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,21 +0,0 @@
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 *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="leader", doc="leader", multi=True)
option_6 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"}))
option_7 = StrOption(name="follower2", doc="follower2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_6)))), properties=frozenset({"normal"}))
option_4 = Leadership(name="leader", doc="leader", children=[option_5, option_6, option_7], properties=frozenset({"normal"}))
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_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>oui</value>
</variable>

View File

@ -1,18 +0,0 @@
{
"rougail.general.condition": {
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif2": {
"owner": "default",
"value": "non"
},
"rougail.general2.mode_conteneur_actif3": {
"owner": "default",
"value": "non"
}
}

View File

@ -1,6 +0,0 @@
{
"rougail.general.condition": "non",
"rougail.general.mode_conteneur_actif": "non",
"rougail.general.mode_conteneur_actif2": "non",
"rougail.general2.mode_conteneur_actif3": "non"
}

View File

@ -1,18 +0,0 @@
{
"rougail.general.condition": {
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif2": {
"owner": "default",
"value": "non"
},
"rougail.general2.mode_conteneur_actif3": {
"owner": "default",
"value": "non"
}
}

View File

@ -1,21 +0,0 @@
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 *
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_7 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_6 = OptionDescription(name="general2", doc="Général2", children=[option_7], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_6])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="Général">
<family name="general" description="Général">
<variable name="condition" type="string" description="No change">
<value>non</value>
</variable>
@ -12,7 +12,7 @@
<value>non</value>
</variable>
</family>
<family name="Général2">
<family name="general2" description="Général2">
</family>
</variables>
@ -21,7 +21,7 @@
<param>oui</param>
<target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target>
<target type="family">Général2</target>
<target type="family">general2</target>
</condition>
</constraints>
</rougail>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="Général">
<family name="general" description="Général">
<variable name="condition" type="string" description="No change">
<value>non</value>
</variable>
@ -12,7 +12,7 @@
<value>non</value>
</variable>
</family>
<family name="Général2">
<family name="general2" description="Général2">
<variable name="mode_conteneur_actif3" type="string" description="No change" hidden="True">
<value>non</value>
</variable>
@ -24,7 +24,7 @@
<param>oui</param>
<target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target>
<target type="family">Général2</target>
<target type="family">general2</target>
</condition>
</constraints>
</rougail>

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general_1.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general_1.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general_1.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,4 +0,0 @@
{
"rougail.general.mode_conteneur_actif": "non",
"rougail.general_1.leader.leader": []
}

View File

@ -1,18 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "non"
},
"rougail.general_1.leader.leader": {
"owner": "default",
"value": []
},
"rougail.general_1.leader.follower1": {
"owner": [],
"value": []
},
"rougail.general_1.leader.follower2": {
"owner": [],
"value": []
}
}

View File

@ -1,22 +0,0 @@
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 *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({"mandatory"}))
option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal"}))
option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal"}))
option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"basic"}))
option_4 = OptionDescription(name="general_1", doc="general-1", children=[option_5], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -15,7 +15,7 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non"
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_6 = StrOption(name="leader", doc="leader", multi=True)
option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"}))
option_8 = StrOption(name="follower2", doc="follower2", multi=submulti, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"}))
option_8 = StrOption(name="follower2", doc="follower2", multi=submulti, default=[Calculation(func.calc_val, Params((ParamOption(option_7))))], properties=frozenset({"normal"}))
option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"}))
option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])

View File

@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="general">
<variable name="var" type="number" description="New variable">
<value>9</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum">
<param type="function">trange</param>
<param type="number">0</param>
<param type="number">10</param>
<target>var</target>
</check>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1,6 @@
{
"rougail.general.var": {
"owner": "default",
"value": 9
}
}

View File

@ -0,0 +1,3 @@
{
"rougail.general.var": 9
}

View File

@ -0,0 +1,6 @@
{
"rougail.general.var": {
"owner": "default",
"value": 9
}
}

View File

@ -11,8 +11,7 @@ try:
from tiramisu3 import *
except:
from tiramisu import *
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"}))
option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4], properties=frozenset({"normal"}))
option_3 = ChoiceOption(name="var", doc="New variable", values=Calculation(func.trange, Params((ParamValue(0), ParamValue(10)))), default=9, 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_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,14 +0,0 @@
{
"rougail.general.mode_conteneur_actif1": {
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif2": {
"owner": "default",
"value": "non"
},
"rougail.other.mode_conteneur_actif3": {
"owner": "default",
"value": "non"
}
}

View File

@ -1,5 +0,0 @@
{
"rougail.general.mode_conteneur_actif1": "non",
"rougail.general.mode_conteneur_actif2": "non",
"rougail.other.mode_conteneur_actif3": "non"
}

View File

@ -1,14 +0,0 @@
{
"rougail.general.mode_conteneur_actif1": {
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif2": {
"owner": "default",
"value": "non"
},
"rougail.other.mode_conteneur_actif3": {
"owner": "default",
"value": "non"
}
}

View File

@ -1,21 +0,0 @@
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 *
option_7 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_6 = OptionDescription(name="other", doc="Other", children=[option_7], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_6])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -15,6 +15,6 @@ from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_5 = StrOption(name="vardyn", doc="No change", properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"}))
option_7 = StrOption(name="newvar", doc="No change", default=Calculation(func.calc_val, Params((ParamDynOption(option_5, 'val1', option_4)))), properties=frozenset({"normal"}))
option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])

View File

@ -16,7 +16,7 @@ option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_7 = StrOption(name="newvar", doc="No change", properties=frozenset({"normal"}))
option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_5 = StrOption(name="vardyn", doc="No change", default=Calculation(func.calc_val, Params((ParamSuffix()))), properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"}))
option_7 = StrOption(name="newvar", doc="No change", properties=frozenset({"normal"}))
option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])

View File

@ -15,6 +15,6 @@ from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_5 = StrOption(name="vardyn", doc="No change", properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="Dyn ", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="Dyn ", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
option_3 = IntOption(name="varname", doc="No change", multi=True, default=[1, 2], default_multi=1, properties=frozenset({"mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"}))
option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"}))
option_7 = StrOption(name="newvar", doc="No change", default=Calculation(func.calc_val, Params((ParamDynOption(option_5, '1', option_4)))), properties=frozenset({"normal"}))
option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])

View File

@ -3,7 +3,7 @@
<services/>
<variables>
<family name="proxy authentifié">
<family name="proxy_authentifie" description="proxy authentifié">
<variable name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
</variable>
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">

View File

@ -3,7 +3,7 @@
<services/>
<variables>
<family name="proxy authentifié">
<family name="proxy_authentifie" description="proxy authentifié">
<variable name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
</variable>
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">

View File

@ -0,0 +1,31 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>
</family>
<family name="general2" hidden="True">
<variable name="mode_conteneur_actif2" type="string" description="No change" hidden="True">
<value>oui</value>
</variable>
<variable name="mode_conteneur_actif3" type="string" description="No change">
<value>non</value>
</variable>
</family>
</variables>
<constraints>
<condition name="disabled_if_in" source="mode_conteneur_actif">
<param>oui</param>
<target type="variable">mode_conteneur_actif3</target>
</condition>
<condition name="disabled_if_in" source="mode_conteneur_actif2">
<param>oui</param>
<target type="variable">mode_conteneur_actif3</target>
</condition>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -3,8 +3,8 @@
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif1": {
"rougail.general2.mode_conteneur_actif2": {
"owner": "default",
"value": "non"
"value": "oui"
}
}

View File

@ -1,4 +1,4 @@
{
"rougail.general.mode_conteneur_actif": "non",
"rougail.general1.leader.leader": []
"rougail.general2.mode_conteneur_actif2": "oui"
}

View File

@ -3,8 +3,8 @@
"owner": "default",
"value": "non"
},
"rougail.general.mode_conteneur_actif1": {
"rougail.general2.mode_conteneur_actif2": {
"owner": "default",
"value": "non"
"value": "oui"
}
}

View File

@ -0,0 +1,20 @@
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 *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))}))
option_4 = OptionDescription(name="general2", doc="general2", children=[option_5, option_6], properties=frozenset({"hidden", "normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="my_var" auto_freeze="True">
<value>no</value>
</variable>

View File

@ -7,7 +7,7 @@
</service>
</services>
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -8,7 +8,7 @@
</services>
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>non</value>
</variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.9">
<variables>
<family name="général">
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change">
<value>non</value>
</variable>

Some files were not shown because too many files have changed in this diff Show More