Compare commits
11 Commits
fc686e9b7f
...
17e7f4caa0
Author | SHA1 | Date |
---|---|---|
Emmanuel Garette | 17e7f4caa0 | |
Emmanuel Garette | 2a77093187 | |
Emmanuel Garette | db69df3b86 | |
Emmanuel Garette | 2b2cc4cf20 | |
Emmanuel Garette | 20de4443ae | |
Emmanuel Garette | 1e6c9060b5 | |
Emmanuel Garette | e66a462710 | |
Emmanuel Garette | 9eb6a67ac6 | |
Emmanuel Garette | d895c46729 | |
Emmanuel Garette | 63e679036b | |
Emmanuel Garette | 12acf2a3f4 |
|
@ -52,6 +52,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
self.functions.extend(INTERNAL_FUNCTIONS)
|
self.functions.extend(INTERNAL_FUNCTIONS)
|
||||||
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
||||||
self.target_is_uniq = False
|
self.target_is_uniq = False
|
||||||
|
self.allow_function = True
|
||||||
self.convert_target(self.objectspace.space.constraints.check)
|
self.convert_target(self.objectspace.space.constraints.check)
|
||||||
self.convert_param(self.objectspace.space.constraints.check)
|
self.convert_param(self.objectspace.space.constraints.check)
|
||||||
self.check_check()
|
self.check_check()
|
||||||
|
@ -132,11 +133,23 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
has_variable = False
|
has_variable = False
|
||||||
values = []
|
values = []
|
||||||
has_nil = False
|
has_nil = False
|
||||||
|
is_function = False
|
||||||
for param in check.param:
|
for param in check.param:
|
||||||
if has_variable:
|
if has_variable:
|
||||||
msg = _(f'only one "variable" parameter is allowed for valid_enum '
|
msg = _(f'only one "variable" parameter is allowed for valid_enum '
|
||||||
f'of variable "{variable.name}"')
|
f'of variable "{variable.name}"')
|
||||||
raise DictConsistencyError(msg, 5, param.xmlfiles)
|
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
|
param_type = variable.ori_type
|
||||||
if param.type == 'variable':
|
if param.type == 'variable':
|
||||||
has_variable = True
|
has_variable = True
|
||||||
|
@ -148,7 +161,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
msg = _(f'only multi "variable" parameter is allowed for valid_enum '
|
msg = _(f'only multi "variable" parameter is allowed for valid_enum '
|
||||||
f'of variable "{variable.name}"')
|
f'of variable "{variable.name}"')
|
||||||
raise DictConsistencyError(msg, 6, param.xmlfiles)
|
raise DictConsistencyError(msg, 6, param.xmlfiles)
|
||||||
param_type = 'calculation'
|
param_type = 'variable'
|
||||||
elif param.type == 'nil':
|
elif param.type == 'nil':
|
||||||
has_nil = True
|
has_nil = True
|
||||||
values.append(param.text)
|
values.append(param.text)
|
||||||
|
@ -156,6 +169,8 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
choice.name = param.text
|
choice.name = param.text
|
||||||
choice.type = param_type
|
choice.type = param_type
|
||||||
variable.values.append(choice)
|
variable.values.append(choice)
|
||||||
|
if is_function:
|
||||||
|
return None
|
||||||
if 'mandatory' not in vars(variable):
|
if 'mandatory' not in vars(variable):
|
||||||
variable.mandatory = not has_nil
|
variable.mandatory = not has_nil
|
||||||
elif variable.mandatory is False:
|
elif variable.mandatory is False:
|
||||||
|
|
|
@ -50,6 +50,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
||||||
return
|
return
|
||||||
self.target_is_uniq = False
|
self.target_is_uniq = False
|
||||||
self.only_variable = False
|
self.only_variable = False
|
||||||
|
self.allow_function = False
|
||||||
self.convert_target(self.objectspace.space.constraints.condition)
|
self.convert_target(self.objectspace.space.constraints.condition)
|
||||||
self.check_condition_optional()
|
self.check_condition_optional()
|
||||||
self.convert_condition_source()
|
self.convert_condition_source()
|
||||||
|
@ -74,9 +75,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
||||||
for variable in self.get_variables():
|
for variable in self.get_variables():
|
||||||
if not variable.auto_freeze and not variable.auto_save:
|
if not variable.auto_freeze and not variable.auto_save:
|
||||||
continue
|
continue
|
||||||
if variable.namespace != self.objectspace.rougailconfig['variable_namespace']:
|
#if variable.namespace != self.objectspace.rougailconfig['variable_namespace']:
|
||||||
msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
|
# msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
|
||||||
raise DictConsistencyError(msg, 49, variable.xmlfiles)
|
# raise DictConsistencyError(msg, 49, variable.xmlfiles)
|
||||||
variable.force_store_value = True
|
variable.force_store_value = True
|
||||||
if variable.auto_save:
|
if variable.auto_save:
|
||||||
continue
|
continue
|
||||||
|
@ -89,7 +90,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
||||||
new_condition.param = [new_param]
|
new_condition.param = [new_param]
|
||||||
new_target = self.objectspace.target(variable.xmlfiles)
|
new_target = self.objectspace.target(variable.xmlfiles)
|
||||||
new_target.type = 'variable'
|
new_target.type = 'variable'
|
||||||
new_target.name = variable.name
|
new_target.name = variable.path
|
||||||
new_condition.target = [new_target]
|
new_condition.target = [new_target]
|
||||||
if not hasattr(self.objectspace.space, 'constraints'):
|
if not hasattr(self.objectspace.space, 'constraints'):
|
||||||
self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles)
|
self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles)
|
||||||
|
|
|
@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
from ..utils import normalize_family
|
|
||||||
from .variable import Walk
|
from .variable import Walk
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +90,6 @@ class FamilyAnnotator(Walk):
|
||||||
family.description = family.name
|
family.description = family.name
|
||||||
family.doc = family.description
|
family.doc = family.description
|
||||||
del family.description
|
del family.description
|
||||||
family.name = normalize_family(family.name)
|
|
||||||
|
|
||||||
def change_modes(self):
|
def change_modes(self):
|
||||||
"""change the mode of variables
|
"""change the mode of variables
|
||||||
|
|
|
@ -32,6 +32,9 @@ from .target import TargetAnnotator
|
||||||
from .param import ParamAnnotator
|
from .param import ParamAnnotator
|
||||||
|
|
||||||
|
|
||||||
|
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename')
|
||||||
|
|
||||||
|
|
||||||
class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
"""Fill annotator
|
"""Fill annotator
|
||||||
"""
|
"""
|
||||||
|
@ -44,13 +47,23 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
not hasattr(self.objectspace.space.constraints, 'fill'):
|
not hasattr(self.objectspace.space.constraints, 'fill'):
|
||||||
return
|
return
|
||||||
self.functions = dir(load_modules(eosfunc_file))
|
self.functions = dir(load_modules(eosfunc_file))
|
||||||
|
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
||||||
self.target_is_uniq = True
|
self.target_is_uniq = True
|
||||||
self.only_variable = True
|
self.only_variable = True
|
||||||
|
self.allow_function = False
|
||||||
self.convert_target(self.objectspace.space.constraints.fill)
|
self.convert_target(self.objectspace.space.constraints.fill)
|
||||||
self.convert_param(self.objectspace.space.constraints.fill)
|
self.convert_param(self.objectspace.space.constraints.fill)
|
||||||
self.fill_to_value()
|
self.fill_to_value()
|
||||||
del self.objectspace.space.constraints.fill
|
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:
|
def fill_to_value(self) -> None:
|
||||||
"""valid and manage <fill>
|
"""valid and manage <fill>
|
||||||
"""
|
"""
|
||||||
|
@ -65,6 +78,11 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
value = self.objectspace.value(fill.xmlfiles)
|
value = self.objectspace.value(fill.xmlfiles)
|
||||||
value.type = 'calculation'
|
value.type = 'calculation'
|
||||||
value.name = fill.name
|
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':
|
if target.name.namespace == 'services':
|
||||||
target.name.default = value
|
target.name.default = value
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -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
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
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
|
from .variable import CONVERT_OPTION
|
||||||
|
|
||||||
|
@ -82,6 +85,16 @@ class ParamAnnotator:
|
||||||
if err.errno != 42 or not param.optional:
|
if err.errno != 42 or not param.optional:
|
||||||
raise err
|
raise err
|
||||||
param_to_delete.append(param_idx)
|
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:
|
elif variable_type:
|
||||||
self._convert_with_variable_type(variable_type, param)
|
self._convert_with_variable_type(variable_type, param)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
from ..objspace import convert_boolean
|
from ..objspace import convert_boolean
|
||||||
from ..utils import normalize_family
|
|
||||||
|
|
||||||
|
|
||||||
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
|
@ -50,7 +49,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
'broadcast': dict(opttype="BroadcastOption"),
|
'broadcast': dict(opttype="BroadcastOption"),
|
||||||
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios',
|
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios',
|
||||||
'warnings_only': True}),
|
'warnings_only': True}),
|
||||||
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname',
|
'domainname': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname',
|
||||||
'allow_ip': False}),
|
'allow_ip': False}),
|
||||||
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname',
|
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname',
|
||||||
'allow_ip': False}),
|
'allow_ip': False}),
|
||||||
|
@ -171,7 +170,6 @@ class VariableAnnotator(Walk): # pylint: disable=R0903
|
||||||
if not variable.value:
|
if not variable.value:
|
||||||
del variable.value
|
del variable.value
|
||||||
variable.doc = variable.description
|
variable.doc = variable.description
|
||||||
variable.name = normalize_family(variable.name)
|
|
||||||
del variable.description
|
del variable.description
|
||||||
if variable_type == 'follower':
|
if variable_type == 'follower':
|
||||||
if variable.multi is True:
|
if variable.multi is True:
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
|
|
||||||
<!ELEMENT variable (value*)>
|
<!ELEMENT variable (value*)>
|
||||||
<!ATTLIST variable name CDATA #REQUIRED>
|
<!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 description CDATA #IMPLIED>
|
||||||
<!ATTLIST variable help CDATA #IMPLIED>
|
<!ATTLIST variable help CDATA #IMPLIED>
|
||||||
<!ATTLIST variable hidden (True|False) "False">
|
<!ATTLIST variable hidden (True|False) "False">
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT param (#PCDATA)>
|
<!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 name CDATA #IMPLIED>
|
||||||
<!ATTLIST param propertyerror (True|False) "True">
|
<!ATTLIST param propertyerror (True|False) "True">
|
||||||
<!ATTLIST param optional (True|False) "False">
|
<!ATTLIST param optional (True|False) "False">
|
||||||
|
|
|
@ -29,7 +29,7 @@ from typing import Optional
|
||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .xmlreflector import XMLReflector
|
from .xmlreflector import XMLReflector
|
||||||
from .utils import normalize_family
|
from .utils import valid_variable_family_name
|
||||||
from .error import SpaceObjShallNotBeUpdated, DictConsistencyError
|
from .error import SpaceObjShallNotBeUpdated, DictConsistencyError
|
||||||
from .path import Path
|
from .path import Path
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class RougailObjSpace:
|
||||||
if child.tag == 'family':
|
if child.tag == 'family':
|
||||||
if child.attrib['name'] in family_names:
|
if child.attrib['name'] in family_names:
|
||||||
msg = _(f'Family "{child.attrib["name"]}" is set several times')
|
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'])
|
family_names.append(child.attrib['name'])
|
||||||
try:
|
try:
|
||||||
# variable objects creation
|
# variable objects creation
|
||||||
|
@ -296,6 +296,7 @@ class RougailObjSpace:
|
||||||
"""A redefinable object could be created or updated
|
"""A redefinable object could be created or updated
|
||||||
"""
|
"""
|
||||||
existed_var = self.get_existed_obj(name,
|
existed_var = self.get_existed_obj(name,
|
||||||
|
xmlfile,
|
||||||
space,
|
space,
|
||||||
child,
|
child,
|
||||||
namespace,
|
namespace,
|
||||||
|
@ -337,6 +338,7 @@ class RougailObjSpace:
|
||||||
|
|
||||||
def get_existed_obj(self,
|
def get_existed_obj(self,
|
||||||
name: str,
|
name: str,
|
||||||
|
xmlfile: str,
|
||||||
space: str,
|
space: str,
|
||||||
child,
|
child,
|
||||||
namespace: str,
|
namespace: str,
|
||||||
|
@ -344,7 +346,7 @@ class RougailObjSpace:
|
||||||
"""if an object exists, return it
|
"""if an object exists, return it
|
||||||
"""
|
"""
|
||||||
if child.tag in ['variable', 'family']:
|
if child.tag in ['variable', 'family']:
|
||||||
name = normalize_family(name)
|
valid_variable_family_name(name, [xmlfile])
|
||||||
if child.tag == 'variable': # pylint: disable=E1101
|
if child.tag == 'variable': # pylint: disable=E1101
|
||||||
if namespace != self.rougailconfig['variable_namespace']:
|
if namespace != self.rougailconfig['variable_namespace']:
|
||||||
name = space.path + '.' + name
|
name = space.path + '.' + name
|
||||||
|
@ -468,18 +470,18 @@ class RougailObjSpace:
|
||||||
"""
|
"""
|
||||||
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
||||||
if 'name' in document.attrib:
|
if 'name' in document.attrib:
|
||||||
family_name = normalize_family(document.attrib['name'])
|
family_name = document.attrib['name']
|
||||||
else:
|
else:
|
||||||
family_name = namespace
|
family_name = namespace
|
||||||
|
|
||||||
self.paths.add_variable(namespace,
|
self.paths.add_variable(namespace,
|
||||||
normalize_family(variableobj.name),
|
variableobj.name,
|
||||||
space.path,
|
space.path,
|
||||||
document.attrib.get('dynamic') is not None,
|
document.attrib.get('dynamic') is not None,
|
||||||
variableobj,
|
variableobj,
|
||||||
)
|
)
|
||||||
elif isinstance(variableobj, self.family): # pylint: disable=E1101
|
elif isinstance(variableobj, self.family): # pylint: disable=E1101
|
||||||
family_name = normalize_family(variableobj.name)
|
family_name = variableobj.name
|
||||||
if namespace != self.rougailconfig['variable_namespace']:
|
if namespace != self.rougailconfig['variable_namespace']:
|
||||||
family_name = namespace + '.' + family_name
|
family_name = namespace + '.' + family_name
|
||||||
self.paths.add_family(namespace,
|
self.paths.add_family(namespace,
|
||||||
|
@ -502,8 +504,6 @@ class RougailObjSpace:
|
||||||
if isinstance(variableobj, Redefinable):
|
if isinstance(variableobj, Redefinable):
|
||||||
name = variableobj.name
|
name = variableobj.name
|
||||||
tag = FORCE_TAG.get(child.tag, child.tag)
|
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||||
if child.tag in ['family', 'variable']:
|
|
||||||
name = normalize_family(name)
|
|
||||||
getattr(space, tag)[name] = variableobj
|
getattr(space, tag)[name] = variableobj
|
||||||
elif isinstance(variableobj, UnRedefinable):
|
elif isinstance(variableobj, UnRedefinable):
|
||||||
getattr(space, child.tag).append(variableobj)
|
getattr(space, child.tag).append(variableobj)
|
||||||
|
|
|
@ -166,11 +166,14 @@ class RougailExtra:
|
||||||
try:
|
try:
|
||||||
return self.suboption[key]
|
return self.suboption[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise AttributeError
|
raise AttributeError(f'unable to find extra "{key}"')
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self.suboption.values())
|
return iter(self.suboption.values())
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
return self.suboption.items()
|
||||||
|
|
||||||
|
|
||||||
class RougailBaseTemplate:
|
class RougailBaseTemplate:
|
||||||
"""Engine to process Creole cheetah template
|
"""Engine to process Creole cheetah template
|
||||||
|
@ -231,7 +234,7 @@ class RougailBaseTemplate:
|
||||||
|
|
||||||
def instance_file(self,
|
def instance_file(self,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
type: str,
|
type_: str,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Run templatisation on one file
|
"""Run templatisation on one file
|
||||||
|
@ -253,7 +256,7 @@ class RougailBaseTemplate:
|
||||||
var = variable[idx]
|
var = variable[idx]
|
||||||
else:
|
else:
|
||||||
var = None
|
var = None
|
||||||
func = f'_instance_{type}'
|
func = f'_instance_{type_}'
|
||||||
data = getattr(self, func)(filevar,
|
data = getattr(self, func)(filevar,
|
||||||
filename,
|
filename,
|
||||||
service_name,
|
service_name,
|
||||||
|
|
|
@ -74,6 +74,27 @@ class IsDefined:
|
||||||
return varname in self.context
|
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):
|
class CheetahTemplate(oriCheetahTemplate):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
filename: str,
|
filename: str,
|
||||||
|
@ -82,7 +103,12 @@ class CheetahTemplate(oriCheetahTemplate):
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
extra_context: Dict,
|
extra_context: Dict,
|
||||||
):
|
):
|
||||||
|
creole_client = CreoleClient()
|
||||||
|
creole_client.context=context
|
||||||
extra_context['is_defined'] = IsDefined(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)
|
super().__init__(filename, source, context, eosfunc, extra_context)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ z %%filename - - - - -
|
||||||
%end if
|
%end if
|
||||||
%end for
|
%end for
|
||||||
%end if
|
%end if
|
||||||
%end for"""
|
%end for
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class RougailSystemdTemplate(RougailBaseTemplate):
|
class RougailSystemdTemplate(RougailBaseTemplate):
|
||||||
|
|
|
@ -296,9 +296,11 @@ class Variable(Common):
|
||||||
keys['opt'] = self.elt.opt.reflector_object.get()
|
keys['opt'] = self.elt.opt.reflector_object.get()
|
||||||
if hasattr(self.elt, 'values'):
|
if hasattr(self.elt, 'values'):
|
||||||
values = self.elt.values
|
values = self.elt.values
|
||||||
if values[0].type == 'calculation':
|
if values[0].type == 'variable':
|
||||||
value = values[0].name.reflector_object.get()
|
value = values[0].name.reflector_object.get()
|
||||||
keys['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
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:
|
else:
|
||||||
keys['values'] = str(tuple([val.name for val in values]))
|
keys['values'] = str(tuple([val.name for val in values]))
|
||||||
if hasattr(self.elt, 'multi') and self.elt.multi:
|
if hasattr(self.elt, 'multi') and self.elt.multi:
|
||||||
|
@ -309,11 +311,11 @@ class Variable(Common):
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
value = self.convert_str(value)
|
value = self.convert_str(value)
|
||||||
elif isinstance(value, self.objectspace.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
|
keys[key] = value
|
||||||
if hasattr(self.elt, 'validators'):
|
if hasattr(self.elt, 'validators'):
|
||||||
keys['validators'] = '[' + ', '.join([self.calculation_value(val,
|
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']:
|
for key in ['min_number', 'max_number']:
|
||||||
if hasattr(self.elt, key):
|
if hasattr(self.elt, key):
|
||||||
keys[key] = getattr(self.elt, key)
|
keys[key] = getattr(self.elt, key)
|
||||||
|
@ -325,6 +327,7 @@ class Variable(Common):
|
||||||
def calculation_value(self,
|
def calculation_value(self,
|
||||||
child,
|
child,
|
||||||
args,
|
args,
|
||||||
|
calc_multi=False,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Generate calculated value
|
"""Generate calculated value
|
||||||
"""
|
"""
|
||||||
|
@ -336,11 +339,9 @@ class Variable(Common):
|
||||||
for param in child.param:
|
for param in child.param:
|
||||||
value = self.populate_param(param)
|
value = self.populate_param(param)
|
||||||
if not hasattr(param, 'name'):
|
if not hasattr(param, 'name'):
|
||||||
# args.append(str(value))
|
|
||||||
new_args.append(str(value))
|
new_args.append(str(value))
|
||||||
else:
|
else:
|
||||||
kwargs.append(f"'{param.name}': " + value)
|
kwargs.append(f"'{param.name}': " + value)
|
||||||
# ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')'
|
|
||||||
if function == 'valid_network_netmask':
|
if function == 'valid_network_netmask':
|
||||||
new_args.extend(args)
|
new_args.extend(args)
|
||||||
else:
|
else:
|
||||||
|
@ -352,7 +353,10 @@ class Variable(Common):
|
||||||
ret += ')'
|
ret += ')'
|
||||||
if hasattr(child, 'warnings_only'):
|
if hasattr(child, 'warnings_only'):
|
||||||
ret += f', warnings_only={child.warnings_only}'
|
ret += f', warnings_only={child.warnings_only}'
|
||||||
return ret + ')'
|
ret = ret + ')'
|
||||||
|
if calc_multi:
|
||||||
|
ret = '[' + ret + ']'
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class Family(Common):
|
class Family(Common):
|
||||||
|
@ -383,5 +387,5 @@ class Family(Common):
|
||||||
) -> None:
|
) -> None:
|
||||||
if hasattr(self.elt, 'suffixes'):
|
if hasattr(self.elt, 'suffixes'):
|
||||||
dyn = self.elt.suffixes.reflector_object.get()
|
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]) + ']'
|
keys['children'] = '[' + ', '.join([child.get() for child in self.children]) + ']'
|
||||||
|
|
|
@ -25,10 +25,13 @@ from os.path import join, isfile, basename
|
||||||
from os import listdir
|
from os import listdir
|
||||||
from lxml.etree import DTD, parse, XMLParser, XMLSyntaxError # pylint: disable=E0611
|
from lxml.etree import DTD, parse, XMLParser, XMLSyntaxError # pylint: disable=E0611
|
||||||
from lxml.etree import Element, SubElement, tostring
|
from lxml.etree import Element, SubElement, tostring
|
||||||
|
from ast import parse as ast_parse
|
||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .error import UpgradeError
|
from .error import UpgradeError
|
||||||
|
|
||||||
|
from .utils import normalize_family
|
||||||
|
|
||||||
|
|
||||||
VERSIONS = {'creole': ['1'],
|
VERSIONS = {'creole': ['1'],
|
||||||
'rougail': ['0.9'],
|
'rougail': ['0.9'],
|
||||||
|
@ -40,7 +43,7 @@ def get_function_name(root, version):
|
||||||
return f'update_{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:
|
class RougailUpgrade:
|
||||||
|
@ -53,6 +56,7 @@ class RougailUpgrade:
|
||||||
def load_xml_from_folders(self,
|
def load_xml_from_folders(self,
|
||||||
srcfolder: str,
|
srcfolder: str,
|
||||||
dstfolder: str,
|
dstfolder: str,
|
||||||
|
namespace: str,
|
||||||
):
|
):
|
||||||
"""Loads all the XML files located in the xmlfolders' list
|
"""Loads all the XML files located in the xmlfolders' list
|
||||||
|
|
||||||
|
@ -71,10 +75,13 @@ class RougailUpgrade:
|
||||||
root = document.getroot()
|
root = document.getroot()
|
||||||
search_function_name = get_function_name(root.tag, root.attrib.get('version', '1'))
|
search_function_name = get_function_name(root.tag, root.attrib.get('version', '1'))
|
||||||
function_found = False
|
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):
|
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, {})
|
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:
|
if function_version == search_function_name:
|
||||||
function_found = True
|
function_found = True
|
||||||
with open(xmldst, 'wb') as xmlfh:
|
with open(xmldst, 'wb') as xmlfh:
|
||||||
|
@ -90,6 +97,7 @@ class RougailUpgrade:
|
||||||
def update_rougail_0_9(self,
|
def update_rougail_0_9(self,
|
||||||
root: 'Element',
|
root: 'Element',
|
||||||
upgrade_help: dict,
|
upgrade_help: dict,
|
||||||
|
namespace: str,
|
||||||
) -> 'Element':
|
) -> 'Element':
|
||||||
# rename root
|
# rename root
|
||||||
root.tag = 'rougail'
|
root.tag = 'rougail'
|
||||||
|
@ -111,6 +119,9 @@ class RougailUpgrade:
|
||||||
if not isinstance(subelement.tag, str):
|
if not isinstance(subelement.tag, str):
|
||||||
# XML comment
|
# XML comment
|
||||||
continue
|
continue
|
||||||
|
if subelement.tag == 'family_action':
|
||||||
|
root.remove(subelement)
|
||||||
|
continue
|
||||||
for subsubelement in subelement:
|
for subsubelement in subelement:
|
||||||
if not isinstance(subsubelement.tag, str):
|
if not isinstance(subsubelement.tag, str):
|
||||||
# XML comment
|
# XML comment
|
||||||
|
@ -130,16 +141,27 @@ class RougailUpgrade:
|
||||||
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('remove', []):
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('remove', []):
|
||||||
self.remove(subsubsubelement, 'hidden', optional=True)
|
self.remove(subsubsubelement, 'hidden', optional=True)
|
||||||
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('remove', []):
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('remove', []):
|
||||||
self.remove(subsubsubelement, 'mandatory', optional=True)
|
self.remove(subsubsubelement, 'mandatory')
|
||||||
variables[subsubsubelement.attrib['name']] = subsubsubelement
|
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')
|
type = subsubsubelement.attrib.get('type')
|
||||||
if type in ['oui/non', 'yes/no', 'on/off']:
|
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']
|
del subsubsubelement.attrib['type']
|
||||||
elif type == 'hostname_strict':
|
elif type == 'hostname_strict':
|
||||||
subsubsubelement.attrib['type'] = 'hostname'
|
subsubsubelement.attrib['type'] = 'hostname'
|
||||||
elif type == 'domain_strict':
|
elif type in ['domain', 'domain_strict']:
|
||||||
subsubsubelement.attrib['type'] = 'domain'
|
subsubsubelement.attrib['type'] = 'domainname'
|
||||||
elif type == 'string':
|
elif type == 'string':
|
||||||
del subsubsubelement.attrib['type']
|
del subsubsubelement.attrib['type']
|
||||||
if self.test and subsubsubelement.attrib.get('auto_freeze') == 'True':
|
if self.test and subsubsubelement.attrib.get('auto_freeze') == 'True':
|
||||||
|
@ -153,17 +175,36 @@ class RougailUpgrade:
|
||||||
subsubsubelement.attrib['remove_check'] = 'True'
|
subsubsubelement.attrib['remove_check'] = 'True'
|
||||||
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mode', {}).get('modify', {}):
|
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']]
|
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', {}):
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('test', {}):
|
||||||
subsubsubelement.attrib['test'] = upgrade_help.get('variables', {}).get('test', {})[subsubsubelement.attrib['name']]
|
subsubsubelement.attrib['test'] = upgrade_help.get('variables', {}).get('test', {})[subsubsubelement.attrib['name']]
|
||||||
# for value in subsubsubelement:
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove_value', []):
|
||||||
# if value.text is None:
|
for value in subsubsubelement:
|
||||||
# value.attrib['type'] = 'nil'
|
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':
|
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')
|
type = subsubsubelement.attrib.get('type')
|
||||||
if type == 'eole':
|
if type == 'eole':
|
||||||
subsubsubelement.attrib['type'] = 'variable'
|
subsubsubelement.attrib['type'] = 'variable'
|
||||||
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}"'))
|
raise UpgradeError(_(f'cannot convert param with type "{type}"'))
|
||||||
if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib:
|
if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib:
|
||||||
subsubsubelement.attrib['type'] = 'number'
|
subsubsubelement.attrib['type'] = 'number'
|
||||||
|
@ -172,10 +213,14 @@ class RougailUpgrade:
|
||||||
continue
|
continue
|
||||||
if subsubelement.attrib['name'] == 'valid_enum' and not type:
|
if subsubelement.attrib['name'] == 'valid_enum' and not type:
|
||||||
if subsubsubelement.attrib.get('name') == 'checkval':
|
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'))
|
raise UpgradeError(_('checkval in valid_enum is no more supported'))
|
||||||
for val in eval(subsubsubelement.text):
|
if subsubsubelement.text.startswith('['):
|
||||||
SubElement(subsubelement, 'param').text = str(val)
|
for val in eval(subsubsubelement.text):
|
||||||
subsubelement.remove(subsubsubelement)
|
SubElement(subsubelement, 'param').text = str(val)
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
self.move(subsubsubelement, 'hidden', 'propertyerror', optional=True)
|
self.move(subsubsubelement, 'hidden', 'propertyerror', optional=True)
|
||||||
if type == 'variable' and subsubsubelement.text in upgrade_help.get('variables', {}).get('rename', []):
|
if type == 'variable' and subsubsubelement.text in upgrade_help.get('variables', {}).get('rename', []):
|
||||||
subsubsubelement.text = upgrade_help.get('variables', {}).get('rename', [])[subsubsubelement.text]
|
subsubsubelement.text = upgrade_help.get('variables', {}).get('rename', [])[subsubsubelement.text]
|
||||||
|
@ -189,16 +234,18 @@ class RougailUpgrade:
|
||||||
type = subsubsubelement.attrib.get('type')
|
type = subsubsubelement.attrib.get('type')
|
||||||
if type in ['service_accesslist', 'service_restrictionlist', 'interfacelist', 'hostlist']:
|
if type in ['service_accesslist', 'service_restrictionlist', 'interfacelist', 'hostlist']:
|
||||||
subsubelement.remove(subsubsubelement)
|
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', []):
|
elif (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
subsubelement.remove(subsubsubelement)
|
subsubelement.remove(subsubsubelement)
|
||||||
elif type == 'family' and subsubsubelement.text in upgrade_help.get('families', {}).get('remove', []):
|
elif type == 'family' and subsubsubelement.text in upgrade_help.get('families', {}).get('remove', []):
|
||||||
subsubelement.remove(subsubsubelement)
|
subsubelement.remove(subsubsubelement)
|
||||||
up = upgrade_help.get('targets', {}).get(subsubsubelement.text)
|
elif type == 'actionlist':
|
||||||
if up:
|
# for family in root.find('variables'):
|
||||||
if 'optional' in up:
|
# family_list = SubElement(subsubelement, 'target')
|
||||||
subsubsubelement.attrib['optional'] = up['optional']
|
# 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
|
has_target = False
|
||||||
for target in subsubelement:
|
for target in subsubelement:
|
||||||
if target.tag == 'target':
|
if target.tag == 'target':
|
||||||
|
@ -208,7 +255,11 @@ class RougailUpgrade:
|
||||||
subelement.remove(subsubelement)
|
subelement.remove(subsubelement)
|
||||||
continue
|
continue
|
||||||
elif subsubsubelement.tag == 'slave':
|
elif subsubsubelement.tag == 'slave':
|
||||||
|
if subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
continue
|
||||||
subsubsubelement.tag = 'follower'
|
subsubsubelement.tag = 'follower'
|
||||||
|
subsubsubelement.text = normalize_family(subsubsubelement.text)
|
||||||
if subelement.tag == 'containers':
|
if subelement.tag == 'containers':
|
||||||
current_service = self.upgrade_container(subsubsubelement, current_service, files, ips, servicelists, upgrade_help)
|
current_service = self.upgrade_container(subsubsubelement, current_service, files, ips, servicelists, upgrade_help)
|
||||||
subsubelement.remove(subsubsubelement)
|
subsubelement.remove(subsubsubelement)
|
||||||
|
@ -283,6 +334,12 @@ class RougailUpgrade:
|
||||||
subelement.remove(subsubelement)
|
subelement.remove(subsubelement)
|
||||||
else:
|
else:
|
||||||
self.move(subsubelement, 'master', 'leader')
|
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', {}):
|
if subsubelement.attrib['leader'] in upgrade_help.get('groups', {}).get('reorder', {}):
|
||||||
for follower in subsubelement:
|
for follower in subsubelement:
|
||||||
subsubelement.remove(follower)
|
subsubelement.remove(follower)
|
||||||
|
@ -302,6 +359,10 @@ class RougailUpgrade:
|
||||||
continue
|
continue
|
||||||
if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('hidden', {}).get('add', []):
|
if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('hidden', {}).get('add', []):
|
||||||
subsubelement.attrib['hidden'] = 'True'
|
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
|
families[subsubelement.attrib['name']] = subsubelement
|
||||||
# if empty, remove
|
# if empty, remove
|
||||||
if is_empty(subelement) or subelement.tag in ['containers', 'files', 'help']:
|
if is_empty(subelement) or subelement.tag in ['containers', 'files', 'help']:
|
||||||
|
@ -394,7 +455,9 @@ class RougailUpgrade:
|
||||||
for name, text in variables_help.items():
|
for name, text in variables_help.items():
|
||||||
variables[name].attrib['help'] = text
|
variables[name].attrib['help'] = text
|
||||||
for name, text in families_help.items():
|
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:
|
for auto in autos:
|
||||||
if auto in variables:
|
if auto in variables:
|
||||||
variables[auto].attrib['hidden'] = 'True'
|
variables[auto].attrib['hidden'] = 'True'
|
||||||
|
@ -436,6 +499,8 @@ class RougailUpgrade:
|
||||||
service.attrib['name'] = service_name
|
service.attrib['name'] = service_name
|
||||||
if service_name == 'unknown':
|
if service_name == 'unknown':
|
||||||
service.attrib['manage'] = 'False'
|
service.attrib['manage'] = 'False'
|
||||||
|
if service_name in upgrade_help.get('services', {}).get('unmanage', []):
|
||||||
|
service.attrib['manage'] = 'False'
|
||||||
service_elt[service_name] = service
|
service_elt[service_name] = service
|
||||||
if upgrade_help.get('servicelists', {}).get(service_name):
|
if upgrade_help.get('servicelists', {}).get(service_name):
|
||||||
service.attrib['servicelist'] = 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'
|
elt.attrib['engine'] = 'creole_legacy'
|
||||||
if (not 'instance_mode' in elt.attrib or elt.attrib['instance_mode'] != 'when_container') and \
|
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', {}):
|
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']:
|
elif elt.tag in ['host', 'disknod', 'fstab', 'interface', 'package', 'service_access']:
|
||||||
pass
|
pass
|
||||||
elif elt.tag == 'service_restriction':
|
elif elt.tag == 'service_restriction':
|
||||||
|
@ -458,7 +531,15 @@ class RougailUpgrade:
|
||||||
if restriction.tag == 'ip' and restriction.text != '0.0.0.0':
|
if restriction.tag == 'ip' and restriction.text != '0.0.0.0':
|
||||||
self.remove(restriction, 'ip_type', optional=True)
|
self.remove(restriction, 'ip_type', optional=True)
|
||||||
self.remove(restriction, 'netmask_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':
|
elif elt.tag == 'service':
|
||||||
new_name = elt.text
|
new_name = elt.text
|
||||||
if current_service == 'unknown':
|
if current_service == 'unknown':
|
||||||
|
|
|
@ -26,10 +26,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
from typing import List
|
from typing import List
|
||||||
from unicodedata import normalize, combining
|
from unicodedata import normalize, combining
|
||||||
|
import re
|
||||||
|
|
||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
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:
|
def normalize_family(family_name: str) -> str:
|
||||||
"""replace space, accent, uppercase, ... by valid character
|
"""replace space, accent, uppercase, ... by valid character
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True" mode="expert">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<!-- this is a comment -->
|
<!-- this is a comment -->
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name='mode_conteneur_actif1' type='string' description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="domain" type="domain" description="Description">
|
<variable name="domain" type="domainname" description="Description">
|
||||||
<value>my.domain.name</value>
|
<value>my.domain.name</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
|
||||||
"rougail.general.mode_conteneur_actif1": "non"
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -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
|
||||||
|
-->
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": "no",
|
||||||
|
"rougail.var2": [
|
||||||
|
"no"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -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])
|
|
@ -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
|
||||||
|
-->
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
],
|
||||||
|
"rougail.var2": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -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])
|
|
@ -2,7 +2,7 @@
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -12,7 +12,7 @@ try:
|
||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -13,7 +13,7 @@ except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -13,7 +13,7 @@ except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -12,7 +12,7 @@ try:
|
||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -14,7 +14,7 @@ except:
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -14,7 +14,7 @@ except:
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -14,7 +14,7 @@ except:
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -13,7 +13,7 @@ except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -13,7 +13,7 @@ except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
|
||||||
"rougail.general1.leader.leader": []
|
|
||||||
}
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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])
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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])
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
|
||||||
"rougail.general.leader.leader": []
|
|
||||||
}
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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])
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>oui</value>
|
<value>oui</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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"
|
|
||||||
}
|
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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])
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="Général">
|
<family name="general" description="Général">
|
||||||
<variable name="condition" type="string" description="No change">
|
<variable name="condition" type="string" description="No change">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<family name="Général2">
|
<family name="general2" description="Général2">
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<param>oui</param>
|
<param>oui</param>
|
||||||
<target type="variable">mode_conteneur_actif</target>
|
<target type="variable">mode_conteneur_actif</target>
|
||||||
<target type="variable">mode_conteneur_actif2</target>
|
<target type="variable">mode_conteneur_actif2</target>
|
||||||
<target type="family">Général2</target>
|
<target type="family">general2</target>
|
||||||
</condition>
|
</condition>
|
||||||
</constraints>
|
</constraints>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="Général">
|
<family name="general" description="Général">
|
||||||
<variable name="condition" type="string" description="No change">
|
<variable name="condition" type="string" description="No change">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</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">
|
<variable name="mode_conteneur_actif3" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<param>oui</param>
|
<param>oui</param>
|
||||||
<target type="variable">mode_conteneur_actif</target>
|
<target type="variable">mode_conteneur_actif</target>
|
||||||
<target type="variable">mode_conteneur_actif2</target>
|
<target type="variable">mode_conteneur_actif2</target>
|
||||||
<target type="family">Général2</target>
|
<target type="family">general2</target>
|
||||||
</condition>
|
</condition>
|
||||||
</constraints>
|
</constraints>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
|
||||||
"rougail.general_1.leader.leader": []
|
|
||||||
}
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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])
|
|
|
@ -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_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||||
option_6 = StrOption(name="leader", doc="leader", multi=True)
|
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_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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
||||||
|
|
|
@ -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
|
||||||
|
-->
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.general.var": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": 9
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"rougail.general.var": 9
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.general.var": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": 9
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,8 +11,7 @@ try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "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_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="general", children=[option_3], 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif1": "non",
|
|
||||||
"rougail.general.mode_conteneur_actif2": "non",
|
|
||||||
"rougail.other.mode_conteneur_actif3": "non"
|
|
||||||
}
|
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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])
|
|
|
@ -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_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_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||||
option_5 = StrOption(name="vardyn", doc="No change", 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -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_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_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_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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])
|
||||||
|
|
|
@ -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_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||||
option_7 = StrOption(name="newvar", doc="No change", 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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -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_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_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_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_7 = StrOption(name="newvar", doc="No change", properties=frozenset({"normal"}))
|
||||||
option_6 = OptionDescription(name="new", doc="new", children=[option_7], 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])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])
|
||||||
|
|
|
@ -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_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_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||||
option_5 = StrOption(name="vardyn", doc="No change", 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -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_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_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_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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6])
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<services/>
|
<services/>
|
||||||
|
|
||||||
<variables>
|
<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 name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
|
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<services/>
|
<services/>
|
||||||
|
|
||||||
<variables>
|
<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 name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
|
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
|
||||||
|
|
|
@ -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
|
||||||
|
-->
|
|
@ -3,8 +3,8 @@
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"rougail.general.mode_conteneur_actif1": {
|
"rougail.general2.mode_conteneur_actif2": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "oui"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
"rougail.general1.leader.leader": []
|
"rougail.general2.mode_conteneur_actif2": "oui"
|
||||||
}
|
}
|
|
@ -3,8 +3,8 @@
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"rougail.general.mode_conteneur_actif1": {
|
"rougail.general2.mode_conteneur_actif2": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "oui"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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])
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="my_var" auto_freeze="True">
|
<variable name="my_var" auto_freeze="True">
|
||||||
<value>no</value>
|
<value>no</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</services>
|
</services>
|
||||||
|
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<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">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue