From 0a8be9a355cfce437e39fcf236bffdb13d3b454d Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 30 Jan 2021 12:28:36 +0100 Subject: [PATCH] activate is not a true boolean --- src/rougail/annotator/condition.py | 92 +++++++++++++------ src/rougail/annotator/fill.py | 5 +- src/rougail/annotator/service.py | 2 - src/rougail/template.py | 2 +- src/rougail/tiramisureflector.py | 4 +- .../tiramisu/base.py | 2 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 4 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- 19 files changed, 87 insertions(+), 48 deletions(-) diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 303fd0a9..5d9eff25 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -41,14 +41,15 @@ class ConditionAnnotator: objectspace, ): self.objectspace = objectspace + self.force_service_value = {} if hasattr(objectspace.space, 'variables'): self.convert_auto_freeze() if not hasattr(objectspace.space, 'constraints') or \ not hasattr(self.objectspace.space.constraints, 'condition'): return self.convert_condition_target() - self.convert_xxxlist_to_variable() self.check_condition_fallback() + self.convert_xxxlist_to_variable() self.convert_condition_source() self.check_choice_option_condition() self.remove_condition_with_empty_target() @@ -133,31 +134,6 @@ class ConditionAnnotator: for index in remove_targets: condition.target.pop(index) - - def convert_xxxlist_to_variable(self): - """transform *list to variable or family - """ - for condition in self.objectspace.space.constraints.condition: - new_targets = [] - remove_targets = [] - for target_idx, target in enumerate(condition.target): - if target.type.endswith('list'): - listname = target.type - listvars = self.objectspace.list_conditions.get(listname, - {}).get(target.name) - if listvars: - for listvar in listvars: - type_ = 'variable' - new_target = self.objectspace.target(listvar.xmlfiles) - new_target.type = type_ - new_target.name = listvar - new_targets.append(new_target) - remove_targets.append(target_idx) - remove_targets.sort(reverse=True) - for target_idx in remove_targets: - condition.target.pop(target_idx) - condition.target.extend(new_targets) - def check_condition_fallback(self): """a condition with a fallback **and** the source variable doesn't exist """ @@ -187,8 +163,11 @@ class ConditionAnnotator: """ actions = self.get_actions_from_condition(condition.name) for target in condition.target: - leader_or_var, variables = self._get_family_variables_from_target(target) main_action = actions[0] + if target.type.endswith('list'): + self.force_service_value[target.name] = main_action != 'disabled' + continue + leader_or_var, variables = self._get_family_variables_from_target(target) setattr(leader_or_var, main_action, True) for action in actions[1:]: for variable in variables: @@ -224,6 +203,65 @@ class ConditionAnnotator: return variable, list(variable.variable.values()) return variable, [] + def convert_xxxlist_to_variable(self): + """transform *list to variable or family + """ + fills = {} + for condition in self.objectspace.space.constraints.condition: + remove_targets = [] + for target_idx, target in enumerate(condition.target): + if target.type.endswith('list'): + listname = target.type + listvars = self.objectspace.list_conditions.get(listname, + {}).get(target.name) + if listvars: + for listvar in listvars: + if target.name in self.force_service_value: + listvar.default = self.force_service_value[target.name] + continue + value = condition.name != 'disabled_if_in' + if len(condition.param) != 1: + xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) + msg = _(f'a condition with "{listname}" can only have ' + f'only have only on param') + raise DictConsistencyError(msg, 35) from err + if listvar.path in fills: + fill = fills[listvar.path] + fill.index += 1 + else: + fill = self.objectspace.fill(target.xmlfiles) + fill.target = listvar.path + fill.name = 'calc_value' + fill.namespace = 'services' + fill.index = 0 + if not hasattr(self.objectspace.space, 'constraints'): + self.objectspace.space.constraints = self.objectspace.constraints(elt.xmlfiles) + if not hasattr(self.objectspace.space.constraints, 'fill'): + self.objectspace.space.constraints.fill = [] + self.objectspace.space.constraints.fill.append(fill) + fills[listvar.path] = fill + param1 = self.objectspace.param(target.xmlfiles) + param1.text = value + param1.type = 'boolean' + param2 = self.objectspace.param(target.xmlfiles) + param2.name = 'default' + param2.text = not value + param2.type = 'boolean' + fill.param = [param1, param2] + param3 = self.objectspace.param(target.xmlfiles) + param3.name = f'condition_{fill.index}' + param3.type = 'variable' + param3.text = condition.source + fill.param.append(param3) + param4 = self.objectspace.param(target.xmlfiles) + param4.name = f'expected_{fill.index}' + param4.text = getattr(condition.param[0], 'text', None) + fill.param.append(param4) + remove_targets.append(target_idx) + remove_targets.sort(reverse=True) + for target_idx in remove_targets: + condition.target.pop(target_idx) + def convert_condition_source(self): """remove condition for ChoiceOption that don't have param """ diff --git a/src/rougail/annotator/fill.py b/src/rougail/annotator/fill.py index c32048e1..8480b7bd 100644 --- a/src/rougail/annotator/fill.py +++ b/src/rougail/annotator/fill.py @@ -79,7 +79,10 @@ class FillAnnotator: value = self.objectspace.value(fill.xmlfiles) value.type = 'calculation' value.name = fill.name - variable.value = [value] + if variable.namespace == 'services': + variable.default = value + else: + variable.value = [value] # manage params if not hasattr(fill, 'param'): diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index e5bb9361..3c909492 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -123,8 +123,6 @@ class ServiceAnnotator: elt.xmlfiles, ) family.variable = [] - # FIXME ne devrait pas etre True par défaut - # devrait etre un calcule activate_obj = self._generate_element('boolean', 'activate', True, diff --git a/src/rougail/template.py b/src/rougail/template.py index fe2384f3..9badfd50 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -365,7 +365,7 @@ class CreoleTemplateEngine: filename = fill['source'] if not isfile(filename): # pragma: no cover raise FileNotFound(_(f"File {filename} does not exist.")) - if fill.get('activate', False): + if fill['activate']: self.instance_file(fill, tmp_dir, dest_dir, diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 6f7ffdea..0f4a6c70 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -312,7 +312,7 @@ class Variable(Common): if value is not None: value = self.convert_str(value) return f"ParamValue({value})" - if param.type == 'number': + if param.type in ['number', 'boolean']: return f'ParamValue({param.text})' if param.type == 'variable': return self.build_param(param, function) @@ -320,7 +320,7 @@ class Variable(Common): return f'ParamInformation("{param.text}", None)' if param.type == 'suffix': return 'ParamSuffix()' - return '' # pragma: no cover + raise Exception(f'unknown type {param.type}') # pragma: no cover @staticmethod def build_param(param, diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index ea8d31e2..9419755a 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/etc/file") option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="templating", doc="templating", default=True) -option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json index aa8b1724..41df076b 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "oui", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{"rougail.general.condition": "oui", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": false} diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py index f387474e..04df8611 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/etc/file") option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="templating", doc="templating", default=True) -option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py index 52063e37..e98a0f43 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file1") option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file1") option_15 = BoolOption(name="templating", doc="templating", default=True) -option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_18 = StrOption(name="group", doc="group", default="root") option_19 = StrOption(name="mode", doc="mode", default="0644") @@ -31,7 +31,7 @@ option_20 = StrOption(name="name", doc="name", default="/tmp/file2") option_21 = StrOption(name="owner", doc="owner", default="root") option_22 = StrOption(name="source", doc="source", default="file2") option_23 = BoolOption(name="templating", doc="templating", default=True) -option_24 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_24 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("oui")}))) option_17 = OptionDescription(name="file2", doc="file2", children=[option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_17]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json index 1a2b116f..775c5456 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json +++ b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": false} diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 34e5c4b9..7d3358f7 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file") option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="templating", doc="templating", default=True) -option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('unpossible'), 'reverse_condition': ParamValue(True)}))})) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("unpossible")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json index 1a2b116f..775c5456 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": false} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 34e5c4b9..7d3358f7 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file") option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="templating", doc="templating", default=True) -option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('unpossible'), 'reverse_condition': ParamValue(True)}))})) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("unpossible")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json index 1a2b116f..775c5456 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": false} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index b73ff5b3..fa799280 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file") option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="templating", doc="templating", default=True) -option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('unpossible'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("unpossible"), 'condition_1': ParamOption(option_5, notraisepropertyerror=False, todict=False), 'expected_1': ParamValue("oui")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json index 1a2b116f..775c5456 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": false} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index d7f638da..02fc8465 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -23,7 +23,7 @@ option_12 = StrOption(name="name", doc="name", default="/tmp/file") option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="templating", doc="templating", default=True) -option_16 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('statique'), 'reverse_condition': ParamValue(True)}))})) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(True)), kwargs={'default': ParamValue(False), 'condition_0': ParamOption(option_3, notraisepropertyerror=False, todict=False), 'expected_0': ParamValue("statique")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json index 5f07cf3d..73d8047f 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": false} diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py index 00428ba2..5f0c6bcc 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="name", doc="name", default="/tmp/file1") option_12 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="source", doc="source", default="file1") option_14 = BoolOption(name="templating", doc="templating", default=True) -option_15 = BoolOption(name="activate", doc="activate", default=True, properties=frozenset({"disabled"})) +option_15 = BoolOption(name="activate", doc="activate", default=False) option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) option_6 = OptionDescription(name="test", doc="test", children=[option_7])