From 7d42517430331285188cd3eedc6d8e68fc98fd0f Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 22 Dec 2020 17:22:56 +0100 Subject: [PATCH 001/168] remove 'imp' warning --- src/rougail/annotator.py | 4 ++-- src/rougail/template.py | 4 ++-- src/rougail/tiramisureflector.py | 6 +++--- tests/dictionaries/00empty/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_autofreeze/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_autosave/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_autosaveexpert/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_comment/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_notype/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_save/tiramisu/base.py | 6 +++--- tests/dictionaries/00load_subfolder/tiramisu/base.py | 6 +++--- tests/dictionaries/01auto_base/tiramisu/base.py | 6 +++--- tests/dictionaries/01auto_withoutparam/tiramisu/base.py | 6 +++--- tests/dictionaries/01base_file_include/tiramisu/base.py | 6 +++--- tests/dictionaries/01base_file_patch/tiramisu/base.py | 6 +++--- tests/dictionaries/01base_file_utfchar/tiramisu/base.py | 6 +++--- tests/dictionaries/01base_float/tiramisu/base.py | 6 +++--- tests/dictionaries/01base_multi/tiramisu/base.py | 6 +++--- .../01base_var_name_same_family/tiramisu/base.py | 6 +++--- tests/dictionaries/01fill_autofreeze/tiramisu/base.py | 6 +++--- tests/dictionaries/01fill_autosave/tiramisu/base.py | 6 +++--- tests/dictionaries/01fill_base/tiramisu/base.py | 6 +++--- tests/dictionaries/01fill_baseaccent/tiramisu/base.py | 6 +++--- tests/dictionaries/01fill_mandatory/tiramisu/base.py | 6 +++--- tests/dictionaries/01fill_number/tiramisu/base.py | 6 +++--- tests/dictionaries/01fill_optional/tiramisu/base.py | 6 +++--- tests/dictionaries/01separator_base/tiramisu/base.py | 6 +++--- tests/dictionaries/01separator_neverhidden/tiramisu/base.py | 6 +++--- tests/dictionaries/10autosave_hidden/tiramisu/base.py | 6 +++--- .../10autosave_hidden_frozenifin/tiramisu/base.py | 6 +++--- tests/dictionaries/10check_base/tiramisu/base.py | 6 +++--- tests/dictionaries/10check_no_param/tiramisu/base.py | 6 +++--- tests/dictionaries/10check_option/tiramisu/base.py | 6 +++--- tests/dictionaries/10check_optional/tiramisu/base.py | 6 +++--- tests/dictionaries/10check_valid_differ/tiramisu/base.py | 6 +++--- .../dictionaries/10check_valid_differ_add/tiramisu/base.py | 6 +++--- .../10check_valid_differ_removecheck/tiramisu/base.py | 6 +++--- .../dictionaries/10check_valid_in_network/tiramisu/base.py | 6 +++--- .../10check_valid_in_network_cidr/tiramisu/base.py | 6 +++--- tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py | 6 +++--- tests/dictionaries/10leadership_append/tiramisu/base.py | 6 +++--- tests/dictionaries/10leadership_auto/tiramisu/base.py | 6 +++--- tests/dictionaries/10leadership_autoleader/tiramisu/base.py | 6 +++--- .../10leadership_autoleader_expert/tiramisu/base.py | 6 +++--- .../10leadership_autosaveexpert/tiramisu/base.py | 6 +++--- .../dictionaries/10leadership_familyaccent/tiramisu/base.py | 6 +++--- .../10leadership_leader_hidden/tiramisu/base.py | 6 +++--- .../10leadership_leader_hidden_if_in/tiramisu/base.py | 6 +++--- .../10leadership_leadermandatory/tiramisu/base.py | 6 +++--- tests/dictionaries/10leadership_mandatory/tiramisu/base.py | 6 +++--- .../10leadership_mandatoryfollower/tiramisu/base.py | 6 +++--- tests/dictionaries/10leadership_multi/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_disabled_if_in/tiramisu/base.py | 6 +++--- .../10load_disabled_if_in_none/tiramisu/base.py | 6 +++--- .../10load_disabled_if_inaccent_family/tiramisu/base.py | 6 +++--- .../10load_disabled_if_not_in_fallback/tiramisu/base.py | 6 +++--- .../tiramisu/base.py | 6 +++--- .../10load_disabledifin_fallback/tiramisu/base.py | 6 +++--- .../10load_disabledifin_fallback_force/tiramisu/base.py | 6 +++--- .../10load_disabledifin_whithouttype/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_emptyvalue/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_frozenifin/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py | 6 +++--- .../10load_frozenifin_multiparam/tiramisu/base.py | 6 +++--- .../dictionaries/10load_frozenifin_noexist/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_hidden_if_family/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_leadership/tiramisu/base.py | 6 +++--- .../10load_leadership_default_multi/tiramisu/base.py | 6 +++--- .../10load_leadership_default_submulti/tiramisu/base.py | 6 +++--- .../10load_leadership_defaultmulti_leader/tiramisu/base.py | 6 +++--- .../10load_leadership_description/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_leadership_name/tiramisu/base.py | 6 +++--- .../10load_leadership_normalize_family/tiramisu/base.py | 6 +++--- .../10load_leadership_submulti/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_mandatoryifin/tiramisu/base.py | 6 +++--- tests/dictionaries/10load_multivalue/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_accent/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_base/tiramisu/base.py | 6 +++--- .../10valid_enum_base_redefine/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_leader/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_multi/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_none/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_number/tiramisu/base.py | 6 +++--- .../10valid_enum_numberdefault/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_python/tiramisu/base.py | 6 +++--- tests/dictionaries/10valid_enum_value/tiramisu/base.py | 6 +++--- .../dictionaries/11disabled_if_in_filelist/tiramisu/base.py | 6 +++--- .../11disabled_if_in_filelist_disabled/tiramisu/base.py | 6 +++--- .../11disabled_if_in_filelist_multi/tiramisu/base.py | 6 +++--- .../11disabledifin_filelist_notexist/tiramisu/base.py | 6 +++--- .../11disabledifnotin_filelist_notexist/tiramisu/base.py | 6 +++--- .../tiramisu/base.py | 6 +++--- .../tiramisu/base.py | 6 +++--- .../11multi_disabled_if_in_filelist/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_append/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_appendaccent/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_dynamic/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_dynamic_calc/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_dynamic_number/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_empty/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_hidden/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_mode/tiramisu/base.py | 6 +++--- tests/dictionaries/20family_modeleadership/tiramisu/base.py | 6 +++--- tests/dictionaries/20notemplating/tiramisu/base.py | 6 +++--- tests/dictionaries/20override/tiramisu/base.py | 6 +++--- tests/dictionaries/21family_change/tiramisu/base.py | 6 +++--- tests/dictionaries/21family_changeaccent/tiramisu/base.py | 6 +++--- tests/dictionaries/21family_empty/tiramisu/base.py | 6 +++--- .../dictionaries/30mandatory_withoutvalue/tiramisu/base.py | 6 +++--- .../30mandatory_withoutvaluecalc/tiramisu/base.py | 6 +++--- tests/dictionaries/30mandatory_withvalue/tiramisu/base.py | 6 +++--- .../dictionaries/30mandatory_withvaluecalc/tiramisu/base.py | 6 +++--- tests/dictionaries/40condition_base/tiramisu/base.py | 6 +++--- tests/dictionaries/40condition_fallback/tiramisu/base.py | 6 +++--- tests/dictionaries/40condition_optional/tiramisu/base.py | 6 +++--- tests/dictionaries/40empty_param/tiramisu/base.py | 6 +++--- tests/dictionaries/40empty_param2/tiramisu/base.py | 6 +++--- .../40hidden_if_in_group_fallback/tiramisu/base.py | 6 +++--- tests/dictionaries/40ifin_leadership/tiramisu/base.py | 6 +++--- tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py | 6 +++--- tests/dictionaries/40ifin_multi/tiramisu/base.py | 6 +++--- tests/dictionaries/40ifin_validenum/tiramisu/base.py | 6 +++--- tests/dictionaries/50exists_exists/tiramisu/base.py | 6 +++--- tests/dictionaries/50redefine_description/tiramisu/base.py | 6 +++--- tests/dictionaries/51exists_nonexists/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_auto/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_autofill/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_family/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_fill/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_fillauto/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_help/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_hidden/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_remove_check/tiramisu/base.py | 6 +++--- .../51redefine_remove_condition/tiramisu/base.py | 6 +++--- .../51redefine_removecondition_alltarget/tiramisu/base.py | 6 +++--- .../tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_validenum/tiramisu/base.py | 6 +++--- tests/dictionaries/51redefine_value/tiramisu/base.py | 6 +++--- tests/dictionaries/51remove_fill/tiramisu/base.py | 6 +++--- tests/dictionaries/52exists_redefine/tiramisu/base.py | 6 +++--- tests/dictionaries/60action_external/tiramisu/base.py | 6 +++--- .../60extra_externalspacecondition/tiramisu/base.py | 6 +++--- tests/dictionaries/60extra_group/tiramisu/base.py | 6 +++--- tests/dictionaries/60extra_help/tiramisu/base.py | 6 +++--- tests/dictionaries/60extra_load/tiramisu/base.py | 6 +++--- tests/dictionaries/60extra_mandatory/tiramisu/base.py | 6 +++--- tests/dictionaries/60extra_name_family/tiramisu/base.py | 6 +++--- tests/dictionaries/60extra_redefine/tiramisu/base.py | 6 +++--- tests/dictionaries/60extra_separators/tiramisu/base.py | 6 +++--- tests/dictionaries/60familyaction/tiramisu/base.py | 6 +++--- tests/dictionaries/60familyaction_accent/tiramisu/base.py | 6 +++--- .../dictionaries/60familyaction_mandatory/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_files/tiramisu/base.py | 6 +++--- .../70container_files_symlink_multi/tiramisu/base.py | 6 +++--- .../tiramisu/base.py | 6 +++--- tests/dictionaries/70container_files_twice/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_filesmulti/tiramisu/base.py | 6 +++--- .../dictionaries/70container_filesredefine/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_new/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_newnocont/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_newwithip/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_pathaccess/tiramisu/base.py | 6 +++--- .../70container_pathaccess_leadership/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_save/tiramisu/base.py | 6 +++--- .../dictionaries/70container_serviceaccess/tiramisu/base.py | 6 +++--- .../70container_servicerestriction/tiramisu/base.py | 6 +++--- tests/dictionaries/70container_services/tiramisu/base.py | 6 +++--- tests/dictionaries/70services_unmanage/tiramisu/base.py | 6 +++--- 171 files changed, 511 insertions(+), 511 deletions(-) diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index 77cb5f94..ea487d1b 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -5,7 +5,7 @@ from typing import List from collections import OrderedDict from os.path import join, basename from ast import literal_eval -import imp +from importlib.machinery import SourceFileLoader from .i18n import _ @@ -640,7 +640,7 @@ class ConstraintAnnotator: if not hasattr(objectspace.space, 'constraints'): return self.objectspace = objectspace - eosfunc = imp.load_source('eosfunc', eosfunc_file) + eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() self.functions = dir(eosfunc) self.functions.extend(INTERNAL_FUNCTIONS) self.valid_enums = {} diff --git a/src/rougail/template.py b/src/rougail/template.py index a8484cf1..60e70c08 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -4,7 +4,7 @@ Gestion du mini-langage de template On travaille sur les fichiers cibles """ -import imp +from importlib.machinery import SourceFileLoader from shutil import copy import logging from typing import Dict, Any @@ -252,7 +252,7 @@ class CreoleTemplateEngine: self.distrib_dir = distrib_dir eos = {} if eosfunc_file is not None: - eosfunc = imp.load_source('eosfunc', eosfunc_file) + eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() for func in dir(eosfunc): if not func.startswith('_'): eos[func] = getattr(eosfunc, func) diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 076332ed..1da99e17 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -18,10 +18,10 @@ class TiramisuReflector: funcs_path, ): self.storage = ElementStorage() - self.storage.text = ["import imp", - f"func = imp.load_source('func', '{funcs_path}')", + self.storage.text = ["from importlib.machinery import SourceFileLoader", + f"func = SourceFileLoader('func', '{funcs_path}').load_module()", "for key, value in dict(locals()).items():", - " if key != ['imp', 'func']:", + " if key != ['SourceFileLoader', 'func']:", " setattr(func, key, value)", "try:", " from tiramisu3 import *", diff --git a/tests/dictionaries/00empty/tiramisu/base.py b/tests/dictionaries/00empty/tiramisu/base.py index 9c1dfd24..2194ab46 100644 --- a/tests/dictionaries/00empty/tiramisu/base.py +++ b/tests/dictionaries/00empty/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_autofreeze/tiramisu/base.py b/tests/dictionaries/00load_autofreeze/tiramisu/base.py index 97ebe1a3..f54bce7f 100644 --- a/tests/dictionaries/00load_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreeze/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py index d409c87f..34cd6727 100644 --- a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_autosave/tiramisu/base.py b/tests/dictionaries/00load_autosave/tiramisu/base.py index 00e39f8f..0353b8dd 100644 --- a/tests/dictionaries/00load_autosave/tiramisu/base.py +++ b/tests/dictionaries/00load_autosave/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py index 24553e0b..a2270173 100644 --- a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_comment/tiramisu/base.py b/tests/dictionaries/00load_comment/tiramisu/base.py index 47434df5..1706e7d2 100644 --- a/tests/dictionaries/00load_comment/tiramisu/base.py +++ b/tests/dictionaries/00load_comment/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_notype/tiramisu/base.py b/tests/dictionaries/00load_notype/tiramisu/base.py index d4a98ff9..d5600c5f 100644 --- a/tests/dictionaries/00load_notype/tiramisu/base.py +++ b/tests/dictionaries/00load_notype/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_save/tiramisu/base.py b/tests/dictionaries/00load_save/tiramisu/base.py index 47434df5..1706e7d2 100644 --- a/tests/dictionaries/00load_save/tiramisu/base.py +++ b/tests/dictionaries/00load_save/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/00load_subfolder/tiramisu/base.py b/tests/dictionaries/00load_subfolder/tiramisu/base.py index 25529dfa..4d2f9b3f 100644 --- a/tests/dictionaries/00load_subfolder/tiramisu/base.py +++ b/tests/dictionaries/00load_subfolder/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01auto_base/tiramisu/base.py b/tests/dictionaries/01auto_base/tiramisu/base.py index 2244cd9e..73ac2fac 100644 --- a/tests/dictionaries/01auto_base/tiramisu/base.py +++ b/tests/dictionaries/01auto_base/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01auto_withoutparam/tiramisu/base.py b/tests/dictionaries/01auto_withoutparam/tiramisu/base.py index 818bbb99..982e80ee 100644 --- a/tests/dictionaries/01auto_withoutparam/tiramisu/base.py +++ b/tests/dictionaries/01auto_withoutparam/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01base_file_include/tiramisu/base.py b/tests/dictionaries/01base_file_include/tiramisu/base.py index 95802381..91651b3a 100644 --- a/tests/dictionaries/01base_file_include/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01base_file_patch/tiramisu/base.py b/tests/dictionaries/01base_file_patch/tiramisu/base.py index 95802381..91651b3a 100644 --- a/tests/dictionaries/01base_file_patch/tiramisu/base.py +++ b/tests/dictionaries/01base_file_patch/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py index 40fbf605..20aa1de6 100644 --- a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py +++ b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01base_float/tiramisu/base.py b/tests/dictionaries/01base_float/tiramisu/base.py index 792415e7..ed3aa549 100644 --- a/tests/dictionaries/01base_float/tiramisu/base.py +++ b/tests/dictionaries/01base_float/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01base_multi/tiramisu/base.py b/tests/dictionaries/01base_multi/tiramisu/base.py index a66267ed..4e5ebc96 100644 --- a/tests/dictionaries/01base_multi/tiramisu/base.py +++ b/tests/dictionaries/01base_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py b/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py index e5a1d6e8..66f0c490 100644 --- a/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py +++ b/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py index 9344c659..f6b55a21 100644 --- a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01fill_autosave/tiramisu/base.py b/tests/dictionaries/01fill_autosave/tiramisu/base.py index 744081b4..adfd39f4 100644 --- a/tests/dictionaries/01fill_autosave/tiramisu/base.py +++ b/tests/dictionaries/01fill_autosave/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01fill_base/tiramisu/base.py b/tests/dictionaries/01fill_base/tiramisu/base.py index 879048aa..19f280a7 100644 --- a/tests/dictionaries/01fill_base/tiramisu/base.py +++ b/tests/dictionaries/01fill_base/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01fill_baseaccent/tiramisu/base.py b/tests/dictionaries/01fill_baseaccent/tiramisu/base.py index 500aba18..e18b37a2 100644 --- a/tests/dictionaries/01fill_baseaccent/tiramisu/base.py +++ b/tests/dictionaries/01fill_baseaccent/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01fill_mandatory/tiramisu/base.py b/tests/dictionaries/01fill_mandatory/tiramisu/base.py index c10c7b4f..c3e70073 100644 --- a/tests/dictionaries/01fill_mandatory/tiramisu/base.py +++ b/tests/dictionaries/01fill_mandatory/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01fill_number/tiramisu/base.py b/tests/dictionaries/01fill_number/tiramisu/base.py index 74bb0ac6..d3f4b953 100644 --- a/tests/dictionaries/01fill_number/tiramisu/base.py +++ b/tests/dictionaries/01fill_number/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01fill_optional/tiramisu/base.py b/tests/dictionaries/01fill_optional/tiramisu/base.py index 2244cd9e..73ac2fac 100644 --- a/tests/dictionaries/01fill_optional/tiramisu/base.py +++ b/tests/dictionaries/01fill_optional/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01separator_base/tiramisu/base.py b/tests/dictionaries/01separator_base/tiramisu/base.py index 81455b2b..fe16c668 100644 --- a/tests/dictionaries/01separator_base/tiramisu/base.py +++ b/tests/dictionaries/01separator_base/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/01separator_neverhidden/tiramisu/base.py b/tests/dictionaries/01separator_neverhidden/tiramisu/base.py index 81455b2b..fe16c668 100644 --- a/tests/dictionaries/01separator_neverhidden/tiramisu/base.py +++ b/tests/dictionaries/01separator_neverhidden/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10autosave_hidden/tiramisu/base.py b/tests/dictionaries/10autosave_hidden/tiramisu/base.py index 159efd65..4865425f 100644 --- a/tests/dictionaries/10autosave_hidden/tiramisu/base.py +++ b/tests/dictionaries/10autosave_hidden/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py b/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py index c2ab2847..00ac1625 100644 --- a/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py +++ b/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_base/tiramisu/base.py b/tests/dictionaries/10check_base/tiramisu/base.py index 5fa9ad8b..3ce7da46 100644 --- a/tests/dictionaries/10check_base/tiramisu/base.py +++ b/tests/dictionaries/10check_base/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_no_param/tiramisu/base.py b/tests/dictionaries/10check_no_param/tiramisu/base.py index 6a38e064..53015e37 100644 --- a/tests/dictionaries/10check_no_param/tiramisu/base.py +++ b/tests/dictionaries/10check_no_param/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_option/tiramisu/base.py b/tests/dictionaries/10check_option/tiramisu/base.py index 3d7f6a7e..cdb10cb7 100644 --- a/tests/dictionaries/10check_option/tiramisu/base.py +++ b/tests/dictionaries/10check_option/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_optional/tiramisu/base.py b/tests/dictionaries/10check_optional/tiramisu/base.py index 9d8edf84..2e3a50e3 100644 --- a/tests/dictionaries/10check_optional/tiramisu/base.py +++ b/tests/dictionaries/10check_optional/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_valid_differ/tiramisu/base.py b/tests/dictionaries/10check_valid_differ/tiramisu/base.py index c19f3526..932d3384 100644 --- a/tests/dictionaries/10check_valid_differ/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py index 8427ae8b..889721ea 100644 --- a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py index 8427ae8b..889721ea 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_valid_in_network/tiramisu/base.py b/tests/dictionaries/10check_valid_in_network/tiramisu/base.py index c5e87cc1..4b08b5a7 100644 --- a/tests/dictionaries/10check_valid_in_network/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_in_network/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py b/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py index c994c75d..87059f5b 100644 --- a/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py index ca78b4b4..74b4048f 100644 --- a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_append/tiramisu/base.py b/tests/dictionaries/10leadership_append/tiramisu/base.py index 77d7c860..17183fd6 100644 --- a/tests/dictionaries/10leadership_append/tiramisu/base.py +++ b/tests/dictionaries/10leadership_append/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_auto/tiramisu/base.py b/tests/dictionaries/10leadership_auto/tiramisu/base.py index 25e40a7a..61a5a51a 100644 --- a/tests/dictionaries/10leadership_auto/tiramisu/base.py +++ b/tests/dictionaries/10leadership_auto/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_autoleader/tiramisu/base.py b/tests/dictionaries/10leadership_autoleader/tiramisu/base.py index 9383b4e1..603a822e 100644 --- a/tests/dictionaries/10leadership_autoleader/tiramisu/base.py +++ b/tests/dictionaries/10leadership_autoleader/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py b/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py index 85e6d953..23714997 100644 --- a/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py +++ b/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py b/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py index e6bd370f..2e06a883 100644 --- a/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py +++ b/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py b/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py index 42bb96cf..409a996a 100644 --- a/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py +++ b/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py b/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py index 66a90baf..517d1f00 100644 --- a/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py +++ b/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py b/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py index 5eae8d0f..078731e2 100644 --- a/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py +++ b/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py b/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py index 37314913..13096066 100644 --- a/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py +++ b/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_mandatory/tiramisu/base.py b/tests/dictionaries/10leadership_mandatory/tiramisu/base.py index dc5dcb6f..cf7bd654 100644 --- a/tests/dictionaries/10leadership_mandatory/tiramisu/base.py +++ b/tests/dictionaries/10leadership_mandatory/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py b/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py index 2b3032e5..680294a7 100644 --- a/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py +++ b/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10leadership_multi/tiramisu/base.py b/tests/dictionaries/10leadership_multi/tiramisu/base.py index 5e9f2a2d..124649c9 100644 --- a/tests/dictionaries/10leadership_multi/tiramisu/base.py +++ b/tests/dictionaries/10leadership_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py index 045c4aa8..f4417eb1 100644 --- a/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py index e164e131..e326f33b 100644 --- a/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py index a274173f..0f4cfd3f 100644 --- a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py index bd97b904..bda8e34d 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py index bd97b904..bda8e34d 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py index 11dea415..8a4d9b0d 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py index ece5cb0a..d2ceca2a 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py index ece5cb0a..d2ceca2a 100644 --- a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_emptyvalue/tiramisu/base.py b/tests/dictionaries/10load_emptyvalue/tiramisu/base.py index 99d60ca8..fe8d2f29 100644 --- a/tests/dictionaries/10load_emptyvalue/tiramisu/base.py +++ b/tests/dictionaries/10load_emptyvalue/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_frozenifin/tiramisu/base.py b/tests/dictionaries/10load_frozenifin/tiramisu/base.py index 6f508f07..18568980 100644 --- a/tests/dictionaries/10load_frozenifin/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py index 41a7f17d..15fd77ab 100644 --- a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py index be5cc846..56618c9b 100644 --- a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py index 0c8f50d3..099f9f5b 100644 --- a/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py index cb1e16d1..8d3c0a28 100644 --- a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py +++ b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership/tiramisu/base.py b/tests/dictionaries/10load_leadership/tiramisu/base.py index 40c6be70..2b6c7f2e 100644 --- a/tests/dictionaries/10load_leadership/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py b/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py index 733972c1..698f4fd6 100644 --- a/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py b/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py index 8eb1e448..5f6ed712 100644 --- a/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py b/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py index ffb25093..26973f15 100644 --- a/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership_description/tiramisu/base.py b/tests/dictionaries/10load_leadership_description/tiramisu/base.py index b46cb5be..185ca49d 100644 --- a/tests/dictionaries/10load_leadership_description/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_description/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership_name/tiramisu/base.py b/tests/dictionaries/10load_leadership_name/tiramisu/base.py index 6a5fb478..00966a8a 100644 --- a/tests/dictionaries/10load_leadership_name/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_name/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py b/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py index 6202f6f3..a786a86d 100644 --- a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py index b5b069b4..dc3c9358 100644 --- a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py index aaf23b1a..0586d6ca 100644 --- a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py +++ b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10load_multivalue/tiramisu/base.py b/tests/dictionaries/10load_multivalue/tiramisu/base.py index 1bf9e43e..58fd3070 100644 --- a/tests/dictionaries/10load_multivalue/tiramisu/base.py +++ b/tests/dictionaries/10load_multivalue/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_accent/tiramisu/base.py b/tests/dictionaries/10valid_enum_accent/tiramisu/base.py index 8661e0e2..df4d5e5f 100644 --- a/tests/dictionaries/10valid_enum_accent/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_accent/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_base/tiramisu/base.py b/tests/dictionaries/10valid_enum_base/tiramisu/base.py index 86bd114b..7927e4aa 100644 --- a/tests/dictionaries/10valid_enum_base/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_base/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py b/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py index dbfd219e..a98880c1 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py b/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_leader/tiramisu/base.py b/tests/dictionaries/10valid_enum_leader/tiramisu/base.py index 644c6fbc..2cd2b462 100644 --- a/tests/dictionaries/10valid_enum_leader/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_leader/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py b/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py index 3694c214..8e227990 100644 --- a/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_multi/tiramisu/base.py b/tests/dictionaries/10valid_enum_multi/tiramisu/base.py index 49f57dd8..cf203f79 100644 --- a/tests/dictionaries/10valid_enum_multi/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_none/tiramisu/base.py b/tests/dictionaries/10valid_enum_none/tiramisu/base.py index b625b414..7280d633 100644 --- a/tests/dictionaries/10valid_enum_none/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_none/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_number/tiramisu/base.py b/tests/dictionaries/10valid_enum_number/tiramisu/base.py index 18f94276..8469e612 100644 --- a/tests/dictionaries/10valid_enum_number/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_number/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py b/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py index df4da567..ad529d22 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_python/tiramisu/base.py b/tests/dictionaries/10valid_enum_python/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/10valid_enum_python/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_python/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/10valid_enum_value/tiramisu/base.py b/tests/dictionaries/10valid_enum_value/tiramisu/base.py index 9c4f9248..765a38f2 100644 --- a/tests/dictionaries/10valid_enum_value/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_value/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 52775683..72216c79 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * 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 272d5d66..30774a6a 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * 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 ab07f4da..8e3a9d82 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 64792051..4d35a859 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 64792051..4d35a859 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index 64792051..4d35a859 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * 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 32ff2abd..26103da2 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_append/tiramisu/base.py b/tests/dictionaries/20family_append/tiramisu/base.py index 5cbf2a29..85852eac 100644 --- a/tests/dictionaries/20family_append/tiramisu/base.py +++ b/tests/dictionaries/20family_append/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_appendaccent/tiramisu/base.py b/tests/dictionaries/20family_appendaccent/tiramisu/base.py index 4fa47c1c..4ef20798 100644 --- a/tests/dictionaries/20family_appendaccent/tiramisu/base.py +++ b/tests/dictionaries/20family_appendaccent/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_dynamic/tiramisu/base.py b/tests/dictionaries/20family_dynamic/tiramisu/base.py index 645fa11c..fae4b10e 100644 --- a/tests/dictionaries/20family_dynamic/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_dynamic_number/tiramisu/base.py b/tests/dictionaries/20family_dynamic_number/tiramisu/base.py index 720caec3..c57de266 100644 --- a/tests/dictionaries/20family_dynamic_number/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_number/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_empty/tiramisu/base.py b/tests/dictionaries/20family_empty/tiramisu/base.py index f630040e..0c0e09fc 100644 --- a/tests/dictionaries/20family_empty/tiramisu/base.py +++ b/tests/dictionaries/20family_empty/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_hidden/tiramisu/base.py b/tests/dictionaries/20family_hidden/tiramisu/base.py index 28d0cf25..ffc3bf9f 100644 --- a/tests/dictionaries/20family_hidden/tiramisu/base.py +++ b/tests/dictionaries/20family_hidden/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_mode/tiramisu/base.py b/tests/dictionaries/20family_mode/tiramisu/base.py index f630040e..0c0e09fc 100644 --- a/tests/dictionaries/20family_mode/tiramisu/base.py +++ b/tests/dictionaries/20family_mode/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20family_modeleadership/tiramisu/base.py b/tests/dictionaries/20family_modeleadership/tiramisu/base.py index 5ee6c9fc..3b4d01be 100644 --- a/tests/dictionaries/20family_modeleadership/tiramisu/base.py +++ b/tests/dictionaries/20family_modeleadership/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20notemplating/tiramisu/base.py b/tests/dictionaries/20notemplating/tiramisu/base.py index 5acfdd35..0ca374f8 100644 --- a/tests/dictionaries/20notemplating/tiramisu/base.py +++ b/tests/dictionaries/20notemplating/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/20override/tiramisu/base.py b/tests/dictionaries/20override/tiramisu/base.py index bc89bc7f..8422df21 100644 --- a/tests/dictionaries/20override/tiramisu/base.py +++ b/tests/dictionaries/20override/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/21family_change/tiramisu/base.py b/tests/dictionaries/21family_change/tiramisu/base.py index 15f9ae1c..0c85ccbd 100644 --- a/tests/dictionaries/21family_change/tiramisu/base.py +++ b/tests/dictionaries/21family_change/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/21family_changeaccent/tiramisu/base.py b/tests/dictionaries/21family_changeaccent/tiramisu/base.py index da65accc..c355200d 100644 --- a/tests/dictionaries/21family_changeaccent/tiramisu/base.py +++ b/tests/dictionaries/21family_changeaccent/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/21family_empty/tiramisu/base.py b/tests/dictionaries/21family_empty/tiramisu/base.py index f8ee0799..effe1f38 100644 --- a/tests/dictionaries/21family_empty/tiramisu/base.py +++ b/tests/dictionaries/21family_empty/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py b/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py index ccd638ed..a7cf6187 100644 --- a/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py b/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py index 332169bc..4f115221 100644 --- a/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40condition_base/tiramisu/base.py b/tests/dictionaries/40condition_base/tiramisu/base.py index a625bf05..5937b3ed 100644 --- a/tests/dictionaries/40condition_base/tiramisu/base.py +++ b/tests/dictionaries/40condition_base/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40condition_fallback/tiramisu/base.py b/tests/dictionaries/40condition_fallback/tiramisu/base.py index 97dc84ea..8217c7db 100644 --- a/tests/dictionaries/40condition_fallback/tiramisu/base.py +++ b/tests/dictionaries/40condition_fallback/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40condition_optional/tiramisu/base.py b/tests/dictionaries/40condition_optional/tiramisu/base.py index a3e9bbd6..383a4887 100644 --- a/tests/dictionaries/40condition_optional/tiramisu/base.py +++ b/tests/dictionaries/40condition_optional/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40empty_param/tiramisu/base.py b/tests/dictionaries/40empty_param/tiramisu/base.py index 551c89af..c914025d 100644 --- a/tests/dictionaries/40empty_param/tiramisu/base.py +++ b/tests/dictionaries/40empty_param/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40empty_param2/tiramisu/base.py b/tests/dictionaries/40empty_param2/tiramisu/base.py index a5ee9ef3..1bf93ce4 100644 --- a/tests/dictionaries/40empty_param2/tiramisu/base.py +++ b/tests/dictionaries/40empty_param2/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py b/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py index 03c70bbe..dc1619d7 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py +++ b/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40ifin_leadership/tiramisu/base.py b/tests/dictionaries/40ifin_leadership/tiramisu/base.py index b0f6181e..c5956c3d 100644 --- a/tests/dictionaries/40ifin_leadership/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadership/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index 8fbfc4aa..7daf47d8 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40ifin_multi/tiramisu/base.py b/tests/dictionaries/40ifin_multi/tiramisu/base.py index 5698bf29..b883c673 100644 --- a/tests/dictionaries/40ifin_multi/tiramisu/base.py +++ b/tests/dictionaries/40ifin_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/40ifin_validenum/tiramisu/base.py b/tests/dictionaries/40ifin_validenum/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/40ifin_validenum/tiramisu/base.py +++ b/tests/dictionaries/40ifin_validenum/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/50exists_exists/tiramisu/base.py b/tests/dictionaries/50exists_exists/tiramisu/base.py index 53cf044e..94a06d3e 100644 --- a/tests/dictionaries/50exists_exists/tiramisu/base.py +++ b/tests/dictionaries/50exists_exists/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/50redefine_description/tiramisu/base.py b/tests/dictionaries/50redefine_description/tiramisu/base.py index be7a8196..a1701b84 100644 --- a/tests/dictionaries/50redefine_description/tiramisu/base.py +++ b/tests/dictionaries/50redefine_description/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51exists_nonexists/tiramisu/base.py b/tests/dictionaries/51exists_nonexists/tiramisu/base.py index 7562d282..e5971909 100644 --- a/tests/dictionaries/51exists_nonexists/tiramisu/base.py +++ b/tests/dictionaries/51exists_nonexists/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_auto/tiramisu/base.py b/tests/dictionaries/51redefine_auto/tiramisu/base.py index d799758c..b7935695 100644 --- a/tests/dictionaries/51redefine_auto/tiramisu/base.py +++ b/tests/dictionaries/51redefine_auto/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_autofill/tiramisu/base.py b/tests/dictionaries/51redefine_autofill/tiramisu/base.py index 374d3f5a..6e9d77cb 100644 --- a/tests/dictionaries/51redefine_autofill/tiramisu/base.py +++ b/tests/dictionaries/51redefine_autofill/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_family/tiramisu/base.py b/tests/dictionaries/51redefine_family/tiramisu/base.py index fb36bd02..8f654ea6 100644 --- a/tests/dictionaries/51redefine_family/tiramisu/base.py +++ b/tests/dictionaries/51redefine_family/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_fill/tiramisu/base.py b/tests/dictionaries/51redefine_fill/tiramisu/base.py index d799758c..b7935695 100644 --- a/tests/dictionaries/51redefine_fill/tiramisu/base.py +++ b/tests/dictionaries/51redefine_fill/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_fillauto/tiramisu/base.py b/tests/dictionaries/51redefine_fillauto/tiramisu/base.py index d799758c..b7935695 100644 --- a/tests/dictionaries/51redefine_fillauto/tiramisu/base.py +++ b/tests/dictionaries/51redefine_fillauto/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_help/tiramisu/base.py b/tests/dictionaries/51redefine_help/tiramisu/base.py index 61d03acf..a4bdb30c 100644 --- a/tests/dictionaries/51redefine_help/tiramisu/base.py +++ b/tests/dictionaries/51redefine_help/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_hidden/tiramisu/base.py b/tests/dictionaries/51redefine_hidden/tiramisu/base.py index aabe91f7..eb2f5484 100644 --- a/tests/dictionaries/51redefine_hidden/tiramisu/base.py +++ b/tests/dictionaries/51redefine_hidden/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_remove_check/tiramisu/base.py b/tests/dictionaries/51redefine_remove_check/tiramisu/base.py index ce7ab6f0..a1246e8d 100644 --- a/tests/dictionaries/51redefine_remove_check/tiramisu/base.py +++ b/tests/dictionaries/51redefine_remove_check/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py index 94a4442d..9cbbd7ae 100644 --- a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py +++ b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py index fd6facb1..e73621e0 100644 --- a/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py index 24f08342..ef405048 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_validenum/tiramisu/base.py b/tests/dictionaries/51redefine_validenum/tiramisu/base.py index adf637ed..0f8b1858 100644 --- a/tests/dictionaries/51redefine_validenum/tiramisu/base.py +++ b/tests/dictionaries/51redefine_validenum/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51redefine_value/tiramisu/base.py b/tests/dictionaries/51redefine_value/tiramisu/base.py index 919c8917..070daa7f 100644 --- a/tests/dictionaries/51redefine_value/tiramisu/base.py +++ b/tests/dictionaries/51redefine_value/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/51remove_fill/tiramisu/base.py b/tests/dictionaries/51remove_fill/tiramisu/base.py index 0fbc07a3..9c7bf4ee 100644 --- a/tests/dictionaries/51remove_fill/tiramisu/base.py +++ b/tests/dictionaries/51remove_fill/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/52exists_redefine/tiramisu/base.py b/tests/dictionaries/52exists_redefine/tiramisu/base.py index 457f5830..7b37cf15 100644 --- a/tests/dictionaries/52exists_redefine/tiramisu/base.py +++ b/tests/dictionaries/52exists_redefine/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60action_external/tiramisu/base.py b/tests/dictionaries/60action_external/tiramisu/base.py index 079e5107..7c69ed2d 100644 --- a/tests/dictionaries/60action_external/tiramisu/base.py +++ b/tests/dictionaries/60action_external/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py index 2b470570..58bfc1d6 100644 --- a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py +++ b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_group/tiramisu/base.py b/tests/dictionaries/60extra_group/tiramisu/base.py index 14e5487c..2d4f23bb 100644 --- a/tests/dictionaries/60extra_group/tiramisu/base.py +++ b/tests/dictionaries/60extra_group/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_help/tiramisu/base.py b/tests/dictionaries/60extra_help/tiramisu/base.py index 3d5d5943..fc578ca0 100644 --- a/tests/dictionaries/60extra_help/tiramisu/base.py +++ b/tests/dictionaries/60extra_help/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_load/tiramisu/base.py b/tests/dictionaries/60extra_load/tiramisu/base.py index 9d3914dc..5af30610 100644 --- a/tests/dictionaries/60extra_load/tiramisu/base.py +++ b/tests/dictionaries/60extra_load/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_mandatory/tiramisu/base.py b/tests/dictionaries/60extra_mandatory/tiramisu/base.py index 212acda1..7e453d82 100644 --- a/tests/dictionaries/60extra_mandatory/tiramisu/base.py +++ b/tests/dictionaries/60extra_mandatory/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_name_family/tiramisu/base.py b/tests/dictionaries/60extra_name_family/tiramisu/base.py index 3ea4851e..60875b64 100644 --- a/tests/dictionaries/60extra_name_family/tiramisu/base.py +++ b/tests/dictionaries/60extra_name_family/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_redefine/tiramisu/base.py b/tests/dictionaries/60extra_redefine/tiramisu/base.py index e97378a3..2af3c290 100644 --- a/tests/dictionaries/60extra_redefine/tiramisu/base.py +++ b/tests/dictionaries/60extra_redefine/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60extra_separators/tiramisu/base.py b/tests/dictionaries/60extra_separators/tiramisu/base.py index c3510700..362cb6c5 100644 --- a/tests/dictionaries/60extra_separators/tiramisu/base.py +++ b/tests/dictionaries/60extra_separators/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60familyaction/tiramisu/base.py b/tests/dictionaries/60familyaction/tiramisu/base.py index 450057f0..fc010805 100644 --- a/tests/dictionaries/60familyaction/tiramisu/base.py +++ b/tests/dictionaries/60familyaction/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60familyaction_accent/tiramisu/base.py b/tests/dictionaries/60familyaction_accent/tiramisu/base.py index 450057f0..fc010805 100644 --- a/tests/dictionaries/60familyaction_accent/tiramisu/base.py +++ b/tests/dictionaries/60familyaction_accent/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py b/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py index b5b6f450..d1c47a4d 100644 --- a/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py +++ b/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_files/tiramisu/base.py b/tests/dictionaries/70container_files/tiramisu/base.py index 5c544d27..d39e4cee 100644 --- a/tests/dictionaries/70container_files/tiramisu/base.py +++ b/tests/dictionaries/70container_files/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py index ea8bac4f..da0f64d5 100644 --- a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py index 2979fb35..44935fd9 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_files_twice/tiramisu/base.py b/tests/dictionaries/70container_files_twice/tiramisu/base.py index cecefa40..2091aa84 100644 --- a/tests/dictionaries/70container_files_twice/tiramisu/base.py +++ b/tests/dictionaries/70container_files_twice/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_filesmulti/tiramisu/base.py b/tests/dictionaries/70container_filesmulti/tiramisu/base.py index 81015c29..4ba3ca44 100644 --- a/tests/dictionaries/70container_filesmulti/tiramisu/base.py +++ b/tests/dictionaries/70container_filesmulti/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_filesredefine/tiramisu/base.py b/tests/dictionaries/70container_filesredefine/tiramisu/base.py index 9f873680..835a174d 100644 --- a/tests/dictionaries/70container_filesredefine/tiramisu/base.py +++ b/tests/dictionaries/70container_filesredefine/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_new/tiramisu/base.py b/tests/dictionaries/70container_new/tiramisu/base.py index d0d844bc..9996d5c1 100644 --- a/tests/dictionaries/70container_new/tiramisu/base.py +++ b/tests/dictionaries/70container_new/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_newnocont/tiramisu/base.py b/tests/dictionaries/70container_newnocont/tiramisu/base.py index f1d6ce8a..dce6bb1c 100644 --- a/tests/dictionaries/70container_newnocont/tiramisu/base.py +++ b/tests/dictionaries/70container_newnocont/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_newwithip/tiramisu/base.py b/tests/dictionaries/70container_newwithip/tiramisu/base.py index 57fa3d22..2ea73192 100644 --- a/tests/dictionaries/70container_newwithip/tiramisu/base.py +++ b/tests/dictionaries/70container_newwithip/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_pathaccess/tiramisu/base.py b/tests/dictionaries/70container_pathaccess/tiramisu/base.py index d69fb5d8..ef44ebda 100644 --- a/tests/dictionaries/70container_pathaccess/tiramisu/base.py +++ b/tests/dictionaries/70container_pathaccess/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py b/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py index e9e26368..18285703 100644 --- a/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py +++ b/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_save/tiramisu/base.py b/tests/dictionaries/70container_save/tiramisu/base.py index 55f3655f..b2e531e2 100644 --- a/tests/dictionaries/70container_save/tiramisu/base.py +++ b/tests/dictionaries/70container_save/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_serviceaccess/tiramisu/base.py b/tests/dictionaries/70container_serviceaccess/tiramisu/base.py index f2c96bf6..99236f07 100644 --- a/tests/dictionaries/70container_serviceaccess/tiramisu/base.py +++ b/tests/dictionaries/70container_serviceaccess/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_servicerestriction/tiramisu/base.py b/tests/dictionaries/70container_servicerestriction/tiramisu/base.py index 0f139ece..c90882e4 100644 --- a/tests/dictionaries/70container_servicerestriction/tiramisu/base.py +++ b/tests/dictionaries/70container_servicerestriction/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70container_services/tiramisu/base.py b/tests/dictionaries/70container_services/tiramisu/base.py index 0be8be13..16a59438 100644 --- a/tests/dictionaries/70container_services/tiramisu/base.py +++ b/tests/dictionaries/70container_services/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * diff --git a/tests/dictionaries/70services_unmanage/tiramisu/base.py b/tests/dictionaries/70services_unmanage/tiramisu/base.py index 024306ef..e5ec9e9d 100644 --- a/tests/dictionaries/70services_unmanage/tiramisu/base.py +++ b/tests/dictionaries/70services_unmanage/tiramisu/base.py @@ -1,7 +1,7 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * From 80b7f1b0838bab334724648f8bad9efbcb3c89ea Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 22 Dec 2020 17:25:13 +0100 Subject: [PATCH 002/168] remove xml_compare --- src/rougail/xml_compare.py | 161 ------------------------------------- tests/test_1_flattener.py | 18 ----- 2 files changed, 179 deletions(-) delete mode 100644 src/rougail/xml_compare.py diff --git a/src/rougail/xml_compare.py b/src/rougail/xml_compare.py deleted file mode 100644 index 9c06e856..00000000 --- a/src/rougail/xml_compare.py +++ /dev/null @@ -1,161 +0,0 @@ -try: - import doctest - doctest.OutputChecker -except (AttributeError, ImportError): # Python < 2.4 - import util.doctest24 as doctest -try: - import xml.etree.ElementTree as ET -except ImportError: - import elementtree.ElementTree as ET -from xml.parsers.expat import ExpatError as XMLParseError - -RealOutputChecker = doctest.OutputChecker - - -def debug(*msg): - import sys - print >> sys.stderr, ' '.join(map(str, msg)) - - -class HTMLOutputChecker(RealOutputChecker): - - def check_output(self, want, got, optionflags): - normal = RealOutputChecker.check_output(self, want, got, optionflags) - if normal or not got: - return normal - try: - want_xml = make_xml(want) - except XMLParseError: - pass - else: - try: - got_xml = make_xml(got) - except XMLParseError: - pass - else: - if xml_compare(want_xml, got_xml): - return True - return False - - def output_difference(self, example, got, optionflags): - actual = RealOutputChecker.output_difference( - self, example, got, optionflags) - want_xml = got_xml = None - try: - want_xml = make_xml(example.want) - want_norm = make_string(want_xml) - except XMLParseError as e: - if example.want.startswith('<'): - want_norm = '(bad XML: %s)' % e - # '%s' % example.want - else: - return actual - try: - got_xml = make_xml(got) - got_norm = make_string(got_xml) - except XMLParseError as e: - if example.want.startswith('<'): - got_norm = '(bad XML: %s)' % e - else: - return actual - s = '%s\nXML Wanted: %s\nXML Got : %s\n' % ( - actual, want_norm, got_norm) - if got_xml and want_xml: - result = [] - xml_compare(want_xml, got_xml, result.append) - s += 'Difference report:\n%s\n' % '\n'.join(result) - return s - - -def xml_sort(children): - tcl1 = {} - #idx = 0 - - for child in children: - if 'name' in child.attrib: - key = child.attrib['name'] - else: - key = child.tag - if key not in tcl1: - tcl1[key] = [] - tcl1[key].append(child) - cl1_keys = list(tcl1.keys()) - cl1_keys.sort() - cl1 = [] - for key in cl1_keys: - cl1.extend(tcl1[key]) - return cl1 - -def xml_compare(x1, x2): - if x1.tag != x2.tag: - print ('Tags do not match: %s and %s' % (x1.tag, x2.tag)) - return False - for name, value in x1.attrib.items(): - if x2.attrib.get(name) != value: - print ('Attributes do not match: %s=%r, %s=%r' - % (name, value, name, x2.attrib.get(name))) - return False - for name in x2.attrib: - if name not in x1.attrib: - print ('x2 has an attribute x1 is missing: %s' - % name) - return False - if not text_compare(x1.text, x2.text): - print ('text: %r != %r' % (x1.text, x2.text)) - return False - if not text_compare(x1.tail, x2.tail): - print ('tail: %r != %r' % (x1.tail, x2.tail)) - return False - - cl1 = xml_sort(x1.getchildren()) - cl2 = xml_sort(x2.getchildren()) - - if len(cl1) != len(cl2): - cl1_tags = [] - for c in cl1: - cl1_tags.append(c.tag) - cl2_tags = [] - for c in cl2: - cl2_tags.append(c.tag) - print ('children length differs, %i != %i (%s != %s)' - % (len(cl1), len(cl2), cl1_tags, cl2_tags)) - return False - i = 0 - for c1, c2 in zip(cl1, cl2): - i += 1 - if not xml_compare(c1, c2): - if 'name' in c1.attrib: - name = c1.attrib['name'] - else: - name = i - print ('in tag "%s" with name "%s"' - % (c1.tag, name)) - return False - return True - - -def text_compare(t1, t2): - if not t1 and not t2: - return True - if t1 == '*' or t2 == '*': - return True - return (t1 or '').strip() == (t2 or '').strip() - - -def make_xml(s): - return ET.XML('%s' % s) - - -def make_string(xml): - if isinstance(xml, (str, unicode)): - xml = make_xml(xml) - s = ET.tostring(xml) - if s == '': - return '' - assert s.startswith('') and s.endswith(''), repr(s) - return s[5:-6] - - -def install(): - doctest.OutputChecker = HTMLOutputChecker - diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index d6b9f7b4..3f670f13 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -6,7 +6,6 @@ from os import listdir from json import load from rougail import objspace, annotator -from rougail.xml_compare import xml_compare from rougail.error import DictConsistencyError from rougail.config import Config @@ -53,23 +52,6 @@ def test_dir_error(request): return request.param -def compare_xml(exported_xmlfile, expected_xmlfile): - exported_document = etree.parse(exported_xmlfile).getroot() - expected_document = etree.parse(expected_xmlfile).getroot() - try: - assert xml_compare(exported_document, expected_document) - except AssertionError as err: - print() - print('Le dictionnaire exporte :') - print() - print(etree.tostring(exported_document, pretty_print=True, encoding="UTF-8").decode()) - print() - print('Le dictionnaire attendu :') - print() - print(etree.tostring(expected_document, pretty_print=True, encoding="UTF-8").decode()) - raise err - - def launch_flattener(test_dir, test_ok=False): eolobj = objspace.CreoleObjSpace(Config['dtdfilename']) dirs = [test_dir] From 90bd72de69df11f5426adb6356b69d61feac6741 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 22 Dec 2020 20:17:32 +0100 Subject: [PATCH 003/168] remove condition not only a target --- src/rougail/annotator.py | 14 ++++++++------ src/rougail/objspace.py | 14 +++++--------- .../10check_valid_differ_add/00-base.xml | 2 +- .../10check_valid_differ_add/01-base.xml | 4 +--- .../00-base.xml | 15 ++++----------- .../40condition_base_add/01-base.xml | 19 +++++++++++++++++++ .../__init__.py | 0 .../makedict/base.json | 0 .../tiramisu/__init__.py | 0 .../tiramisu/base.py | 4 ++-- .../51redefine_remove_condition/01-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../01-base.xml | 19 ------------------- .../01-base.xml | 12 +----------- .../tiramisu/base.py | 2 +- tests/test_1_flattener.py | 2 +- 16 files changed, 45 insertions(+), 66 deletions(-) rename tests/dictionaries/{51redefine_removecondition_alltarget => 40condition_base_add}/00-base.xml (76%) create mode 100644 tests/dictionaries/40condition_base_add/01-base.xml rename tests/dictionaries/{51redefine_removecondition_alltarget => 40condition_base_add}/__init__.py (100%) rename tests/dictionaries/{51redefine_removecondition_alltarget => 40condition_base_add}/makedict/base.json (100%) rename tests/dictionaries/{51redefine_removecondition_alltarget => 40condition_base_add}/tiramisu/__init__.py (100%) rename tests/dictionaries/{51redefine_removecondition_alltarget => 40condition_base_add}/tiramisu/base.py (61%) delete mode 100644 tests/dictionaries/51redefine_removecondition_alltarget/01-base.xml diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index ea487d1b..dc94d646 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -765,6 +765,7 @@ class ConstraintAnnotator: if target.type == 'variable': variable = self.objectspace.paths.get_variable_obj(target.name) family = self.objectspace.paths.get_family_obj(target.name.rsplit('.', 1)[0]) + # it's a leader, so apply property to leadership if isinstance(family, self.objectspace.Leadership) and family.name == variable.name: return family, family.variable return variable, [variable] @@ -927,27 +928,28 @@ class ConstraintAnnotator: inverse = condition.name.endswith('_if_not_in') actions = self._get_condition_actions(condition.name) for param in condition.param: - if hasattr(param, 'text'): - param = param.text - else: - param = None + text = getattr(param, 'text', None) for target in condition.target: leader_or_variable, variables = self._get_family_variables_from_target(target) # if option is already disable, do not apply disable_if_in - if hasattr(leader_or_variable, actions[0]) and getattr(leader_or_variable, actions[0]) is True: + # check only the first action (example of multiple actions: 'hidden', 'frozen', 'force_default_on_freeze') + main_action = actions[0] + if getattr(leader_or_variable, main_action, False) is True: continue for idx, action in enumerate(actions): prop = self.objectspace.property_(leader_or_variable.xmlfiles) prop.type = 'calculation' prop.inverse = inverse prop.source = condition.source - prop.expected = param + prop.expected = text prop.name = action if idx == 0: + # main action is for the variable or family if not hasattr(leader_or_variable, 'property'): leader_or_variable.property = [] leader_or_variable.property.append(prop) else: + # other actions are set to the variable or children of family for variable in variables: if not hasattr(variable, 'property'): variable.property = [] diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 30756532..ea83a7cc 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -441,16 +441,12 @@ class CreoleObjSpace: self.space.constraints.check.pop(idx) # pylint: disable=E1101 def remove_condition(self, name): # pylint: disable=C0111 + remove_conditions = [] for idx, condition in enumerate(self.space.constraints.condition): # pylint: disable=E1101 - remove_targets = [] - if hasattr(condition, 'target'): - for target_idx, target in enumerate(condition.target): - if target.name == name: - remove_targets.append(target_idx) - remove_targets = list(set(remove_targets)) - remove_targets.sort(reverse=True) - for idx in remove_targets: - del condition.target[idx] + if condition.source == name: + remove_conditions.append(idx) + for idx in remove_conditions: + del self.space.constraints.condition[idx] def add_to_tree_structure(self, variableobj, diff --git a/tests/dictionaries/10check_valid_differ_add/00-base.xml b/tests/dictionaries/10check_valid_differ_add/00-base.xml index 467a039d..70c315fd 100644 --- a/tests/dictionaries/10check_valid_differ_add/00-base.xml +++ b/tests/dictionaries/10check_valid_differ_add/00-base.xml @@ -26,7 +26,7 @@ mode_conteneur_actif1 - mode_conteneur_actif2 + mode_conteneur_actif1 diff --git a/tests/dictionaries/10check_valid_differ_add/01-base.xml b/tests/dictionaries/10check_valid_differ_add/01-base.xml index e8a453de..3280f094 100644 --- a/tests/dictionaries/10check_valid_differ_add/01-base.xml +++ b/tests/dictionaries/10check_valid_differ_add/01-base.xml @@ -5,9 +5,7 @@ - - oui - + diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/00-base.xml b/tests/dictionaries/40condition_base_add/00-base.xml similarity index 76% rename from tests/dictionaries/51redefine_removecondition_alltarget/00-base.xml rename to tests/dictionaries/40condition_base_add/00-base.xml index 7bb861fd..cfc7b2a6 100644 --- a/tests/dictionaries/51redefine_removecondition_alltarget/00-base.xml +++ b/tests/dictionaries/40condition_base_add/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -11,26 +8,22 @@ non - - - + oui mode_conteneur_actif1 - mode_conteneur_actif2 + mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/40condition_base_add/01-base.xml b/tests/dictionaries/40condition_base_add/01-base.xml new file mode 100644 index 00000000..81b77776 --- /dev/null +++ b/tests/dictionaries/40condition_base_add/01-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + oui + mode_conteneur_actif1 + mode_conteneur_actif2 + + + + + diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/__init__.py b/tests/dictionaries/40condition_base_add/__init__.py similarity index 100% rename from tests/dictionaries/51redefine_removecondition_alltarget/__init__.py rename to tests/dictionaries/40condition_base_add/__init__.py diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/makedict/base.json b/tests/dictionaries/40condition_base_add/makedict/base.json similarity index 100% rename from tests/dictionaries/51redefine_removecondition_alltarget/makedict/base.json rename to tests/dictionaries/40condition_base_add/makedict/base.json diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/__init__.py b/tests/dictionaries/40condition_base_add/tiramisu/__init__.py similarity index 100% rename from tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/__init__.py rename to tests/dictionaries/40condition_base_add/tiramisu/__init__.py diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py b/tests/dictionaries/40condition_base_add/tiramisu/base.py similarity index 61% rename from tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py rename to tests/dictionaries/40condition_base_add/tiramisu/base.py index e73621e0..5937b3ed 100644 --- a/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py +++ b/tests/dictionaries/40condition_base_add/tiramisu/base.py @@ -10,8 +10,8 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/51redefine_remove_condition/01-base.xml b/tests/dictionaries/51redefine_remove_condition/01-base.xml index 205792ab..05c1c8b8 100644 --- a/tests/dictionaries/51redefine_remove_condition/01-base.xml +++ b/tests/dictionaries/51redefine_remove_condition/01-base.xml @@ -5,7 +5,7 @@ - + diff --git a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py index 9cbbd7ae..1c5f1a00 100644 --- a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py +++ b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py @@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/01-base.xml b/tests/dictionaries/51redefine_removecondition_alltarget/01-base.xml deleted file mode 100644 index ada5ad56..00000000 --- a/tests/dictionaries/51redefine_removecondition_alltarget/01-base.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml b/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml index 205792ab..e11fe0c6 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml @@ -1,18 +1,8 @@ - - - - + - - - - - - - diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py index ef405048..4de69ba1 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py @@ -12,7 +12,7 @@ option_7 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4, option_5, option_6, option_7]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 3f670f13..2b725121 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -28,7 +28,7 @@ excludes = set([]) #excludes = set(['01base_file_utfchar']) test_ok -= excludes test_raise -= excludes -#test_ok = ['10leadership_autoleader'] +#test_ok = ['40condition_base_add'] #test_raise = [] ORI_DIR = getcwd() From 0e08757e22df35466540c15351f31abef6c1062d Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 22 Dec 2020 21:11:14 +0100 Subject: [PATCH 004/168] test multiple xmlfiles in error --- src/rougail/annotator.py | 3 ++- src/rougail/objspace.py | 3 +-- .../80redefine_double_error/00-base.xml | 22 +++++++++++++++++++ .../80redefine_double_error/01-base.xml | 10 +++++++++ .../80redefine_double_error/02-base.xml | 10 +++++++++ .../80redefine_double_error/__init__.py | 0 tests/test_1_flattener.py | 3 ++- 7 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 tests/dictionaries/80redefine_double_error/00-base.xml create mode 100644 tests/dictionaries/80redefine_double_error/01-base.xml create mode 100644 tests/dictionaries/80redefine_double_error/02-base.xml create mode 100644 tests/dictionaries/80redefine_double_error/__init__.py diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index dc94d646..5d529bf2 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -1064,7 +1064,8 @@ class ConstraintAnnotator: fill = fills[idx] # test if it's redefined calculation if fill.target in targets and not fill.redefine: - raise DictConsistencyError(_(f"A fill already exists for the target: {fill.target}")) + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}')) targets.append(fill.target) # if fill.name not in self.functions: diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index ea83a7cc..eccf50e4 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -323,8 +323,7 @@ class CreoleObjSpace: ) -> str: if len(xmlfiles) == 1: return '"' + xmlfiles[0] + '"' - else: - return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"' + return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"' def create_tree_structure(self, space, diff --git a/tests/dictionaries/80redefine_double_error/00-base.xml b/tests/dictionaries/80redefine_double_error/00-base.xml new file mode 100644 index 00000000..c973121f --- /dev/null +++ b/tests/dictionaries/80redefine_double_error/00-base.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/dictionaries/80redefine_double_error/01-base.xml b/tests/dictionaries/80redefine_double_error/01-base.xml new file mode 100644 index 00000000..8a75dbe3 --- /dev/null +++ b/tests/dictionaries/80redefine_double_error/01-base.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/tests/dictionaries/80redefine_double_error/02-base.xml b/tests/dictionaries/80redefine_double_error/02-base.xml new file mode 100644 index 00000000..fb649e93 --- /dev/null +++ b/tests/dictionaries/80redefine_double_error/02-base.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/tests/dictionaries/80redefine_double_error/__init__.py b/tests/dictionaries/80redefine_double_error/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 2b725121..15b6be2b 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -29,7 +29,8 @@ excludes = set([]) test_ok -= excludes test_raise -= excludes #test_ok = ['40condition_base_add'] -#test_raise = [] +#test_ok = [] +#test_raise = ['80redefine_double_error'] ORI_DIR = getcwd() From afdc19887f6a6f58e58362b6bcbdd7056aeb8113 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 23 Dec 2020 11:28:43 +0100 Subject: [PATCH 005/168] simplify normalize_family --- src/rougail/annotator.py | 11 ++++---- src/rougail/objspace.py | 26 ++++++++----------- src/rougail/path.py | 5 +--- src/rougail/tiramisu.py | 3 +-- src/rougail/utils.py | 26 ++++++++----------- .../00-base.xml | 7 ----- .../01-base.xml | 9 ------- .../60extra_redefine/tiramisu/base.py | 6 ++--- 8 files changed, 33 insertions(+), 60 deletions(-) diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index 5d529bf2..1cfd34fe 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -166,7 +166,7 @@ class GroupAnnotator: ) has_a_leader = True else: - raise DictConsistencyError(_('cannot found followers {}').format(follower_names)) + raise DictConsistencyError(_('cannot found followers "{}"').format('", "'.join(follower_names))) del self.objectspace.space.constraints.group def manage_leader(self, @@ -464,8 +464,7 @@ class ServiceAnnotator: if not hasattr(file_, 'source'): file_.source = basename(file_.name) elif not hasattr(file_, 'source'): - raise DictConsistencyError(_('attribute source mandatory for file with variable name ' - 'for {}').format(file_.name)) + raise DictConsistencyError(_('attribute source mandatory for file with variable name for {}').format(file_.name)) class VariableAnnotator: @@ -789,13 +788,15 @@ class ConstraintAnnotator: if condition.source == target.name: raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source)) try: - target.name = self.objectspace.paths.get_variable_path(target.name, namespace) + target_names = [normalize_family(name) for name in target.name.split('.')] + target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace) except DictConsistencyError: # for optional variable pass elif target.type == 'family': try: - target.name = self.objectspace.paths.get_family_path(target.name, namespace) + target_names = [normalize_family(name) for name in target.name.split('.')] + target.name = self.objectspace.paths.get_family_path('.'.join(target_names), namespace) except KeyError: raise DictConsistencyError(_('cannot found family {}').format(target.name)) diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index eccf50e4..e485b3ad 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -292,6 +292,8 @@ class CreoleObjSpace: name = child.text else: name = subspace['name'] + if child.tag == 'family': + name = normalize_family(name) existed_var = self.is_already_exists(name, space, child, @@ -362,13 +364,9 @@ class CreoleObjSpace: if self.paths.path_is_defined(name): return self.paths.get_variable_obj(name) return - if child.tag == 'family': - norm_name = normalize_family(name) - else: - norm_name = name children = getattr(space, child.tag, {}) - if norm_name in children: - return children[norm_name] + if name in children: + return children[name] def convert_boolean(self, value): # pylint: disable=R0201 """Boolean coercion. The Creole XML may contain srings like `True` or `False` @@ -389,19 +387,15 @@ class CreoleObjSpace: namespace, ): if not isinstance(family, self.family): # pylint: disable=E1101 - if variable.tag == 'family': - norm_name = normalize_family(name) - else: - norm_name = name - return getattr(family, variable.tag)[norm_name] + return getattr(family, variable.tag)[name] if namespace == Config['variable_namespace']: path = name else: path = family.path + '.' + name old_family_name = self.paths.get_variable_family_name(path) - if normalize_family(family.name) == old_family_name: + if family.path == old_family_name: return getattr(family, variable.tag)[name] - old_family = self.space.variables[Config['variable_namespace']].family[old_family_name] # pylint: disable=E1101 + old_family = self.space.variables[namespace].family[old_family_name] # pylint: disable=E1101 variable_obj = old_family.variable[name] del old_family.variable[name] if 'variable' not in vars(family): @@ -541,12 +535,14 @@ class CreoleObjSpace: if isinstance(space, self.help): # pylint: disable=E1101 return if child.tag == 'variable': - family_name = normalize_family(document.attrib['name']) + family_name = document.attrib['name'] + family_name = normalize_family(family_name) self.paths.add_variable(namespace, child.attrib['name'], family_name, document.attrib.get('dynamic') != None, - variableobj) + variableobj, + ) if child.attrib.get('redefine', 'False') == 'True': if namespace == Config['variable_namespace']: self.redefine_variables.append(child.attrib['name']) diff --git a/src/rougail/path.py b/src/rougail/path.py index 16123fab..00abc959 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -38,10 +38,7 @@ class Path: name: str, current_namespace: str, ) -> str: # pylint: disable=C0111 - name = normalize_family(name, - check_name=False, - allow_dot=True, - ) + #name = normalize_family(name) if '.' not in name and current_namespace == Config['variable_namespace'] and name in self.full_paths_families: name = self.full_paths_families[name] if current_namespace is None: # pragma: no cover diff --git a/src/rougail/tiramisu.py b/src/rougail/tiramisu.py index 44b3d259..f09f297d 100644 --- a/src/rougail/tiramisu.py +++ b/src/rougail/tiramisu.py @@ -9,5 +9,4 @@ class ConvertDynOptionDescription(DynOptionDescription): def convert_suffix_to_path(self, suffix): if not isinstance(suffix, str): suffix = str(suffix) - return normalize_family(suffix, - check_name=False) + return normalize_family(suffix) diff --git a/src/rougail/utils.py b/src/rougail/utils.py index fd90d31c..d430d0b5 100644 --- a/src/rougail/utils.py +++ b/src/rougail/utils.py @@ -1,23 +1,19 @@ """ utilitaires créole """ -import unicodedata +from unicodedata import normalize, combining from .i18n import _ -def normalize_family(family_name: str, - check_name: bool=True, - allow_dot: bool=False) -> str: +def valid_name(name: str) -> None: + if '.' in name: + raise ValueError(_(f'"{name}" is a forbidden variable or family name, dot is not allowed')) + + +def normalize_family(family_name: str) -> str: """replace space, accent, uppercase, ... by valid character """ - family_name = family_name.replace('-', '_') - if not allow_dot: - family_name = family_name.replace('.', '_') - family_name = family_name.replace(' ', '_') - nfkd_form = unicodedata.normalize('NFKD', family_name) - family_name = ''.join([c for c in nfkd_form if not unicodedata.combining(c)]) - family_name = family_name.lower() - if check_name and family_name == 'containers': - raise ValueError(_(f'"{family_name}" is a forbidden family name')) - return family_name - + family_name = family_name.replace('-', '_').replace(' ', '_').replace('.', '_') + nfkd_form = normalize('NFKD', family_name) + family_name = ''.join([c for c in nfkd_form if not combining(c)]) + return family_name.lower() diff --git a/tests/dictionaries/10load_leadership_normalize_family/00-base.xml b/tests/dictionaries/10load_leadership_normalize_family/00-base.xml index c68db10e..eedee1d0 100644 --- a/tests/dictionaries/10load_leadership_normalize_family/00-base.xml +++ b/tests/dictionaries/10load_leadership_normalize_family/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,14 +12,10 @@ - follower1 follower2 - - - diff --git a/tests/dictionaries/10load_leadership_normalize_family/01-base.xml b/tests/dictionaries/10load_leadership_normalize_family/01-base.xml index d0926cce..b770c714 100644 --- a/tests/dictionaries/10load_leadership_normalize_family/01-base.xml +++ b/tests/dictionaries/10load_leadership_normalize_family/01-base.xml @@ -1,17 +1,8 @@ - - - - - - - - - diff --git a/tests/dictionaries/60extra_redefine/tiramisu/base.py b/tests/dictionaries/60extra_redefine/tiramisu/base.py index 2af3c290..8703416c 100644 --- a/tests/dictionaries/60extra_redefine/tiramisu/base.py +++ b/tests/dictionaries/60extra_redefine/tiramisu/base.py @@ -12,9 +12,9 @@ option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_7 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') -option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) -option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) +option_7 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) +option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) +option_9 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7, option_8, option_9]) option_5 = OptionDescription(name='extra', doc='extra', children=[option_6]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5]) From 08ed28fc9597cb6862de2212ca2a8127cbb7425c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 23 Dec 2020 11:50:20 +0100 Subject: [PATCH 006/168] remove_check and remove_condition must be explicite --- src/rougail/annotator.py | 16 +++++++++++++--- src/rougail/objspace.py | 6 ------ .../10check_valid_differ_add/00-base.xml | 3 --- .../10check_valid_differ_add/tiramisu/base.py | 2 +- .../10check_valid_differ_removecheck/00-base.xml | 3 --- .../10check_valid_differ_removecheck/01-base.xml | 2 +- .../10valid_enum_base_redefine/01-base.xml | 2 +- .../40condition_base_add/01-base.xml | 2 +- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index 1cfd34fe..cc730110 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -704,7 +704,9 @@ class ConstraintAnnotator: for idx, check in enumerate(self.objectspace.space.constraints.check): if check.name == 'valid_enum': if check.target in self.valid_enums: - raise DictConsistencyError(_(f'valid_enum already set for {check.target}')) + old_xmlfiles = self.objectspace.display_xmlfiles(self.valid_enums[check.target]['xmlfiles']) + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?')) if not hasattr(check, 'param'): raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}')) variable = self.objectspace.paths.get_variable_obj(check.target) @@ -715,7 +717,8 @@ class ConstraintAnnotator: self._set_valid_enum(variable, values, variable.type, - check.target + check.target, + check.xmlfiles, ) remove_indexes.append(idx) remove_indexes.sort(reverse=True) @@ -957,7 +960,13 @@ class ConstraintAnnotator: variable.property.append(prop) del self.objectspace.space.constraints.condition - def _set_valid_enum(self, variable, values, type_, target): + def _set_valid_enum(self, + variable, + values, + type_, + target: str, + xmlfiles: List[str], + ): # value for choice's variable is mandatory variable.mandatory = True # build choice @@ -970,6 +979,7 @@ class ConstraintAnnotator: else: self.valid_enums[target] = {'type': type_, 'values': values, + 'xmlfiles': xmlfiles, } choices = [] for value in values: diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index e485b3ad..f297b6f2 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -515,12 +515,6 @@ class CreoleObjSpace: self.fill_removed.append(child.attrib['target']) if not hasattr(variableobj, 'index'): variableobj.index = self.index - if child.tag == 'check' and child.attrib['target'] in self.redefine_variables and child.attrib['target'] not in self.check_removed: - self.remove_check(child.attrib['target']) - self.check_removed.append(child.attrib['target']) - if child.tag == 'condition' and child.attrib['source'] in self.redefine_variables and child.attrib['source'] not in self.condition_removed: - self.remove_condition(child.attrib['source']) - self.condition_removed.append(child.attrib['source']) variableobj.namespace = namespace def fill_variableobj_path_attribute(self, diff --git a/tests/dictionaries/10check_valid_differ_add/00-base.xml b/tests/dictionaries/10check_valid_differ_add/00-base.xml index 70c315fd..fd47c9ca 100644 --- a/tests/dictionaries/10check_valid_differ_add/00-base.xml +++ b/tests/dictionaries/10check_valid_differ_add/00-base.xml @@ -25,9 +25,6 @@ mode_conteneur_actif1 - - mode_conteneur_actif1 - diff --git a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py index 889721ea..2aac2277 100644 --- a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py @@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui') +option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui') option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml b/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml index 467a039d..fd47c9ca 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml +++ b/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml @@ -25,9 +25,6 @@ mode_conteneur_actif1 - - mode_conteneur_actif2 - diff --git a/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml b/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml index e8a453de..2f4e1a74 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml +++ b/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml @@ -5,7 +5,7 @@ - + oui diff --git a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml index 87b45ceb..44db7160 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml +++ b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml @@ -5,7 +5,7 @@ - + c diff --git a/tests/dictionaries/40condition_base_add/01-base.xml b/tests/dictionaries/40condition_base_add/01-base.xml index 81b77776..a87dc7e6 100644 --- a/tests/dictionaries/40condition_base_add/01-base.xml +++ b/tests/dictionaries/40condition_base_add/01-base.xml @@ -2,7 +2,7 @@ - + From 6c6746c58f7ee1f4a243050a2350ae761e83f087 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 23 Dec 2020 13:29:51 +0100 Subject: [PATCH 007/168] help in variable or family now --- src/rougail/annotator.py | 15 --------------- src/rougail/data/rougail.dtd | 8 ++++---- .../dictionaries/00load_autofreeze/00-base.xml | 8 -------- .../00load_autofreezeexpert/00-base.xml | 10 ---------- tests/dictionaries/00load_autosave/00-base.xml | 10 ---------- .../00load_autosaveexpert/00-base.xml | 10 ---------- tests/dictionaries/00load_comment/00-base.xml | 10 ---------- tests/dictionaries/00load_notype/00-base.xml | 10 ---------- tests/dictionaries/00load_save/00-base.xml | 10 ---------- tests/dictionaries/00load_subfolder/99-base.xml | 10 ---------- .../00load_subfolder/subfolder/00-base.xml | 10 ---------- tests/dictionaries/01auto_base/00-base.xml | 7 ------- .../01auto_withoutparam/00-base.xml | 7 ------- tests/dictionaries/01base_multi/00-base.xml | 10 ---------- .../dictionaries/01fill_autofreeze/00-base.xml | 7 ------- tests/dictionaries/01fill_autosave/00-base.xml | 7 ------- tests/dictionaries/01fill_base/00-base.xml | 7 ------- .../dictionaries/01fill_baseaccent/00-base.xml | 7 ------- tests/dictionaries/01fill_mandatory/00-base.xml | 7 ------- tests/dictionaries/01fill_number/00-base.xml | 7 ------- tests/dictionaries/01fill_optional/00-base.xml | 7 ------- tests/dictionaries/01separator_base/00-base.xml | 9 --------- .../01separator_neverhidden/00-base.xml | 9 --------- .../dictionaries/10autosave_hidden/00-base.xml | 8 -------- .../10autosave_hidden_frozenifin/00-base.xml | 8 -------- tests/dictionaries/10check_base/00-base.xml | 7 ------- tests/dictionaries/10check_no_param/00-base.xml | 7 ------- tests/dictionaries/10check_option/00-base.xml | 7 ------- tests/dictionaries/10check_optional/00-base.xml | 8 -------- .../10check_valid_differ/00-base.xml | 7 ------- .../10check_valid_differ_add/00-base.xml | 7 ------- .../10check_valid_differ_add/01-base.xml | 6 ------ .../00-base.xml | 7 ------- .../01-base.xml | 7 ------- .../10check_valid_in_network/00-base.xml | 7 ------- .../10check_valid_in_network_cidr/00-base.xml | 7 ------- .../10check_valid_ipnetmask/00-base.xml | 7 ------- .../10leadership_append/00-base.xml | 6 ------ .../10leadership_append/01-base.xml | 10 ++-------- .../dictionaries/10leadership_auto/00-base.xml | 6 ------ .../10leadership_autoleader/00-base.xml | 6 ------ .../10leadership_autoleader_expert/00-base.xml | 6 ------ .../10leadership_autosaveexpert/00-base.xml | 6 ------ .../10leadership_familyaccent/00-base.xml | 6 ------ .../10leadership_leader_hidden/00-base.xml | 6 ------ .../00-base.xml | 6 ------ .../10leadership_leadermandatory/00-base.xml | 6 ------ .../10leadership_mandatory/00-base.xml | 6 ------ .../10leadership_mandatoryfollower/00-base.xml | 5 ----- .../dictionaries/10leadership_multi/00-base.xml | 6 ------ .../10load_disabled_if_in/00-base.xml | 7 ------- .../10load_disabled_if_in_none/00-base.xml | 7 ------- .../00-base.xml | 7 ------- .../00-base.xml | 7 ------- .../00-base.xml | 7 ------- .../10load_disabledifin_fallback/00-base.xml | 7 ------- .../00-base.xml | 7 ------- .../00-base.xml | 7 ------- .../dictionaries/10load_emptyvalue/00-base.xml | 10 ---------- .../dictionaries/10load_frozenifin/00-base.xml | 7 ------- .../10load_frozenifin_auto/00-base.xml | 7 ------- .../10load_frozenifin_multiparam/00-base.xml | 7 ------- .../10load_hidden_if_family/00-base.xml | 7 ------- .../dictionaries/10load_leadership/00-base.xml | 6 ------ .../10load_leadership_default_multi/00-base.xml | 6 ------ .../00-base.xml | 6 ------ .../00-base.xml | 8 +------- .../10load_leadership_submulti/00-base.xml | 6 ------ .../10load_mandatoryifin/00-base.xml | 7 ------- .../dictionaries/10load_multivalue/00-base.xml | 10 ---------- .../10valid_enum_accent/00-base.xml | 11 +---------- .../dictionaries/10valid_enum_base/00-base.xml | 10 +--------- .../10valid_enum_base_redefine/00-base.xml | 11 +---------- .../10valid_enum_base_redefine/01-base.xml | 8 -------- .../10valid_enum_leader/00-base.xml | 7 ------- .../dictionaries/10valid_enum_multi/00-base.xml | 7 ------- .../dictionaries/10valid_enum_none/00-base.xml | 10 +--------- .../10valid_enum_number/00-base.xml | 10 +--------- .../10valid_enum_numberdefault/00-base.xml | 11 +---------- .../dictionaries/10valid_enum_value/00-base.xml | 7 ------- .../11disabled_if_in_filelist/00-base.xml | 4 ---- .../00-base.xml | 4 ---- .../11disabled_if_in_filelist_multi/00-base.xml | 4 ---- .../00-base.xml | 4 ---- .../00-base.xml | 6 ------ .../00-base.xml | 4 ---- .../11multi_disabled_if_in_filelist/00-base.xml | 4 ---- tests/dictionaries/20family_append/00-base.xml | 10 ---------- tests/dictionaries/20family_append/01-base.xml | 10 ---------- .../20family_appendaccent/00-base.xml | 7 ------- .../20family_appendaccent/01-base.xml | 10 ---------- .../20family_appendaccent/02-base.xml | 10 ---------- tests/dictionaries/20family_empty/00-base.xml | 14 +------------- tests/dictionaries/20family_hidden/00-base.xml | 10 ---------- tests/dictionaries/20family_hidden/01-base.xml | 10 ---------- tests/dictionaries/20family_mode/00-base.xml | 10 ---------- .../20family_modeleadership/00-base.xml | 7 ------- tests/dictionaries/21family_change/00-base.xml | 10 ---------- tests/dictionaries/21family_change/01-base.xml | 10 ---------- .../21family_changeaccent/00-base.xml | 10 ---------- .../21family_changeaccent/01-base.xml | 10 ---------- tests/dictionaries/21family_empty/00-base.xml | 10 ---------- .../30mandatory_withoutvalue/00-base.xml | 10 ---------- .../30mandatory_withvalue/00-base.xml | 10 ---------- tests/dictionaries/40condition_base/00-base.xml | 7 ------- .../40condition_fallback/00-base.xml | 7 ------- .../40condition_optional/00-base.xml | 7 ------- .../40hidden_if_in_group_fallback/00-base.xml | 7 ------- .../dictionaries/40ifin_leadership/00-base.xml | 6 ------ .../40ifin_leadershipauto/00-base.xml | 6 ------ tests/dictionaries/40ifin_multi/00-base.xml | 7 ------- tests/dictionaries/50exists_exists/00-base.xml | 10 ---------- tests/dictionaries/50exists_exists/01-base.xml | 10 ---------- .../50redefine_description/00-base.xml | 10 ---------- .../50redefine_description/01-redefine.xml | 10 ---------- .../dictionaries/51exists_nonexists/00-base.xml | 10 ---------- .../dictionaries/51exists_nonexists/01-base.xml | 10 ---------- tests/dictionaries/51redefine_auto/00-base.xml | 7 ------- tests/dictionaries/51redefine_auto/01-base.xml | 7 ------- .../51redefine_autofill/00-base.xml | 6 ------ .../51redefine_autofill/01-base.xml | 7 ------- .../dictionaries/51redefine_family/00-base.xml | 7 ------- .../dictionaries/51redefine_family/01-base.xml | 10 ---------- tests/dictionaries/51redefine_fill/00-base.xml | 7 ------- tests/dictionaries/51redefine_fill/01-base.xml | 7 ------- .../51redefine_fillauto/00-base.xml | 7 ------- .../51redefine_fillauto/01-base.xml | 7 ------- tests/dictionaries/51redefine_help/00-base.xml | 17 ++--------------- tests/dictionaries/51redefine_help/01-base.xml | 17 +++++------------ .../dictionaries/51redefine_hidden/00-base.xml | 10 ---------- .../51redefine_hidden/01-redefine.xml | 10 ---------- .../51redefine_remove_check/00-base.xml | 6 ------ .../51redefine_remove_check/01-base.xml | 10 ---------- .../51redefine_remove_condition/00-base.xml | 7 ------- .../51redefine_remove_condition/01-base.xml | 10 ---------- .../00-base.xml | 7 ------- tests/dictionaries/51redefine_value/00-base.xml | 10 ---------- .../51redefine_value/01-redefine.xml | 9 --------- tests/dictionaries/51remove_fill/00-base.xml | 7 ------- .../dictionaries/52exists_redefine/00-base.xml | 10 ---------- .../dictionaries/52exists_redefine/01-base.xml | 9 --------- .../dictionaries/60action_external/00-base.xml | 10 ---------- .../extra_dirs/extra/00-base.xml | 1 - .../60extra_externalspacecondition/00-base.xml | 10 ---------- tests/dictionaries/60extra_help/00-base.xml | 6 ------ .../60extra_help/extra_dirs/extra/00-base.xml | 5 +---- tests/dictionaries/60extra_load/00-base.xml | 10 ---------- .../dictionaries/60extra_mandatory/00-base.xml | 10 ---------- .../60extra_name_family/00-base.xml | 10 ---------- tests/dictionaries/60extra_redefine/00-base.xml | 10 ---------- .../dictionaries/60extra_separators/00-base.xml | 10 ---------- tests/dictionaries/60familyaction/00-base.xml | 10 ---------- .../60familyaction/extra_dirs/extra/00-base.xml | 3 --- .../60familyaction_accent/00-base.xml | 10 ---------- .../extra_dirs/extra/00-base.xml | 3 --- .../60familyaction_mandatory/00-base.xml | 10 ---------- .../extra_dirs/extra/00-base.xml | 5 +---- .../dictionaries/70container_files/00-base.xml | 7 ------- .../70container_files_twice/00-base.xml | 7 ------- .../70container_filesmulti/00-base.xml | 7 ------- .../70container_filesredefine/00-base.xml | 7 ------- tests/dictionaries/70container_new/00-base.xml | 7 ------- .../70container_newnocont/00-base.xml | 7 ------- .../70container_newwithip/00-base.xml | 7 ------- .../70container_pathaccess/00-base.xml | 7 ------- .../00-base.xml | 4 ---- tests/dictionaries/70container_save/00-base.xml | 10 ---------- .../70container_serviceaccess/00-base.xml | 7 ------- .../70container_servicerestriction/00-base.xml | 8 -------- .../70container_services/00-base.xml | 9 --------- .../70services_unmanage/00-base.xml | 7 ------- 171 files changed, 23 insertions(+), 1335 deletions(-) diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index cc730110..1162e567 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -473,7 +473,6 @@ class VariableAnnotator: ): self.objectspace = objectspace self.convert_variable() - self.convert_helps() self.convert_auto_freeze() self.convert_separators() @@ -567,20 +566,6 @@ class VariableAnnotator: ) _valid_type(variable) - def convert_helps(self): - if not hasattr(self.objectspace.space, 'help'): - return - helps = self.objectspace.space.help - if hasattr(helps, 'variable'): - for hlp in helps.variable.values(): - variable = self.objectspace.paths.get_variable_obj(hlp.name) - variable.help = hlp.text - if hasattr(helps, 'family'): - for hlp in helps.family.values(): - variable = self.objectspace.paths.get_family_obj(hlp.name) - variable.help = hlp.text - del self.objectspace.space.help - def convert_auto_freeze(self): # pylint: disable=C0111 def _convert_auto_freeze(variable, namespace): if variable.auto_freeze: diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 6269540d..c4fa78c3 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -80,17 +80,19 @@ - + + - + + @@ -145,5 +147,3 @@ - - diff --git a/tests/dictionaries/00load_autofreeze/00-base.xml b/tests/dictionaries/00load_autofreeze/00-base.xml index 63563a7e..aefd954e 100644 --- a/tests/dictionaries/00load_autofreeze/00-base.xml +++ b/tests/dictionaries/00load_autofreeze/00-base.xml @@ -1,6 +1,5 @@ - @@ -10,14 +9,7 @@ non - - - - - - - diff --git a/tests/dictionaries/00load_autofreezeexpert/00-base.xml b/tests/dictionaries/00load_autofreezeexpert/00-base.xml index 3e42d230..2c66f0dc 100644 --- a/tests/dictionaries/00load_autofreezeexpert/00-base.xml +++ b/tests/dictionaries/00load_autofreezeexpert/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,14 +9,7 @@ non - - - - - - - diff --git a/tests/dictionaries/00load_autosave/00-base.xml b/tests/dictionaries/00load_autosave/00-base.xml index c185a325..8825e85b 100644 --- a/tests/dictionaries/00load_autosave/00-base.xml +++ b/tests/dictionaries/00load_autosave/00-base.xml @@ -1,22 +1,12 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/00load_autosaveexpert/00-base.xml b/tests/dictionaries/00load_autosaveexpert/00-base.xml index 0b003702..7fa79f58 100644 --- a/tests/dictionaries/00load_autosaveexpert/00-base.xml +++ b/tests/dictionaries/00load_autosaveexpert/00-base.xml @@ -1,22 +1,12 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/00load_comment/00-base.xml b/tests/dictionaries/00load_comment/00-base.xml index bce00346..a5e543fe 100644 --- a/tests/dictionaries/00load_comment/00-base.xml +++ b/tests/dictionaries/00load_comment/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,14 +7,7 @@ non - - - - - - - diff --git a/tests/dictionaries/00load_notype/00-base.xml b/tests/dictionaries/00load_notype/00-base.xml index c73af336..aac6f7fe 100644 --- a/tests/dictionaries/00load_notype/00-base.xml +++ b/tests/dictionaries/00load_notype/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/00load_save/00-base.xml b/tests/dictionaries/00load_save/00-base.xml index bc7628d5..b0950adb 100644 --- a/tests/dictionaries/00load_save/00-base.xml +++ b/tests/dictionaries/00load_save/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/00load_subfolder/99-base.xml b/tests/dictionaries/00load_subfolder/99-base.xml index bc7628d5..b0950adb 100644 --- a/tests/dictionaries/00load_subfolder/99-base.xml +++ b/tests/dictionaries/00load_subfolder/99-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/00load_subfolder/subfolder/00-base.xml b/tests/dictionaries/00load_subfolder/subfolder/00-base.xml index 28f0419b..337859b5 100644 --- a/tests/dictionaries/00load_subfolder/subfolder/00-base.xml +++ b/tests/dictionaries/00load_subfolder/subfolder/00-base.xml @@ -1,23 +1,13 @@ - - - - - - - - - - diff --git a/tests/dictionaries/01auto_base/00-base.xml b/tests/dictionaries/01auto_base/00-base.xml index edf7fd20..f20b3bc8 100644 --- a/tests/dictionaries/01auto_base/00-base.xml +++ b/tests/dictionaries/01auto_base/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -20,9 +16,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/01auto_withoutparam/00-base.xml b/tests/dictionaries/01auto_withoutparam/00-base.xml index 5c07d2c3..e1fdccf1 100644 --- a/tests/dictionaries/01auto_withoutparam/00-base.xml +++ b/tests/dictionaries/01auto_withoutparam/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - diff --git a/tests/dictionaries/01base_multi/00-base.xml b/tests/dictionaries/01base_multi/00-base.xml index b842e0ca..966384cd 100644 --- a/tests/dictionaries/01base_multi/00-base.xml +++ b/tests/dictionaries/01base_multi/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/01fill_autofreeze/00-base.xml b/tests/dictionaries/01fill_autofreeze/00-base.xml index 79216db2..3613a89e 100644 --- a/tests/dictionaries/01fill_autofreeze/00-base.xml +++ b/tests/dictionaries/01fill_autofreeze/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -23,9 +19,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/01fill_autosave/00-base.xml b/tests/dictionaries/01fill_autosave/00-base.xml index 422e8149..39223fe0 100644 --- a/tests/dictionaries/01fill_autosave/00-base.xml +++ b/tests/dictionaries/01fill_autosave/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,7 +9,6 @@ non - @@ -20,9 +16,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/01fill_base/00-base.xml b/tests/dictionaries/01fill_base/00-base.xml index 5bc01db8..d5a6d18c 100644 --- a/tests/dictionaries/01fill_base/00-base.xml +++ b/tests/dictionaries/01fill_base/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,6 @@ non - @@ -18,9 +14,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/01fill_baseaccent/00-base.xml b/tests/dictionaries/01fill_baseaccent/00-base.xml index 8d6ea338..faad1554 100644 --- a/tests/dictionaries/01fill_baseaccent/00-base.xml +++ b/tests/dictionaries/01fill_baseaccent/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -20,9 +16,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/01fill_mandatory/00-base.xml b/tests/dictionaries/01fill_mandatory/00-base.xml index e6c39d4d..499a1f6e 100644 --- a/tests/dictionaries/01fill_mandatory/00-base.xml +++ b/tests/dictionaries/01fill_mandatory/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,6 @@ non - @@ -18,9 +14,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/01fill_number/00-base.xml b/tests/dictionaries/01fill_number/00-base.xml index 642b8f77..bfb810f2 100644 --- a/tests/dictionaries/01fill_number/00-base.xml +++ b/tests/dictionaries/01fill_number/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -18,9 +14,6 @@ 3 - - - diff --git a/tests/dictionaries/01fill_optional/00-base.xml b/tests/dictionaries/01fill_optional/00-base.xml index a2142cab..a48bbd65 100644 --- a/tests/dictionaries/01fill_optional/00-base.xml +++ b/tests/dictionaries/01fill_optional/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -22,9 +18,6 @@ mode_conteneur_actif3 - - - diff --git a/tests/dictionaries/01separator_base/00-base.xml b/tests/dictionaries/01separator_base/00-base.xml index cd4b3228..9b468a63 100644 --- a/tests/dictionaries/01separator_base/00-base.xml +++ b/tests/dictionaries/01separator_base/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - diff --git a/tests/dictionaries/01separator_neverhidden/00-base.xml b/tests/dictionaries/01separator_neverhidden/00-base.xml index cd4b3228..9b468a63 100644 --- a/tests/dictionaries/01separator_neverhidden/00-base.xml +++ b/tests/dictionaries/01separator_neverhidden/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - diff --git a/tests/dictionaries/10autosave_hidden/00-base.xml b/tests/dictionaries/10autosave_hidden/00-base.xml index b50316fc..a18d598a 100644 --- a/tests/dictionaries/10autosave_hidden/00-base.xml +++ b/tests/dictionaries/10autosave_hidden/00-base.xml @@ -1,8 +1,5 @@ - - - - oui - - - - diff --git a/tests/dictionaries/10autosave_hidden_frozenifin/00-base.xml b/tests/dictionaries/10autosave_hidden_frozenifin/00-base.xml index 3a48d4d7..c983dcd9 100644 --- a/tests/dictionaries/10autosave_hidden_frozenifin/00-base.xml +++ b/tests/dictionaries/10autosave_hidden_frozenifin/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -20,11 +16,7 @@ oui autosavevar - - - - diff --git a/tests/dictionaries/10check_base/00-base.xml b/tests/dictionaries/10check_base/00-base.xml index 49a1c307..40b7ebfa 100644 --- a/tests/dictionaries/10check_base/00-base.xml +++ b/tests/dictionaries/10check_base/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,6 @@ - @@ -19,9 +15,6 @@ 100 - - - diff --git a/tests/dictionaries/10check_no_param/00-base.xml b/tests/dictionaries/10check_no_param/00-base.xml index 45688bf4..f2d3626a 100644 --- a/tests/dictionaries/10check_no_param/00-base.xml +++ b/tests/dictionaries/10check_no_param/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,15 +7,11 @@ - - - - diff --git a/tests/dictionaries/10check_option/00-base.xml b/tests/dictionaries/10check_option/00-base.xml index 5abff47b..3621193d 100644 --- a/tests/dictionaries/10check_option/00-base.xml +++ b/tests/dictionaries/10check_option/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -13,7 +10,6 @@ - @@ -22,9 +18,6 @@ int2 - - - diff --git a/tests/dictionaries/10check_optional/00-base.xml b/tests/dictionaries/10check_optional/00-base.xml index 2e93d1fd..17c64a7f 100644 --- a/tests/dictionaries/10check_optional/00-base.xml +++ b/tests/dictionaries/10check_optional/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -11,7 +8,6 @@ - @@ -21,11 +17,7 @@ int3 - - - - diff --git a/tests/dictionaries/10check_valid_differ/00-base.xml b/tests/dictionaries/10check_valid_differ/00-base.xml index 7f7417bd..e830a9da 100644 --- a/tests/dictionaries/10check_valid_differ/00-base.xml +++ b/tests/dictionaries/10check_valid_differ/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,7 +9,6 @@ non - @@ -20,9 +16,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/10check_valid_differ_add/00-base.xml b/tests/dictionaries/10check_valid_differ_add/00-base.xml index fd47c9ca..4bf28ad6 100644 --- a/tests/dictionaries/10check_valid_differ_add/00-base.xml +++ b/tests/dictionaries/10check_valid_differ_add/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -18,7 +15,6 @@ oui - @@ -26,9 +22,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/10check_valid_differ_add/01-base.xml b/tests/dictionaries/10check_valid_differ_add/01-base.xml index 3280f094..05fdad68 100644 --- a/tests/dictionaries/10check_valid_differ_add/01-base.xml +++ b/tests/dictionaries/10check_valid_differ_add/01-base.xml @@ -1,8 +1,5 @@ - - - @@ -18,9 +15,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml b/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml index fd47c9ca..4bf28ad6 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml +++ b/tests/dictionaries/10check_valid_differ_removecheck/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -18,7 +15,6 @@ oui - @@ -26,9 +22,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml b/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml index 2f4e1a74..336a79c8 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml +++ b/tests/dictionaries/10check_valid_differ_removecheck/01-base.xml @@ -1,15 +1,11 @@ - - - oui - @@ -20,9 +16,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/10check_valid_in_network/00-base.xml b/tests/dictionaries/10check_valid_in_network/00-base.xml index 43cc2898..2ce08d1a 100644 --- a/tests/dictionaries/10check_valid_in_network/00-base.xml +++ b/tests/dictionaries/10check_valid_in_network/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,7 +9,6 @@ - @@ -21,9 +17,6 @@ adresse_netmask_eth0 - - - diff --git a/tests/dictionaries/10check_valid_in_network_cidr/00-base.xml b/tests/dictionaries/10check_valid_in_network_cidr/00-base.xml index f11b495b..fba7e8c2 100644 --- a/tests/dictionaries/10check_valid_in_network_cidr/00-base.xml +++ b/tests/dictionaries/10check_valid_in_network_cidr/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -11,7 +8,6 @@ - @@ -19,9 +15,6 @@ adresse_ip_eth0 - - - diff --git a/tests/dictionaries/10check_valid_ipnetmask/00-base.xml b/tests/dictionaries/10check_valid_ipnetmask/00-base.xml index d02da19d..2a8d6c9d 100644 --- a/tests/dictionaries/10check_valid_ipnetmask/00-base.xml +++ b/tests/dictionaries/10check_valid_ipnetmask/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -11,7 +8,6 @@ - @@ -19,9 +15,6 @@ adresse_ip_eth0 - - - diff --git a/tests/dictionaries/10leadership_append/00-base.xml b/tests/dictionaries/10leadership_append/00-base.xml index f24dc653..7e4144bc 100644 --- a/tests/dictionaries/10leadership_append/00-base.xml +++ b/tests/dictionaries/10leadership_append/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -28,7 +25,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_append/01-base.xml b/tests/dictionaries/10leadership_append/01-base.xml index 6a86d00f..93706d66 100644 --- a/tests/dictionaries/10leadership_append/01-base.xml +++ b/tests/dictionaries/10leadership_append/01-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,11 +7,8 @@ - + follower3 - + - - - diff --git a/tests/dictionaries/10leadership_auto/00-base.xml b/tests/dictionaries/10leadership_auto/00-base.xml index 329c04a4..04fd7138 100644 --- a/tests/dictionaries/10leadership_auto/00-base.xml +++ b/tests/dictionaries/10leadership_auto/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -31,7 +28,4 @@ follower3 - - - diff --git a/tests/dictionaries/10leadership_autoleader/00-base.xml b/tests/dictionaries/10leadership_autoleader/00-base.xml index 04132f05..a79f5a36 100644 --- a/tests/dictionaries/10leadership_autoleader/00-base.xml +++ b/tests/dictionaries/10leadership_autoleader/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_autoleader_expert/00-base.xml b/tests/dictionaries/10leadership_autoleader_expert/00-base.xml index 1defb82c..316c78da 100644 --- a/tests/dictionaries/10leadership_autoleader_expert/00-base.xml +++ b/tests/dictionaries/10leadership_autoleader_expert/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -25,7 +22,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_autosaveexpert/00-base.xml b/tests/dictionaries/10leadership_autosaveexpert/00-base.xml index 35355328..20e93913 100644 --- a/tests/dictionaries/10leadership_autosaveexpert/00-base.xml +++ b/tests/dictionaries/10leadership_autosaveexpert/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_familyaccent/00-base.xml b/tests/dictionaries/10leadership_familyaccent/00-base.xml index b272a405..201ce4b0 100644 --- a/tests/dictionaries/10leadership_familyaccent/00-base.xml +++ b/tests/dictionaries/10leadership_familyaccent/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_leader_hidden/00-base.xml b/tests/dictionaries/10leadership_leader_hidden/00-base.xml index 8449817f..14b731f5 100644 --- a/tests/dictionaries/10leadership_leader_hidden/00-base.xml +++ b/tests/dictionaries/10leadership_leader_hidden/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -25,7 +22,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_leader_hidden_if_in/00-base.xml b/tests/dictionaries/10leadership_leader_hidden_if_in/00-base.xml index 5cfb49e1..019d321d 100644 --- a/tests/dictionaries/10leadership_leader_hidden_if_in/00-base.xml +++ b/tests/dictionaries/10leadership_leader_hidden_if_in/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ leader - - - diff --git a/tests/dictionaries/10leadership_leadermandatory/00-base.xml b/tests/dictionaries/10leadership_leadermandatory/00-base.xml index e3c02788..7e97da35 100644 --- a/tests/dictionaries/10leadership_leadermandatory/00-base.xml +++ b/tests/dictionaries/10leadership_leadermandatory/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_mandatory/00-base.xml b/tests/dictionaries/10leadership_mandatory/00-base.xml index c09871f7..39d53033 100644 --- a/tests/dictionaries/10leadership_mandatory/00-base.xml +++ b/tests/dictionaries/10leadership_mandatory/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ follower2 - - - diff --git a/tests/dictionaries/10leadership_mandatoryfollower/00-base.xml b/tests/dictionaries/10leadership_mandatoryfollower/00-base.xml index 74fda799..0697a0c7 100644 --- a/tests/dictionaries/10leadership_mandatoryfollower/00-base.xml +++ b/tests/dictionaries/10leadership_mandatoryfollower/00-base.xml @@ -1,6 +1,5 @@ - - @@ -17,9 +15,6 @@ nut_monitor_host - - - diff --git a/tests/dictionaries/10leadership_multi/00-base.xml b/tests/dictionaries/10leadership_multi/00-base.xml index 4c00818e..1f3bd07c 100644 --- a/tests/dictionaries/10leadership_multi/00-base.xml +++ b/tests/dictionaries/10leadership_multi/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -35,7 +32,4 @@ follower21 - - - diff --git a/tests/dictionaries/10load_disabled_if_in/00-base.xml b/tests/dictionaries/10load_disabled_if_in/00-base.xml index 4a6ccb5c..1080837f 100644 --- a/tests/dictionaries/10load_disabled_if_in/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_in/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -26,9 +22,6 @@ afilllist - - - diff --git a/tests/dictionaries/10load_disabled_if_in_none/00-base.xml b/tests/dictionaries/10load_disabled_if_in_none/00-base.xml index 894d0a13..a9f4476c 100644 --- a/tests/dictionaries/10load_disabled_if_in_none/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_in_none/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -26,9 +22,6 @@ afilllist - - - diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/00-base.xml b/tests/dictionaries/10load_disabled_if_inaccent_family/00-base.xml index d185fc60..4e5af5b7 100644 --- a/tests/dictionaries/10load_disabled_if_inaccent_family/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_inaccent_family/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -20,7 +17,6 @@ non - @@ -31,9 +27,6 @@ Général2 - - - diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml b/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml index d09fdf81..e2c7f89c 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -30,9 +26,6 @@ mode_conteneur_actif - - - diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml index 26da30a0..3303b547 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -30,9 +26,6 @@ mode_conteneur_actif - - - diff --git a/tests/dictionaries/10load_disabledifin_fallback/00-base.xml b/tests/dictionaries/10load_disabledifin_fallback/00-base.xml index f6f0484c..a52611d9 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_fallback/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -30,9 +26,6 @@ mode_conteneur_actif - - - diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml b/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml index bbbb919e..d39daed4 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -30,9 +26,6 @@ mode_conteneur_actif - - - diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml b/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml index 1280f3f1..1f375c62 100644 --- a/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -26,9 +22,6 @@ afilllist - - - diff --git a/tests/dictionaries/10load_emptyvalue/00-base.xml b/tests/dictionaries/10load_emptyvalue/00-base.xml index 4469691e..49be4776 100644 --- a/tests/dictionaries/10load_emptyvalue/00-base.xml +++ b/tests/dictionaries/10load_emptyvalue/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,14 +9,7 @@ - - - - - - - diff --git a/tests/dictionaries/10load_frozenifin/00-base.xml b/tests/dictionaries/10load_frozenifin/00-base.xml index 37e6f3d7..cb873c2b 100644 --- a/tests/dictionaries/10load_frozenifin/00-base.xml +++ b/tests/dictionaries/10load_frozenifin/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -25,9 +21,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/10load_frozenifin_auto/00-base.xml b/tests/dictionaries/10load_frozenifin_auto/00-base.xml index 3a89b4b8..73c32950 100644 --- a/tests/dictionaries/10load_frozenifin_auto/00-base.xml +++ b/tests/dictionaries/10load_frozenifin_auto/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -28,9 +24,6 @@ non - - - diff --git a/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml b/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml index 900d5e65..270cf7d2 100644 --- a/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml +++ b/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -31,9 +27,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/10load_hidden_if_family/00-base.xml b/tests/dictionaries/10load_hidden_if_family/00-base.xml index 193a2f76..172a26fb 100644 --- a/tests/dictionaries/10load_hidden_if_family/00-base.xml +++ b/tests/dictionaries/10load_hidden_if_family/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -20,7 +17,6 @@ non - @@ -31,9 +27,6 @@ Général2 - - - diff --git a/tests/dictionaries/10load_leadership/00-base.xml b/tests/dictionaries/10load_leadership/00-base.xml index f24dc653..7e4144bc 100644 --- a/tests/dictionaries/10load_leadership/00-base.xml +++ b/tests/dictionaries/10load_leadership/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -28,7 +25,4 @@ follower2 - - - diff --git a/tests/dictionaries/10load_leadership_default_multi/00-base.xml b/tests/dictionaries/10load_leadership_default_multi/00-base.xml index f08a2d8e..8e8ef66d 100644 --- a/tests/dictionaries/10load_leadership_default_multi/00-base.xml +++ b/tests/dictionaries/10load_leadership_default_multi/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -22,7 +19,4 @@ follower2 - - - diff --git a/tests/dictionaries/10load_leadership_default_submulti/00-base.xml b/tests/dictionaries/10load_leadership_default_submulti/00-base.xml index 37966c0d..b750b66d 100644 --- a/tests/dictionaries/10load_leadership_default_submulti/00-base.xml +++ b/tests/dictionaries/10load_leadership_default_submulti/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -27,7 +24,4 @@ follower2 - - - diff --git a/tests/dictionaries/10load_leadership_defaultmulti_leader/00-base.xml b/tests/dictionaries/10load_leadership_defaultmulti_leader/00-base.xml index 687f8e83..daadfbd1 100644 --- a/tests/dictionaries/10load_leadership_defaultmulti_leader/00-base.xml +++ b/tests/dictionaries/10load_leadership_defaultmulti_leader/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -11,7 +8,7 @@ value - + @@ -22,7 +19,4 @@ follower2 - - - diff --git a/tests/dictionaries/10load_leadership_submulti/00-base.xml b/tests/dictionaries/10load_leadership_submulti/00-base.xml index 48377ba3..92e68587 100644 --- a/tests/dictionaries/10load_leadership_submulti/00-base.xml +++ b/tests/dictionaries/10load_leadership_submulti/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -28,7 +25,4 @@ follower2 - - - diff --git a/tests/dictionaries/10load_mandatoryifin/00-base.xml b/tests/dictionaries/10load_mandatoryifin/00-base.xml index 718a24f7..9f973020 100644 --- a/tests/dictionaries/10load_mandatoryifin/00-base.xml +++ b/tests/dictionaries/10load_mandatoryifin/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -25,9 +21,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/10load_multivalue/00-base.xml b/tests/dictionaries/10load_multivalue/00-base.xml index 5ee2a5ee..6fb737af 100644 --- a/tests/dictionaries/10load_multivalue/00-base.xml +++ b/tests/dictionaries/10load_multivalue/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/10valid_enum_accent/00-base.xml b/tests/dictionaries/10valid_enum_accent/00-base.xml index 12720be4..69931d89 100644 --- a/tests/dictionaries/10valid_enum_accent/00-base.xml +++ b/tests/dictionaries/10valid_enum_accent/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,11 +7,10 @@ - + c - @@ -25,11 +21,6 @@ é - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_base/00-base.xml b/tests/dictionaries/10valid_enum_base/00-base.xml index 9c8d133e..4be6f836 100644 --- a/tests/dictionaries/10valid_enum_base/00-base.xml +++ b/tests/dictionaries/10valid_enum_base/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,7 @@ - + c @@ -24,11 +21,6 @@ c - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_base_redefine/00-base.xml b/tests/dictionaries/10valid_enum_base_redefine/00-base.xml index 0b6101aa..b9d58f5c 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/00-base.xml +++ b/tests/dictionaries/10valid_enum_base_redefine/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -13,11 +10,10 @@ c - + c - @@ -32,11 +28,6 @@ c - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml index 44db7160..0a3e784f 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml +++ b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml @@ -1,15 +1,11 @@ - - - c - @@ -18,10 +14,6 @@ c - - - - diff --git a/tests/dictionaries/10valid_enum_leader/00-base.xml b/tests/dictionaries/10valid_enum_leader/00-base.xml index 27161903..d571785a 100644 --- a/tests/dictionaries/10valid_enum_leader/00-base.xml +++ b/tests/dictionaries/10valid_enum_leader/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,7 +9,6 @@ - @@ -26,9 +22,6 @@ follower2 - - - diff --git a/tests/dictionaries/10valid_enum_multi/00-base.xml b/tests/dictionaries/10valid_enum_multi/00-base.xml index 6ea4bfa1..6ff34085 100644 --- a/tests/dictionaries/10valid_enum_multi/00-base.xml +++ b/tests/dictionaries/10valid_enum_multi/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,6 @@ - @@ -20,9 +16,6 @@ c - - - diff --git a/tests/dictionaries/10valid_enum_none/00-base.xml b/tests/dictionaries/10valid_enum_none/00-base.xml index f03d3e1a..0de059b5 100644 --- a/tests/dictionaries/10valid_enum_none/00-base.xml +++ b/tests/dictionaries/10valid_enum_none/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,7 @@ - + b @@ -24,11 +21,6 @@ - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_number/00-base.xml b/tests/dictionaries/10valid_enum_number/00-base.xml index 2ab66988..d0e93af0 100644 --- a/tests/dictionaries/10valid_enum_number/00-base.xml +++ b/tests/dictionaries/10valid_enum_number/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,9 +7,8 @@ - + - @@ -23,10 +19,6 @@ - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_numberdefault/00-base.xml b/tests/dictionaries/10valid_enum_numberdefault/00-base.xml index 531b177f..dbc70d07 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/00-base.xml +++ b/tests/dictionaries/10valid_enum_numberdefault/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,11 +7,10 @@ - + 3 - @@ -24,11 +20,6 @@ 3 - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_value/00-base.xml b/tests/dictionaries/10valid_enum_value/00-base.xml index 1794b78e..fd8b959d 100644 --- a/tests/dictionaries/10valid_enum_value/00-base.xml +++ b/tests/dictionaries/10valid_enum_value/00-base.xml @@ -1,15 +1,11 @@ - - - b - @@ -19,9 +15,6 @@ c - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist/00-base.xml index 6a391d6b..7504d5de 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/00-base.xml +++ b/tests/dictionaries/11disabled_if_in_filelist/00-base.xml @@ -17,7 +17,6 @@ - @@ -28,9 +27,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml index 32c9fdb1..4a169edf 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml @@ -19,7 +19,6 @@ non - @@ -30,9 +29,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml index def894a2..bbe62203 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml @@ -20,7 +20,6 @@ non - @@ -31,9 +30,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml b/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml index 0c84e95b..6d8f6173 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml +++ b/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml @@ -19,7 +19,6 @@ non - @@ -28,9 +27,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml b/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml index e85efc4c..2508fe11 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml @@ -6,8 +6,6 @@ - - @@ -20,7 +18,6 @@ non - @@ -29,9 +26,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml index d97574cc..4537c1bc 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml @@ -19,7 +19,6 @@ non - @@ -32,9 +31,6 @@ afilllist - - - diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml b/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml index a091d1a7..8707e22d 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml @@ -16,7 +16,6 @@ non - @@ -29,9 +28,6 @@ afilllist - - - diff --git a/tests/dictionaries/20family_append/00-base.xml b/tests/dictionaries/20family_append/00-base.xml index 9941bac4..2a71d00f 100644 --- a/tests/dictionaries/20family_append/00-base.xml +++ b/tests/dictionaries/20family_append/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/20family_append/01-base.xml b/tests/dictionaries/20family_append/01-base.xml index 9ffc7dac..a0693ce4 100644 --- a/tests/dictionaries/20family_append/01-base.xml +++ b/tests/dictionaries/20family_append/01-base.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/20family_appendaccent/00-base.xml b/tests/dictionaries/20family_appendaccent/00-base.xml index 7057c75f..67c5d738 100644 --- a/tests/dictionaries/20family_appendaccent/00-base.xml +++ b/tests/dictionaries/20family_appendaccent/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -14,7 +11,6 @@ non - @@ -23,9 +19,6 @@ mode_conteneur_actif - - - diff --git a/tests/dictionaries/20family_appendaccent/01-base.xml b/tests/dictionaries/20family_appendaccent/01-base.xml index 4b835daa..dcb4413d 100644 --- a/tests/dictionaries/20family_appendaccent/01-base.xml +++ b/tests/dictionaries/20family_appendaccent/01-base.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/20family_appendaccent/02-base.xml b/tests/dictionaries/20family_appendaccent/02-base.xml index ddcecbf0..909bd4e6 100644 --- a/tests/dictionaries/20family_appendaccent/02-base.xml +++ b/tests/dictionaries/20family_appendaccent/02-base.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/20family_empty/00-base.xml b/tests/dictionaries/20family_empty/00-base.xml index 5d9d7073..3325774d 100644 --- a/tests/dictionaries/20family_empty/00-base.xml +++ b/tests/dictionaries/20family_empty/00-base.xml @@ -1,25 +1,13 @@ - - - non - - + - - - - - - family - - diff --git a/tests/dictionaries/20family_hidden/00-base.xml b/tests/dictionaries/20family_hidden/00-base.xml index 9941bac4..2a71d00f 100644 --- a/tests/dictionaries/20family_hidden/00-base.xml +++ b/tests/dictionaries/20family_hidden/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/20family_hidden/01-base.xml b/tests/dictionaries/20family_hidden/01-base.xml index 53f82a9e..ded4eeea 100644 --- a/tests/dictionaries/20family_hidden/01-base.xml +++ b/tests/dictionaries/20family_hidden/01-base.xml @@ -1,16 +1,6 @@ - - - - - - - - - diff --git a/tests/dictionaries/20family_mode/00-base.xml b/tests/dictionaries/20family_mode/00-base.xml index 74c33e51..f58d09d5 100644 --- a/tests/dictionaries/20family_mode/00-base.xml +++ b/tests/dictionaries/20family_mode/00-base.xml @@ -1,22 +1,12 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/20family_modeleadership/00-base.xml b/tests/dictionaries/20family_modeleadership/00-base.xml index a52b1256..b2192efd 100644 --- a/tests/dictionaries/20family_modeleadership/00-base.xml +++ b/tests/dictionaries/20family_modeleadership/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,7 +9,6 @@ - @@ -21,9 +17,6 @@ follower2 - - - diff --git a/tests/dictionaries/21family_change/00-base.xml b/tests/dictionaries/21family_change/00-base.xml index 8ac2b7b2..5a042b87 100644 --- a/tests/dictionaries/21family_change/00-base.xml +++ b/tests/dictionaries/21family_change/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/21family_change/01-base.xml b/tests/dictionaries/21family_change/01-base.xml index 10433943..7e335cc1 100644 --- a/tests/dictionaries/21family_change/01-base.xml +++ b/tests/dictionaries/21family_change/01-base.xml @@ -1,20 +1,10 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/21family_changeaccent/00-base.xml b/tests/dictionaries/21family_changeaccent/00-base.xml index 9c3c9676..523b30ca 100644 --- a/tests/dictionaries/21family_changeaccent/00-base.xml +++ b/tests/dictionaries/21family_changeaccent/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/21family_changeaccent/01-base.xml b/tests/dictionaries/21family_changeaccent/01-base.xml index 5ba9b1f6..47ef88e1 100644 --- a/tests/dictionaries/21family_changeaccent/01-base.xml +++ b/tests/dictionaries/21family_changeaccent/01-base.xml @@ -1,20 +1,10 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/21family_empty/00-base.xml b/tests/dictionaries/21family_empty/00-base.xml index 39654c7d..d99b2414 100644 --- a/tests/dictionaries/21family_empty/00-base.xml +++ b/tests/dictionaries/21family_empty/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -11,14 +8,7 @@ - - - - - - - diff --git a/tests/dictionaries/30mandatory_withoutvalue/00-base.xml b/tests/dictionaries/30mandatory_withoutvalue/00-base.xml index b4231102..a35bee0a 100644 --- a/tests/dictionaries/30mandatory_withoutvalue/00-base.xml +++ b/tests/dictionaries/30mandatory_withoutvalue/00-base.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/30mandatory_withvalue/00-base.xml b/tests/dictionaries/30mandatory_withvalue/00-base.xml index fcc28536..cbe896d5 100644 --- a/tests/dictionaries/30mandatory_withvalue/00-base.xml +++ b/tests/dictionaries/30mandatory_withvalue/00-base.xml @@ -1,20 +1,10 @@ - - - value - - - - - - - diff --git a/tests/dictionaries/40condition_base/00-base.xml b/tests/dictionaries/40condition_base/00-base.xml index fe19e698..cfc7b2a6 100644 --- a/tests/dictionaries/40condition_base/00-base.xml +++ b/tests/dictionaries/40condition_base/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -18,7 +15,6 @@ non - @@ -28,9 +24,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/40condition_fallback/00-base.xml b/tests/dictionaries/40condition_fallback/00-base.xml index f2f042ac..621036ae 100644 --- a/tests/dictionaries/40condition_fallback/00-base.xml +++ b/tests/dictionaries/40condition_fallback/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -20,7 +17,6 @@ non - @@ -31,9 +27,6 @@ disabled_family - - - diff --git a/tests/dictionaries/40condition_optional/00-base.xml b/tests/dictionaries/40condition_optional/00-base.xml index 2db75e7b..8099769b 100644 --- a/tests/dictionaries/40condition_optional/00-base.xml +++ b/tests/dictionaries/40condition_optional/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -25,9 +21,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml b/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml index d814f125..8d25428e 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml +++ b/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,7 +12,6 @@ non - @@ -27,9 +23,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/40ifin_leadership/00-base.xml b/tests/dictionaries/40ifin_leadership/00-base.xml index 9eb54040..e27da00e 100644 --- a/tests/dictionaries/40ifin_leadership/00-base.xml +++ b/tests/dictionaries/40ifin_leadership/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -25,7 +22,4 @@ follower1 - - - diff --git a/tests/dictionaries/40ifin_leadershipauto/00-base.xml b/tests/dictionaries/40ifin_leadershipauto/00-base.xml index 0d14016f..d4556f38 100644 --- a/tests/dictionaries/40ifin_leadershipauto/00-base.xml +++ b/tests/dictionaries/40ifin_leadershipauto/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -28,7 +25,4 @@ follower1 - - - diff --git a/tests/dictionaries/40ifin_multi/00-base.xml b/tests/dictionaries/40ifin_multi/00-base.xml index abb35cfd..33627872 100644 --- a/tests/dictionaries/40ifin_multi/00-base.xml +++ b/tests/dictionaries/40ifin_multi/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -30,9 +26,6 @@ mode_conteneur_actif3 - - - diff --git a/tests/dictionaries/50exists_exists/00-base.xml b/tests/dictionaries/50exists_exists/00-base.xml index f4f4f61f..c419dad1 100644 --- a/tests/dictionaries/50exists_exists/00-base.xml +++ b/tests/dictionaries/50exists_exists/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/50exists_exists/01-base.xml b/tests/dictionaries/50exists_exists/01-base.xml index 0376408d..765a7eb9 100644 --- a/tests/dictionaries/50exists_exists/01-base.xml +++ b/tests/dictionaries/50exists_exists/01-base.xml @@ -1,22 +1,12 @@ - - - oui - - - - - - - diff --git a/tests/dictionaries/50redefine_description/00-base.xml b/tests/dictionaries/50redefine_description/00-base.xml index c973121f..d482c3a1 100644 --- a/tests/dictionaries/50redefine_description/00-base.xml +++ b/tests/dictionaries/50redefine_description/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/50redefine_description/01-redefine.xml b/tests/dictionaries/50redefine_description/01-redefine.xml index bef6be40..494558cb 100644 --- a/tests/dictionaries/50redefine_description/01-redefine.xml +++ b/tests/dictionaries/50redefine_description/01-redefine.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/51exists_nonexists/00-base.xml b/tests/dictionaries/51exists_nonexists/00-base.xml index adecfbe4..c91df672 100644 --- a/tests/dictionaries/51exists_nonexists/00-base.xml +++ b/tests/dictionaries/51exists_nonexists/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,14 +9,7 @@ non - - - - - - - diff --git a/tests/dictionaries/51exists_nonexists/01-base.xml b/tests/dictionaries/51exists_nonexists/01-base.xml index edd34100..6fd6f1f5 100644 --- a/tests/dictionaries/51exists_nonexists/01-base.xml +++ b/tests/dictionaries/51exists_nonexists/01-base.xml @@ -1,22 +1,12 @@ - - - oui - - - - - - - diff --git a/tests/dictionaries/51redefine_auto/00-base.xml b/tests/dictionaries/51redefine_auto/00-base.xml index 086c1e48..4aba6f3e 100644 --- a/tests/dictionaries/51redefine_auto/00-base.xml +++ b/tests/dictionaries/51redefine_auto/00-base.xml @@ -1,15 +1,11 @@ - - - - @@ -17,9 +13,6 @@ non - - - diff --git a/tests/dictionaries/51redefine_auto/01-base.xml b/tests/dictionaries/51redefine_auto/01-base.xml index b7b6a0fb..17a39f9b 100644 --- a/tests/dictionaries/51redefine_auto/01-base.xml +++ b/tests/dictionaries/51redefine_auto/01-base.xml @@ -1,13 +1,9 @@ - - - - @@ -15,7 +11,4 @@ non - - - diff --git a/tests/dictionaries/51redefine_autofill/00-base.xml b/tests/dictionaries/51redefine_autofill/00-base.xml index 39d001c1..45c6114e 100644 --- a/tests/dictionaries/51redefine_autofill/00-base.xml +++ b/tests/dictionaries/51redefine_autofill/00-base.xml @@ -1,8 +1,5 @@ - - - diff --git a/tests/dictionaries/51redefine_autofill/01-base.xml b/tests/dictionaries/51redefine_autofill/01-base.xml index ab6b8177..712a6b98 100644 --- a/tests/dictionaries/51redefine_autofill/01-base.xml +++ b/tests/dictionaries/51redefine_autofill/01-base.xml @@ -1,13 +1,9 @@ - - - - @@ -15,7 +11,4 @@ non - - - diff --git a/tests/dictionaries/51redefine_family/00-base.xml b/tests/dictionaries/51redefine_family/00-base.xml index 8b34f2c9..d485fb0c 100644 --- a/tests/dictionaries/51redefine_family/00-base.xml +++ b/tests/dictionaries/51redefine_family/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -23,9 +19,6 @@ general2 - - - diff --git a/tests/dictionaries/51redefine_family/01-base.xml b/tests/dictionaries/51redefine_family/01-base.xml index f341f9e2..dbf23972 100644 --- a/tests/dictionaries/51redefine_family/01-base.xml +++ b/tests/dictionaries/51redefine_family/01-base.xml @@ -1,20 +1,10 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/51redefine_fill/00-base.xml b/tests/dictionaries/51redefine_fill/00-base.xml index 39d001c1..12e6ba60 100644 --- a/tests/dictionaries/51redefine_fill/00-base.xml +++ b/tests/dictionaries/51redefine_fill/00-base.xml @@ -1,15 +1,11 @@ - - - - @@ -17,9 +13,6 @@ oui - - - diff --git a/tests/dictionaries/51redefine_fill/01-base.xml b/tests/dictionaries/51redefine_fill/01-base.xml index b7b6a0fb..17a39f9b 100644 --- a/tests/dictionaries/51redefine_fill/01-base.xml +++ b/tests/dictionaries/51redefine_fill/01-base.xml @@ -1,13 +1,9 @@ - - - - @@ -15,7 +11,4 @@ non - - - diff --git a/tests/dictionaries/51redefine_fillauto/00-base.xml b/tests/dictionaries/51redefine_fillauto/00-base.xml index 833b6e54..d52173e5 100644 --- a/tests/dictionaries/51redefine_fillauto/00-base.xml +++ b/tests/dictionaries/51redefine_fillauto/00-base.xml @@ -1,15 +1,11 @@ - - - non - @@ -17,9 +13,6 @@ oui - - - diff --git a/tests/dictionaries/51redefine_fillauto/01-base.xml b/tests/dictionaries/51redefine_fillauto/01-base.xml index 3a960564..1c9d3331 100644 --- a/tests/dictionaries/51redefine_fillauto/01-base.xml +++ b/tests/dictionaries/51redefine_fillauto/01-base.xml @@ -1,13 +1,9 @@ - - - - @@ -15,7 +11,4 @@ non - - - diff --git a/tests/dictionaries/51redefine_help/00-base.xml b/tests/dictionaries/51redefine_help/00-base.xml index 64d717c8..e554e787 100644 --- a/tests/dictionaries/51redefine_help/00-base.xml +++ b/tests/dictionaries/51redefine_help/00-base.xml @@ -1,25 +1,12 @@ - - - - - - - - - - - redefine help - redefine help family - - diff --git a/tests/dictionaries/51redefine_help/01-base.xml b/tests/dictionaries/51redefine_help/01-base.xml index 480c426b..be1df993 100644 --- a/tests/dictionaries/51redefine_help/01-base.xml +++ b/tests/dictionaries/51redefine_help/01-base.xml @@ -1,17 +1,10 @@ - - - + + + - - - - - - redefine help ok - redefine help family ok - - diff --git a/tests/dictionaries/51redefine_hidden/00-base.xml b/tests/dictionaries/51redefine_hidden/00-base.xml index b473ea15..d480612b 100644 --- a/tests/dictionaries/51redefine_hidden/00-base.xml +++ b/tests/dictionaries/51redefine_hidden/00-base.xml @@ -1,22 +1,12 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/51redefine_hidden/01-redefine.xml b/tests/dictionaries/51redefine_hidden/01-redefine.xml index 65d1eeaa..94364be5 100644 --- a/tests/dictionaries/51redefine_hidden/01-redefine.xml +++ b/tests/dictionaries/51redefine_hidden/01-redefine.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/51redefine_remove_check/00-base.xml b/tests/dictionaries/51redefine_remove_check/00-base.xml index 0fbbb510..b979ceda 100644 --- a/tests/dictionaries/51redefine_remove_check/00-base.xml +++ b/tests/dictionaries/51redefine_remove_check/00-base.xml @@ -1,8 +1,5 @@ - - - diff --git a/tests/dictionaries/51redefine_remove_check/01-base.xml b/tests/dictionaries/51redefine_remove_check/01-base.xml index 2661f4f1..78363e65 100644 --- a/tests/dictionaries/51redefine_remove_check/01-base.xml +++ b/tests/dictionaries/51redefine_remove_check/01-base.xml @@ -1,20 +1,10 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/51redefine_remove_condition/00-base.xml b/tests/dictionaries/51redefine_remove_condition/00-base.xml index 9146f0dd..85656965 100644 --- a/tests/dictionaries/51redefine_remove_condition/00-base.xml +++ b/tests/dictionaries/51redefine_remove_condition/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -18,7 +15,6 @@ non - @@ -28,9 +24,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/51redefine_remove_condition/01-base.xml b/tests/dictionaries/51redefine_remove_condition/01-base.xml index 05c1c8b8..e11fe0c6 100644 --- a/tests/dictionaries/51redefine_remove_condition/01-base.xml +++ b/tests/dictionaries/51redefine_remove_condition/01-base.xml @@ -1,18 +1,8 @@ - - - - - - - - - - diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml b/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml index 7c42bfd4..0ad603c9 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -21,7 +18,6 @@ non - @@ -31,9 +27,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/51redefine_value/00-base.xml b/tests/dictionaries/51redefine_value/00-base.xml index ac8188ca..3a27320e 100644 --- a/tests/dictionaries/51redefine_value/00-base.xml +++ b/tests/dictionaries/51redefine_value/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -12,14 +9,7 @@ non - - - - - - - diff --git a/tests/dictionaries/51redefine_value/01-redefine.xml b/tests/dictionaries/51redefine_value/01-redefine.xml index 2db49451..af8a3d8c 100644 --- a/tests/dictionaries/51redefine_value/01-redefine.xml +++ b/tests/dictionaries/51redefine_value/01-redefine.xml @@ -1,8 +1,5 @@ - - - @@ -11,12 +8,6 @@ - - - - - - diff --git a/tests/dictionaries/51remove_fill/00-base.xml b/tests/dictionaries/51remove_fill/00-base.xml index 5bc01db8..d5a6d18c 100644 --- a/tests/dictionaries/51remove_fill/00-base.xml +++ b/tests/dictionaries/51remove_fill/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,6 @@ non - @@ -18,9 +14,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/52exists_redefine/00-base.xml b/tests/dictionaries/52exists_redefine/00-base.xml index 90e907b0..2b476718 100644 --- a/tests/dictionaries/52exists_redefine/00-base.xml +++ b/tests/dictionaries/52exists_redefine/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/52exists_redefine/01-base.xml b/tests/dictionaries/52exists_redefine/01-base.xml index bd823df2..f43f3172 100644 --- a/tests/dictionaries/52exists_redefine/01-base.xml +++ b/tests/dictionaries/52exists_redefine/01-base.xml @@ -1,8 +1,5 @@ - - - @@ -11,12 +8,6 @@ - - - - - - diff --git a/tests/dictionaries/60action_external/00-base.xml b/tests/dictionaries/60action_external/00-base.xml index bc7628d5..b0950adb 100644 --- a/tests/dictionaries/60action_external/00-base.xml +++ b/tests/dictionaries/60action_external/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml b/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml index 607bb5c1..12840066 100644 --- a/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml @@ -14,5 +14,4 @@ http://localhost/ - diff --git a/tests/dictionaries/60extra_externalspacecondition/00-base.xml b/tests/dictionaries/60extra_externalspacecondition/00-base.xml index 3067f3c0..f0375a2e 100644 --- a/tests/dictionaries/60extra_externalspacecondition/00-base.xml +++ b/tests/dictionaries/60extra_externalspacecondition/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -15,14 +12,7 @@ non - - - - - - - diff --git a/tests/dictionaries/60extra_help/00-base.xml b/tests/dictionaries/60extra_help/00-base.xml index 22be6cd9..1fe81917 100644 --- a/tests/dictionaries/60extra_help/00-base.xml +++ b/tests/dictionaries/60extra_help/00-base.xml @@ -18,12 +18,6 @@ - - - - - - diff --git a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml index 15a5a566..5e631398 100644 --- a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml @@ -6,7 +6,7 @@ Exportation de la base de ejabberd - + pre @@ -20,7 +20,4 @@ daily - - Test help - diff --git a/tests/dictionaries/60extra_load/00-base.xml b/tests/dictionaries/60extra_load/00-base.xml index 2e4fec44..48c2547c 100644 --- a/tests/dictionaries/60extra_load/00-base.xml +++ b/tests/dictionaries/60extra_load/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_mandatory/00-base.xml b/tests/dictionaries/60extra_mandatory/00-base.xml index 2e4fec44..48c2547c 100644 --- a/tests/dictionaries/60extra_mandatory/00-base.xml +++ b/tests/dictionaries/60extra_mandatory/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_name_family/00-base.xml b/tests/dictionaries/60extra_name_family/00-base.xml index 7304014f..f7909f48 100644 --- a/tests/dictionaries/60extra_name_family/00-base.xml +++ b/tests/dictionaries/60extra_name_family/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_redefine/00-base.xml b/tests/dictionaries/60extra_redefine/00-base.xml index 2e4fec44..48c2547c 100644 --- a/tests/dictionaries/60extra_redefine/00-base.xml +++ b/tests/dictionaries/60extra_redefine/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_separators/00-base.xml b/tests/dictionaries/60extra_separators/00-base.xml index 2e4fec44..48c2547c 100644 --- a/tests/dictionaries/60extra_separators/00-base.xml +++ b/tests/dictionaries/60extra_separators/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60familyaction/00-base.xml b/tests/dictionaries/60familyaction/00-base.xml index bc7628d5..b0950adb 100644 --- a/tests/dictionaries/60familyaction/00-base.xml +++ b/tests/dictionaries/60familyaction/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60familyaction/extra_dirs/extra/00-base.xml b/tests/dictionaries/60familyaction/extra_dirs/extra/00-base.xml index 31df7c1f..cee7b730 100644 --- a/tests/dictionaries/60familyaction/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60familyaction/extra_dirs/extra/00-base.xml @@ -6,7 +6,4 @@ - - - diff --git a/tests/dictionaries/60familyaction_accent/00-base.xml b/tests/dictionaries/60familyaction_accent/00-base.xml index bc7628d5..b0950adb 100644 --- a/tests/dictionaries/60familyaction_accent/00-base.xml +++ b/tests/dictionaries/60familyaction_accent/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60familyaction_accent/extra_dirs/extra/00-base.xml b/tests/dictionaries/60familyaction_accent/extra_dirs/extra/00-base.xml index 31df7c1f..cee7b730 100644 --- a/tests/dictionaries/60familyaction_accent/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60familyaction_accent/extra_dirs/extra/00-base.xml @@ -6,7 +6,4 @@ - - - diff --git a/tests/dictionaries/60familyaction_mandatory/00-base.xml b/tests/dictionaries/60familyaction_mandatory/00-base.xml index bc7628d5..b0950adb 100644 --- a/tests/dictionaries/60familyaction_mandatory/00-base.xml +++ b/tests/dictionaries/60familyaction_mandatory/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60familyaction_mandatory/extra_dirs/extra/00-base.xml b/tests/dictionaries/60familyaction_mandatory/extra_dirs/extra/00-base.xml index e6bf3faf..b23cfcb2 100644 --- a/tests/dictionaries/60familyaction_mandatory/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60familyaction_mandatory/extra_dirs/extra/00-base.xml @@ -4,10 +4,7 @@ 0 - + - - - diff --git a/tests/dictionaries/70container_files/00-base.xml b/tests/dictionaries/70container_files/00-base.xml index d07f06d0..41aa835f 100644 --- a/tests/dictionaries/70container_files/00-base.xml +++ b/tests/dictionaries/70container_files/00-base.xml @@ -16,14 +16,7 @@ oui - - - - - - - diff --git a/tests/dictionaries/70container_files_twice/00-base.xml b/tests/dictionaries/70container_files_twice/00-base.xml index 525227b4..999719ba 100644 --- a/tests/dictionaries/70container_files_twice/00-base.xml +++ b/tests/dictionaries/70container_files_twice/00-base.xml @@ -17,14 +17,7 @@ oui - - - - - - - diff --git a/tests/dictionaries/70container_filesmulti/00-base.xml b/tests/dictionaries/70container_filesmulti/00-base.xml index 94e431ec..e0a29f79 100644 --- a/tests/dictionaries/70container_filesmulti/00-base.xml +++ b/tests/dictionaries/70container_filesmulti/00-base.xml @@ -16,14 +16,7 @@ oui - - - - - - - diff --git a/tests/dictionaries/70container_filesredefine/00-base.xml b/tests/dictionaries/70container_filesredefine/00-base.xml index 33c10c0d..7650d10b 100644 --- a/tests/dictionaries/70container_filesredefine/00-base.xml +++ b/tests/dictionaries/70container_filesredefine/00-base.xml @@ -15,14 +15,7 @@ oui - - - - - - - diff --git a/tests/dictionaries/70container_new/00-base.xml b/tests/dictionaries/70container_new/00-base.xml index f9525ee9..eda8cdc8 100644 --- a/tests/dictionaries/70container_new/00-base.xml +++ b/tests/dictionaries/70container_new/00-base.xml @@ -14,14 +14,7 @@ oui - - - - - - - diff --git a/tests/dictionaries/70container_newnocont/00-base.xml b/tests/dictionaries/70container_newnocont/00-base.xml index e72c5a7a..44765892 100644 --- a/tests/dictionaries/70container_newnocont/00-base.xml +++ b/tests/dictionaries/70container_newnocont/00-base.xml @@ -14,14 +14,7 @@ non - - - - - - - diff --git a/tests/dictionaries/70container_newwithip/00-base.xml b/tests/dictionaries/70container_newwithip/00-base.xml index bc94a2bf..27bbcee2 100644 --- a/tests/dictionaries/70container_newwithip/00-base.xml +++ b/tests/dictionaries/70container_newwithip/00-base.xml @@ -15,14 +15,7 @@ - - - - - - - diff --git a/tests/dictionaries/70container_pathaccess/00-base.xml b/tests/dictionaries/70container_pathaccess/00-base.xml index e53c08ed..e4336f77 100644 --- a/tests/dictionaries/70container_pathaccess/00-base.xml +++ b/tests/dictionaries/70container_pathaccess/00-base.xml @@ -16,14 +16,7 @@ - - - - - - - diff --git a/tests/dictionaries/70container_pathaccess_leadership/00-base.xml b/tests/dictionaries/70container_pathaccess_leadership/00-base.xml index e70da268..c0ac9ab9 100644 --- a/tests/dictionaries/70container_pathaccess_leadership/00-base.xml +++ b/tests/dictionaries/70container_pathaccess_leadership/00-base.xml @@ -16,7 +16,6 @@ - @@ -24,9 +23,6 @@ nut_monitor_host - - - diff --git a/tests/dictionaries/70container_save/00-base.xml b/tests/dictionaries/70container_save/00-base.xml index 421369b7..35551231 100644 --- a/tests/dictionaries/70container_save/00-base.xml +++ b/tests/dictionaries/70container_save/00-base.xml @@ -1,23 +1,13 @@ - - - - - - - - - - diff --git a/tests/dictionaries/70container_serviceaccess/00-base.xml b/tests/dictionaries/70container_serviceaccess/00-base.xml index 8ff545f3..57a631bc 100644 --- a/tests/dictionaries/70container_serviceaccess/00-base.xml +++ b/tests/dictionaries/70container_serviceaccess/00-base.xml @@ -14,14 +14,7 @@ oui - - - - - - - diff --git a/tests/dictionaries/70container_servicerestriction/00-base.xml b/tests/dictionaries/70container_servicerestriction/00-base.xml index 8f2cb3cf..7eef4016 100644 --- a/tests/dictionaries/70container_servicerestriction/00-base.xml +++ b/tests/dictionaries/70container_servicerestriction/00-base.xml @@ -8,21 +8,13 @@ - - - - - - - - diff --git a/tests/dictionaries/70container_services/00-base.xml b/tests/dictionaries/70container_services/00-base.xml index 09c24b38..ceebed18 100644 --- a/tests/dictionaries/70container_services/00-base.xml +++ b/tests/dictionaries/70container_services/00-base.xml @@ -6,22 +6,13 @@ - - - - - - - - - diff --git a/tests/dictionaries/70services_unmanage/00-base.xml b/tests/dictionaries/70services_unmanage/00-base.xml index 06d0a07e..87aace2c 100644 --- a/tests/dictionaries/70services_unmanage/00-base.xml +++ b/tests/dictionaries/70services_unmanage/00-base.xml @@ -14,14 +14,7 @@ oui - - - - - - - From ccc69248661ce4a55ec89c76d459bdf497d6309f Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 23 Dec 2020 17:36:50 +0100 Subject: [PATCH 008/168] simplify objectspace --- src/rougail/annotator.py | 2 +- src/rougail/data/rougail.dtd | 10 +- src/rougail/objspace.py | 480 ++++++++---------- .../21family_change/makedict/base.json | 1 - .../21family_change/tiramisu/base.py | 16 - .../21family_changeaccent/__init__.py | 0 .../21family_changeaccent/makedict/base.json | 1 - .../tiramisu/__init__.py | 0 .../21family_changeaccent/tiramisu/base.py | 16 - .../60extra_redefine/tiramisu/base.py | 6 +- .../00-base.xml | 0 .../01-base.xml | 0 .../__init__.py | 0 .../00-base.xml | 0 .../01-base.xml | 0 .../__init__.py | 0 16 files changed, 207 insertions(+), 325 deletions(-) delete mode 100644 tests/dictionaries/21family_change/makedict/base.json delete mode 100644 tests/dictionaries/21family_change/tiramisu/base.py delete mode 100644 tests/dictionaries/21family_changeaccent/__init__.py delete mode 100644 tests/dictionaries/21family_changeaccent/makedict/base.json delete mode 100644 tests/dictionaries/21family_changeaccent/tiramisu/__init__.py delete mode 100644 tests/dictionaries/21family_changeaccent/tiramisu/base.py rename tests/dictionaries/{21family_change => 80family_change}/00-base.xml (100%) rename tests/dictionaries/{21family_change => 80family_change}/01-base.xml (100%) rename tests/dictionaries/{21family_change => 80family_change}/__init__.py (100%) rename tests/dictionaries/{21family_changeaccent => 80family_changeaccent}/00-base.xml (100%) rename tests/dictionaries/{21family_changeaccent => 80family_changeaccent}/01-base.xml (100%) rename tests/dictionaries/{21family_change/tiramisu => 80family_changeaccent}/__init__.py (100%) diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index 1162e567..cee0946d 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -1059,7 +1059,7 @@ class ConstraintAnnotator: for idx in indexes: fill = fills[idx] # test if it's redefined calculation - if fill.target in targets and not fill.redefine: + if fill.target in targets: xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}')) targets.append(fill.target) diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index c4fa78c3..e41596ee 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -50,21 +50,21 @@ - + - - + + - + - + diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index f297b6f2..af085b3d 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -1,20 +1,25 @@ """ -Creole flattener. Takes a bunch of Creole XML dispatched in differents folders -as an input and outputs a human readable flatened XML +Takes a bunch of Creole XML dispatched in differents folders +as an input and outputs a Tiramisu's file Sample usage:: + eolobj.space_visitor(func) + xml = eolobj.save() + + + >>> from rougail.objspace import CreoleObjSpace >>> eolobj = CreoleObjSpace('/usr/share/rougail/rougail.dtd') - >>> eolobj.create_or_populate_from_xml('rougail', ['/usr/share/eole/rougail/dicos']) - >>> eolobj.space_visitor() - >>> eolobj.save('/tmp/rougail_flatened_output.xml') + >>> eolobj.create_or_populate_from_xml('rougail', ['/usr/share/rougail/dicos']) + >>> eolobj.space_visitor('/usr/share/rougail/funcs.py') + >>> tiramisu = eolobj.save() The CreoleObjSpace - loads the XML into an internal CreoleObjSpace representation - visits/annotates the objects -- dumps the object space as XML output into a single XML target +- dumps the object space as Tiramisu string The visit/annotation stage is a complex step that corresponds to the Creole procedures. @@ -23,11 +28,9 @@ For example: a variable is redefined and shall be moved to another family means that a variable1 = Variable() object in the object space who lives in the family1 parent has to be moved in family2. The visit procedure changes the varable1's object space's parent. """ -from lxml.etree import Element, SubElement # pylint: disable=E0611 - from .i18n import _ from .xmlreflector import XMLReflector -from .annotator import ERASED_ATTRIBUTES, SpaceAnnotator +from .annotator import SpaceAnnotator from .tiramisureflector import TiramisuReflector from .utils import normalize_family from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError @@ -41,20 +44,8 @@ FORCE_UNREDEFINABLES = ('value',) # CreoleObjSpace's elements that shall be set to the UnRedefinable type UNREDEFINABLE = ('multi', 'type') -CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force_store_value', 'auto_freeze']} - -RENAME_ATTIBUTES = {'description': 'doc'} - FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target') -CONVERT_EXPORT = {'Leadership': 'leader', - 'Variable': 'variable', - 'Value': 'value', - 'Property': 'property', - 'Choice': 'choice', - 'Param': 'param', - 'Check': 'check', - } # _____________________________________________________________________________ # special types definitions for the Object Space's internal representation @@ -65,6 +56,18 @@ class RootCreoleObject: self.xmlfiles = xmlfiles +class Atom(RootCreoleObject): + pass + + +class Redefinable(RootCreoleObject): + pass + + +class UnRedefinable(RootCreoleObject): + pass + + class CreoleObjSpace: """DOM XML reflexion free internal representation of a Creole Dictionary """ @@ -77,11 +80,6 @@ class CreoleObjSpace: an Object Space's atom object is present only once in the object space's tree """ - Atom = type('Atom', (RootCreoleObject,), dict()) - "A variable that can't be redefined" - Redefinable = type('Redefinable', (RootCreoleObject,), dict()) - "A variable can be redefined" - UnRedefinable = type('UnRedefinable', (RootCreoleObject,), dict()) def __init__(self, dtdfilename): # pylint: disable=R0912 @@ -95,7 +93,6 @@ class CreoleObjSpace: self.xmlreflector = XMLReflector() self.xmlreflector.parse_dtd(dtdfilename) self.redefine_variables = None - self.fill_removed = None self.check_removed = None self.condition_removed = None @@ -116,25 +113,25 @@ class CreoleObjSpace: for dtd_elt in self.xmlreflector.dtd.iterelements(): attrs = {} if dtd_elt.name in FORCE_REDEFINABLES: - clstype = self.Redefinable + clstype = Redefinable + elif not dtd_elt.attributes() and dtd_elt.name not in FORCE_UNREDEFINABLES: + clstype = Atom else: - clstype = self.UnRedefinable - atomic = dtd_elt.name not in FORCE_UNREDEFINABLES and dtd_elt.name not in FORCE_REDEFINABLES + clstype = UnRedefinable forced_text_elt = dtd_elt.type == 'mixed' for dtd_attr in dtd_elt.iterattributes(): - atomic = False - if set(dtd_attr.itervalues()) == set(['True', 'False']): + if set(dtd_attr.itervalues()) == {'True', 'False'}: # it's a boolean self.booleans_attributs.append(dtd_attr.name) if dtd_attr.default_value: # set default value for this attribute default_value = dtd_attr.default_value if dtd_attr.name in self.booleans_attributs: - default_value = self.convert_boolean(dtd_attr.default_value) + default_value = self.convert_boolean(default_value) attrs[dtd_attr.name] = default_value if dtd_attr.name == 'redefine': # has a redefine attribute, so it's a Redefinable object - clstype = self.Redefinable + clstype = Redefinable if dtd_attr.name == 'name' and forced_text_elt: # child.text should be transform has a "name" attribute self.forced_text_elts.add(dtd_elt.name) @@ -142,22 +139,19 @@ class CreoleObjSpace: if forced_text_elt is True: self.forced_text_elts_as_name.add(dtd_elt.name) - if atomic: - # has any attribute so it's an Atomic object - clstype = self.Atom # create ObjectSpace object setattr(self, dtd_elt.name, type(dtd_elt.name.capitalize(), (clstype,), attrs)) def create_or_populate_from_xml(self, namespace, - xmlfolders): + xmlfolders, + ): """Parses a bunch of XML files populates the CreoleObjSpace """ for xmlfile, document in self.xmlreflector.load_xml_from_folders(xmlfolders): self.redefine_variables = [] - self.fill_removed = [] self.check_removed = [] self.condition_removed = [] self.xml_parse_document(xmlfile, @@ -175,51 +169,52 @@ class CreoleObjSpace: """Parses a Creole XML file populates the CreoleObjSpace """ + # var to check unique family name in a XML file family_names = [] for child in document: # this index enables us to reorder objects - self.index += 1 - # doesn't proceed the XML commentaries if not isinstance(child.tag, str): + # doesn't proceed the XML commentaries continue if child.tag == 'family': if child.attrib['name'] in family_names: raise DictConsistencyError(_(f'Family "{child.attrib["name"]}" is set several times in "{xmlfile}"')) family_names.append(child.attrib['name']) if child.tag == 'variables': + # variables has no name, so force namespace name child.attrib['name'] = namespace - if child.tag == 'value' and child.text == None: - # FIXME should not be here + if child.tag == 'value' and child.text is None: continue # variable objects creation try: - variableobj = self.generate_variableobj(xmlfile, - child, - space, - namespace, - ) + variableobj = self.get_variableobj(xmlfile, + child, + space, + namespace, + ) except SpaceObjShallNotBeUpdated: continue - self.set_text_to_obj(child, - variableobj, - ) - self.set_xml_attributes_to_obj(xmlfile, - child, - variableobj, - ) - self.variableobj_tree_visitor(child, - variableobj, - namespace, - ) - self.fill_variableobj_path_attribute(space, - child, - namespace, - document, - variableobj, - ) + self.index += 1 + self.set_text(child, + variableobj, + ) + self.set_attributes(xmlfile, + child, + variableobj, + ) + self.remove(child, + variableobj, + ) + self.set_path(space, + child, + namespace, + document, + variableobj, + ) self.add_to_tree_structure(variableobj, space, child, + namespace, ) if list(child) != []: self.xml_parse_document(xmlfile, @@ -228,34 +223,32 @@ class CreoleObjSpace: namespace, ) - def generate_variableobj(self, - xmlfile, - child, - space, - namespace, - ): + def get_variableobj(self, + xmlfile: str, + child: list, + space, + namespace, + ): """ instanciates or creates Creole Object Subspace objects """ - variableobj = getattr(self, child.tag)(xmlfile) - if isinstance(variableobj, self.Redefinable): - variableobj = self.create_or_update_redefinable_object(xmlfile, - child.attrib, - space, - child, - namespace, - ) - elif isinstance(variableobj, self.Atom) and child.tag in vars(space): - # instanciates an object from the CreoleObjSpace's builtins types - # example : child.tag = constraints -> a self.Constraints() object is created - # this Atom instance has to be a singleton here - # we do not re-create it, we reuse it - variableobj = getattr(space, child.tag) - self.create_tree_structure(space, - child, - variableobj, - ) - return variableobj + obj = getattr(self, child.tag) + if Redefinable in obj.__mro__: + return self.create_or_update_redefinable_object(xmlfile, + child.attrib, + space, + child, + namespace, + ) + elif Atom in obj.__mro__: + if child.tag in vars(space): + # Atom instance has to be a singleton here + # we do not re-create it, we reuse it + return getattr(space, child.tag) + return obj(xmlfile) + if child.tag not in vars(space): + setattr(space, child.tag, []) + return obj(xmlfile) def create_or_update_redefinable_object(self, xmlfile, @@ -264,59 +257,38 @@ class CreoleObjSpace: child, namespace, ): - """Creates or retrieves the space object that corresponds - to the `child` XML object - - Two attributes of the `child` XML object are important: - - - with the `redefine` boolean flag attribute we know whether - the corresponding space object shall be created or updated - - - `True` means that the corresponding space object shall be updated - - `False` means that the corresponding space object shall be created - - - with the `exists` boolean flag attribute we know whether - the corresponding space object shall be created - (or nothing -- that is the space object isn't modified) - - - `True` means that the corresponding space object shall be created - - `False` means that the corresponding space object is not updated - - In the special case `redefine` is True and `exists` is False, - we create the corresponding space object if it doesn't exist - and we update it if it exists. - - :return: the corresponding space object of the `child` XML object - """ if child.tag in self.forced_text_elts_as_name: name = child.text else: name = subspace['name'] if child.tag == 'family': name = normalize_family(name) - existed_var = self.is_already_exists(name, - space, - child, - namespace, - ) + existed_var = self.get_existed_obj(name, + space, + child, + namespace, + ) if existed_var: + # if redefine is set to object, default value is False + # otherwise it's always a redefinable object default_redefine = child.tag in FORCE_REDEFINABLES redefine = self.convert_boolean(subspace.get('redefine', default_redefine)) - exists = self.convert_boolean(subspace.get('exists', True)) if redefine is True: existed_var.xmlfiles.append(xmlfile) - return self.translate_in_space(name, - space, - child, - namespace, - ) - elif exists is False: + return existed_var + exists = self.convert_boolean(subspace.get('exists', True)) + if exists is False: raise SpaceObjShallNotBeUpdated() xmlfiles = self.display_xmlfiles(existed_var.xmlfiles) raise DictConsistencyError(_(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", already defined in {xmlfiles}')) - redefine = self.convert_boolean(subspace.get('redefine', False)) + # if this object must only be modified if object already exists exists = self.convert_boolean(subspace.get('exists', False)) - if redefine is False or exists is True: + if exists is True: + raise SpaceObjShallNotBeUpdated() + redefine = self.convert_boolean(subspace.get('redefine', False)) + if redefine is False: + if child.tag not in vars(space): + setattr(space, child.tag, {}) return getattr(self, child.tag)(xmlfile) raise DictConsistencyError(_(f'Redefined object in "{xmlfile}": "{name}" does not exist yet')) @@ -327,41 +299,22 @@ class CreoleObjSpace: return '"' + xmlfiles[0] + '"' return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"' - def create_tree_structure(self, - space, - child, - variableobj, - ): # pylint: disable=R0201 - """ - Builds the tree structure of the object space here - we set services attributes in order to be populated later on - for example:: - - space = Family() - space.variable = dict() - another example: - space = Variable() - space.value = list() - """ - if child.tag not in vars(space): - if isinstance(variableobj, self.Redefinable): - setattr(space, child.tag, dict()) - elif isinstance(variableobj, self.UnRedefinable): - setattr(space, child.tag, []) - elif not isinstance(variableobj, self.Atom): # pragma: no cover - raise OperationError(_("Creole object {} " - "has a wrong type").format(type(variableobj))) - - def is_already_exists(self, - name: str, - space: str, - child, - namespace: str, - ): + def get_existed_obj(self, + name: str, + space: str, + child, + namespace: str, + ): if isinstance(space, self.family): # pylint: disable=E1101 if namespace != Config['variable_namespace']: name = space.path + '.' + name if self.paths.path_is_defined(name): + old_family_name = self.paths.get_variable_family_name(name) + if namespace != Config['variable_namespace']: + old_family_name = namespace + '.' + old_family_name + if space.path != old_family_name: + xmlfiles = self.display_xmlfiles(space.xmlfiles) + raise DictConsistencyError(_(f'Variable was previously create in family "{old_family_name}", now it is in "{space.path}" in {xmlfiles}')) return self.paths.get_variable_obj(name) return children = getattr(space, child.tag, {}) @@ -377,49 +330,59 @@ class CreoleObjSpace: return True elif value == 'False': return False + raise TypeError(_('{} is not True or False').format(value)) # pragma: no cover + + def set_text(self, + child, + variableobj, + ): + if child.text is None: + return + text = child.text.strip() + if not text: + return + if child.tag in self.forced_text_elts_as_name: + variableobj.name = text else: - raise TypeError(_('{} is not True or False').format(value)) # pragma: no cover + variableobj.text = text - def translate_in_space(self, - name, - family, - variable, - namespace, - ): - if not isinstance(family, self.family): # pylint: disable=E1101 - return getattr(family, variable.tag)[name] - if namespace == Config['variable_namespace']: - path = name - else: - path = family.path + '.' + name - old_family_name = self.paths.get_variable_family_name(path) - if family.path == old_family_name: - return getattr(family, variable.tag)[name] - old_family = self.space.variables[namespace].family[old_family_name] # pylint: disable=E1101 - variable_obj = old_family.variable[name] - del old_family.variable[name] - if 'variable' not in vars(family): - family.variable = dict() - family.variable[name] = variable_obj - self.paths.add_variable(namespace, - name, - family.name, - False, - variable_obj, - ) - return variable_obj + def set_attributes(self, + xmlfile, + child, + variableobj, + ): + redefine = self.convert_boolean(child.attrib.get('redefine', False)) + if redefine and child.tag == 'variable': + # delete old values + has_value = hasattr(variableobj, 'value') + if has_value and len(child) != 0: + del variableobj.value + for attr, val in child.attrib.items(): + if redefine and attr in UNREDEFINABLE: + xmlfiles = self.display_xmlfiles(variableobj.xmlfiles[:-1]) + raise DictConsistencyError(_(f'cannot redefine attribute "{attr}" for variable "{child.attrib["name"]}" in "{xmlfile}", already defined in {xmlfiles}')) + if attr in self.booleans_attributs: + val = self.convert_boolean(val) + if attr == 'name' and getattr(variableobj, 'name', None): + # do not redefine name + continue + setattr(variableobj, attr, val) - def remove_fill(self, name): # pylint: disable=C0111 - if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'fill'): - remove_fills= [] - for idx, fill in enumerate(self.space.constraints.fill): # pylint: disable=E1101 - if hasattr(fill, 'target') and fill.target == name: - remove_fills.append(idx) - - remove_fills = list(set(remove_fills)) - remove_fills.sort(reverse=True) - for idx in remove_fills: - self.space.constraints.fill.pop(idx) # pylint: disable=E1101 + def remove(self, + child, + variableobj, + ): + """Creole object tree manipulations + """ + if child.tag == 'variable': + if child.attrib.get('remove_check', False): + self.remove_check(variableobj.name) + if child.attrib.get('remove_condition', False): + self.remove_condition(variableobj.name) + if child.attrib.get('remove_fill', False): + self.remove_fill(variableobj.name) + if child.tag == 'fill' and child.attrib['target'] in self.redefine_variables: + self.remove_fill(child.attrib['target']) def remove_check(self, name): # pylint: disable=C0111 if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'check'): @@ -441,93 +404,27 @@ class CreoleObjSpace: for idx in remove_conditions: del self.space.constraints.condition[idx] - def add_to_tree_structure(self, - variableobj, - space, - child, - ): # pylint: disable=R0201 - if isinstance(variableobj, self.Redefinable): - name = variableobj.name - if child.tag == 'family': - name = normalize_family(name) - getattr(space, child.tag)[name] = variableobj - elif isinstance(variableobj, self.UnRedefinable): - getattr(space, child.tag).append(variableobj) - else: - setattr(space, child.tag, variableobj) + def remove_fill(self, name): # pylint: disable=C0111 + if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'fill'): + remove_fills= [] + for idx, fill in enumerate(self.space.constraints.fill): # pylint: disable=E1101 + if hasattr(fill, 'target') and fill.target == name: + remove_fills.append(idx) - def set_text_to_obj(self, - child, - variableobj, - ): - if child.text is None: - text = None - else: - text = child.text.strip() - if text: - if child.tag in self.forced_text_elts_as_name: - variableobj.name = text - else: - variableobj.text = text + remove_fills = list(set(remove_fills)) + remove_fills.sort(reverse=True) + for idx in remove_fills: + self.space.constraints.fill.pop(idx) # pylint: disable=E1101 - def set_xml_attributes_to_obj(self, - xmlfile, - child, - variableobj, - ): - redefine = self.convert_boolean(child.attrib.get('redefine', False)) - has_value = hasattr(variableobj, 'value') - if redefine is True and child.tag == 'variable' and has_value and len(child) != 0: - del variableobj.value - for attr, val in child.attrib.items(): - if redefine and attr in UNREDEFINABLE: - # UNREDEFINABLE concerns only 'variable' node so we can fix name - # to child.attrib['name'] - name = child.attrib['name'] - xmlfiles = self.display_xmlfiles(variableobj.xmlfiles[:-1]) - raise DictConsistencyError(_(f'cannot redefine attribute "{attr}" for variable "{name}" in "{xmlfile}", already defined in {xmlfiles}')) - if attr in self.booleans_attributs: - val = self.convert_boolean(val) - if not (attr == 'name' and getattr(variableobj, 'name', None) != None): - setattr(variableobj, attr, val) - keys = list(vars(variableobj).keys()) - - def variableobj_tree_visitor(self, - child, - variableobj, - namespace, - ): - """Creole object tree manipulations - """ - if child.tag == 'variable': - if child.attrib.get('remove_check', False): - self.remove_check(variableobj.name) - if child.attrib.get('remove_condition', False): - self.remove_condition(variableobj.name) - if child.attrib.get('remove_fill', False): - self.remove_fill(variableobj.name) - if child.tag == 'fill': - # if variable is a redefine in current dictionary - # XXX not working with variable not in variable and in leader/followers - variableobj.redefine = child.attrib['target'] in self.redefine_variables - if child.attrib['target'] in self.redefine_variables and child.attrib['target'] not in self.fill_removed: - self.remove_fill(child.attrib['target']) - self.fill_removed.append(child.attrib['target']) - if not hasattr(variableobj, 'index'): - variableobj.index = self.index - variableobj.namespace = namespace - - def fill_variableobj_path_attribute(self, - space, - child, - namespace, - document, - variableobj, - ): # pylint: disable=R0913 + def set_path(self, + space, + child, + namespace, + document, + variableobj, + ): # pylint: disable=R0913 """Fill self.paths attributes """ - if isinstance(space, self.help): # pylint: disable=E1101 - return if child.tag == 'variable': family_name = document.attrib['name'] family_name = normalize_family(family_name) @@ -554,6 +451,25 @@ class CreoleObjSpace: ) variableobj.path = self.paths.get_family_path(family_name, namespace) + def add_to_tree_structure(self, + variableobj, + space, + child, + namespace, + ): # pylint: disable=R0201 + if not hasattr(variableobj, 'index'): + variableobj.index = self.index + variableobj.namespace = namespace + if isinstance(variableobj, Redefinable): + name = variableobj.name + if child.tag == 'family': + name = normalize_family(name) + getattr(space, child.tag)[name] = variableobj + elif isinstance(variableobj, UnRedefinable): + getattr(space, child.tag).append(variableobj) + else: + setattr(space, child.tag, variableobj) + def space_visitor(self, eosfunc_file): # pylint: disable=C0111 self.funcs_path = eosfunc_file SpaceAnnotator(self, eosfunc_file) diff --git a/tests/dictionaries/21family_change/makedict/base.json b/tests/dictionaries/21family_change/makedict/base.json deleted file mode 100644 index 40871a66..00000000 --- a/tests/dictionaries/21family_change/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.other.mode_conteneur_actif1": "non"} diff --git a/tests/dictionaries/21family_change/tiramisu/base.py b/tests/dictionaries/21family_change/tiramisu/base.py deleted file mode 100644 index 0c85ccbd..00000000 --- a/tests/dictionaries/21family_change/tiramisu/base.py +++ /dev/null @@ -1,16 +0,0 @@ -from importlib.machinery import SourceFileLoader -func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() -for key, value in dict(locals()).items(): - if key != ['SourceFileLoader', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = OptionDescription(name='other', doc='other', properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/21family_changeaccent/__init__.py b/tests/dictionaries/21family_changeaccent/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dictionaries/21family_changeaccent/makedict/base.json b/tests/dictionaries/21family_changeaccent/makedict/base.json deleted file mode 100644 index ef4e8007..00000000 --- a/tests/dictionaries/21family_changeaccent/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.otherwithe.mode_conteneur_actif1": "non"} diff --git a/tests/dictionaries/21family_changeaccent/tiramisu/__init__.py b/tests/dictionaries/21family_changeaccent/tiramisu/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dictionaries/21family_changeaccent/tiramisu/base.py b/tests/dictionaries/21family_changeaccent/tiramisu/base.py deleted file mode 100644 index c355200d..00000000 --- a/tests/dictionaries/21family_changeaccent/tiramisu/base.py +++ /dev/null @@ -1,16 +0,0 @@ -from importlib.machinery import SourceFileLoader -func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() -for key, value in dict(locals()).items(): - if key != ['SourceFileLoader', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='Général', properties=frozenset({'normal'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = OptionDescription(name='otherwithe', doc='Otherwithé', properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/60extra_redefine/tiramisu/base.py b/tests/dictionaries/60extra_redefine/tiramisu/base.py index 8703416c..2af3c290 100644 --- a/tests/dictionaries/60extra_redefine/tiramisu/base.py +++ b/tests/dictionaries/60extra_redefine/tiramisu/base.py @@ -12,9 +12,9 @@ option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_7 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) -option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) -option_9 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') +option_7 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') +option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) +option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7, option_8, option_9]) option_5 = OptionDescription(name='extra', doc='extra', children=[option_6]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5]) diff --git a/tests/dictionaries/21family_change/00-base.xml b/tests/dictionaries/80family_change/00-base.xml similarity index 100% rename from tests/dictionaries/21family_change/00-base.xml rename to tests/dictionaries/80family_change/00-base.xml diff --git a/tests/dictionaries/21family_change/01-base.xml b/tests/dictionaries/80family_change/01-base.xml similarity index 100% rename from tests/dictionaries/21family_change/01-base.xml rename to tests/dictionaries/80family_change/01-base.xml diff --git a/tests/dictionaries/21family_change/__init__.py b/tests/dictionaries/80family_change/__init__.py similarity index 100% rename from tests/dictionaries/21family_change/__init__.py rename to tests/dictionaries/80family_change/__init__.py diff --git a/tests/dictionaries/21family_changeaccent/00-base.xml b/tests/dictionaries/80family_changeaccent/00-base.xml similarity index 100% rename from tests/dictionaries/21family_changeaccent/00-base.xml rename to tests/dictionaries/80family_changeaccent/00-base.xml diff --git a/tests/dictionaries/21family_changeaccent/01-base.xml b/tests/dictionaries/80family_changeaccent/01-base.xml similarity index 100% rename from tests/dictionaries/21family_changeaccent/01-base.xml rename to tests/dictionaries/80family_changeaccent/01-base.xml diff --git a/tests/dictionaries/21family_change/tiramisu/__init__.py b/tests/dictionaries/80family_changeaccent/__init__.py similarity index 100% rename from tests/dictionaries/21family_change/tiramisu/__init__.py rename to tests/dictionaries/80family_changeaccent/__init__.py From 54df7aca125720357cb728c6df6156f6b74900cd Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 23 Dec 2020 17:39:21 +0100 Subject: [PATCH 009/168] Creole => Rougail --- src/rougail/__init__.py | 4 +-- src/rougail/objspace.py | 56 ++++++++++++++++++--------------------- tests/test_1_flattener.py | 4 +-- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/rougail/__init__.py b/src/rougail/__init__.py index 84d6d9e8..6fa753fc 100644 --- a/src/rougail/__init__.py +++ b/src/rougail/__init__.py @@ -1,5 +1,5 @@ #from .loader import load -from .objspace import CreoleObjSpace +from .objspace import RougailObjSpace from .annotator import modes -__ALL__ = ('CreoleObjSpace', 'modes') +__ALL__ = ('RougailObjSpace', 'modes') diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index af085b3d..c709075a 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -1,5 +1,5 @@ """ -Takes a bunch of Creole XML dispatched in differents folders +Takes a bunch of Rougail XML dispatched in differents folders as an input and outputs a Tiramisu's file Sample usage:: @@ -9,24 +9,20 @@ Sample usage:: - >>> from rougail.objspace import CreoleObjSpace - >>> eolobj = CreoleObjSpace('/usr/share/rougail/rougail.dtd') + >>> from rougail.objspace import RougailObjSpace + >>> eolobj = RougailObjSpace('/usr/share/rougail/rougail.dtd') >>> eolobj.create_or_populate_from_xml('rougail', ['/usr/share/rougail/dicos']) >>> eolobj.space_visitor('/usr/share/rougail/funcs.py') >>> tiramisu = eolobj.save() -The CreoleObjSpace +The RougailObjSpace -- loads the XML into an internal CreoleObjSpace representation +- loads the XML into an internal RougailObjSpace representation - visits/annotates the objects - dumps the object space as Tiramisu string -The visit/annotation stage is a complex step that corresponds to the Creole +The visit/annotation stage is a complex step that corresponds to the Rougail procedures. - -For example: a variable is redefined and shall be moved to another family -means that a variable1 = Variable() object in the object space who lives in the family1 parent -has to be moved in family2. The visit procedure changes the varable1's object space's parent. """ from .i18n import _ from .xmlreflector import XMLReflector @@ -37,11 +33,11 @@ from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyErr from .path import Path from .config import Config -# CreoleObjSpace's elements like 'family' or 'follower', that shall be forced to the Redefinable type +# RougailObjSpace's elements like 'family' or 'follower', that shall be forced to the Redefinable type FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables') -# CreoleObjSpace's elements that shall be forced to the UnRedefinable type +# RougailObjSpace's elements that shall be forced to the UnRedefinable type FORCE_UNREDEFINABLES = ('value',) -# CreoleObjSpace's elements that shall be set to the UnRedefinable type +# RougailObjSpace's elements that shall be set to the UnRedefinable type UNREDEFINABLE = ('multi', 'type') FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target') @@ -49,32 +45,32 @@ FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target') # _____________________________________________________________________________ # special types definitions for the Object Space's internal representation -class RootCreoleObject: +class RootRougailObject: def __init__(self, xmlfiles): if not isinstance(xmlfiles, list): xmlfiles = [xmlfiles] self.xmlfiles = xmlfiles -class Atom(RootCreoleObject): +class Atom(RootRougailObject): pass -class Redefinable(RootCreoleObject): +class Redefinable(RootRougailObject): pass -class UnRedefinable(RootCreoleObject): +class UnRedefinable(RootRougailObject): pass -class CreoleObjSpace: - """DOM XML reflexion free internal representation of a Creole Dictionary +class RougailObjSpace: + """DOM XML reflexion free internal representation of a Rougail Dictionary """ - choice = type('Choice', (RootCreoleObject,), dict()) - property_ = type('Property', (RootCreoleObject,), dict()) - # Creole ObjectSpace's Leadership variable class type - Leadership = type('Leadership', (RootCreoleObject,), dict()) + choice = type('Choice', (RootRougailObject,), dict()) + property_ = type('Property', (RootRougailObject,), dict()) + # Rougail ObjectSpace's Leadership variable class type + Leadership = type('Leadership', (RootRougailObject,), dict()) """ This Atom type stands for singleton, that is an Object Space's atom object is present only once in the @@ -108,7 +104,7 @@ class CreoleObjSpace: """Create Rougail ObjectSpace class types, it enables us to create objects like: File(), Variable(), Ip(), Family(), Constraints()... and so on. - Creole ObjectSpace is an object's reflexion of the XML elements""" + Rougail ObjectSpace is an object's reflexion of the XML elements""" for dtd_elt in self.xmlreflector.dtd.iterelements(): attrs = {} @@ -148,7 +144,7 @@ class CreoleObjSpace: xmlfolders, ): """Parses a bunch of XML files - populates the CreoleObjSpace + populates the RougailObjSpace """ for xmlfile, document in self.xmlreflector.load_xml_from_folders(xmlfolders): self.redefine_variables = [] @@ -166,8 +162,8 @@ class CreoleObjSpace: space, namespace, ): - """Parses a Creole XML file - populates the CreoleObjSpace + """Parses a Rougail XML file + populates the RougailObjSpace """ # var to check unique family name in a XML file family_names = [] @@ -230,7 +226,7 @@ class CreoleObjSpace: namespace, ): """ - instanciates or creates Creole Object Subspace objects + instanciates or creates Rougail Object Subspace objects """ obj = getattr(self, child.tag) if Redefinable in obj.__mro__: @@ -322,7 +318,7 @@ class CreoleObjSpace: return children[name] def convert_boolean(self, value): # pylint: disable=R0201 - """Boolean coercion. The Creole XML may contain srings like `True` or `False` + """Boolean coercion. The Rougail XML may contain srings like `True` or `False` """ if isinstance(value, bool): return value @@ -372,7 +368,7 @@ class CreoleObjSpace: child, variableobj, ): - """Creole object tree manipulations + """Rougail object tree manipulations """ if child.tag == 'variable': if child.attrib.get('remove_check', False): diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 15b6be2b..1fe241fe 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -54,7 +54,7 @@ def test_dir_error(request): def launch_flattener(test_dir, test_ok=False): - eolobj = objspace.CreoleObjSpace(Config['dtdfilename']) + eolobj = objspace.RougailObjSpace(Config['dtdfilename']) dirs = [test_dir] subfolder = join(test_dir, 'subfolder') if isdir(subfolder): @@ -113,4 +113,4 @@ def test_error_dictionary(test_dir_error): def test_no_dtd(): with raises(IOError): - eolobj = objspace.CreoleObjSpace('notexists.dtd') + eolobj = objspace.RougailObjSpace('notexists.dtd') From 4223e7e5a3188f04819a1d00c1172855aa858421 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 23 Dec 2020 17:57:41 +0100 Subject: [PATCH 010/168] automaticly create choice/property_/Leadership object --- src/rougail/annotator.py | 16 ++++++++-------- src/rougail/objspace.py | 39 ++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index cee0946d..217a7e01 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -144,13 +144,13 @@ class GroupAnnotator: break elif variable.name == leader_name: # it's a leader - if isinstance(variable, self.objectspace.Leadership): + if isinstance(variable, self.objectspace.leadership): # append follower to an existed leadership leader_space = variable # if variable.hidden: # leader_is_hidden = True else: - leader_space = self.objectspace.Leadership(variable.xmlfiles) + leader_space = self.objectspace.leadership(variable.xmlfiles) if hasattr(group, 'name'): leadership_name = group.name else: @@ -540,7 +540,7 @@ class VariableAnnotator: family.name = normalize_family(family.name) if hasattr(family, 'variable'): for variable in family.variable.values(): - if isinstance(variable, self.objectspace.Leadership): + if isinstance(variable, self.objectspace.leadership): for idx, follower in enumerate(variable.variable): if idx == 0: variable_type = 'master' @@ -591,7 +591,7 @@ class VariableAnnotator: for family in variables.family.values(): if hasattr(family, 'variable'): for variable in family.variable.values(): - if isinstance(variable, self.objectspace.Leadership): + if isinstance(variable, self.objectspace.leadership): for follower in variable.variable: _convert_auto_freeze(follower, namespace) else: @@ -753,7 +753,7 @@ class ConstraintAnnotator: variable = self.objectspace.paths.get_variable_obj(target.name) family = self.objectspace.paths.get_family_obj(target.name.rsplit('.', 1)[0]) # it's a leader, so apply property to leadership - if isinstance(family, self.objectspace.Leadership) and family.name == variable.name: + if isinstance(family, self.objectspace.leadership) and family.name == variable.name: return family, family.variable return variable, [variable] # it's a family @@ -1151,7 +1151,7 @@ class FamilyAnnotator: for family in family.family.values(): mode = modes_level[-1] for variable in family.variable.values(): - if isinstance(variable, self.objectspace.Leadership): + if isinstance(variable, self.objectspace.leadership): variable_mode = variable.variable[0].mode variable.variable[0].mode = None variable.mode = variable_mode @@ -1217,7 +1217,7 @@ class FamilyAnnotator: if hasattr(family, 'variable'): for variable in family.variable.values(): - if isinstance(variable, self.objectspace.Leadership): + if isinstance(variable, self.objectspace.leadership): mode = modes_level[-1] for idx, follower in enumerate(variable.variable): if follower.auto_save is True: @@ -1284,7 +1284,7 @@ class PropertyAnnotator: self.convert_property(family) if hasattr(family, 'variable'): for variable in family.variable.values(): - if isinstance(variable, self.objectspace.Leadership): + if isinstance(variable, self.objectspace.leadership): self.convert_property(variable) for follower in variable.variable: self.convert_property(follower) diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index c709075a..e48b4470 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -33,13 +33,15 @@ from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyErr from .path import Path from .config import Config -# RougailObjSpace's elements like 'family' or 'follower', that shall be forced to the Redefinable type +# RougailObjSpace's elements that shall be forced to the Redefinable type FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables') # RougailObjSpace's elements that shall be forced to the UnRedefinable type FORCE_UNREDEFINABLES = ('value',) -# RougailObjSpace's elements that shall be set to the UnRedefinable type +# RougailObjSpace's elements that shall not be modify UNREDEFINABLE = ('multi', 'type') - +# RougailObjSpace's elements that did not created automaticly +FORCE_ELEMENTS = ('choice', 'property_', 'leadership') +# XML text are convert has name FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target') @@ -64,35 +66,26 @@ class UnRedefinable(RootRougailObject): pass +class ObjSpace: + """ + Base object space + """ + pass + + class RougailObjSpace: """DOM XML reflexion free internal representation of a Rougail Dictionary """ - choice = type('Choice', (RootRougailObject,), dict()) - property_ = type('Property', (RootRougailObject,), dict()) - # Rougail ObjectSpace's Leadership variable class type - Leadership = type('Leadership', (RootRougailObject,), dict()) - """ - This Atom type stands for singleton, that is - an Object Space's atom object is present only once in the - object space's tree - """ def __init__(self, dtdfilename): # pylint: disable=R0912 self.index = 0 - class ObjSpace: # pylint: disable=R0903 - """ - Base object space - """ self.space = ObjSpace() self.paths = Path() self.xmlreflector = XMLReflector() self.xmlreflector.parse_dtd(dtdfilename) self.redefine_variables = None - self.check_removed = None - self.condition_removed = None - # ['variable', 'separator', 'family'] self.forced_text_elts = set() self.forced_text_elts_as_name = set(FORCED_TEXT_ELTS_AS_NAME) self.list_conditions = {} @@ -138,6 +131,12 @@ class RougailObjSpace: # create ObjectSpace object setattr(self, dtd_elt.name, type(dtd_elt.name.capitalize(), (clstype,), attrs)) + for elt in FORCE_ELEMENTS: + name = elt.capitalize() + if name.endswith('_'): + name = name[:-1] + setattr(self, elt, type(name, (RootRougailObject,), dict())) + self.Leadership = self.leadership def create_or_populate_from_xml(self, namespace, @@ -148,8 +147,6 @@ class RougailObjSpace: """ for xmlfile, document in self.xmlreflector.load_xml_from_folders(xmlfolders): self.redefine_variables = [] - self.check_removed = [] - self.condition_removed = [] self.xml_parse_document(xmlfile, document, self.space, From 91fd7c9b7ea05c86f6cf7bbf79156cd4e2d0c54e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 07:38:48 +0100 Subject: [PATCH 011/168] dtd error --- src/rougail/annotator.py | 1292 ----------------- .../00-base.xml | 14 +- .../51exists_redefine/01-base.xml | 15 + .../__init__.py | 0 .../51exists_redefine/makedict/base.json | 1 + .../51exists_redefine/tiramisu/__init__.py | 0 .../51exists_redefine/tiramisu/base.py | 14 + .../dictionaries/51redefine_multi/00-base.xml | 10 - .../51redefine_multi/01-redefine.xml | 10 - .../dictionaries/51redefine_type/00-base.xml | 10 - .../51redefine_type/01-redefine.xml | 10 - .../60extra_externalspace/00-base.xml | 10 - .../60extra_externalspaceauto/00-base.xml | 10 - .../00-base.xml | 10 - .../00-base.xml | 10 - .../dictionaries/80check_unknown/00-base.xml | 7 - .../80check_unknown_var/00-base.xml | 7 - .../80condition_itself/00-base.xml | 1 - .../80condition_not_exists_error/00-base.xml | 6 - .../00-base.xml | 7 - .../dictionaries/80family_several/00-base.xml | 6 - tests/dictionaries/80fill_error/00-base.xml | 4 - tests/dictionaries/80fill_multi/00-base.xml | 7 - .../80hidden_if_in_filelist/00-base.xml | 4 - .../80leadership_auto_save/00-base.xml | 6 - .../80leadership_autofreeze/00-base.xml | 6 - .../00-base.xml | 6 - .../80leadership_not_ordered/00-base.xml | 6 - .../80leadership_not_same_family/00-base.xml | 6 - .../80leadership_notexists/00-base.xml | 6 - .../80redefine_double_error/00-base.xml | 9 - .../dictionaries/80redefine_error/00-base.xml | 9 - .../80redefine_error/01-redefine.xml | 10 - .../80redefine_helperror/01-base.xml | 17 - .../80redefine_notexists/00-base.xml | 10 - .../80redefine_notexists/01-redefine.xml | 10 - .../80separator_multi/00-base.xml | 9 - .../80separator_multi2/00-base.xml | 9 - .../80separator_multi2/01-base.xml | 9 - .../80separator_nonexists/00-base.xml | 9 - .../88valid_enum_not_number/00-base.xml | 8 - .../00-base.xml | 9 - 42 files changed, 31 insertions(+), 1588 deletions(-) delete mode 100644 src/rougail/annotator.py rename tests/dictionaries/{80redefine_helperror => 51exists_redefine}/00-base.xml (57%) create mode 100644 tests/dictionaries/51exists_redefine/01-base.xml rename tests/dictionaries/{80redefine_helperror => 51exists_redefine}/__init__.py (100%) create mode 100644 tests/dictionaries/51exists_redefine/makedict/base.json create mode 100644 tests/dictionaries/51exists_redefine/tiramisu/__init__.py create mode 100644 tests/dictionaries/51exists_redefine/tiramisu/base.py delete mode 100644 tests/dictionaries/80redefine_helperror/01-base.xml diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py deleted file mode 100644 index 217a7e01..00000000 --- a/src/rougail/annotator.py +++ /dev/null @@ -1,1292 +0,0 @@ -# coding: utf-8 -from copy import copy -from typing import List - -from collections import OrderedDict -from os.path import join, basename -from ast import literal_eval -from importlib.machinery import SourceFileLoader - - -from .i18n import _ -from .utils import normalize_family -from .error import DictConsistencyError - -#mode order is important -modes_level = ('basic', 'normal', 'expert') - - -class Mode(object): - def __init__(self, name, level): - self.name = name - self.level = level - def __gt__(self, other): - return other.level < self.level - - -def mode_factory(): - mode_obj = {} - for idx in range(len(modes_level)): - name = modes_level[idx] - mode_obj[name] = Mode(name, idx) - return mode_obj - -modes = mode_factory() - - -CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), - 'float': dict(opttype="FloatOption", func=float), - 'choice': dict(opttype="ChoiceOption"), - 'string': dict(opttype="StrOption"), - 'password': dict(opttype="PasswordOption"), - 'mail': dict(opttype="EmailOption"), - 'boolean': dict(opttype="BoolOption"), - 'symlink': dict(opttype="SymLinkOption"), - 'filename': dict(opttype="FilenameOption"), - 'date': dict(opttype="DateOption"), - 'unix_user': dict(opttype="UsernameOption"), - 'ip': dict(opttype="IPOption", initkwargs={'allow_reserved': True}), - 'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, 'warnings_only': True}), - 'netmask': dict(opttype="NetmaskOption"), - 'network': dict(opttype="NetworkOption"), - 'broadcast': dict(opttype="BroadcastOption"), - 'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}), - 'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}), - 'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}), - 'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}), - 'port': dict(opttype="PortOption", initkwargs={'allow_private': True}), - 'mac': dict(opttype="MACOption"), - 'cidr': dict(opttype="IPOption", initkwargs={'cidr': True}), - 'network_cidr': dict(opttype="NetworkOption", initkwargs={'cidr': True}), - } - - -# a CreoleObjSpace's attribute has some annotations -# that shall not be present in the exported (flatened) XML -ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace', - 'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership', - 'level', 'remove_fill', 'xmlfiles') -ERASED_CONTAINER_ATTRIBUTES = ('id', 'container', 'group_id', 'group', 'container_group') - -FORCE_CHOICE = {'oui/non': ['oui', 'non'], - 'on/off': ['on', 'off'], - 'yes/no': ['yes', 'no'], - 'schedule': ['none', 'daily', 'weekly', 'monthly'], - 'schedulemod': ['pre', 'post']} - -KEY_TYPE = {'variable': 'symlink', - 'SymLinkOption': 'symlink', - 'PortOption': 'port', - 'UnicodeOption': 'string', - 'NetworkOption': 'network', - 'NetmaskOption': 'netmask', - 'URLOption': 'web_address', - 'FilenameOption': 'filename'} - -FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' - -PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze', - 'force_store_value', 'disabled', 'mandatory') -CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force_store_value', 'auto_freeze']} - -RENAME_ATTIBUTES = {'description': 'doc'} -INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier'] - -class SpaceAnnotator: - """Transformations applied on a CreoleObjSpace instance - """ - def __init__(self, objectspace, eosfunc_file): - self.objectspace = objectspace - GroupAnnotator(objectspace) - ServiceAnnotator(objectspace) - VariableAnnotator(objectspace) - ConstraintAnnotator(objectspace, - eosfunc_file, - ) - FamilyAnnotator(objectspace) - PropertyAnnotator(objectspace) - - -class GroupAnnotator: - def __init__(self, - objectspace, - ): - self.objectspace = objectspace - if not hasattr(self.objectspace.space, 'constraints') or not hasattr(self.objectspace.space.constraints, 'group'): - return - self.convert_groups() - - def convert_groups(self): # pylint: disable=C0111 - for group in self.objectspace.space.constraints.group: - leader_fullname = group.leader - leader_family_name = self.objectspace.paths.get_variable_family_name(leader_fullname) - leader_name = self.objectspace.paths.get_variable_name(leader_fullname) - namespace = self.objectspace.paths.get_variable_namespace(leader_fullname) - if '.' not in leader_fullname: - leader_fullname = '.'.join([namespace, leader_family_name, leader_fullname]) - follower_names = list(group.follower.keys()) - has_a_leader = False - ori_leader_family = self.objectspace.paths.get_family_obj(leader_fullname.rsplit('.', 1)[0]) - for variable in list(ori_leader_family.variable.values()): - if has_a_leader: - # it's a follower - self.manage_follower(namespace, - leader_family_name, - variable, - leadership_name, - follower_names, - leader_space, - leader_is_hidden, - ) - ori_leader_family.variable.pop(variable.name) - if follower_names == []: - # no more follower - break - elif variable.name == leader_name: - # it's a leader - if isinstance(variable, self.objectspace.leadership): - # append follower to an existed leadership - leader_space = variable - # if variable.hidden: - # leader_is_hidden = True - else: - leader_space = self.objectspace.leadership(variable.xmlfiles) - if hasattr(group, 'name'): - leadership_name = group.name - else: - leadership_name = leader_name - leader_is_hidden = self.manage_leader(leader_space, - leader_family_name, - leadership_name, - leader_name, - namespace, - variable, - group, - leader_fullname, - ) - has_a_leader = True - else: - raise DictConsistencyError(_('cannot found followers "{}"').format('", "'.join(follower_names))) - del self.objectspace.space.constraints.group - - def manage_leader(self, - leader_space: 'Leadership', - leader_family_name: str, - leadership_name: str, - leader_name: str, - namespace: str, - variable: 'Variable', - group: 'Group', - leader_fullname: str, - ) -> None: - # manage leader's variable - if variable.multi is not True: - raise DictConsistencyError(_('the variable {} in a group must be multi').format(variable.name)) - leader_space.variable = [] - leader_space.name = leadership_name - leader_space.hidden = variable.hidden - if variable.hidden: - leader_is_hidden = True - variable.frozen = True - variable.force_default_on_freeze = True - else: - leader_is_hidden = False - variable.hidden = None - if hasattr(group, 'description'): - leader_space.doc = group.description - elif hasattr(variable, 'description'): - leader_space.doc = variable.description - else: - leader_space.doc = variable.name - leadership_path = namespace + '.' + leader_family_name + '.' + leadership_name - self.objectspace.paths.add_family(namespace, - leadership_path, - leader_space, - ) - leader_family = self.objectspace.space.variables[namespace].family[leader_family_name] - leader_family.variable[leader_name] = leader_space - leader_space.variable.append(variable) - self.objectspace.paths.set_leader(namespace, - leader_family_name, - leader_name, - leader_name, - ) - leader_space.path = leader_fullname - return leader_is_hidden - - def manage_follower(self, - namespace: str, - leader_family_name: str, - variable: 'Variable', - leader_name: str, - follower_names: List[str], - leader_space: 'Leadership', - leader_is_hidden: bool, - ) -> None: - if variable.name != follower_names[0]: - raise DictConsistencyError(_('cannot found this follower {}').format(follower_names[0])) - follower_names.remove(variable.name) - if leader_is_hidden: - variable.frozen = True - variable.force_default_on_freeze = True - leader_space.variable.append(variable) # pylint: disable=E1101 - self.objectspace.paths.set_leader(namespace, - leader_family_name, - variable.name, - leader_name, - ) - - -class ServiceAnnotator: - """Manage service's object - for example:: - - - - 123 - - - - """ - def __init__(self, objectspace): - self.objectspace = objectspace - self.convert_services() - - def convert_services(self): - if not hasattr(self.objectspace.space, 'services'): - return - if not hasattr(self.objectspace.space.services, 'service'): - del self.objectspace.space.services - return - self.objectspace.space.services.hidden = True - self.objectspace.space.services.name = 'services' - self.objectspace.space.services.doc = 'services' - families = {} - for idx, service_name in enumerate(self.objectspace.space.services.service.keys()): - service = self.objectspace.space.services.service[service_name] - new_service = self.objectspace.service(service.xmlfiles) - for elttype, values in vars(service).items(): - if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES: - setattr(new_service, elttype, values) - continue - eltname = elttype + 's' - path = '.'.join(['services', service_name, eltname]) - family = self.gen_family(eltname, - path, - service.xmlfiles, - ) - if isinstance(values, dict): - values = list(values.values()) - family.family = self.make_group_from_elts(service_name, - elttype, - values, - path, - ) - setattr(new_service, elttype, family) - new_service.doc = new_service.name - families[service_name] = new_service - self.objectspace.space.services.service = families - - def gen_family(self, - name, - path, - xmlfiles - ): - family = self.objectspace.family(xmlfiles) - family.name = normalize_family(name) - family.doc = name - family.mode = None - self.objectspace.paths.add_family('services', - path, - family, - ) - return family - - def make_group_from_elts(self, - service_name, - name, - elts, - path, - ): - """Splits each objects into a group (and `OptionDescription`, in tiramisu terms) - and build elements and its attributes (the `Options` in tiramisu terms) - """ - families = [] - new_elts = self._reorder_elts(name, - elts, - ) - for index, elt_info in enumerate(new_elts): - elt = elt_info['elt'] - elt_name = elt_info['elt_name'] - - # try to launch _update_xxxx() function - update_elt = '_update_' + elt_name - if hasattr(self, update_elt): - getattr(self, update_elt)(elt, - index, - path, - service_name, - ) - - idx = 0 - while True: - if hasattr(elt, 'source'): - c_name = elt.source - else: - c_name = elt.name - if idx: - c_name += f'_{idx}' - subpath = '{}.{}'.format(path, c_name) - if not self.objectspace.paths.family_is_defined(subpath): - break - idx += 1 - family = self.gen_family(c_name, - subpath, - elt.xmlfiles, - ) - family.variable = [] - listname = '{}list'.format(name) - activate_path = '.'.join([subpath, 'activate']) - for key in dir(elt): - if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES: - continue - value = getattr(elt, key) - if key == listname: - self.objectspace.list_conditions.setdefault(listname, - {}).setdefault( - value, - []).append(activate_path) - continue - family.variable.append(self._generate_element(elt_name, - key, - value, - elt, - f'{subpath}.{key}' - )) - # FIXME ne devrait pas etre True par défaut - # devrait etre un calcule - family.variable.append(self._generate_element(elt_name, - 'activate', - True, - elt, - activate_path, - )) - families.append(family) - return families - - def _generate_element(self, - elt_name, - key, - value, - elt, - path, - ): - variable = self.objectspace.variable(elt.xmlfiles) - variable.name = normalize_family(key) - variable.mode = None - if key == 'name': - true_key = elt_name - else: - true_key = key - dtd_key_type = true_key + '_type' - if key == 'activate': - type_ = 'boolean' - elif hasattr(elt, dtd_key_type): - type_ = KEY_TYPE[getattr(elt, dtd_key_type)] - elif key in self.objectspace.booleans_attributs: - type_ = 'boolean' - else: - type_ = 'string' - variable.type = type_ - if type_ == 'symlink': - variable.opt = self.objectspace.paths.get_variable_path(value, - 'services', - ) -# variable.opt = value - variable.multi = None - else: - variable.doc = key - val = self.objectspace.value(elt.xmlfiles) - val.type = type_ - val.name = value - variable.value = [val] - self.objectspace.paths.add_variable('services', - path, - 'service', - False, - variable, - ) - return variable - - def _reorder_elts(self, - name, - elts, - ): - """Reorders by index the elts - """ - new_elts = {} - # reorder elts by index - for idx, elt in enumerate(elts): - new_elts.setdefault(idx, []).append(elt) - idxes = list(new_elts.keys()) - idxes.sort() - result_elts = [] - for idx in idxes: - for elt in new_elts[idx]: - result_elts.append({'elt_name': name, 'elt': elt}) - return result_elts - - def _update_override(self, - file_, - index, - service_path, - service_name, - ): - file_.name = f'/systemd/system/{service_name}.service.d/rougail.conf' - # retrieve default value from File object - for attr in ['owner', 'group', 'mode']: - setattr(file_, attr, getattr(self.objectspace.file, attr)) - if not hasattr(file_, 'source'): - file_.source = f'{service_name}.service' - self._update_file(file_, - index, - service_path, - service_name, - ) - - def _update_file(self, - file_, - index, - service_path, - service_name, - ): - if not hasattr(file_, 'file_type') or file_.file_type == "UnicodeOption": - if not hasattr(file_, 'source'): - file_.source = basename(file_.name) - elif not hasattr(file_, 'source'): - raise DictConsistencyError(_('attribute source mandatory for file with variable name for {}').format(file_.name)) - - -class VariableAnnotator: - def __init__(self, - objectspace, - ): - self.objectspace = objectspace - self.convert_variable() - self.convert_auto_freeze() - self.convert_separators() - - def convert_variable(self): - def _convert_variable(variable, - variable_type, - ): - if not hasattr(variable, 'type'): - variable.type = 'string' - if variable.type != 'symlink' and not hasattr(variable, 'description'): - variable.description = variable.name - if hasattr(variable, 'value'): - for value in variable.value: - if not hasattr(value, 'type'): - value.type = variable.type - value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name) - for key, value in RENAME_ATTIBUTES.items(): - setattr(variable, value, getattr(variable, key)) - setattr(variable, key, None) - if variable_type == 'follower': - if variable.multi is True: - variable.multi = 'submulti' - else: - variable.multi = True - - def _convert_valid_enum(namespace, - variable, - path, - ): - if variable.type in FORCE_CHOICE: - check = self.objectspace.check(variable.xmlfiles) - check.name = 'valid_enum' - check.target = path - check.namespace = namespace - check.param = [] - for value in FORCE_CHOICE[variable.type]: - param = self.objectspace.param(variable.xmlfiles) - param.text = value - check.param.append(param) - if not hasattr(self.objectspace.space, 'constraints'): - self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) - self.objectspace.space.constraints.namespace = namespace - if not hasattr(self.objectspace.space.constraints, 'check'): - self.objectspace.space.constraints.check = [] - self.objectspace.space.constraints.check.append(check) - variable.type = 'string' - - def _valid_type(variable): - if variable.type not in CONVERT_OPTION: - xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - raise DictConsistencyError(_(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlfiles}')) - - if not hasattr(self.objectspace.space, 'variables'): - return - for families in self.objectspace.space.variables.values(): - namespace = families.name - if hasattr(families, 'family'): - families.doc = families.name - for family in families.family.values(): - family.doc = family.name - for key, value in RENAME_ATTIBUTES.items(): - if hasattr(family, key): - setattr(family, value, getattr(family, key)) - setattr(family, key, None) - family.name = normalize_family(family.name) - if hasattr(family, 'variable'): - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - for idx, follower in enumerate(variable.variable): - if idx == 0: - variable_type = 'master' - else: - variable_type = 'follower' - path = '{}.{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name, follower.name) - _convert_variable(follower, - variable_type, - ) - _convert_valid_enum(namespace, - follower, - path, - ) - _valid_type(follower) - else: - path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name) - _convert_variable(variable, - 'variable', - ) - _convert_valid_enum(namespace, - variable, - path, - ) - _valid_type(variable) - - def convert_auto_freeze(self): # pylint: disable=C0111 - def _convert_auto_freeze(variable, namespace): - if variable.auto_freeze: - new_condition = self.objectspace.condition(variable.xmlfiles) - new_condition.name = 'auto_hidden_if_not_in' - new_condition.namespace = namespace - new_condition.source = FREEZE_AUTOFREEZE_VARIABLE - new_param = self.objectspace.param(variable.xmlfiles) - new_param.text = 'oui' - new_condition.param = [new_param] - new_target = self.objectspace.target(variable.xmlfiles) - new_target.type = 'variable' - path = variable.namespace + '.' + normalize_family(family.name) + '.' + variable.name - new_target.name = path - new_condition.target = [new_target] - if not hasattr(self.objectspace.space.constraints, 'condition'): - self.objectspace.space.constraints.condition = [] - self.objectspace.space.constraints.condition.append(new_condition) - if hasattr(self.objectspace.space, 'variables'): - for variables in self.objectspace.space.variables.values(): - if hasattr(variables, 'family'): - namespace = variables.name - for family in variables.family.values(): - if hasattr(family, 'variable'): - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - for follower in variable.variable: - _convert_auto_freeze(follower, namespace) - else: - _convert_auto_freeze(variable, namespace) - - def convert_separators(self): # pylint: disable=C0111,R0201 - if not hasattr(self.objectspace.space, 'variables'): - return - for family in self.objectspace.space.variables.values(): - if not hasattr(family, 'separators'): - continue - if hasattr(family.separators, 'separator'): - for idx, separator in enumerate(family.separators.separator): - option = self.objectspace.paths.get_variable_obj(separator.name) - if hasattr(option, 'separator'): - subpath = self.objectspace.paths.get_variable_path(separator.name, - separator.namespace, - ) - xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles) - raise DictConsistencyError(_(f'{subpath} already has a separator in {xmlfiles}')) - option.separator = separator.text - del family.separators - - -class ConstraintAnnotator: - def __init__(self, - objectspace, - eosfunc_file, - ): - if not hasattr(objectspace.space, 'constraints'): - return - self.objectspace = objectspace - eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() - self.functions = dir(eosfunc) - self.functions.extend(INTERNAL_FUNCTIONS) - self.valid_enums = {} - if hasattr(self.objectspace.space.constraints, 'check'): - self.check_check() - self.check_replace_text() - self.check_valid_enum() - self.check_change_warning() - self.convert_check() - if hasattr(self.objectspace.space.constraints, 'condition'): - self.check_params_target() - self.filter_targets() - self.convert_xxxlist_to_variable() - self.check_condition_fallback_optional() - self.check_choice_option_condition() - self.remove_condition_with_empty_target() - self.convert_condition() - if hasattr(self.objectspace.space.constraints, 'fill'): - self.convert_fill() - self.remove_constraints() - - def check_check(self): - remove_indexes = [] - for check_idx, check in enumerate(self.objectspace.space.constraints.check): - if not check.name in self.functions: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'cannot find check function "{check.name}" in {xmlfiles}')) - if hasattr(check, 'param'): - param_option_indexes = [] - for idx, param in enumerate(check.param): - if param.type == 'variable' and not self.objectspace.paths.path_is_defined(param.text): - if param.optional is True: - param_option_indexes.append(idx) - else: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'cannot find check param "{param.text}" in {xmlfiles}')) - if param.type != 'variable': - param.notraisepropertyerror = None - param_option_indexes = list(set(param_option_indexes)) - param_option_indexes.sort(reverse=True) - for idx in param_option_indexes: - check.param.pop(idx) - if check.param == []: - remove_indexes.append(check_idx) - remove_indexes.sort(reverse=True) - for idx in remove_indexes: - del self.objectspace.space.constraints.check[idx] - - def check_replace_text(self): - for check_idx, check in enumerate(self.objectspace.space.constraints.check): - namespace = check.namespace - if hasattr(check, 'param'): - for idx, param in enumerate(check.param): - if param.type == 'variable': - param.text = self.objectspace.paths.get_variable_path(param.text, namespace) - check.is_in_leadership = self.objectspace.paths.get_leader(check.target) != None - # let's replace the target by the path - check.target = self.objectspace.paths.get_variable_path(check.target, namespace) - - def check_valid_enum(self): - remove_indexes = [] - for idx, check in enumerate(self.objectspace.space.constraints.check): - if check.name == 'valid_enum': - if check.target in self.valid_enums: - old_xmlfiles = self.objectspace.display_xmlfiles(self.valid_enums[check.target]['xmlfiles']) - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?')) - if not hasattr(check, 'param'): - raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}')) - variable = self.objectspace.paths.get_variable_obj(check.target) - values = self.load_params_in_valid_enum(check.param, - variable.name, - variable.type, - ) - self._set_valid_enum(variable, - values, - variable.type, - check.target, - check.xmlfiles, - ) - remove_indexes.append(idx) - remove_indexes.sort(reverse=True) - for idx in remove_indexes: - del self.objectspace.space.constraints.check[idx] - - def load_params_in_valid_enum(self, - params, - variable_name, - variable_type, - ): - has_variable = None - values = [] - for param in params: - if param.type == 'variable': - if has_variable is not None: - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) - has_variable = True - variable = self.objectspace.paths.get_variable_obj(param.text) - if not variable.multi: - raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable {variable_name}')) - values = param.text - else: - if has_variable: - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) - if not hasattr(param, 'text'): - if param.type == 'number': - raise DictConsistencyError(_(f'value is mandatory for valid_enum of variable {variable_name}')) - values.append(None) - else: - values.append(param.text) - return values - - def check_change_warning(self): - #convert level to "warnings_only" - for check in self.objectspace.space.constraints.check: - if check.level == 'warning': - check.warnings_only = True - else: - check.warnings_only = False - check.level = None - - def _get_family_variables_from_target(self, - target, - ): - if target.type == 'variable': - variable = self.objectspace.paths.get_variable_obj(target.name) - family = self.objectspace.paths.get_family_obj(target.name.rsplit('.', 1)[0]) - # it's a leader, so apply property to leadership - if isinstance(family, self.objectspace.leadership) and family.name == variable.name: - return family, family.variable - return variable, [variable] - # it's a family - variable = self.objectspace.paths.get_family_obj(target.name) - return variable, list(variable.variable.values()) - - def check_params_target(self): - for condition in self.objectspace.space.constraints.condition: - if not hasattr(condition, 'target'): - raise DictConsistencyError(_('target is mandatory in condition')) - for target in condition.target: - if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']: - raise DictConsistencyError(_(f'target in condition for {target.type} not allow in {condition.name}')) - - def filter_targets(self): # pylint: disable=C0111 - for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): - namespace = condition.namespace - for idx, target in enumerate(condition.target): - if target.type == 'variable': - if condition.source == target.name: - raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source)) - try: - target_names = [normalize_family(name) for name in target.name.split('.')] - target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace) - except DictConsistencyError: - # for optional variable - pass - elif target.type == 'family': - try: - target_names = [normalize_family(name) for name in target.name.split('.')] - target.name = self.objectspace.paths.get_family_path('.'.join(target_names), namespace) - except KeyError: - raise DictConsistencyError(_('cannot found family {}').format(target.name)) - - def convert_xxxlist_to_variable(self): # pylint: disable=C0111 - # transform *list to variable or family - for condition_idx, condition in enumerate(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: - variable = self.objectspace.paths.get_variable_obj(listvar) - type_ = 'variable' - new_target = self.objectspace.target(variable.xmlfiles) - new_target.type = type_ - new_target.name = listvar - new_target.index = target.index - 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_optional(self): - # a condition with a fallback **and** the source variable doesn't exist - remove_conditions = [] - for idx, condition in enumerate(self.objectspace.space.constraints.condition): - # fallback - if condition.fallback is True and not self.objectspace.paths.path_is_defined(condition.source): - apply_action = False - if condition.name in ['disabled_if_in', 'mandatory_if_in', 'hidden_if_in']: - apply_action = not condition.force_condition_on_fallback - else: - apply_action = condition.force_inverse_condition_on_fallback - if apply_action: - actions = self._get_condition_actions(condition.name) - for target in condition.target: - leader_or_variable, variables = self._get_family_variables_from_target(target) - for action_idx, action in enumerate(actions): - if action_idx == 0: - setattr(leader_or_variable, action, True) - else: - for variable in variables: - setattr(variable, action, True) - remove_conditions.append(idx) - continue - - remove_targets = [] - # optional - for idx, target in enumerate(condition.target): - if target.optional is True and not self.objectspace.paths.path_is_defined(target.name): - remove_targets.append(idx) - remove_targets = list(set(remove_targets)) - remove_targets.sort(reverse=True) - for idx in remove_targets: - condition.target.pop(idx) - remove_conditions = list(set(remove_conditions)) - remove_conditions.sort(reverse=True) - for idx in remove_conditions: - self.objectspace.space.constraints.condition.pop(idx) - - def _get_condition_actions(self, condition_name): - if condition_name.startswith('disabled_if_'): - return ['disabled'] - elif condition_name.startswith('hidden_if_'): - return ['hidden', 'frozen', 'force_default_on_freeze'] - elif condition_name.startswith('mandatory_if_'): - return ['mandatory'] - elif condition_name == 'auto_hidden_if_not_in': - return ['auto_frozen'] - - def check_choice_option_condition(self): - # remove condition for ChoiceOption that don't have param - remove_conditions = [] - for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): - namespace = condition.namespace - condition.source = self.objectspace.paths.get_variable_path(condition.source, namespace, allow_source=True) - src_variable = self.objectspace.paths.get_variable_obj(condition.source) - valid_enum = None - if condition.source in self.valid_enums and self.valid_enums[condition.source]['type'] == 'string': - valid_enum = self.valid_enums[condition.source]['values'] - if valid_enum is not None: - remove_param = [] - for param_idx, param in enumerate(condition.param): - if param.text not in valid_enum: - remove_param.append(param_idx) - remove_param.sort(reverse=True) - for idx in remove_param: - del condition.param[idx] - if condition.param == []: - remove_targets = [] - for target in condition.target: - leader_or_variable, variables = self._get_family_variables_from_target(target) - if condition.name == 'disabled_if_not_in': - leader_or_variable.disabled = True - elif condition.name == 'hidden_if_not_in': - leader_or_variable.hidden = True - for variable in variables: - variable.frozen = True - variable.force_default_on_freeze = True - elif condition.name == 'mandatory_if_not_in': - variable.mandatory = True - remove_targets = list(set(remove_targets)) - remove_targets.sort(reverse=True) - for target_idx in remove_targets: - condition.target.pop(target_idx) - remove_conditions.append(condition_idx) - remove_conditions = list(set(remove_conditions)) - remove_conditions.sort(reverse=True) - for idx in remove_conditions: - self.objectspace.space.constraints.condition.pop(idx) - - def remove_condition_with_empty_target(self): - remove_conditions = [] - for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): - if not condition.target: - remove_conditions.append(condition_idx) - remove_conditions = list(set(remove_conditions)) - remove_conditions.sort(reverse=True) - for idx in remove_conditions: - self.objectspace.space.constraints.condition.pop(idx) - - def convert_condition(self): - for condition in self.objectspace.space.constraints.condition: - inverse = condition.name.endswith('_if_not_in') - actions = self._get_condition_actions(condition.name) - for param in condition.param: - text = getattr(param, 'text', None) - for target in condition.target: - leader_or_variable, variables = self._get_family_variables_from_target(target) - # if option is already disable, do not apply disable_if_in - # check only the first action (example of multiple actions: 'hidden', 'frozen', 'force_default_on_freeze') - main_action = actions[0] - if getattr(leader_or_variable, main_action, False) is True: - continue - for idx, action in enumerate(actions): - prop = self.objectspace.property_(leader_or_variable.xmlfiles) - prop.type = 'calculation' - prop.inverse = inverse - prop.source = condition.source - prop.expected = text - prop.name = action - if idx == 0: - # main action is for the variable or family - if not hasattr(leader_or_variable, 'property'): - leader_or_variable.property = [] - leader_or_variable.property.append(prop) - else: - # other actions are set to the variable or children of family - for variable in variables: - if not hasattr(variable, 'property'): - variable.property = [] - variable.property.append(prop) - del self.objectspace.space.constraints.condition - - def _set_valid_enum(self, - variable, - values, - type_, - target: str, - xmlfiles: List[str], - ): - # value for choice's variable is mandatory - variable.mandatory = True - # build choice - variable.choice = [] - if isinstance(values, str): - choice = self.objectspace.choice() - choice.type = 'calculation' - choice.name = values - variable.choice.append(choice) - else: - self.valid_enums[target] = {'type': type_, - 'values': values, - 'xmlfiles': xmlfiles, - } - choices = [] - for value in values: - choice = self.objectspace.choice(variable.xmlfiles) - try: - if value is not None: - choice.name = CONVERT_OPTION[type_].get('func', str)(value) - else: - choice.name = value - except: - raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"')) - if choice.name == '': - choice.name = None - choices.append(choice.name) - choice.type = type_ - variable.choice.append(choice) - # check value or set first choice value has default value - if hasattr(variable, 'value'): - for value in variable.value: - value.type = type_ - try: - cvalue = CONVERT_OPTION[type_].get('func', str)(value.name) - except: - raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"')) - if cvalue not in choices: - raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices)) - else: - new_value = self.objectspace.value(variable.xmlfiles) - new_value.name = choices[0] - new_value.type = type_ - variable.value = [new_value] - if not variable.choice: - raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name)) - variable.type = 'choice' - - def convert_check(self): - for check in self.objectspace.space.constraints.check: - variable = self.objectspace.paths.get_variable_obj(check.target) - name = check.name - if name == 'valid_entier': - if not hasattr(check, 'param'): - raise DictConsistencyError(_('{} must have, at least, 1 param').format(name)) - for param in check.param: - if param.type not in ['string', 'number']: - raise DictConsistencyError(_(f'param in "valid_entier" must not be a "{param.type}"')) - if param.name == 'mini': - variable.min_number = int(param.text) - elif param.name == 'maxi': - variable.max_number = int(param.text) - else: - raise DictConsistencyError(_(f'unknown parameter {param.text} in check "valid_entier" for variable {check.target}')) - else: - check_ = self.objectspace.check(variable.xmlfiles) - if name == 'valid_differ': - name = 'valid_not_equal' - elif name == 'valid_network_netmask': - params_len = 1 - if len(check.param) != params_len: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) - elif name == 'valid_ipnetmask': - params_len = 1 - if len(check.param) != params_len: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) - name = 'valid_ip_netmask' - elif name == 'valid_broadcast': - params_len = 2 - if len(check.param) != params_len: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) - elif name == 'valid_in_network': - if len(check.param) not in (1, 2): - params_len = 2 - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) - check_.name = name - check_.warnings_only = check.warnings_only - if hasattr(check, 'param'): - check_.param = check.param - if not hasattr(variable, 'check'): - variable.check = [] - variable.check.append(check_) - del self.objectspace.space.constraints.check - - def convert_fill(self): # pylint: disable=C0111,R0912 - # sort fill/auto by index - fills = {fill.index: fill for idx, fill in enumerate(self.objectspace.space.constraints.fill)} - indexes = list(fills.keys()) - indexes.sort() - targets = [] - for idx in indexes: - fill = fills[idx] - # test if it's redefined calculation - if fill.target in targets: - xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}')) - targets.append(fill.target) - # - if fill.name not in self.functions: - raise DictConsistencyError(_('cannot find fill function {}').format(fill.name)) - - namespace = fill.namespace - # let's replace the target by the path - fill.target, suffix = self.objectspace.paths.get_variable_path(fill.target, - namespace, - with_suffix=True, - ) - if suffix is not None: - raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}"')) - variable = self.objectspace.paths.get_variable_obj(fill.target) - value = self.objectspace.value(variable.xmlfiles) - value.type = 'calculation' - value.name = fill.name - if hasattr(fill, 'param'): - param_to_delete = [] - for fill_idx, param in enumerate(fill.param): - if param.type not in ['suffix', 'string'] and not hasattr(param, 'text'): - raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}")) - if param.type == 'suffix' and hasattr(param, 'text'): - raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}")) - if param.type == 'string': - if not hasattr(param, 'text'): - param.text = None - if param.type == 'variable': - try: - param.text, suffix = self.objectspace.paths.get_variable_path(param.text, - namespace, - with_suffix=True, - ) - if suffix: - param.suffix = suffix - except DictConsistencyError as err: - if param.optional is False: - raise err - param_to_delete.append(fill_idx) - continue - else: - param.notraisepropertyerror = None - param_to_delete.sort(reverse=True) - for param_idx in param_to_delete: - fill.param.pop(param_idx) - value.param = fill.param - variable.value = [value] - del self.objectspace.space.constraints.fill - - def remove_constraints(self): - if hasattr(self.objectspace.space.constraints, 'index'): - del self.objectspace.space.constraints.index - del self.objectspace.space.constraints.namespace - del self.objectspace.space.constraints.xmlfiles - if vars(self.objectspace.space.constraints): - raise Exception('constraints again?') - del self.objectspace.space.constraints - - -class FamilyAnnotator: - def __init__(self, - objectspace, - ): - self.objectspace = objectspace - self.remove_empty_families() - self.change_variable_mode() - self.change_family_mode() - self.dynamic_families() - - def remove_empty_families(self): # pylint: disable=C0111,R0201 - if hasattr(self.objectspace.space, 'variables'): - for family in self.objectspace.space.variables.values(): - if hasattr(family, 'family'): - space = family.family - removed_families = [] - for family_name, family in space.items(): - if not hasattr(family, 'variable') or len(family.variable) == 0: - removed_families.append(family_name) - for family_name in removed_families: - del space[family_name] - - def change_family_mode(self): # pylint: disable=C0111 - if not hasattr(self.objectspace.space, 'variables'): - return - for family in self.objectspace.space.variables.values(): - if hasattr(family, 'family'): - for family in family.family.values(): - mode = modes_level[-1] - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - variable_mode = variable.variable[0].mode - variable.variable[0].mode = None - variable.mode = variable_mode - else: - variable_mode = variable.mode - if variable_mode is not None and modes[mode] > modes[variable_mode]: - mode = variable_mode - family.mode = mode - - def dynamic_families(self): # pylint: disable=C0111 - if not hasattr(self.objectspace.space, 'variables'): - return - for family in self.objectspace.space.variables.values(): - if hasattr(family, 'family'): - for family in family.family.values(): - if 'dynamic' in vars(family): - namespace = self.objectspace.paths.get_variable_namespace(family.dynamic) - varpath = self.objectspace.paths.get_variable_path(family.dynamic, namespace) - family.dynamic = varpath - - def annotate_variable(self, variable, family_mode, path, is_follower=False): - # if the variable is mandatory and doesn't have any value - # then the variable's mode is set to 'basic' - if not hasattr(variable, 'value') and variable.type == 'boolean': - new_value = self.objectspace.value(variable.xmlfiles) - new_value.name = True - new_value.type = 'boolean' - variable.value = [new_value] - if hasattr(variable, 'value') and variable.value: - has_value = True - for value in variable.value: - if value.type == 'calculation': - has_value = False - has_variable = False - if hasattr(value, 'param'): - for param in value.param: - if param.type == 'variable': - has_variable = True - break - #if not has_variable: - # # if one parameter is a variable, let variable choice if it's mandatory - # variable.mandatory = True - if has_value: - # if has value but without any calculation - variable.mandatory = True - if variable.mandatory is True and (not hasattr(variable, 'value') or is_follower): - variable.mode = modes_level[0] - if variable.mode != None and modes[variable.mode] < modes[family_mode] and (not is_follower or variable.mode != modes_level[0]): - variable.mode = family_mode - if variable.hidden is True: - variable.frozen = True - if not variable.auto_save is True and 'force_default_on_freeze' not in vars(variable): - variable.force_default_on_freeze = True - - def change_variable_mode(self): # pylint: disable=C0111 - if not hasattr(self.objectspace.space, 'variables'): - return - for variables in self.objectspace.space.variables.values(): - namespace = variables.name - if hasattr(variables, 'family'): - for family in variables.family.values(): - family_mode = family.mode - if hasattr(family, 'variable'): - for variable in family.variable.values(): - - if isinstance(variable, self.objectspace.leadership): - mode = modes_level[-1] - for idx, follower in enumerate(variable.variable): - if follower.auto_save is True: - raise DictConsistencyError(_(f'leader/followers {follower.name} could not be auto_save')) - if follower.auto_freeze is True: - raise DictConsistencyError(_('leader/followers {follower.name} could not be auto_freeze')) - is_follower = idx != 0 - path = '{}.{}.{}'.format(family.path, variable.name, follower.name) - self.annotate_variable(follower, family_mode, path, is_follower) - # leader's mode is minimum level - if modes[variable.variable[0].mode] > modes[follower.mode]: - follower.mode = variable.variable[0].mode - variable.mode = variable.variable[0].mode - else: - # auto_save's variable is set in 'basic' mode if its mode is 'normal' - if variable.auto_save is True and variable.mode != modes_level[-1]: - variable.mode = modes_level[0] - # auto_freeze's variable is set in 'basic' mode if its mode is 'normal' - if variable.auto_freeze is True and variable.mode != modes_level[-1]: - variable.mode = modes_level[0] - path = '{}.{}'.format(family.path, variable.name) - self.annotate_variable(variable, family_mode, path) - -class PropertyAnnotator: - def __init__(self, objectspace): - self.objectspace = objectspace - self.convert_annotator() - - def convert_property(self, - variable, - ): - properties = [] - for prop in PROPERTIES: - if hasattr(variable, prop): - if getattr(variable, prop) == True: - for subprop in CONVERT_PROPERTIES.get(prop, [prop]): - properties.append(subprop) - setattr(variable, prop, None) - if hasattr(variable, 'mode') and variable.mode: - properties.append(variable.mode) - variable.mode = None - if properties: - variable.properties = frozenset(properties) - - def convert_annotator(self): # pylint: disable=C0111 - if hasattr(self.objectspace.space, 'services'): - self.convert_property(self.objectspace.space.services) - for services in self.objectspace.space.services.service.values(): - self.convert_property(services) - for service in vars(services).values(): - if isinstance(service, self.objectspace.family): - self.convert_property(service) - if hasattr(service, 'family'): - self.convert_property(service) - for family in service.family: - self.convert_property(family) - if hasattr(family, 'variable'): - for variable in family.variable: - self.convert_property(variable) - if hasattr(self.objectspace.space, 'variables'): - for variables in self.objectspace.space.variables.values(): - if hasattr(variables, 'family'): - for family in variables.family.values(): - self.convert_property(family) - if hasattr(family, 'variable'): - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - self.convert_property(variable) - for follower in variable.variable: - self.convert_property(follower) - else: - self.convert_property(variable) diff --git a/tests/dictionaries/80redefine_helperror/00-base.xml b/tests/dictionaries/51exists_redefine/00-base.xml similarity index 57% rename from tests/dictionaries/80redefine_helperror/00-base.xml rename to tests/dictionaries/51exists_redefine/00-base.xml index 41da51c5..c419dad1 100644 --- a/tests/dictionaries/80redefine_helperror/00-base.xml +++ b/tests/dictionaries/51exists_redefine/00-base.xml @@ -1,24 +1,12 @@ - - - - - - - - - - - redefine help - - diff --git a/tests/dictionaries/51exists_redefine/01-base.xml b/tests/dictionaries/51exists_redefine/01-base.xml new file mode 100644 index 00000000..934b6c7e --- /dev/null +++ b/tests/dictionaries/51exists_redefine/01-base.xml @@ -0,0 +1,15 @@ + + + + + + oui + + + oui + + + + + diff --git a/tests/dictionaries/80redefine_helperror/__init__.py b/tests/dictionaries/51exists_redefine/__init__.py similarity index 100% rename from tests/dictionaries/80redefine_helperror/__init__.py rename to tests/dictionaries/51exists_redefine/__init__.py diff --git a/tests/dictionaries/51exists_redefine/makedict/base.json b/tests/dictionaries/51exists_redefine/makedict/base.json new file mode 100644 index 00000000..eb10bec4 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "oui"} diff --git a/tests/dictionaries/51exists_redefine/tiramisu/__init__.py b/tests/dictionaries/51exists_redefine/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/51exists_redefine/tiramisu/base.py b/tests/dictionaries/51exists_redefine/tiramisu/base.py new file mode 100644 index 00000000..e8875624 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/tiramisu/base.py @@ -0,0 +1,14 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='oui', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/51redefine_multi/00-base.xml b/tests/dictionaries/51redefine_multi/00-base.xml index c973121f..d482c3a1 100644 --- a/tests/dictionaries/51redefine_multi/00-base.xml +++ b/tests/dictionaries/51redefine_multi/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/51redefine_multi/01-redefine.xml b/tests/dictionaries/51redefine_multi/01-redefine.xml index ef35e190..d1534cec 100644 --- a/tests/dictionaries/51redefine_multi/01-redefine.xml +++ b/tests/dictionaries/51redefine_multi/01-redefine.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/51redefine_type/00-base.xml b/tests/dictionaries/51redefine_type/00-base.xml index c973121f..d482c3a1 100644 --- a/tests/dictionaries/51redefine_type/00-base.xml +++ b/tests/dictionaries/51redefine_type/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/51redefine_type/01-redefine.xml b/tests/dictionaries/51redefine_type/01-redefine.xml index f02740f0..3d0575b1 100644 --- a/tests/dictionaries/51redefine_type/01-redefine.xml +++ b/tests/dictionaries/51redefine_type/01-redefine.xml @@ -1,20 +1,10 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspace/00-base.xml b/tests/dictionaries/60extra_externalspace/00-base.xml index 4263114a..2550ebd8 100644 --- a/tests/dictionaries/60extra_externalspace/00-base.xml +++ b/tests/dictionaries/60extra_externalspace/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspaceauto/00-base.xml b/tests/dictionaries/60extra_externalspaceauto/00-base.xml index 4263114a..2550ebd8 100644 --- a/tests/dictionaries/60extra_externalspaceauto/00-base.xml +++ b/tests/dictionaries/60extra_externalspaceauto/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspacecondition2/00-base.xml b/tests/dictionaries/60extra_externalspacecondition2/00-base.xml index 4263114a..2550ebd8 100644 --- a/tests/dictionaries/60extra_externalspacecondition2/00-base.xml +++ b/tests/dictionaries/60extra_externalspacecondition2/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspacecondition3/00-base.xml b/tests/dictionaries/60extra_externalspacecondition3/00-base.xml index 4263114a..2550ebd8 100644 --- a/tests/dictionaries/60extra_externalspacecondition3/00-base.xml +++ b/tests/dictionaries/60extra_externalspacecondition3/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/80check_unknown/00-base.xml b/tests/dictionaries/80check_unknown/00-base.xml index 9d604427..b8600cd7 100644 --- a/tests/dictionaries/80check_unknown/00-base.xml +++ b/tests/dictionaries/80check_unknown/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -10,7 +7,6 @@ - @@ -19,9 +15,6 @@ 100 - - - diff --git a/tests/dictionaries/80check_unknown_var/00-base.xml b/tests/dictionaries/80check_unknown_var/00-base.xml index afa32329..d5e0f432 100644 --- a/tests/dictionaries/80check_unknown_var/00-base.xml +++ b/tests/dictionaries/80check_unknown_var/00-base.xml @@ -1,15 +1,11 @@ - - - b - @@ -18,9 +14,6 @@ - - - diff --git a/tests/dictionaries/80condition_itself/00-base.xml b/tests/dictionaries/80condition_itself/00-base.xml index 99fb6ba1..46092fa3 100644 --- a/tests/dictionaries/80condition_itself/00-base.xml +++ b/tests/dictionaries/80condition_itself/00-base.xml @@ -11,7 +11,6 @@ replicationType - diff --git a/tests/dictionaries/80condition_not_exists_error/00-base.xml b/tests/dictionaries/80condition_not_exists_error/00-base.xml index 9136db89..0f3a64c1 100644 --- a/tests/dictionaries/80condition_not_exists_error/00-base.xml +++ b/tests/dictionaries/80condition_not_exists_error/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -18,9 +15,6 @@ notexists - - - diff --git a/tests/dictionaries/80container_filesredefine_error/00-base.xml b/tests/dictionaries/80container_filesredefine_error/00-base.xml index 8f430c19..d7a7d843 100644 --- a/tests/dictionaries/80container_filesredefine_error/00-base.xml +++ b/tests/dictionaries/80container_filesredefine_error/00-base.xml @@ -14,14 +14,7 @@ oui - - - - - - - diff --git a/tests/dictionaries/80family_several/00-base.xml b/tests/dictionaries/80family_several/00-base.xml index 2422864a..d9b82e64 100644 --- a/tests/dictionaries/80family_several/00-base.xml +++ b/tests/dictionaries/80family_several/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -28,7 +25,4 @@ follower2 - - - diff --git a/tests/dictionaries/80fill_error/00-base.xml b/tests/dictionaries/80fill_error/00-base.xml index 89fd1387..97cdc076 100644 --- a/tests/dictionaries/80fill_error/00-base.xml +++ b/tests/dictionaries/80fill_error/00-base.xml @@ -7,7 +7,6 @@ non - @@ -18,9 +17,6 @@ valeur2 - - - diff --git a/tests/dictionaries/80fill_multi/00-base.xml b/tests/dictionaries/80fill_multi/00-base.xml index 975810cc..2ab8329b 100644 --- a/tests/dictionaries/80fill_multi/00-base.xml +++ b/tests/dictionaries/80fill_multi/00-base.xml @@ -1,8 +1,5 @@ - - - - @@ -23,9 +19,6 @@ mode_conteneur_actif1 - - - diff --git a/tests/dictionaries/80hidden_if_in_filelist/00-base.xml b/tests/dictionaries/80hidden_if_in_filelist/00-base.xml index 1944491b..4d9b232e 100644 --- a/tests/dictionaries/80hidden_if_in_filelist/00-base.xml +++ b/tests/dictionaries/80hidden_if_in_filelist/00-base.xml @@ -16,7 +16,6 @@ non - @@ -25,9 +24,6 @@ afilllist - - - diff --git a/tests/dictionaries/80leadership_auto_save/00-base.xml b/tests/dictionaries/80leadership_auto_save/00-base.xml index bd5f003c..cf2cbc65 100644 --- a/tests/dictionaries/80leadership_auto_save/00-base.xml +++ b/tests/dictionaries/80leadership_auto_save/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ follower2 - - - diff --git a/tests/dictionaries/80leadership_autofreeze/00-base.xml b/tests/dictionaries/80leadership_autofreeze/00-base.xml index 70dec0a9..941c98b6 100644 --- a/tests/dictionaries/80leadership_autofreeze/00-base.xml +++ b/tests/dictionaries/80leadership_autofreeze/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -23,7 +20,4 @@ follower2 - - - diff --git a/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml b/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml index 12a0e074..047c6d0e 100644 --- a/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml +++ b/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -26,7 +23,4 @@ follower2 - - - diff --git a/tests/dictionaries/80leadership_not_ordered/00-base.xml b/tests/dictionaries/80leadership_not_ordered/00-base.xml index 2801924f..ad4849c7 100644 --- a/tests/dictionaries/80leadership_not_ordered/00-base.xml +++ b/tests/dictionaries/80leadership_not_ordered/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -28,7 +25,4 @@ follower1 - - - diff --git a/tests/dictionaries/80leadership_not_same_family/00-base.xml b/tests/dictionaries/80leadership_not_same_family/00-base.xml index b5dff8b7..008bacd6 100644 --- a/tests/dictionaries/80leadership_not_same_family/00-base.xml +++ b/tests/dictionaries/80leadership_not_same_family/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -30,7 +27,4 @@ follower2 - - - diff --git a/tests/dictionaries/80leadership_notexists/00-base.xml b/tests/dictionaries/80leadership_notexists/00-base.xml index 57d9b8c0..da86c9a8 100644 --- a/tests/dictionaries/80leadership_notexists/00-base.xml +++ b/tests/dictionaries/80leadership_notexists/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -30,7 +27,4 @@ follower4 - - - diff --git a/tests/dictionaries/80redefine_double_error/00-base.xml b/tests/dictionaries/80redefine_double_error/00-base.xml index c973121f..8ab6107e 100644 --- a/tests/dictionaries/80redefine_double_error/00-base.xml +++ b/tests/dictionaries/80redefine_double_error/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - diff --git a/tests/dictionaries/80redefine_error/00-base.xml b/tests/dictionaries/80redefine_error/00-base.xml index c973121f..8ab6107e 100644 --- a/tests/dictionaries/80redefine_error/00-base.xml +++ b/tests/dictionaries/80redefine_error/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - diff --git a/tests/dictionaries/80redefine_error/01-redefine.xml b/tests/dictionaries/80redefine_error/01-redefine.xml index c973121f..d482c3a1 100644 --- a/tests/dictionaries/80redefine_error/01-redefine.xml +++ b/tests/dictionaries/80redefine_error/01-redefine.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/80redefine_helperror/01-base.xml b/tests/dictionaries/80redefine_helperror/01-base.xml deleted file mode 100644 index 90318220..00000000 --- a/tests/dictionaries/80redefine_helperror/01-base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - redefine help - - - diff --git a/tests/dictionaries/80redefine_notexists/00-base.xml b/tests/dictionaries/80redefine_notexists/00-base.xml index c973121f..d482c3a1 100644 --- a/tests/dictionaries/80redefine_notexists/00-base.xml +++ b/tests/dictionaries/80redefine_notexists/00-base.xml @@ -1,22 +1,12 @@ - - - - - - - - - - diff --git a/tests/dictionaries/80redefine_notexists/01-redefine.xml b/tests/dictionaries/80redefine_notexists/01-redefine.xml index 8900805a..0f04ef27 100644 --- a/tests/dictionaries/80redefine_notexists/01-redefine.xml +++ b/tests/dictionaries/80redefine_notexists/01-redefine.xml @@ -1,22 +1,12 @@ - - - non - - - - - - - diff --git a/tests/dictionaries/80separator_multi/00-base.xml b/tests/dictionaries/80separator_multi/00-base.xml index 1089b2ed..9b11ae94 100644 --- a/tests/dictionaries/80separator_multi/00-base.xml +++ b/tests/dictionaries/80separator_multi/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - diff --git a/tests/dictionaries/80separator_multi2/00-base.xml b/tests/dictionaries/80separator_multi2/00-base.xml index cd4b3228..9b468a63 100644 --- a/tests/dictionaries/80separator_multi2/00-base.xml +++ b/tests/dictionaries/80separator_multi2/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - diff --git a/tests/dictionaries/80separator_multi2/01-base.xml b/tests/dictionaries/80separator_multi2/01-base.xml index d1d424a0..69191a32 100644 --- a/tests/dictionaries/80separator_multi2/01-base.xml +++ b/tests/dictionaries/80separator_multi2/01-base.xml @@ -1,17 +1,8 @@ - - - Établissement - - - - - - diff --git a/tests/dictionaries/80separator_nonexists/00-base.xml b/tests/dictionaries/80separator_nonexists/00-base.xml index e92644cc..966ee47d 100644 --- a/tests/dictionaries/80separator_nonexists/00-base.xml +++ b/tests/dictionaries/80separator_nonexists/00-base.xml @@ -1,8 +1,5 @@ - - - - - - - - - diff --git a/tests/dictionaries/88valid_enum_not_number/00-base.xml b/tests/dictionaries/88valid_enum_not_number/00-base.xml index f6d92700..b0802b43 100644 --- a/tests/dictionaries/88valid_enum_not_number/00-base.xml +++ b/tests/dictionaries/88valid_enum_not_number/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -22,11 +19,6 @@ c - - - bla bla bla - - diff --git a/tests/dictionaries/88valid_enum_numberdefaultstring/00-base.xml b/tests/dictionaries/88valid_enum_numberdefaultstring/00-base.xml index fda4ef95..f36e7313 100644 --- a/tests/dictionaries/88valid_enum_numberdefaultstring/00-base.xml +++ b/tests/dictionaries/88valid_enum_numberdefaultstring/00-base.xml @@ -1,8 +1,5 @@ - - - @@ -14,7 +11,6 @@ a - @@ -24,11 +20,6 @@ 3 - - - bla bla bla - - From ca40aa5ec3610384582c4edd77fa6cfe955fe8b5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 07:39:51 +0100 Subject: [PATCH 012/168] split annotator --- src/rougail/annotator/__init__.py | 23 ++ src/rougail/annotator/constrainte.py | 515 +++++++++++++++++++++++++++ src/rougail/annotator/family.py | 146 ++++++++ src/rougail/annotator/group.py | 135 +++++++ src/rougail/annotator/property.py | 55 +++ src/rougail/annotator/service.py | 251 +++++++++++++ src/rougail/annotator/variable.py | 193 ++++++++++ 7 files changed, 1318 insertions(+) create mode 100644 src/rougail/annotator/__init__.py create mode 100644 src/rougail/annotator/constrainte.py create mode 100644 src/rougail/annotator/family.py create mode 100644 src/rougail/annotator/group.py create mode 100644 src/rougail/annotator/property.py create mode 100644 src/rougail/annotator/service.py create mode 100644 src/rougail/annotator/variable.py diff --git a/src/rougail/annotator/__init__.py b/src/rougail/annotator/__init__.py new file mode 100644 index 00000000..c22fe358 --- /dev/null +++ b/src/rougail/annotator/__init__.py @@ -0,0 +1,23 @@ +from .group import GroupAnnotator +from .service import ServiceAnnotator, ERASED_ATTRIBUTES +from .variable import VariableAnnotator, CONVERT_OPTION +from .constrainte import ConstrainteAnnotator +from .family import FamilyAnnotator, modes +from .property import PropertyAnnotator + +class SpaceAnnotator: + """Transformations applied on a CreoleObjSpace instance + """ + def __init__(self, objectspace, eosfunc_file): + self.objectspace = objectspace + GroupAnnotator(objectspace) + ServiceAnnotator(objectspace) + VariableAnnotator(objectspace) + ConstrainteAnnotator(objectspace, + eosfunc_file, + ) + FamilyAnnotator(objectspace) + PropertyAnnotator(objectspace) + + +__all__ = ('SpaceAnnotator', 'ERASED_ATTRIBUTES', 'CONVERT_OPTION', 'modes') diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py new file mode 100644 index 00000000..6c81202a --- /dev/null +++ b/src/rougail/annotator/constrainte.py @@ -0,0 +1,515 @@ +from typing import List +from importlib.machinery import SourceFileLoader + +from .variable import CONVERT_OPTION + +from ..i18n import _ +from ..utils import normalize_family +from ..error import DictConsistencyError +INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier'] + + +class ConstrainteAnnotator: + def __init__(self, + objectspace, + eosfunc_file, + ): + if not hasattr(objectspace.space, 'constraints'): + return + self.objectspace = objectspace + eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() + self.functions = dir(eosfunc) + self.functions.extend(INTERNAL_FUNCTIONS) + self.valid_enums = {} + if hasattr(self.objectspace.space.constraints, 'check'): + self.check_check() + self.check_replace_text() + self.check_valid_enum() + self.check_change_warning() + self.convert_check() + if hasattr(self.objectspace.space.constraints, 'condition'): + self.check_params_target() + self.filter_targets() + self.convert_xxxlist_to_variable() + self.check_condition_fallback_optional() + self.check_choice_option_condition() + self.remove_condition_with_empty_target() + self.convert_condition() + if hasattr(self.objectspace.space.constraints, 'fill'): + self.convert_fill() + self.remove_constraints() + + def check_check(self): + remove_indexes = [] + for check_idx, check in enumerate(self.objectspace.space.constraints.check): + if not check.name in self.functions: + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'cannot find check function "{check.name}" in {xmlfiles}')) + if hasattr(check, 'param'): + param_option_indexes = [] + for idx, param in enumerate(check.param): + if param.type == 'variable' and not self.objectspace.paths.path_is_defined(param.text): + if param.optional is True: + param_option_indexes.append(idx) + else: + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'cannot find check param "{param.text}" in {xmlfiles}')) + if param.type != 'variable': + param.notraisepropertyerror = None + param_option_indexes = list(set(param_option_indexes)) + param_option_indexes.sort(reverse=True) + for idx in param_option_indexes: + check.param.pop(idx) + if check.param == []: + remove_indexes.append(check_idx) + remove_indexes.sort(reverse=True) + for idx in remove_indexes: + del self.objectspace.space.constraints.check[idx] + + def check_replace_text(self): + for check_idx, check in enumerate(self.objectspace.space.constraints.check): + namespace = check.namespace + if hasattr(check, 'param'): + for idx, param in enumerate(check.param): + if param.type == 'variable': + param.text = self.objectspace.paths.get_variable_path(param.text, namespace) + check.is_in_leadership = self.objectspace.paths.get_leader(check.target) != None + # let's replace the target by the path + check.target = self.objectspace.paths.get_variable_path(check.target, namespace) + + def check_valid_enum(self): + remove_indexes = [] + for idx, check in enumerate(self.objectspace.space.constraints.check): + if check.name == 'valid_enum': + if check.target in self.valid_enums: + old_xmlfiles = self.objectspace.display_xmlfiles(self.valid_enums[check.target]['xmlfiles']) + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?')) + if not hasattr(check, 'param'): + raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}')) + variable = self.objectspace.paths.get_variable_obj(check.target) + values = self.load_params_in_valid_enum(check.param, + variable.name, + variable.type, + ) + self._set_valid_enum(variable, + values, + variable.type, + check.target, + check.xmlfiles, + ) + remove_indexes.append(idx) + remove_indexes.sort(reverse=True) + for idx in remove_indexes: + del self.objectspace.space.constraints.check[idx] + + def load_params_in_valid_enum(self, + params, + variable_name, + variable_type, + ): + has_variable = None + values = [] + for param in params: + if param.type == 'variable': + if has_variable is not None: + raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) + has_variable = True + variable = self.objectspace.paths.get_variable_obj(param.text) + if not variable.multi: + raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable {variable_name}')) + values = param.text + else: + if has_variable: + raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) + if not hasattr(param, 'text'): + if param.type == 'number': + raise DictConsistencyError(_(f'value is mandatory for valid_enum of variable {variable_name}')) + values.append(None) + else: + values.append(param.text) + return values + + def check_change_warning(self): + #convert level to "warnings_only" + for check in self.objectspace.space.constraints.check: + if check.level == 'warning': + check.warnings_only = True + else: + check.warnings_only = False + check.level = None + + def _get_family_variables_from_target(self, + target, + ): + if target.type == 'variable': + variable = self.objectspace.paths.get_variable_obj(target.name) + family = self.objectspace.paths.get_family_obj(target.name.rsplit('.', 1)[0]) + # it's a leader, so apply property to leadership + if isinstance(family, self.objectspace.leadership) and family.name == variable.name: + return family, family.variable + return variable, [variable] + # it's a family + variable = self.objectspace.paths.get_family_obj(target.name) + return variable, list(variable.variable.values()) + + def check_params_target(self): + for condition in self.objectspace.space.constraints.condition: + if not hasattr(condition, 'target'): + raise DictConsistencyError(_('target is mandatory in condition')) + for target in condition.target: + if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']: + raise DictConsistencyError(_(f'target in condition for {target.type} not allow in {condition.name}')) + + def filter_targets(self): # pylint: disable=C0111 + for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): + namespace = condition.namespace + for idx, target in enumerate(condition.target): + if target.type == 'variable': + if condition.source == target.name: + raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source)) + try: + target_names = [normalize_family(name) for name in target.name.split('.')] + target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace) + except DictConsistencyError: + # for optional variable + pass + elif target.type == 'family': + try: + target_names = [normalize_family(name) for name in target.name.split('.')] + target.name = self.objectspace.paths.get_family_path('.'.join(target_names), namespace) + except KeyError: + raise DictConsistencyError(_('cannot found family {}').format(target.name)) + + def convert_xxxlist_to_variable(self): # pylint: disable=C0111 + # transform *list to variable or family + for condition_idx, condition in enumerate(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: + variable = self.objectspace.paths.get_variable_obj(listvar) + type_ = 'variable' + new_target = self.objectspace.target(variable.xmlfiles) + new_target.type = type_ + new_target.name = listvar + new_target.index = target.index + 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_optional(self): + # a condition with a fallback **and** the source variable doesn't exist + remove_conditions = [] + for idx, condition in enumerate(self.objectspace.space.constraints.condition): + # fallback + if condition.fallback is True and not self.objectspace.paths.path_is_defined(condition.source): + apply_action = False + if condition.name in ['disabled_if_in', 'mandatory_if_in', 'hidden_if_in']: + apply_action = not condition.force_condition_on_fallback + else: + apply_action = condition.force_inverse_condition_on_fallback + if apply_action: + actions = self._get_condition_actions(condition.name) + for target in condition.target: + leader_or_variable, variables = self._get_family_variables_from_target(target) + for action_idx, action in enumerate(actions): + if action_idx == 0: + setattr(leader_or_variable, action, True) + else: + for variable in variables: + setattr(variable, action, True) + remove_conditions.append(idx) + continue + + remove_targets = [] + # optional + for idx, target in enumerate(condition.target): + if target.optional is True and not self.objectspace.paths.path_is_defined(target.name): + remove_targets.append(idx) + remove_targets = list(set(remove_targets)) + remove_targets.sort(reverse=True) + for idx in remove_targets: + condition.target.pop(idx) + remove_conditions = list(set(remove_conditions)) + remove_conditions.sort(reverse=True) + for idx in remove_conditions: + self.objectspace.space.constraints.condition.pop(idx) + + def _get_condition_actions(self, condition_name): + if condition_name.startswith('disabled_if_'): + return ['disabled'] + elif condition_name.startswith('hidden_if_'): + return ['hidden', 'frozen', 'force_default_on_freeze'] + elif condition_name.startswith('mandatory_if_'): + return ['mandatory'] + elif condition_name == 'auto_hidden_if_not_in': + return ['auto_frozen'] + + def check_choice_option_condition(self): + # remove condition for ChoiceOption that don't have param + remove_conditions = [] + for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): + namespace = condition.namespace + condition.source = self.objectspace.paths.get_variable_path(condition.source, namespace, allow_source=True) + src_variable = self.objectspace.paths.get_variable_obj(condition.source) + valid_enum = None + if condition.source in self.valid_enums and self.valid_enums[condition.source]['type'] == 'string': + valid_enum = self.valid_enums[condition.source]['values'] + if valid_enum is not None: + remove_param = [] + for param_idx, param in enumerate(condition.param): + if param.text not in valid_enum: + remove_param.append(param_idx) + remove_param.sort(reverse=True) + for idx in remove_param: + del condition.param[idx] + if condition.param == []: + remove_targets = [] + for target in condition.target: + leader_or_variable, variables = self._get_family_variables_from_target(target) + if condition.name == 'disabled_if_not_in': + leader_or_variable.disabled = True + elif condition.name == 'hidden_if_not_in': + leader_or_variable.hidden = True + for variable in variables: + variable.frozen = True + variable.force_default_on_freeze = True + elif condition.name == 'mandatory_if_not_in': + variable.mandatory = True + remove_targets = list(set(remove_targets)) + remove_targets.sort(reverse=True) + for target_idx in remove_targets: + condition.target.pop(target_idx) + remove_conditions.append(condition_idx) + remove_conditions = list(set(remove_conditions)) + remove_conditions.sort(reverse=True) + for idx in remove_conditions: + self.objectspace.space.constraints.condition.pop(idx) + + def remove_condition_with_empty_target(self): + remove_conditions = [] + for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): + if not condition.target: + remove_conditions.append(condition_idx) + remove_conditions = list(set(remove_conditions)) + remove_conditions.sort(reverse=True) + for idx in remove_conditions: + self.objectspace.space.constraints.condition.pop(idx) + + def convert_condition(self): + for condition in self.objectspace.space.constraints.condition: + inverse = condition.name.endswith('_if_not_in') + actions = self._get_condition_actions(condition.name) + for param in condition.param: + text = getattr(param, 'text', None) + for target in condition.target: + leader_or_variable, variables = self._get_family_variables_from_target(target) + # if option is already disable, do not apply disable_if_in + # check only the first action (example of multiple actions: 'hidden', 'frozen', 'force_default_on_freeze') + main_action = actions[0] + if getattr(leader_or_variable, main_action, False) is True: + continue + for idx, action in enumerate(actions): + prop = self.objectspace.property_(leader_or_variable.xmlfiles) + prop.type = 'calculation' + prop.inverse = inverse + prop.source = condition.source + prop.expected = text + prop.name = action + if idx == 0: + # main action is for the variable or family + if not hasattr(leader_or_variable, 'property'): + leader_or_variable.property = [] + leader_or_variable.property.append(prop) + else: + # other actions are set to the variable or children of family + for variable in variables: + if not hasattr(variable, 'property'): + variable.property = [] + variable.property.append(prop) + del self.objectspace.space.constraints.condition + + def _set_valid_enum(self, + variable, + values, + type_, + target: str, + xmlfiles: List[str], + ): + # value for choice's variable is mandatory + variable.mandatory = True + # build choice + variable.choice = [] + if isinstance(values, str): + choice = self.objectspace.choice() + choice.type = 'calculation' + choice.name = values + variable.choice.append(choice) + else: + self.valid_enums[target] = {'type': type_, + 'values': values, + 'xmlfiles': xmlfiles, + } + choices = [] + for value in values: + choice = self.objectspace.choice(variable.xmlfiles) + try: + if value is not None: + choice.name = CONVERT_OPTION[type_].get('func', str)(value) + else: + choice.name = value + except: + raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"')) + if choice.name == '': + choice.name = None + choices.append(choice.name) + choice.type = type_ + variable.choice.append(choice) + # check value or set first choice value has default value + if hasattr(variable, 'value'): + for value in variable.value: + value.type = type_ + try: + cvalue = CONVERT_OPTION[type_].get('func', str)(value.name) + except: + raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"')) + if cvalue not in choices: + raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices)) + else: + new_value = self.objectspace.value(variable.xmlfiles) + new_value.name = choices[0] + new_value.type = type_ + variable.value = [new_value] + if not variable.choice: + raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name)) + variable.type = 'choice' + + def convert_check(self): + for check in self.objectspace.space.constraints.check: + variable = self.objectspace.paths.get_variable_obj(check.target) + name = check.name + if name == 'valid_entier': + if not hasattr(check, 'param'): + raise DictConsistencyError(_('{} must have, at least, 1 param').format(name)) + for param in check.param: + if param.type not in ['string', 'number']: + raise DictConsistencyError(_(f'param in "valid_entier" must not be a "{param.type}"')) + if param.name == 'mini': + variable.min_number = int(param.text) + elif param.name == 'maxi': + variable.max_number = int(param.text) + else: + raise DictConsistencyError(_(f'unknown parameter {param.text} in check "valid_entier" for variable {check.target}')) + else: + check_ = self.objectspace.check(variable.xmlfiles) + if name == 'valid_differ': + name = 'valid_not_equal' + elif name == 'valid_network_netmask': + params_len = 1 + if len(check.param) != params_len: + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + elif name == 'valid_ipnetmask': + params_len = 1 + if len(check.param) != params_len: + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + name = 'valid_ip_netmask' + elif name == 'valid_broadcast': + params_len = 2 + if len(check.param) != params_len: + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + elif name == 'valid_in_network': + if len(check.param) not in (1, 2): + params_len = 2 + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + check_.name = name + check_.warnings_only = check.warnings_only + if hasattr(check, 'param'): + check_.param = check.param + if not hasattr(variable, 'check'): + variable.check = [] + variable.check.append(check_) + del self.objectspace.space.constraints.check + + def convert_fill(self): # pylint: disable=C0111,R0912 + # sort fill/auto by index + fills = {fill.index: fill for idx, fill in enumerate(self.objectspace.space.constraints.fill)} + indexes = list(fills.keys()) + indexes.sort() + targets = [] + for idx in indexes: + fill = fills[idx] + # test if it's redefined calculation + if fill.target in targets: + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}')) + targets.append(fill.target) + # + if fill.name not in self.functions: + raise DictConsistencyError(_('cannot find fill function {}').format(fill.name)) + + namespace = fill.namespace + # let's replace the target by the path + fill.target, suffix = self.objectspace.paths.get_variable_path(fill.target, + namespace, + with_suffix=True, + ) + if suffix is not None: + raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}"')) + variable = self.objectspace.paths.get_variable_obj(fill.target) + value = self.objectspace.value(variable.xmlfiles) + value.type = 'calculation' + value.name = fill.name + if hasattr(fill, 'param'): + param_to_delete = [] + for fill_idx, param in enumerate(fill.param): + if param.type not in ['suffix', 'string'] and not hasattr(param, 'text'): + raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}")) + if param.type == 'suffix' and hasattr(param, 'text'): + raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}")) + if param.type == 'string': + if not hasattr(param, 'text'): + param.text = None + if param.type == 'variable': + try: + param.text, suffix = self.objectspace.paths.get_variable_path(param.text, + namespace, + with_suffix=True, + ) + if suffix: + param.suffix = suffix + except DictConsistencyError as err: + if param.optional is False: + raise err + param_to_delete.append(fill_idx) + continue + else: + param.notraisepropertyerror = None + param_to_delete.sort(reverse=True) + for param_idx in param_to_delete: + fill.param.pop(param_idx) + value.param = fill.param + variable.value = [value] + del self.objectspace.space.constraints.fill + + def remove_constraints(self): + if hasattr(self.objectspace.space.constraints, 'index'): + del self.objectspace.space.constraints.index + del self.objectspace.space.constraints.namespace + del self.objectspace.space.constraints.xmlfiles + if vars(self.objectspace.space.constraints): + raise Exception('constraints again?') + del self.objectspace.space.constraints + diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py new file mode 100644 index 00000000..78361e00 --- /dev/null +++ b/src/rougail/annotator/family.py @@ -0,0 +1,146 @@ +from ..i18n import _ +from ..error import DictConsistencyError + + +#mode order is important +modes_level = ('basic', 'normal', 'expert') + + +class Mode(object): + def __init__(self, name, level): + self.name = name + self.level = level + def __gt__(self, other): + return other.level < self.level + + +def mode_factory(): + mode_obj = {} + for idx in range(len(modes_level)): + name = modes_level[idx] + mode_obj[name] = Mode(name, idx) + return mode_obj + +modes = mode_factory() + + +class FamilyAnnotator: + def __init__(self, + objectspace, + ): + self.objectspace = objectspace + self.remove_empty_families() + self.change_variable_mode() + self.change_family_mode() + self.dynamic_families() + + def remove_empty_families(self): # pylint: disable=C0111,R0201 + if hasattr(self.objectspace.space, 'variables'): + for family in self.objectspace.space.variables.values(): + if hasattr(family, 'family'): + space = family.family + removed_families = [] + for family_name, family in space.items(): + if not hasattr(family, 'variable') or len(family.variable) == 0: + removed_families.append(family_name) + for family_name in removed_families: + del space[family_name] + + def change_family_mode(self): # pylint: disable=C0111 + if not hasattr(self.objectspace.space, 'variables'): + return + for family in self.objectspace.space.variables.values(): + if hasattr(family, 'family'): + for family in family.family.values(): + mode = modes_level[-1] + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + variable_mode = variable.variable[0].mode + variable.variable[0].mode = None + variable.mode = variable_mode + else: + variable_mode = variable.mode + if variable_mode is not None and modes[mode] > modes[variable_mode]: + mode = variable_mode + family.mode = mode + + def dynamic_families(self): # pylint: disable=C0111 + if not hasattr(self.objectspace.space, 'variables'): + return + for family in self.objectspace.space.variables.values(): + if hasattr(family, 'family'): + for family in family.family.values(): + if 'dynamic' in vars(family): + namespace = self.objectspace.paths.get_variable_namespace(family.dynamic) + varpath = self.objectspace.paths.get_variable_path(family.dynamic, namespace) + family.dynamic = varpath + + def annotate_variable(self, variable, family_mode, path, is_follower=False): + # if the variable is mandatory and doesn't have any value + # then the variable's mode is set to 'basic' + if not hasattr(variable, 'value') and variable.type == 'boolean': + new_value = self.objectspace.value(variable.xmlfiles) + new_value.name = True + new_value.type = 'boolean' + variable.value = [new_value] + if hasattr(variable, 'value') and variable.value: + has_value = True + for value in variable.value: + if value.type == 'calculation': + has_value = False + has_variable = False + if hasattr(value, 'param'): + for param in value.param: + if param.type == 'variable': + has_variable = True + break + #if not has_variable: + # # if one parameter is a variable, let variable choice if it's mandatory + # variable.mandatory = True + if has_value: + # if has value but without any calculation + variable.mandatory = True + if variable.mandatory is True and (not hasattr(variable, 'value') or is_follower): + variable.mode = modes_level[0] + if variable.mode != None and modes[variable.mode] < modes[family_mode] and (not is_follower or variable.mode != modes_level[0]): + variable.mode = family_mode + if variable.hidden is True: + variable.frozen = True + if not variable.auto_save is True and 'force_default_on_freeze' not in vars(variable): + variable.force_default_on_freeze = True + + def change_variable_mode(self): # pylint: disable=C0111 + if not hasattr(self.objectspace.space, 'variables'): + return + for variables in self.objectspace.space.variables.values(): + namespace = variables.name + if hasattr(variables, 'family'): + for family in variables.family.values(): + family_mode = family.mode + if hasattr(family, 'variable'): + for variable in family.variable.values(): + + if isinstance(variable, self.objectspace.leadership): + mode = modes_level[-1] + for idx, follower in enumerate(variable.variable): + if follower.auto_save is True: + raise DictConsistencyError(_(f'leader/followers {follower.name} could not be auto_save')) + if follower.auto_freeze is True: + raise DictConsistencyError(_('leader/followers {follower.name} could not be auto_freeze')) + is_follower = idx != 0 + path = '{}.{}.{}'.format(family.path, variable.name, follower.name) + self.annotate_variable(follower, family_mode, path, is_follower) + # leader's mode is minimum level + if modes[variable.variable[0].mode] > modes[follower.mode]: + follower.mode = variable.variable[0].mode + variable.mode = variable.variable[0].mode + else: + # auto_save's variable is set in 'basic' mode if its mode is 'normal' + if variable.auto_save is True and variable.mode != modes_level[-1]: + variable.mode = modes_level[0] + # auto_freeze's variable is set in 'basic' mode if its mode is 'normal' + if variable.auto_freeze is True and variable.mode != modes_level[-1]: + variable.mode = modes_level[0] + path = '{}.{}'.format(family.path, variable.name) + self.annotate_variable(variable, family_mode, path) + diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py new file mode 100644 index 00000000..532ba9f3 --- /dev/null +++ b/src/rougail/annotator/group.py @@ -0,0 +1,135 @@ +from typing import List + +from ..i18n import _ +from ..error import DictConsistencyError + + +class GroupAnnotator: + def __init__(self, + objectspace, + ): + self.objectspace = objectspace + if not hasattr(self.objectspace.space, 'constraints') or not hasattr(self.objectspace.space.constraints, 'group'): + return + self.convert_groups() + + def convert_groups(self): # pylint: disable=C0111 + for group in self.objectspace.space.constraints.group: + leader_fullname = group.leader + leader_family_name = self.objectspace.paths.get_variable_family_name(leader_fullname) + leader_name = self.objectspace.paths.get_variable_name(leader_fullname) + namespace = self.objectspace.paths.get_variable_namespace(leader_fullname) + if '.' not in leader_fullname: + leader_fullname = '.'.join([namespace, leader_family_name, leader_fullname]) + follower_names = list(group.follower.keys()) + has_a_leader = False + ori_leader_family = self.objectspace.paths.get_family_obj(leader_fullname.rsplit('.', 1)[0]) + for variable in list(ori_leader_family.variable.values()): + if has_a_leader: + # it's a follower + self.manage_follower(namespace, + leader_family_name, + variable, + leadership_name, + follower_names, + leader_space, + leader_is_hidden, + ) + ori_leader_family.variable.pop(variable.name) + if follower_names == []: + # no more follower + break + elif variable.name == leader_name: + # it's a leader + if isinstance(variable, self.objectspace.leadership): + # append follower to an existed leadership + leader_space = variable + # if variable.hidden: + # leader_is_hidden = True + else: + leader_space = self.objectspace.leadership(variable.xmlfiles) + if hasattr(group, 'name'): + leadership_name = group.name + else: + leadership_name = leader_name + leader_is_hidden = self.manage_leader(leader_space, + leader_family_name, + leadership_name, + leader_name, + namespace, + variable, + group, + leader_fullname, + ) + has_a_leader = True + else: + raise DictConsistencyError(_('cannot found followers "{}"').format('", "'.join(follower_names))) + del self.objectspace.space.constraints.group + + def manage_leader(self, + leader_space: 'Leadership', + leader_family_name: str, + leadership_name: str, + leader_name: str, + namespace: str, + variable: 'Variable', + group: 'Group', + leader_fullname: str, + ) -> None: + # manage leader's variable + if variable.multi is not True: + raise DictConsistencyError(_('the variable {} in a group must be multi').format(variable.name)) + leader_space.variable = [] + leader_space.name = leadership_name + leader_space.hidden = variable.hidden + if variable.hidden: + leader_is_hidden = True + variable.frozen = True + variable.force_default_on_freeze = True + else: + leader_is_hidden = False + variable.hidden = None + if hasattr(group, 'description'): + leader_space.doc = group.description + elif hasattr(variable, 'description'): + leader_space.doc = variable.description + else: + leader_space.doc = variable.name + leadership_path = namespace + '.' + leader_family_name + '.' + leadership_name + self.objectspace.paths.add_family(namespace, + leadership_path, + leader_space, + ) + leader_family = self.objectspace.space.variables[namespace].family[leader_family_name] + leader_family.variable[leader_name] = leader_space + leader_space.variable.append(variable) + self.objectspace.paths.set_leader(namespace, + leader_family_name, + leader_name, + leader_name, + ) + leader_space.path = leader_fullname + return leader_is_hidden + + def manage_follower(self, + namespace: str, + leader_family_name: str, + variable: 'Variable', + leader_name: str, + follower_names: List[str], + leader_space: 'Leadership', + leader_is_hidden: bool, + ) -> None: + if variable.name != follower_names[0]: + raise DictConsistencyError(_('cannot found this follower {}').format(follower_names[0])) + follower_names.remove(variable.name) + if leader_is_hidden: + variable.frozen = True + variable.force_default_on_freeze = True + leader_space.variable.append(variable) # pylint: disable=E1101 + self.objectspace.paths.set_leader(namespace, + leader_family_name, + variable.name, + leader_name, + ) + diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py new file mode 100644 index 00000000..741538e3 --- /dev/null +++ b/src/rougail/annotator/property.py @@ -0,0 +1,55 @@ +PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze', + 'force_store_value', 'disabled', 'mandatory') +CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force_store_value', 'auto_freeze']} + + +class PropertyAnnotator: + def __init__(self, objectspace): + self.objectspace = objectspace + self.convert_annotator() + + def convert_property(self, + variable, + ): + properties = [] + for prop in PROPERTIES: + if hasattr(variable, prop): + if getattr(variable, prop) == True: + for subprop in CONVERT_PROPERTIES.get(prop, [prop]): + properties.append(subprop) + setattr(variable, prop, None) + if hasattr(variable, 'mode') and variable.mode: + properties.append(variable.mode) + variable.mode = None + if properties: + variable.properties = frozenset(properties) + + def convert_annotator(self): # pylint: disable=C0111 + if hasattr(self.objectspace.space, 'services'): + self.convert_property(self.objectspace.space.services) + for services in self.objectspace.space.services.service.values(): + self.convert_property(services) + for service in vars(services).values(): + if isinstance(service, self.objectspace.family): + self.convert_property(service) + if hasattr(service, 'family'): + self.convert_property(service) + for family in service.family: + self.convert_property(family) + if hasattr(family, 'variable'): + for variable in family.variable: + self.convert_property(variable) + if hasattr(self.objectspace.space, 'variables'): + for variables in self.objectspace.space.variables.values(): + if hasattr(variables, 'family'): + for family in variables.family.values(): + self.convert_property(family) + if hasattr(family, 'variable'): + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + self.convert_property(variable) + for follower in variable.variable: + self.convert_property(follower) + else: + self.convert_property(variable) + diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py new file mode 100644 index 00000000..e4e72116 --- /dev/null +++ b/src/rougail/annotator/service.py @@ -0,0 +1,251 @@ +from os.path import basename + +from ..i18n import _ +from ..utils import normalize_family +from ..error import DictConsistencyError +# a CreoleObjSpace's attribute has some annotations +# that shall not be present in the exported (flatened) XML +ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace', + 'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership', + 'level', 'remove_fill', 'xmlfiles') + + +KEY_TYPE = {'variable': 'symlink', + 'SymLinkOption': 'symlink', + 'PortOption': 'port', + 'UnicodeOption': 'string', + 'NetworkOption': 'network', + 'NetmaskOption': 'netmask', + 'URLOption': 'web_address', + 'FilenameOption': 'filename'} + + +class ServiceAnnotator: + """Manage service's object + for example:: + + + + 123 + + + + """ + def __init__(self, objectspace): + self.objectspace = objectspace + self.convert_services() + + def convert_services(self): + if not hasattr(self.objectspace.space, 'services'): + return + if not hasattr(self.objectspace.space.services, 'service'): + del self.objectspace.space.services + return + self.objectspace.space.services.hidden = True + self.objectspace.space.services.name = 'services' + self.objectspace.space.services.doc = 'services' + families = {} + for idx, service_name in enumerate(self.objectspace.space.services.service.keys()): + service = self.objectspace.space.services.service[service_name] + new_service = self.objectspace.service(service.xmlfiles) + for elttype, values in vars(service).items(): + if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES: + setattr(new_service, elttype, values) + continue + eltname = elttype + 's' + path = '.'.join(['services', service_name, eltname]) + family = self.gen_family(eltname, + path, + service.xmlfiles, + ) + if isinstance(values, dict): + values = list(values.values()) + family.family = self.make_group_from_elts(service_name, + elttype, + values, + path, + ) + setattr(new_service, elttype, family) + new_service.doc = new_service.name + families[service_name] = new_service + self.objectspace.space.services.service = families + + def gen_family(self, + name, + path, + xmlfiles + ): + family = self.objectspace.family(xmlfiles) + family.name = normalize_family(name) + family.doc = name + family.mode = None + self.objectspace.paths.add_family('services', + path, + family, + ) + return family + + def make_group_from_elts(self, + service_name, + name, + elts, + path, + ): + """Splits each objects into a group (and `OptionDescription`, in tiramisu terms) + and build elements and its attributes (the `Options` in tiramisu terms) + """ + families = [] + new_elts = self._reorder_elts(name, + elts, + ) + for index, elt_info in enumerate(new_elts): + elt = elt_info['elt'] + elt_name = elt_info['elt_name'] + + # try to launch _update_xxxx() function + update_elt = '_update_' + elt_name + if hasattr(self, update_elt): + getattr(self, update_elt)(elt, + index, + path, + service_name, + ) + + idx = 0 + while True: + if hasattr(elt, 'source'): + c_name = elt.source + else: + c_name = elt.name + if idx: + c_name += f'_{idx}' + subpath = '{}.{}'.format(path, c_name) + if not self.objectspace.paths.family_is_defined(subpath): + break + idx += 1 + family = self.gen_family(c_name, + subpath, + elt.xmlfiles, + ) + family.variable = [] + listname = '{}list'.format(name) + activate_path = '.'.join([subpath, 'activate']) + for key in dir(elt): + if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES: + continue + value = getattr(elt, key) + if key == listname: + self.objectspace.list_conditions.setdefault(listname, + {}).setdefault( + value, + []).append(activate_path) + continue + family.variable.append(self._generate_element(elt_name, + key, + value, + elt, + f'{subpath}.{key}' + )) + # FIXME ne devrait pas etre True par défaut + # devrait etre un calcule + family.variable.append(self._generate_element(elt_name, + 'activate', + True, + elt, + activate_path, + )) + families.append(family) + return families + + def _generate_element(self, + elt_name, + key, + value, + elt, + path, + ): + variable = self.objectspace.variable(elt.xmlfiles) + variable.name = normalize_family(key) + variable.mode = None + if key == 'name': + true_key = elt_name + else: + true_key = key + dtd_key_type = true_key + '_type' + if key == 'activate': + type_ = 'boolean' + elif hasattr(elt, dtd_key_type): + type_ = KEY_TYPE[getattr(elt, dtd_key_type)] + elif key in self.objectspace.booleans_attributs: + type_ = 'boolean' + else: + type_ = 'string' + variable.type = type_ + if type_ == 'symlink': + variable.opt = self.objectspace.paths.get_variable_path(value, + 'services', + ) +# variable.opt = value + variable.multi = None + else: + variable.doc = key + val = self.objectspace.value(elt.xmlfiles) + val.type = type_ + val.name = value + variable.value = [val] + self.objectspace.paths.add_variable('services', + path, + 'service', + False, + variable, + ) + return variable + + def _reorder_elts(self, + name, + elts, + ): + """Reorders by index the elts + """ + new_elts = {} + # reorder elts by index + for idx, elt in enumerate(elts): + new_elts.setdefault(idx, []).append(elt) + idxes = list(new_elts.keys()) + idxes.sort() + result_elts = [] + for idx in idxes: + for elt in new_elts[idx]: + result_elts.append({'elt_name': name, 'elt': elt}) + return result_elts + + def _update_override(self, + file_, + index, + service_path, + service_name, + ): + file_.name = f'/systemd/system/{service_name}.service.d/rougail.conf' + # retrieve default value from File object + for attr in ['owner', 'group', 'mode']: + setattr(file_, attr, getattr(self.objectspace.file, attr)) + if not hasattr(file_, 'source'): + file_.source = f'{service_name}.service' + self._update_file(file_, + index, + service_path, + service_name, + ) + + def _update_file(self, + file_, + index, + service_path, + service_name, + ): + if not hasattr(file_, 'file_type') or file_.file_type == "UnicodeOption": + if not hasattr(file_, 'source'): + file_.source = basename(file_.name) + elif not hasattr(file_, 'source'): + raise DictConsistencyError(_('attribute source mandatory for file with variable name for {}').format(file_.name)) + diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py new file mode 100644 index 00000000..69e8b512 --- /dev/null +++ b/src/rougail/annotator/variable.py @@ -0,0 +1,193 @@ +from ..i18n import _ +from ..utils import normalize_family +from ..error import DictConsistencyError + + +CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), + 'float': dict(opttype="FloatOption", func=float), + 'choice': dict(opttype="ChoiceOption"), + 'string': dict(opttype="StrOption"), + 'password': dict(opttype="PasswordOption"), + 'mail': dict(opttype="EmailOption"), + 'boolean': dict(opttype="BoolOption"), + 'symlink': dict(opttype="SymLinkOption"), + 'filename': dict(opttype="FilenameOption"), + 'date': dict(opttype="DateOption"), + 'unix_user': dict(opttype="UsernameOption"), + 'ip': dict(opttype="IPOption", initkwargs={'allow_reserved': True}), + 'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, 'warnings_only': True}), + 'netmask': dict(opttype="NetmaskOption"), + 'network': dict(opttype="NetworkOption"), + 'broadcast': dict(opttype="BroadcastOption"), + 'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}), + 'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}), + 'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}), + 'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}), + 'port': dict(opttype="PortOption", initkwargs={'allow_private': True}), + 'mac': dict(opttype="MACOption"), + 'cidr': dict(opttype="IPOption", initkwargs={'cidr': True}), + 'network_cidr': dict(opttype="NetworkOption", initkwargs={'cidr': True}), + } + + +FORCE_CHOICE = {'oui/non': ['oui', 'non'], + 'on/off': ['on', 'off'], + 'yes/no': ['yes', 'no'], + 'schedule': ['none', 'daily', 'weekly', 'monthly'], + 'schedulemod': ['pre', 'post']} + + +FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' + + +RENAME_ATTIBUTES = {'description': 'doc'} + + +class VariableAnnotator: + def __init__(self, + objectspace, + ): + self.objectspace = objectspace + self.convert_variable() + self.convert_auto_freeze() + self.convert_separators() + + def convert_variable(self): + def _convert_variable(variable, + variable_type, + ): + if not hasattr(variable, 'type'): + variable.type = 'string' + if variable.type != 'symlink' and not hasattr(variable, 'description'): + variable.description = variable.name + if hasattr(variable, 'value'): + for value in variable.value: + if not hasattr(value, 'type'): + value.type = variable.type + value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name) + for key, value in RENAME_ATTIBUTES.items(): + setattr(variable, value, getattr(variable, key)) + setattr(variable, key, None) + if variable_type == 'follower': + if variable.multi is True: + variable.multi = 'submulti' + else: + variable.multi = True + + def _convert_valid_enum(namespace, + variable, + path, + ): + if variable.type in FORCE_CHOICE: + check = self.objectspace.check(variable.xmlfiles) + check.name = 'valid_enum' + check.target = path + check.namespace = namespace + check.param = [] + for value in FORCE_CHOICE[variable.type]: + param = self.objectspace.param(variable.xmlfiles) + param.text = value + check.param.append(param) + if not hasattr(self.objectspace.space, 'constraints'): + self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) + self.objectspace.space.constraints.namespace = namespace + if not hasattr(self.objectspace.space.constraints, 'check'): + self.objectspace.space.constraints.check = [] + self.objectspace.space.constraints.check.append(check) + variable.type = 'string' + + def _valid_type(variable): + if variable.type not in CONVERT_OPTION: + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + raise DictConsistencyError(_(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlfiles}')) + + if not hasattr(self.objectspace.space, 'variables'): + return + for families in self.objectspace.space.variables.values(): + namespace = families.name + if hasattr(families, 'family'): + families.doc = families.name + for family in families.family.values(): + family.doc = family.name + for key, value in RENAME_ATTIBUTES.items(): + if hasattr(family, key): + setattr(family, value, getattr(family, key)) + setattr(family, key, None) + family.name = normalize_family(family.name) + if hasattr(family, 'variable'): + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + for idx, follower in enumerate(variable.variable): + if idx == 0: + variable_type = 'master' + else: + variable_type = 'follower' + path = '{}.{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name, follower.name) + _convert_variable(follower, + variable_type, + ) + _convert_valid_enum(namespace, + follower, + path, + ) + _valid_type(follower) + else: + path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name) + _convert_variable(variable, + 'variable', + ) + _convert_valid_enum(namespace, + variable, + path, + ) + _valid_type(variable) + + def convert_auto_freeze(self): # pylint: disable=C0111 + def _convert_auto_freeze(variable, namespace): + if variable.auto_freeze: + new_condition = self.objectspace.condition(variable.xmlfiles) + new_condition.name = 'auto_hidden_if_not_in' + new_condition.namespace = namespace + new_condition.source = FREEZE_AUTOFREEZE_VARIABLE + new_param = self.objectspace.param(variable.xmlfiles) + new_param.text = 'oui' + new_condition.param = [new_param] + new_target = self.objectspace.target(variable.xmlfiles) + new_target.type = 'variable' + path = variable.namespace + '.' + normalize_family(family.name) + '.' + variable.name + new_target.name = path + new_condition.target = [new_target] + if not hasattr(self.objectspace.space.constraints, 'condition'): + self.objectspace.space.constraints.condition = [] + self.objectspace.space.constraints.condition.append(new_condition) + if hasattr(self.objectspace.space, 'variables'): + for variables in self.objectspace.space.variables.values(): + if hasattr(variables, 'family'): + namespace = variables.name + for family in variables.family.values(): + if hasattr(family, 'variable'): + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + for follower in variable.variable: + _convert_auto_freeze(follower, namespace) + else: + _convert_auto_freeze(variable, namespace) + + def convert_separators(self): # pylint: disable=C0111,R0201 + if not hasattr(self.objectspace.space, 'variables'): + return + for family in self.objectspace.space.variables.values(): + if not hasattr(family, 'separators'): + continue + if hasattr(family.separators, 'separator'): + for idx, separator in enumerate(family.separators.separator): + option = self.objectspace.paths.get_variable_obj(separator.name) + if hasattr(option, 'separator'): + subpath = self.objectspace.paths.get_variable_path(separator.name, + separator.namespace, + ) + xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles) + raise DictConsistencyError(_(f'{subpath} already has a separator in {xmlfiles}')) + option.separator = separator.text + del family.separators + From fffd52eec6bf00ad1227796c365f96fafc9c33b5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 07:40:14 +0100 Subject: [PATCH 013/168] remove pylint comment --- src/rougail/objspace.py | 94 ++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 52 deletions(-) diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index e48b4470..0a462bc3 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -4,11 +4,6 @@ as an input and outputs a Tiramisu's file Sample usage:: - eolobj.space_visitor(func) - xml = eolobj.save() - - - >>> from rougail.objspace import RougailObjSpace >>> eolobj = RougailObjSpace('/usr/share/rougail/rougail.dtd') >>> eolobj.create_or_populate_from_xml('rougail', ['/usr/share/rougail/dicos']) @@ -74,11 +69,10 @@ class ObjSpace: class RougailObjSpace: - """DOM XML reflexion free internal representation of a Rougail Dictionary + """Rougail ObjectSpace is an object's reflexion of the XML elements """ - - def __init__(self, dtdfilename): # pylint: disable=R0912 + def __init__(self, dtdfilename): self.index = 0 self.space = ObjSpace() self.paths = Path() @@ -91,13 +85,13 @@ class RougailObjSpace: self.list_conditions = {} self.booleans_attributs = [] - self.make_object_space_class() + self.make_object_space_classes() - def make_object_space_class(self): - """Create Rougail ObjectSpace class types, it enables us to create objects like: + def make_object_space_classes(self): + """Create Rougail ObjectSpace class types from DDT file + It enables us to create objects like: File(), Variable(), Ip(), Family(), Constraints()... and so on. - - Rougail ObjectSpace is an object's reflexion of the XML elements""" + """ for dtd_elt in self.xmlreflector.dtd.iterelements(): attrs = {} @@ -138,12 +132,18 @@ class RougailObjSpace: setattr(self, elt, type(name, (RootRougailObject,), dict())) self.Leadership = self.leadership + def display_xmlfiles(self, + xmlfiles: list, + ) -> str: + if len(xmlfiles) == 1: + return '"' + xmlfiles[0] + '"' + return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"' + def create_or_populate_from_xml(self, namespace, xmlfolders, ): - """Parses a bunch of XML files - populates the RougailObjSpace + """Parses a bunch of XML files and populates the RougailObjSpace """ for xmlfile, document in self.xmlreflector.load_xml_from_folders(xmlfolders): self.redefine_variables = [] @@ -159,8 +159,7 @@ class RougailObjSpace: space, namespace, ): - """Parses a Rougail XML file - populates the RougailObjSpace + """Parses a Rougail XML file and populates the RougailObjSpace """ # var to check unique family name in a XML file family_names = [] @@ -177,6 +176,7 @@ class RougailObjSpace: # variables has no name, so force namespace name child.attrib['name'] = namespace if child.tag == 'value' and child.text is None: + # remove empty value continue # variable objects creation try: @@ -223,7 +223,7 @@ class RougailObjSpace: namespace, ): """ - instanciates or creates Rougail Object Subspace objects + retrieves or creates Rougail Object Subspace objects """ obj = getattr(self, child.tag) if Redefinable in obj.__mro__: @@ -285,45 +285,36 @@ class RougailObjSpace: return getattr(self, child.tag)(xmlfile) raise DictConsistencyError(_(f'Redefined object in "{xmlfile}": "{name}" does not exist yet')) - def display_xmlfiles(self, - xmlfiles: list, - ) -> str: - if len(xmlfiles) == 1: - return '"' + xmlfiles[0] + '"' - return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"' - def get_existed_obj(self, name: str, space: str, child, namespace: str, ): - if isinstance(space, self.family): # pylint: disable=E1101 + if isinstance(space, self.family): if namespace != Config['variable_namespace']: name = space.path + '.' + name - if self.paths.path_is_defined(name): - old_family_name = self.paths.get_variable_family_name(name) - if namespace != Config['variable_namespace']: - old_family_name = namespace + '.' + old_family_name - if space.path != old_family_name: - xmlfiles = self.display_xmlfiles(space.xmlfiles) - raise DictConsistencyError(_(f'Variable was previously create in family "{old_family_name}", now it is in "{space.path}" in {xmlfiles}')) - return self.paths.get_variable_obj(name) - return + if not self.paths.path_is_defined(name): + return + old_family_name = self.paths.get_variable_family_name(name) + if namespace != Config['variable_namespace']: + old_family_name = namespace + '.' + old_family_name + if space.path != old_family_name: + xmlfiles = self.display_xmlfiles(space.xmlfiles) + raise DictConsistencyError(_(f'Variable was previously create in family "{old_family_name}", now it is in "{space.path}" in {xmlfiles}')) + return self.paths.get_variable_obj(name) children = getattr(space, child.tag, {}) if name in children: return children[name] - def convert_boolean(self, value): # pylint: disable=R0201 + def convert_boolean(self, value): """Boolean coercion. The Rougail XML may contain srings like `True` or `False` """ if isinstance(value, bool): return value if value == 'True': return True - elif value == 'False': - return False - raise TypeError(_('{} is not True or False').format(value)) # pragma: no cover + return False def set_text(self, child, @@ -377,37 +368,37 @@ class RougailObjSpace: if child.tag == 'fill' and child.attrib['target'] in self.redefine_variables: self.remove_fill(child.attrib['target']) - def remove_check(self, name): # pylint: disable=C0111 + def remove_check(self, name): if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'check'): remove_checks = [] - for idx, check in enumerate(self.space.constraints.check): # pylint: disable=E1101 + for idx, check in enumerate(self.space.constraints.check): if hasattr(check, 'target') and check.target == name: remove_checks.append(idx) remove_checks = list(set(remove_checks)) remove_checks.sort(reverse=True) for idx in remove_checks: - self.space.constraints.check.pop(idx) # pylint: disable=E1101 + self.space.constraints.check.pop(idx) - def remove_condition(self, name): # pylint: disable=C0111 + def remove_condition(self, name): remove_conditions = [] - for idx, condition in enumerate(self.space.constraints.condition): # pylint: disable=E1101 + for idx, condition in enumerate(self.space.constraints.condition): if condition.source == name: remove_conditions.append(idx) for idx in remove_conditions: del self.space.constraints.condition[idx] - def remove_fill(self, name): # pylint: disable=C0111 + def remove_fill(self, name): if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'fill'): remove_fills= [] - for idx, fill in enumerate(self.space.constraints.fill): # pylint: disable=E1101 + for idx, fill in enumerate(self.space.constraints.fill): if hasattr(fill, 'target') and fill.target == name: remove_fills.append(idx) remove_fills = list(set(remove_fills)) remove_fills.sort(reverse=True) for idx in remove_fills: - self.space.constraints.fill.pop(idx) # pylint: disable=E1101 + self.space.constraints.fill.pop(idx) def set_path(self, space, @@ -415,7 +406,7 @@ class RougailObjSpace: namespace, document, variableobj, - ): # pylint: disable=R0913 + ): """Fill self.paths attributes """ if child.tag == 'variable': @@ -449,7 +440,7 @@ class RougailObjSpace: space, child, namespace, - ): # pylint: disable=R0201 + ): if not hasattr(variableobj, 'index'): variableobj.index = self.index variableobj.namespace = namespace @@ -463,12 +454,11 @@ class RougailObjSpace: else: setattr(space, child.tag, variableobj) - def space_visitor(self, eosfunc_file): # pylint: disable=C0111 + def space_visitor(self, eosfunc_file): self.funcs_path = eosfunc_file SpaceAnnotator(self, eosfunc_file) - def save(self, - ): + def save(self): tiramisu_objects = TiramisuReflector(self.space, self.funcs_path, ) From 04ab1edd36c39f145152113962d7cb90dd007aee Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 12:41:10 +0100 Subject: [PATCH 014/168] test error number --- src/rougail/annotator/constrainte.py | 104 +++++++++++++----- src/rougail/annotator/family.py | 6 +- src/rougail/annotator/group.py | 10 +- src/rougail/annotator/property.py | 8 +- src/rougail/annotator/service.py | 3 +- src/rougail/annotator/variable.py | 43 +------- src/rougail/error.py | 3 + src/rougail/objspace.py | 10 +- src/rougail/path.py | 16 +-- src/rougail/xmlreflector.py | 2 +- .../makedict/base.json | 1 - .../tiramisu/base.py | 15 --- .../__init__.py => 51redefine_multi/errno_48} | 0 .../__init__.py => 51redefine_type/errno_48} | 0 .../errno_41} | 0 .../60extra_externalspaceauto/errno_41 | 0 .../60extra_externalspacecondition2/errno_38 | 0 .../60extra_externalspacecondition3/errno_12 | 0 .../00-base.xml | 7 +- .../80auto_autofreeze/__init__.py | 0 tests/dictionaries/80auto_autofreeze/errno_50 | 0 .../00-base.xml | 0 .../80autosave_hidden_frozenifin/__init__.py | 0 .../80autosave_hidden_frozenifin/errno_51 | 0 tests/dictionaries/80check_unknown/errno_1 | 0 .../dictionaries/80check_unknown_var/errno_2 | 0 .../dictionaries/80condition_itself/errno_11 | 0 .../80condition_not_exists_error/errno_12 | 0 .../errno_34 | 0 .../80container_filesredefine_error/errno_45 | 0 .../80empty_param_number/errno_27 | 0 .../80empty_typeeole_eole/errno_27 | 0 .../80empty_typeeole_number/errno_27 | 0 .../80extra_auto_freeze/00-base.xml | 15 +++ .../80extra_auto_freeze/__init__.py | 0 .../dictionaries/80extra_auto_freeze/errno_49 | 0 .../extra_dirs/extra/00-base.xml | 11 ++ tests/dictionaries/80family_change/errno_47 | 0 .../80family_changeaccent/errno_47 | 0 tests/dictionaries/80family_several/errno_44 | 0 tests/dictionaries/80fill_error/errno_24 | 0 tests/dictionaries/80fill_multi/errno_24 | 0 .../80hidden_if_in_filelist/errno_10 | 0 .../80leadership_auto_save/errno_29 | 0 .../80leadership_autofreeze/00-base.xml | 7 +- .../80leadership_autofreeze/errno_30 | 0 .../errno_33 | 0 .../80leadership_not_ordered/errno_33 | 0 .../80leadership_not_same_family/errno_31 | 0 .../80leadership_notexists/errno_42 | 0 .../80redefine_double_error/errno_48 | 0 tests/dictionaries/80redefine_error/errno_45 | 0 .../80redefine_fillerror/errno_24 | 0 .../80redefine_notexists/errno_46 | 0 tests/dictionaries/80separator_multi/errno_35 | 0 .../dictionaries/80separator_multi2/errno_35 | 0 .../80separator_nonexists/errno_42 | 0 tests/dictionaries/80unknown_type/errno_36 | 0 .../88valid_enum_not_number/errno_13 | 0 .../88valid_enum_numberdefaultstring/errno_15 | 0 tests/test_1_flattener.py | 24 ++-- 61 files changed, 164 insertions(+), 121 deletions(-) delete mode 100644 tests/dictionaries/10autosave_hidden_frozenifin/makedict/base.json delete mode 100644 tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py rename tests/dictionaries/{10autosave_hidden_frozenifin/__init__.py => 51redefine_multi/errno_48} (100%) rename tests/dictionaries/{10autosave_hidden_frozenifin/tiramisu/__init__.py => 51redefine_type/errno_48} (100%) rename tests/dictionaries/{80fill_autofreeze/__init__.py => 60extra_externalspace/errno_41} (100%) create mode 100644 tests/dictionaries/60extra_externalspaceauto/errno_41 create mode 100644 tests/dictionaries/60extra_externalspacecondition2/errno_38 create mode 100644 tests/dictionaries/60extra_externalspacecondition3/errno_12 rename tests/dictionaries/{80fill_autofreeze => 80auto_autofreeze}/00-base.xml (64%) create mode 100644 tests/dictionaries/80auto_autofreeze/__init__.py create mode 100644 tests/dictionaries/80auto_autofreeze/errno_50 rename tests/dictionaries/{10autosave_hidden_frozenifin => 80autosave_hidden_frozenifin}/00-base.xml (100%) create mode 100644 tests/dictionaries/80autosave_hidden_frozenifin/__init__.py create mode 100644 tests/dictionaries/80autosave_hidden_frozenifin/errno_51 create mode 100644 tests/dictionaries/80check_unknown/errno_1 create mode 100644 tests/dictionaries/80check_unknown_var/errno_2 create mode 100644 tests/dictionaries/80condition_itself/errno_11 create mode 100644 tests/dictionaries/80condition_not_exists_error/errno_12 create mode 100644 tests/dictionaries/80container_files_symlink_without_source/errno_34 create mode 100644 tests/dictionaries/80container_filesredefine_error/errno_45 create mode 100644 tests/dictionaries/80empty_param_number/errno_27 create mode 100644 tests/dictionaries/80empty_typeeole_eole/errno_27 create mode 100644 tests/dictionaries/80empty_typeeole_number/errno_27 create mode 100644 tests/dictionaries/80extra_auto_freeze/00-base.xml create mode 100644 tests/dictionaries/80extra_auto_freeze/__init__.py create mode 100644 tests/dictionaries/80extra_auto_freeze/errno_49 create mode 100644 tests/dictionaries/80extra_auto_freeze/extra_dirs/extra/00-base.xml create mode 100644 tests/dictionaries/80family_change/errno_47 create mode 100644 tests/dictionaries/80family_changeaccent/errno_47 create mode 100644 tests/dictionaries/80family_several/errno_44 create mode 100644 tests/dictionaries/80fill_error/errno_24 create mode 100644 tests/dictionaries/80fill_multi/errno_24 create mode 100644 tests/dictionaries/80hidden_if_in_filelist/errno_10 create mode 100644 tests/dictionaries/80leadership_auto_save/errno_29 create mode 100644 tests/dictionaries/80leadership_autofreeze/errno_30 create mode 100644 tests/dictionaries/80leadership_none_follower_between_follower/errno_33 create mode 100644 tests/dictionaries/80leadership_not_ordered/errno_33 create mode 100644 tests/dictionaries/80leadership_not_same_family/errno_31 create mode 100644 tests/dictionaries/80leadership_notexists/errno_42 create mode 100644 tests/dictionaries/80redefine_double_error/errno_48 create mode 100644 tests/dictionaries/80redefine_error/errno_45 create mode 100644 tests/dictionaries/80redefine_fillerror/errno_24 create mode 100644 tests/dictionaries/80redefine_notexists/errno_46 create mode 100644 tests/dictionaries/80separator_multi/errno_35 create mode 100644 tests/dictionaries/80separator_multi2/errno_35 create mode 100644 tests/dictionaries/80separator_nonexists/errno_42 create mode 100644 tests/dictionaries/80unknown_type/errno_36 create mode 100644 tests/dictionaries/88valid_enum_not_number/errno_13 create mode 100644 tests/dictionaries/88valid_enum_numberdefaultstring/errno_15 diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 6c81202a..a65f6a45 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -6,6 +6,10 @@ from .variable import CONVERT_OPTION from ..i18n import _ from ..utils import normalize_family from ..error import DictConsistencyError +from ..config import Config + +FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' + INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier'] @@ -20,6 +24,8 @@ class ConstrainteAnnotator: eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() self.functions = dir(eosfunc) self.functions.extend(INTERNAL_FUNCTIONS) + + self.convert_auto_freeze() self.valid_enums = {} if hasattr(self.objectspace.space.constraints, 'check'): self.check_check() @@ -39,12 +45,46 @@ class ConstrainteAnnotator: self.convert_fill() self.remove_constraints() + def convert_auto_freeze(self): # pylint: disable=C0111 + if not hasattr(self.objectspace.space, 'variables'): + return + def _convert_auto_freeze(variable, namespace): + if variable.auto_freeze: + if namespace != Config['variable_namespace']: + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + raise DictConsistencyError(_(f'auto_freeze is not allowed in extra "{namespace}" in {xmlfiles}'), 49) + new_condition = self.objectspace.condition(variable.xmlfiles) + new_condition.name = 'auto_hidden_if_not_in' + new_condition.namespace = namespace + new_condition.source = FREEZE_AUTOFREEZE_VARIABLE + new_param = self.objectspace.param(variable.xmlfiles) + new_param.text = 'oui' + new_condition.param = [new_param] + new_target = self.objectspace.target(variable.xmlfiles) + new_target.type = 'variable' + new_target.name = variable.name + new_condition.target = [new_target] + if not hasattr(self.objectspace.space.constraints, 'condition'): + self.objectspace.space.constraints.condition = [] + self.objectspace.space.constraints.condition.append(new_condition) + for variables in self.objectspace.space.variables.values(): + if hasattr(variables, 'family'): + namespace = variables.name + for family in variables.family.values(): + if hasattr(family, 'variable'): + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + for follower in variable.variable: + _convert_auto_freeze(follower, namespace) + else: + _convert_auto_freeze(variable, namespace) + def check_check(self): remove_indexes = [] for check_idx, check in enumerate(self.objectspace.space.constraints.check): if not check.name in self.functions: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'cannot find check function "{check.name}" in {xmlfiles}')) + raise DictConsistencyError(_(f'cannot find check function "{check.name}" in {xmlfiles}'), 1) if hasattr(check, 'param'): param_option_indexes = [] for idx, param in enumerate(check.param): @@ -53,7 +93,7 @@ class ConstrainteAnnotator: param_option_indexes.append(idx) else: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'cannot find check param "{param.text}" in {xmlfiles}')) + raise DictConsistencyError(_(f'cannot find check param "{param.text}" in {xmlfiles}'), 2) if param.type != 'variable': param.notraisepropertyerror = None param_option_indexes = list(set(param_option_indexes)) @@ -84,9 +124,9 @@ class ConstrainteAnnotator: if check.target in self.valid_enums: old_xmlfiles = self.objectspace.display_xmlfiles(self.valid_enums[check.target]['xmlfiles']) xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?')) + raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?'), 3) if not hasattr(check, 'param'): - raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}')) + raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}'), 4) variable = self.objectspace.paths.get_variable_obj(check.target) values = self.load_params_in_valid_enum(check.param, variable.name, @@ -113,18 +153,18 @@ class ConstrainteAnnotator: for param in params: if param.type == 'variable': if has_variable is not None: - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) + raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}'), 5) has_variable = True variable = self.objectspace.paths.get_variable_obj(param.text) if not variable.multi: - raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable {variable_name}')) + raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable {variable_name}'), 6) values = param.text else: if has_variable: - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) + raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}'), 7) if not hasattr(param, 'text'): if param.type == 'number': - raise DictConsistencyError(_(f'value is mandatory for valid_enum of variable {variable_name}')) + raise DictConsistencyError(_(f'value is mandatory for valid_enum of variable {variable_name}'), 8) values.append(None) else: values.append(param.text) @@ -156,10 +196,11 @@ class ConstrainteAnnotator: def check_params_target(self): for condition in self.objectspace.space.constraints.condition: if not hasattr(condition, 'target'): - raise DictConsistencyError(_('target is mandatory in condition')) + raise DictConsistencyError(_('target is mandatory in condition'), 9) for target in condition.target: if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']: - raise DictConsistencyError(_(f'target in condition for {target.type} not allow in {condition.name}')) + xmlfiles = self.objectspace.display_xmlfiles(target.xmlfiles) + raise DictConsistencyError(_(f'target "{target.type}" not allow in condition "{condition.name}" in {xmlfiles}'), 10) def filter_targets(self): # pylint: disable=C0111 for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): @@ -167,7 +208,7 @@ class ConstrainteAnnotator: for idx, target in enumerate(condition.target): if target.type == 'variable': if condition.source == target.name: - raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source)) + raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source), 11) try: target_names = [normalize_family(name) for name in target.name.split('.')] target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace) @@ -179,7 +220,7 @@ class ConstrainteAnnotator: target_names = [normalize_family(name) for name in target.name.split('.')] target.name = self.objectspace.paths.get_family_path('.'.join(target_names), namespace) except KeyError: - raise DictConsistencyError(_('cannot found family {}').format(target.name)) + raise DictConsistencyError(_('cannot found family {}').format(target.name), 12) def convert_xxxlist_to_variable(self): # pylint: disable=C0111 # transform *list to variable or family @@ -318,6 +359,11 @@ class ConstrainteAnnotator: main_action = actions[0] if getattr(leader_or_variable, main_action, False) is True: continue + if isinstance(leader_or_variable, self.objectspace.variable) and \ + (leader_or_variable.auto_save or leader_or_variable.auto_freeze) and \ + 'force_default_on_freeze' in actions: + xmlfiles = self.objectspace.display_xmlfiles(leader_or_variable.xmlfiles) + raise DictConsistencyError(_(f'cannot have auto_freeze or auto_store with the hidden_if_in or hidden_if_not_in variable "{leader_or_variable.name}" in {xmlfiles}'), 51) for idx, action in enumerate(actions): prop = self.objectspace.property_(leader_or_variable.xmlfiles) prop.type = 'calculation' @@ -368,7 +414,7 @@ class ConstrainteAnnotator: else: choice.name = value except: - raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"')) + raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"'), 13) if choice.name == '': choice.name = None choices.append(choice.name) @@ -381,16 +427,16 @@ class ConstrainteAnnotator: try: cvalue = CONVERT_OPTION[type_].get('func', str)(value.name) except: - raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"')) + raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'), 14) if cvalue not in choices: - raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices)) + raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices), 15) else: new_value = self.objectspace.value(variable.xmlfiles) new_value.name = choices[0] new_value.type = type_ variable.value = [new_value] if not variable.choice: - raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name)) + raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name), 16) variable.type = 'choice' def convert_check(self): @@ -399,16 +445,16 @@ class ConstrainteAnnotator: name = check.name if name == 'valid_entier': if not hasattr(check, 'param'): - raise DictConsistencyError(_('{} must have, at least, 1 param').format(name)) + raise DictConsistencyError(_('{} must have, at least, 1 param').format(name), 17) for param in check.param: if param.type not in ['string', 'number']: - raise DictConsistencyError(_(f'param in "valid_entier" must not be a "{param.type}"')) + raise DictConsistencyError(_(f'param in "valid_entier" must not be a "{param.type}"'), 18) if param.name == 'mini': variable.min_number = int(param.text) elif param.name == 'maxi': variable.max_number = int(param.text) else: - raise DictConsistencyError(_(f'unknown parameter {param.text} in check "valid_entier" for variable {check.target}')) + raise DictConsistencyError(_(f'unknown parameter {param.text} in check "valid_entier" for variable {check.target}'), 19) else: check_ = self.objectspace.check(variable.xmlfiles) if name == 'valid_differ': @@ -417,23 +463,23 @@ class ConstrainteAnnotator: params_len = 1 if len(check.param) != params_len: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 20) elif name == 'valid_ipnetmask': params_len = 1 if len(check.param) != params_len: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 21) name = 'valid_ip_netmask' elif name == 'valid_broadcast': params_len = 2 if len(check.param) != params_len: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 22) elif name == 'valid_in_network': if len(check.param) not in (1, 2): params_len = 2 xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}')) + raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 23) check_.name = name check_.warnings_only = check.warnings_only if hasattr(check, 'param'): @@ -454,11 +500,11 @@ class ConstrainteAnnotator: # test if it's redefined calculation if fill.target in targets: xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}')) + raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}'), 24) targets.append(fill.target) # if fill.name not in self.functions: - raise DictConsistencyError(_('cannot find fill function {}').format(fill.name)) + raise DictConsistencyError(_('cannot find fill function {}').format(fill.name), 25) namespace = fill.namespace # let's replace the target by the path @@ -467,7 +513,7 @@ class ConstrainteAnnotator: with_suffix=True, ) if suffix is not None: - raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}"')) + raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}"'), 26) variable = self.objectspace.paths.get_variable_obj(fill.target) value = self.objectspace.value(variable.xmlfiles) value.type = 'calculation' @@ -476,9 +522,9 @@ class ConstrainteAnnotator: param_to_delete = [] for fill_idx, param in enumerate(fill.param): if param.type not in ['suffix', 'string'] and not hasattr(param, 'text'): - raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}")) + raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}"), 27) if param.type == 'suffix' and hasattr(param, 'text'): - raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}")) + raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}"), 28) if param.type == 'string': if not hasattr(param, 'text'): param.text = None @@ -491,6 +537,8 @@ class ConstrainteAnnotator: if suffix: param.suffix = suffix except DictConsistencyError as err: + if err.errno != 42: + raise err if param.optional is False: raise err param_to_delete.append(fill_idx) diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 78361e00..43d3ceb4 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -124,9 +124,11 @@ class FamilyAnnotator: mode = modes_level[-1] for idx, follower in enumerate(variable.variable): if follower.auto_save is True: - raise DictConsistencyError(_(f'leader/followers {follower.name} could not be auto_save')) + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + raise DictConsistencyError(_(f'leader/followers "{follower.name}" could not be auto_save in {xmlfiles}'), 29) if follower.auto_freeze is True: - raise DictConsistencyError(_('leader/followers {follower.name} could not be auto_freeze')) + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + raise DictConsistencyError(_(f'leader/followers "{follower.name}" could not be auto_freeze in {xmlfiles}'), 30) is_follower = idx != 0 path = '{}.{}.{}'.format(family.path, variable.name, follower.name) self.annotate_variable(follower, family_mode, path, is_follower) diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py index 532ba9f3..aaba954a 100644 --- a/src/rougail/annotator/group.py +++ b/src/rougail/annotator/group.py @@ -63,7 +63,9 @@ class GroupAnnotator: ) has_a_leader = True else: - raise DictConsistencyError(_('cannot found followers "{}"').format('", "'.join(follower_names))) + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + joined = '", "'.join(follower_names) + raise DictConsistencyError(_(f'when parsing leadership, we espect to find those followers "{joined}" in {xmlfiles}'), 31) del self.objectspace.space.constraints.group def manage_leader(self, @@ -78,7 +80,8 @@ class GroupAnnotator: ) -> None: # manage leader's variable if variable.multi is not True: - raise DictConsistencyError(_('the variable {} in a group must be multi').format(variable.name)) + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + raise DictConsistencyError(_(f'the variable "{variable.name}" in a group must be multi in {xmlfiles}'), 32) leader_space.variable = [] leader_space.name = leadership_name leader_space.hidden = variable.hidden @@ -121,7 +124,8 @@ class GroupAnnotator: leader_is_hidden: bool, ) -> None: if variable.name != follower_names[0]: - raise DictConsistencyError(_('cannot found this follower {}').format(follower_names[0])) + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + raise DictConsistencyError(_(f'when parsing leadership, we espect to find the follower "{follower_names[0]}" but we found "{variable.name}" in {xmlfiles}'), 33) follower_names.remove(variable.name) if leader_is_hidden: variable.frozen = True diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py index 741538e3..6a2aebbe 100644 --- a/src/rougail/annotator/property.py +++ b/src/rougail/annotator/property.py @@ -1,3 +1,7 @@ +from ..i18n import _ +from ..error import DictConsistencyError + + PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze', 'force_store_value', 'disabled', 'mandatory') CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force_store_value', 'auto_freeze']} @@ -21,6 +25,9 @@ class PropertyAnnotator: if hasattr(variable, 'mode') and variable.mode: properties.append(variable.mode) variable.mode = None + if 'force_store_value' in properties and 'force_default_on_freeze' in properties: + xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) + raise DictConsistencyError(_(f'cannot have auto_freeze or auto_store with the hidden variable "{variable.name}" in {xmlfiles}'), 50) if properties: variable.properties = frozenset(properties) @@ -52,4 +59,3 @@ class PropertyAnnotator: self.convert_property(follower) else: self.convert_property(variable) - diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index e4e72116..c5daabd4 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -247,5 +247,6 @@ class ServiceAnnotator: if not hasattr(file_, 'source'): file_.source = basename(file_.name) elif not hasattr(file_, 'source'): - raise DictConsistencyError(_('attribute source mandatory for file with variable name for {}').format(file_.name)) + xmlfiles = self.objectspace.display_xmlfiles(file_.xmlfiles) + raise DictConsistencyError(_(f'attribute "source" is mandatory for the file "{file_.name}" in {xmlfiles}'), 34) diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 69e8b512..e258f60f 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -37,9 +37,6 @@ FORCE_CHOICE = {'oui/non': ['oui', 'non'], 'schedulemod': ['pre', 'post']} -FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' - - RENAME_ATTIBUTES = {'description': 'doc'} @@ -49,7 +46,6 @@ class VariableAnnotator: ): self.objectspace = objectspace self.convert_variable() - self.convert_auto_freeze() self.convert_separators() def convert_variable(self): @@ -99,7 +95,7 @@ class VariableAnnotator: def _valid_type(variable): if variable.type not in CONVERT_OPTION: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - raise DictConsistencyError(_(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlfiles}')) + raise DictConsistencyError(_(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlfiles}'), 36) if not hasattr(self.objectspace.space, 'variables'): return @@ -109,10 +105,6 @@ class VariableAnnotator: families.doc = families.name for family in families.family.values(): family.doc = family.name - for key, value in RENAME_ATTIBUTES.items(): - if hasattr(family, key): - setattr(family, value, getattr(family, key)) - setattr(family, key, None) family.name = normalize_family(family.name) if hasattr(family, 'variable'): for variable in family.variable.values(): @@ -142,37 +134,6 @@ class VariableAnnotator: ) _valid_type(variable) - def convert_auto_freeze(self): # pylint: disable=C0111 - def _convert_auto_freeze(variable, namespace): - if variable.auto_freeze: - new_condition = self.objectspace.condition(variable.xmlfiles) - new_condition.name = 'auto_hidden_if_not_in' - new_condition.namespace = namespace - new_condition.source = FREEZE_AUTOFREEZE_VARIABLE - new_param = self.objectspace.param(variable.xmlfiles) - new_param.text = 'oui' - new_condition.param = [new_param] - new_target = self.objectspace.target(variable.xmlfiles) - new_target.type = 'variable' - path = variable.namespace + '.' + normalize_family(family.name) + '.' + variable.name - new_target.name = path - new_condition.target = [new_target] - if not hasattr(self.objectspace.space.constraints, 'condition'): - self.objectspace.space.constraints.condition = [] - self.objectspace.space.constraints.condition.append(new_condition) - if hasattr(self.objectspace.space, 'variables'): - for variables in self.objectspace.space.variables.values(): - if hasattr(variables, 'family'): - namespace = variables.name - for family in variables.family.values(): - if hasattr(family, 'variable'): - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - for follower in variable.variable: - _convert_auto_freeze(follower, namespace) - else: - _convert_auto_freeze(variable, namespace) - def convert_separators(self): # pylint: disable=C0111,R0201 if not hasattr(self.objectspace.space, 'variables'): return @@ -187,7 +148,7 @@ class VariableAnnotator: separator.namespace, ) xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles) - raise DictConsistencyError(_(f'{subpath} already has a separator in {xmlfiles}')) + raise DictConsistencyError(_(f'{subpath} already has a separator in {xmlfiles}'), 35) option.separator = separator.text del family.separators diff --git a/src/rougail/error.py b/src/rougail/error.py index 221e355f..68252f61 100644 --- a/src/rougail/error.py +++ b/src/rougail/error.py @@ -29,6 +29,9 @@ class DictConsistencyError(Exception): """It's not only that the Creole XML is valid against the Creole DTD it's that it is not consistent. """ + def __init__(self, msg, errno): + super().__init__(msg) + self.errno = errno class LoaderError(Exception): diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 0a462bc3..bcb2ac36 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -170,7 +170,7 @@ class RougailObjSpace: continue if child.tag == 'family': if child.attrib['name'] in family_names: - raise DictConsistencyError(_(f'Family "{child.attrib["name"]}" is set several times in "{xmlfile}"')) + raise DictConsistencyError(_(f'Family "{child.attrib["name"]}" is set several times in "{xmlfile}"'), 44) family_names.append(child.attrib['name']) if child.tag == 'variables': # variables has no name, so force namespace name @@ -273,7 +273,7 @@ class RougailObjSpace: if exists is False: raise SpaceObjShallNotBeUpdated() xmlfiles = self.display_xmlfiles(existed_var.xmlfiles) - raise DictConsistencyError(_(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", already defined in {xmlfiles}')) + raise DictConsistencyError(_(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", already defined in {xmlfiles}'), 45) # if this object must only be modified if object already exists exists = self.convert_boolean(subspace.get('exists', False)) if exists is True: @@ -283,7 +283,7 @@ class RougailObjSpace: if child.tag not in vars(space): setattr(space, child.tag, {}) return getattr(self, child.tag)(xmlfile) - raise DictConsistencyError(_(f'Redefined object in "{xmlfile}": "{name}" does not exist yet')) + raise DictConsistencyError(_(f'Redefined object in "{xmlfile}": "{name}" does not exist yet'), 46) def get_existed_obj(self, name: str, @@ -301,7 +301,7 @@ class RougailObjSpace: old_family_name = namespace + '.' + old_family_name if space.path != old_family_name: xmlfiles = self.display_xmlfiles(space.xmlfiles) - raise DictConsistencyError(_(f'Variable was previously create in family "{old_family_name}", now it is in "{space.path}" in {xmlfiles}')) + raise DictConsistencyError(_(f'Variable was previously create in family "{old_family_name}", now it is in "{space.path}" in {xmlfiles}'), 47) return self.paths.get_variable_obj(name) children = getattr(space, child.tag, {}) if name in children: @@ -344,7 +344,7 @@ class RougailObjSpace: for attr, val in child.attrib.items(): if redefine and attr in UNREDEFINABLE: xmlfiles = self.display_xmlfiles(variableobj.xmlfiles[:-1]) - raise DictConsistencyError(_(f'cannot redefine attribute "{attr}" for variable "{child.attrib["name"]}" in "{xmlfile}", already defined in {xmlfiles}')) + raise DictConsistencyError(_(f'cannot redefine attribute "{attr}" for variable "{child.attrib["name"]}" in "{xmlfile}", already defined in {xmlfiles}'), 48) if attr in self.booleans_attributs: val = self.convert_boolean(val) if attr == 'name' and getattr(variableobj, 'name', None): diff --git a/src/rougail/path.py b/src/rougail/path.py index 00abc959..b8374b16 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -28,7 +28,7 @@ class Path: else: full_name = name if full_name in self.families and self.families[full_name]['variableobj'] != variableobj: - raise DictConsistencyError(_(f'Duplicate family name {name}')) + raise DictConsistencyError(_(f'Duplicate family name {name}'), 37) self.families[full_name] = dict(name=name, namespace=namespace, variableobj=variableobj, @@ -45,9 +45,7 @@ class Path: raise OperationError('current_namespace must not be None') dico = self.families[name] if dico['namespace'] != Config['variable_namespace'] and current_namespace != dico['namespace']: - raise DictConsistencyError(_('A family located in the {} namespace ' - 'shall not be used in the {} namespace').format( - dico['namespace'], current_namespace)) + raise DictConsistencyError(_(f'A family located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 38) return dico['name'] def get_family_obj(self, @@ -56,7 +54,7 @@ class Path: if '.' not in name and name in self.full_paths_families: name = self.full_paths_families[name] if name not in self.families: - raise DictConsistencyError(_('unknown family {}').format(name)) + raise DictConsistencyError(_('unknown family {}').format(name), 39) dico = self.families[name] return dico['variableobj'] @@ -92,7 +90,7 @@ class Path: dico = self._get_variable(name) if dico['leader'] != None: raise DictConsistencyError(_('Already defined leader {} for variable' - ' {}'.format(dico['leader'], name))) + ' {}'.format(dico['leader'], name)), 40) dico['leader'] = leader_name def get_leader(self, name): # pylint: disable=C0111 @@ -156,9 +154,7 @@ class Path: dico = self._get_variable(name) if not allow_source: if dico['namespace'] not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']: - raise DictConsistencyError(_('A variable located in the {} namespace ' - 'shall not be used in the {} namespace').format( - dico['namespace'], current_namespace)) + raise DictConsistencyError(_(f'A variable located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 41) if '.' in dico['name']: value = dico['name'] else: @@ -200,7 +196,7 @@ class Path: if not with_suffix: raise Exception('This option is dynamic, should use "with_suffix" attribute') return variable, name[len(var_name):] - raise DictConsistencyError(_('unknown option {}').format(name)) + raise DictConsistencyError(_('unknown option {}').format(name), 42) if with_suffix: return self.variables[name], None return self.variables[name] diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index a2ebcc90..d6352c71 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -37,7 +37,7 @@ class XMLReflector(object): # document = parse(BytesIO(xmlfile), XMLParser(remove_blank_text=True)) document = parse(xmlfile) if not self.dtd.validate(document): - raise DictConsistencyError(_(f'"{xmlfile}" not a valid xml file: {self.dtd.error_log.filter_from_errors()[0]}')) + raise DictConsistencyError(_(f'"{xmlfile}" not a valid xml file: {self.dtd.error_log.filter_from_errors()[0]}'), 43) return document.getroot() def load_xml_from_folders(self, xmlfolders): diff --git a/tests/dictionaries/10autosave_hidden_frozenifin/makedict/base.json b/tests/dictionaries/10autosave_hidden_frozenifin/makedict/base.json deleted file mode 100644 index 2a8f28f8..00000000 --- a/tests/dictionaries/10autosave_hidden_frozenifin/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": "oui"} diff --git a/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py b/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py deleted file mode 100644 index 00ac1625..00000000 --- a/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/base.py +++ /dev/null @@ -1,15 +0,0 @@ -from importlib.machinery import SourceFileLoader -func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() -for key, value in dict(locals()).items(): - if key != ['SourceFileLoader', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = StrOption(properties=frozenset({'basic', 'force_store_value', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='autosavevar', doc='autosave variable', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={}))) -option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10autosave_hidden_frozenifin/__init__.py b/tests/dictionaries/51redefine_multi/errno_48 similarity index 100% rename from tests/dictionaries/10autosave_hidden_frozenifin/__init__.py rename to tests/dictionaries/51redefine_multi/errno_48 diff --git a/tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/__init__.py b/tests/dictionaries/51redefine_type/errno_48 similarity index 100% rename from tests/dictionaries/10autosave_hidden_frozenifin/tiramisu/__init__.py rename to tests/dictionaries/51redefine_type/errno_48 diff --git a/tests/dictionaries/80fill_autofreeze/__init__.py b/tests/dictionaries/60extra_externalspace/errno_41 similarity index 100% rename from tests/dictionaries/80fill_autofreeze/__init__.py rename to tests/dictionaries/60extra_externalspace/errno_41 diff --git a/tests/dictionaries/60extra_externalspaceauto/errno_41 b/tests/dictionaries/60extra_externalspaceauto/errno_41 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/60extra_externalspacecondition2/errno_38 b/tests/dictionaries/60extra_externalspacecondition2/errno_38 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/60extra_externalspacecondition3/errno_12 b/tests/dictionaries/60extra_externalspacecondition3/errno_12 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80fill_autofreeze/00-base.xml b/tests/dictionaries/80auto_autofreeze/00-base.xml similarity index 64% rename from tests/dictionaries/80fill_autofreeze/00-base.xml rename to tests/dictionaries/80auto_autofreeze/00-base.xml index a63e8ddc..53f69a83 100644 --- a/tests/dictionaries/80fill_autofreeze/00-base.xml +++ b/tests/dictionaries/80auto_autofreeze/00-base.xml @@ -2,7 +2,10 @@ - + + non + + @@ -10,7 +13,7 @@ - value + oui diff --git a/tests/dictionaries/80auto_autofreeze/__init__.py b/tests/dictionaries/80auto_autofreeze/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80auto_autofreeze/errno_50 b/tests/dictionaries/80auto_autofreeze/errno_50 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10autosave_hidden_frozenifin/00-base.xml b/tests/dictionaries/80autosave_hidden_frozenifin/00-base.xml similarity index 100% rename from tests/dictionaries/10autosave_hidden_frozenifin/00-base.xml rename to tests/dictionaries/80autosave_hidden_frozenifin/00-base.xml diff --git a/tests/dictionaries/80autosave_hidden_frozenifin/__init__.py b/tests/dictionaries/80autosave_hidden_frozenifin/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80autosave_hidden_frozenifin/errno_51 b/tests/dictionaries/80autosave_hidden_frozenifin/errno_51 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80check_unknown/errno_1 b/tests/dictionaries/80check_unknown/errno_1 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80check_unknown_var/errno_2 b/tests/dictionaries/80check_unknown_var/errno_2 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80condition_itself/errno_11 b/tests/dictionaries/80condition_itself/errno_11 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80condition_not_exists_error/errno_12 b/tests/dictionaries/80condition_not_exists_error/errno_12 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80container_files_symlink_without_source/errno_34 b/tests/dictionaries/80container_files_symlink_without_source/errno_34 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80container_filesredefine_error/errno_45 b/tests/dictionaries/80container_filesredefine_error/errno_45 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80empty_param_number/errno_27 b/tests/dictionaries/80empty_param_number/errno_27 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80empty_typeeole_eole/errno_27 b/tests/dictionaries/80empty_typeeole_eole/errno_27 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80empty_typeeole_number/errno_27 b/tests/dictionaries/80empty_typeeole_number/errno_27 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80extra_auto_freeze/00-base.xml b/tests/dictionaries/80extra_auto_freeze/00-base.xml new file mode 100644 index 00000000..032f30d3 --- /dev/null +++ b/tests/dictionaries/80extra_auto_freeze/00-base.xml @@ -0,0 +1,15 @@ + + + + + + non + + + + + + diff --git a/tests/dictionaries/80extra_auto_freeze/__init__.py b/tests/dictionaries/80extra_auto_freeze/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80extra_auto_freeze/errno_49 b/tests/dictionaries/80extra_auto_freeze/errno_49 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80extra_auto_freeze/extra_dirs/extra/00-base.xml b/tests/dictionaries/80extra_auto_freeze/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..7f4f6fe4 --- /dev/null +++ b/tests/dictionaries/80extra_auto_freeze/extra_dirs/extra/00-base.xml @@ -0,0 +1,11 @@ + + + + + + + pre + + + + diff --git a/tests/dictionaries/80family_change/errno_47 b/tests/dictionaries/80family_change/errno_47 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_changeaccent/errno_47 b/tests/dictionaries/80family_changeaccent/errno_47 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_several/errno_44 b/tests/dictionaries/80family_several/errno_44 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80fill_error/errno_24 b/tests/dictionaries/80fill_error/errno_24 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80fill_multi/errno_24 b/tests/dictionaries/80fill_multi/errno_24 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80hidden_if_in_filelist/errno_10 b/tests/dictionaries/80hidden_if_in_filelist/errno_10 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_auto_save/errno_29 b/tests/dictionaries/80leadership_auto_save/errno_29 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_autofreeze/00-base.xml b/tests/dictionaries/80leadership_autofreeze/00-base.xml index 941c98b6..be26dc51 100644 --- a/tests/dictionaries/80leadership_autofreeze/00-base.xml +++ b/tests/dictionaries/80leadership_autofreeze/00-base.xml @@ -2,9 +2,10 @@ - - - + + + + diff --git a/tests/dictionaries/80leadership_autofreeze/errno_30 b/tests/dictionaries/80leadership_autofreeze/errno_30 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_none_follower_between_follower/errno_33 b/tests/dictionaries/80leadership_none_follower_between_follower/errno_33 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_not_ordered/errno_33 b/tests/dictionaries/80leadership_not_ordered/errno_33 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_not_same_family/errno_31 b/tests/dictionaries/80leadership_not_same_family/errno_31 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_notexists/errno_42 b/tests/dictionaries/80leadership_notexists/errno_42 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80redefine_double_error/errno_48 b/tests/dictionaries/80redefine_double_error/errno_48 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80redefine_error/errno_45 b/tests/dictionaries/80redefine_error/errno_45 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80redefine_fillerror/errno_24 b/tests/dictionaries/80redefine_fillerror/errno_24 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80redefine_notexists/errno_46 b/tests/dictionaries/80redefine_notexists/errno_46 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80separator_multi/errno_35 b/tests/dictionaries/80separator_multi/errno_35 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80separator_multi2/errno_35 b/tests/dictionaries/80separator_multi2/errno_35 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80separator_nonexists/errno_42 b/tests/dictionaries/80separator_nonexists/errno_42 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80unknown_type/errno_36 b/tests/dictionaries/80unknown_type/errno_36 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/88valid_enum_not_number/errno_13 b/tests/dictionaries/88valid_enum_not_number/errno_13 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/88valid_enum_numberdefaultstring/errno_15 b/tests/dictionaries/88valid_enum_numberdefaultstring/errno_15 new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 1fe241fe..3d3e8c0c 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -71,13 +71,14 @@ def launch_flattener(test_dir, test_ok=False): eolobj.space_visitor(eosfunc) tiramisu_objects = eolobj.save() tiramisu_dir = join(test_dir, 'tiramisu') - tiramisu_file = join(tiramisu_dir, 'base.py') - if not isfile(tiramisu_file) or debug: - with open(tiramisu_file, 'w') as fh: - fh.write(tiramisu_objects) - with open(tiramisu_file, 'r') as fh: - tiramisu_objects_ori = fh.read() - assert tiramisu_objects == tiramisu_objects_ori + if isdir(tiramisu_dir): + tiramisu_file = join(tiramisu_dir, 'base.py') + if not isfile(tiramisu_file) or debug: + with open(tiramisu_file, 'w') as fh: + fh.write(tiramisu_objects) + with open(tiramisu_file, 'r') as fh: + tiramisu_objects_ori = fh.read() + assert tiramisu_objects == tiramisu_objects_ori def fake_traduc(txt): @@ -106,8 +107,15 @@ def test_dictionary(test_dir): def test_error_dictionary(test_dir_error): assert getcwd() == ORI_DIR test_dir = join(dico_dirs, test_dir_error) - with raises(DictConsistencyError): + errno = 0 + for i in listdir(test_dir): + if i.startswith('errno_'): + if errno: + raise Exception('multiple errno') + errno = int(i.split('_')[1]) + with raises(DictConsistencyError) as err: launch_flattener(test_dir) + assert err.value.errno == errno, f'expected errno: {errno}, errno: {err.value.errno}, value: {err.value}' assert getcwd() == ORI_DIR From 23ce59a85149d629ec041a505b10eb229f0f44d0 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 15:31:10 +0100 Subject: [PATCH 015/168] leader not multi is not allowed --- .../80leadership_leader_not_multi/00-base.xml | 22 +++++++++++++++++++ .../80leadership_leader_not_multi/__init__.py | 0 .../80leadership_leader_not_multi/errno_32 | 0 3 files changed, 22 insertions(+) create mode 100644 tests/dictionaries/80leadership_leader_not_multi/00-base.xml create mode 100644 tests/dictionaries/80leadership_leader_not_multi/__init__.py create mode 100644 tests/dictionaries/80leadership_leader_not_multi/errno_32 diff --git a/tests/dictionaries/80leadership_leader_not_multi/00-base.xml b/tests/dictionaries/80leadership_leader_not_multi/00-base.xml new file mode 100644 index 00000000..abdec3e0 --- /dev/null +++ b/tests/dictionaries/80leadership_leader_not_multi/00-base.xml @@ -0,0 +1,22 @@ + + + + + + non + + + + + + + + + + + + follower1 + follower2 + + + diff --git a/tests/dictionaries/80leadership_leader_not_multi/__init__.py b/tests/dictionaries/80leadership_leader_not_multi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_leader_not_multi/errno_32 b/tests/dictionaries/80leadership_leader_not_multi/errno_32 new file mode 100644 index 00000000..e69de29b From 81d30612e85ed50676fddf988c391d08f1fb607e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 15:31:30 +0100 Subject: [PATCH 016/168] remove unused function --- src/rougail/utils.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/rougail/utils.py b/src/rougail/utils.py index d430d0b5..5a1fc93f 100644 --- a/src/rougail/utils.py +++ b/src/rougail/utils.py @@ -5,11 +5,6 @@ from unicodedata import normalize, combining from .i18n import _ -def valid_name(name: str) -> None: - if '.' in name: - raise ValueError(_(f'"{name}" is a forbidden variable or family name, dot is not allowed')) - - def normalize_family(family_name: str) -> str: """replace space, accent, uppercase, ... by valid character """ From f8959ef16faedef25470a95b41d4fb906e8e96f0 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 15:40:01 +0100 Subject: [PATCH 017/168] test invalid xml --- src/rougail/xmlreflector.py | 10 ++++++---- tests/dictionaries/80invalid_dtd/00_base.xml | 7 +++++++ tests/dictionaries/80invalid_dtd/__init__.py | 0 tests/dictionaries/80invalid_dtd/errno_43 | 0 tests/dictionaries/80invalid_xml/00_base.xml | 5 +++++ tests/dictionaries/80invalid_xml/__init__.py | 0 tests/dictionaries/80invalid_xml/errno_52 | 0 7 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 tests/dictionaries/80invalid_dtd/00_base.xml create mode 100644 tests/dictionaries/80invalid_dtd/__init__.py create mode 100644 tests/dictionaries/80invalid_dtd/errno_43 create mode 100644 tests/dictionaries/80invalid_xml/00_base.xml create mode 100644 tests/dictionaries/80invalid_xml/__init__.py create mode 100644 tests/dictionaries/80invalid_xml/errno_52 diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index d6352c71..37fbd16f 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -3,7 +3,7 @@ from os.path import join, isfile, basename, isdir from os import listdir #from io import BytesIO -from lxml.etree import DTD, parse, tostring # , XMLParser +from lxml.etree import DTD, parse, tostring, XMLSyntaxError from .i18n import _ from .error import DictConsistencyError @@ -34,10 +34,12 @@ class XMLReflector(object): :returns: the root element tree object """ - # document = parse(BytesIO(xmlfile), XMLParser(remove_blank_text=True)) - document = parse(xmlfile) + try: + document = parse(xmlfile) + except XMLSyntaxError as err: + raise DictConsistencyError(_(f'{xmlfile} is not an XML file: {err}'), 52) if not self.dtd.validate(document): - raise DictConsistencyError(_(f'"{xmlfile}" not a valid xml file: {self.dtd.error_log.filter_from_errors()[0]}'), 43) + raise DictConsistencyError(_(f'"{xmlfile}" not a valid XML file: {self.dtd.error_log.filter_from_errors()[0]}'), 43) return document.getroot() def load_xml_from_folders(self, xmlfolders): diff --git a/tests/dictionaries/80invalid_dtd/00_base.xml b/tests/dictionaries/80invalid_dtd/00_base.xml new file mode 100644 index 00000000..5377be4c --- /dev/null +++ b/tests/dictionaries/80invalid_dtd/00_base.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/dictionaries/80invalid_dtd/__init__.py b/tests/dictionaries/80invalid_dtd/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80invalid_dtd/errno_43 b/tests/dictionaries/80invalid_dtd/errno_43 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80invalid_xml/00_base.xml b/tests/dictionaries/80invalid_xml/00_base.xml new file mode 100644 index 00000000..7234125c --- /dev/null +++ b/tests/dictionaries/80invalid_xml/00_base.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/dictionaries/80invalid_xml/__init__.py b/tests/dictionaries/80invalid_xml/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80invalid_xml/errno_52 b/tests/dictionaries/80invalid_xml/errno_52 new file mode 100644 index 00000000..e69de29b From 02edd0eaf04d96ff231e7d7f9ae18cf0155eca7f Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 15:42:52 +0100 Subject: [PATCH 018/168] test create_or_populate_from_xml without a list --- tests/test_1_flattener.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 3d3e8c0c..764a8d81 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -55,10 +55,10 @@ def test_dir_error(request): def launch_flattener(test_dir, test_ok=False): eolobj = objspace.RougailObjSpace(Config['dtdfilename']) - dirs = [test_dir] + dirs = test_dir subfolder = join(test_dir, 'subfolder') if isdir(subfolder): - dirs.append(subfolder) + dirs = [dirs, subfolder] eolobj.create_or_populate_from_xml(Config['variable_namespace'], dirs) subfolder = join(test_dir, 'extra_dirs', 'extra') if isdir(subfolder): From 9feb45e1653058e7f6f966fcc1414f3deb54912d Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 16:02:20 +0100 Subject: [PATCH 019/168] load only folder now --- src/rougail/objspace.py | 12 ++++++--- src/rougail/xmlreflector.py | 52 ++++++------------------------------- tests/test_1_flattener.py | 4 +-- 3 files changed, 18 insertions(+), 50 deletions(-) diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index bcb2ac36..94e39c61 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -19,6 +19,9 @@ The RougailObjSpace The visit/annotation stage is a complex step that corresponds to the Rougail procedures. """ + +from typing import List + from .i18n import _ from .xmlreflector import XMLReflector from .annotator import SpaceAnnotator @@ -140,12 +143,13 @@ class RougailObjSpace: return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"' def create_or_populate_from_xml(self, - namespace, - xmlfolders, - ): + namespace: str, + xmlfolders: List[str], + ) -> List[str]: """Parses a bunch of XML files and populates the RougailObjSpace """ - for xmlfile, document in self.xmlreflector.load_xml_from_folders(xmlfolders): + for xmlfile in self.xmlreflector.load_xml_from_folders(xmlfolders): + document = self.xmlreflector.parse_xmlfile(xmlfile) self.redefine_variables = [] self.xml_parse_document(xmlfile, document, diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index 37fbd16f..77d75811 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -1,7 +1,7 @@ # coding: utf-8 -from os.path import join, isfile, basename, isdir +from typing import List +from os.path import join, isfile from os import listdir -#from io import BytesIO from lxml.etree import DTD, parse, tostring, XMLSyntaxError @@ -42,51 +42,15 @@ class XMLReflector(object): raise DictConsistencyError(_(f'"{xmlfile}" not a valid XML file: {self.dtd.error_log.filter_from_errors()[0]}'), 43) return document.getroot() - def load_xml_from_folders(self, xmlfolders): + def load_xml_from_folders(self, + xmlfolders: List[str], + ): """Loads all the XML files located in the xmlfolders' list :param xmlfolders: list of full folder's name """ - documents = [] - if not isinstance(xmlfolders, list): - xmlfolders = [xmlfolders] for xmlfolder in xmlfolders: - if isinstance(xmlfolder, list) or isinstance(xmlfolder, tuple): - # directory group : collect files from each - # directory and sort them before loading - group_files = [] - for idx, subdir in enumerate(xmlfolder): - if isdir(subdir): - for filename in listdir(subdir): - group_files.append((filename, idx, subdir)) - else: - group_files.append(basename(subdir), idx, dirname(subdir)) - def sort_group(file1, file2): - if file1[0] == file2[0]: - # sort by initial xmlfolder order if same name - return file1[1].__cmp__(file2[1]) - # sort by filename - elif file1[0] > file2[0]: - return 1 - else: - return -1 - group_files.sort(sort_group) - filenames = [join(f[2], f[0]) for f in group_files] - elif isdir(xmlfolder): - filenames = [] - for filename in listdir(xmlfolder): - filenames.append(join(xmlfolder, filename)) - filenames.sort() - else: - filenames = [xmlfolder] + filenames = [join(xmlfolder, filename) for filename in listdir(xmlfolder) if filename.endswith('.xml')] + filenames.sort() for xmlfile in filenames: - if xmlfile.endswith('.xml'): - #xmlfile_path = join(xmlfolder, xmlfile) - documents.append((xmlfile, self.parse_xmlfile(xmlfile))) - return documents - - def save_xmlfile(self, xmlfilename, xml): # pylint: disable=R0201 - """Write a bunch of XML on the disk - """ - with open(xmlfilename, 'w') as xmlfh: - xmlfh.write(tostring(xml, pretty_print=True, encoding="UTF-8", xml_declaration=True).decode('utf8')) + yield xmlfile diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 764a8d81..3d3e8c0c 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -55,10 +55,10 @@ def test_dir_error(request): def launch_flattener(test_dir, test_ok=False): eolobj = objspace.RougailObjSpace(Config['dtdfilename']) - dirs = test_dir + dirs = [test_dir] subfolder = join(test_dir, 'subfolder') if isdir(subfolder): - dirs = [dirs, subfolder] + dirs.append(subfolder) eolobj.create_or_populate_from_xml(Config['variable_namespace'], dirs) subfolder = join(test_dir, 'extra_dirs', 'extra') if isdir(subfolder): From d395f4a17b6949d694bf79e60e91187df2e541c3 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 16:19:31 +0100 Subject: [PATCH 020/168] create a new Rougail object --- src/rougail/__init__.py | 2 +- src/rougail/objspace.py | 57 ++++------------------------------- src/rougail/rougail.py | 63 +++++++++++++++++++++++++++++++++++++++ tests/test_1_flattener.py | 22 ++------------ 4 files changed, 72 insertions(+), 72 deletions(-) create mode 100644 src/rougail/rougail.py diff --git a/src/rougail/__init__.py b/src/rougail/__init__.py index 6fa753fc..bf8873fb 100644 --- a/src/rougail/__init__.py +++ b/src/rougail/__init__.py @@ -1,5 +1,5 @@ #from .loader import load -from .objspace import RougailObjSpace +from .rougail import Rougail from .annotator import modes __ALL__ = ('RougailObjSpace', 'modes') diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 94e39c61..94c76231 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -1,33 +1,10 @@ -""" -Takes a bunch of Rougail XML dispatched in differents folders -as an input and outputs a Tiramisu's file - -Sample usage:: - - >>> from rougail.objspace import RougailObjSpace - >>> eolobj = RougailObjSpace('/usr/share/rougail/rougail.dtd') - >>> eolobj.create_or_populate_from_xml('rougail', ['/usr/share/rougail/dicos']) - >>> eolobj.space_visitor('/usr/share/rougail/funcs.py') - >>> tiramisu = eolobj.save() - -The RougailObjSpace - -- loads the XML into an internal RougailObjSpace representation -- visits/annotates the objects -- dumps the object space as Tiramisu string - -The visit/annotation stage is a complex step that corresponds to the Rougail -procedures. -""" from typing import List from .i18n import _ from .xmlreflector import XMLReflector -from .annotator import SpaceAnnotator -from .tiramisureflector import TiramisuReflector from .utils import normalize_family -from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError +from .error import SpaceObjShallNotBeUpdated, DictConsistencyError from .path import Path from .config import Config @@ -75,12 +52,13 @@ class RougailObjSpace: """Rougail ObjectSpace is an object's reflexion of the XML elements """ - def __init__(self, dtdfilename): + def __init__(self, + xmlreflector: XMLReflector, + ) -> None: self.index = 0 + self.xmlreflector = xmlreflector self.space = ObjSpace() self.paths = Path() - self.xmlreflector = XMLReflector() - self.xmlreflector.parse_dtd(dtdfilename) self.redefine_variables = None self.forced_text_elts = set() @@ -142,21 +120,6 @@ class RougailObjSpace: return '"' + xmlfiles[0] + '"' return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"' - def create_or_populate_from_xml(self, - namespace: str, - xmlfolders: List[str], - ) -> List[str]: - """Parses a bunch of XML files and populates the RougailObjSpace - """ - for xmlfile in self.xmlreflector.load_xml_from_folders(xmlfolders): - document = self.xmlreflector.parse_xmlfile(xmlfile) - self.redefine_variables = [] - self.xml_parse_document(xmlfile, - document, - self.space, - namespace, - ) - def xml_parse_document(self, xmlfile, document, @@ -457,13 +420,3 @@ class RougailObjSpace: getattr(space, child.tag).append(variableobj) else: setattr(space, child.tag, variableobj) - - def space_visitor(self, eosfunc_file): - self.funcs_path = eosfunc_file - SpaceAnnotator(self, eosfunc_file) - - def save(self): - tiramisu_objects = TiramisuReflector(self.space, - self.funcs_path, - ) - return tiramisu_objects.get_text() + '\n' diff --git a/src/rougail/rougail.py b/src/rougail/rougail.py new file mode 100644 index 00000000..71880435 --- /dev/null +++ b/src/rougail/rougail.py @@ -0,0 +1,63 @@ +""" +Takes a bunch of Rougail XML dispatched in differents folders +as an input and outputs a Tiramisu's file + +Sample usage:: + + >>> from rougail import Rougail + >>> rougail = Rougail('/usr/share/rougail/rougail.dtd') + >>> rougail.create_or_populate_from_xml('rougail', ['/usr/share/rougail/dicos']) + >>> rougail.space_visitor('/usr/share/rougail/funcs.py') + >>> tiramisu = rougail.save() + +The Rougail + +- loads the XML into an internal RougailObjSpace representation +- visits/annotates the objects +- dumps the object space as Tiramisu string + +The visit/annotation stage is a complex step that corresponds to the Rougail +procedures. +""" + +from typing import List +from .objspace import RougailObjSpace +from .xmlreflector import XMLReflector +from .tiramisureflector import TiramisuReflector +from .annotator import SpaceAnnotator + + +class Rougail: + def __init__(self, + dtdfilename: str, + ) -> None: + self.xmlreflector = XMLReflector() + self.xmlreflector.parse_dtd(dtdfilename) + self.rougailobjspace = RougailObjSpace(self.xmlreflector) + + def create_or_populate_from_xml(self, + namespace: str, + xmlfolders: List[str], + ) -> List[str]: + """Parses a bunch of XML files and populates the RougailObjSpace + """ + for xmlfile in self.xmlreflector.load_xml_from_folders(xmlfolders): + document = self.xmlreflector.parse_xmlfile(xmlfile) + self.rougailobjspace.redefine_variables = [] + self.rougailobjspace.xml_parse_document(xmlfile, + document, + self.rougailobjspace.space, + namespace, + ) + + def space_visitor(self, + eosfunc_file: str, + ) -> None: + self.funcs_path = eosfunc_file + SpaceAnnotator(self.rougailobjspace, eosfunc_file) + + def save(self) -> str: + tiramisu_objects = TiramisuReflector(self.rougailobjspace.space, + self.funcs_path, + ) + return tiramisu_objects.get_text() + '\n' diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 3d3e8c0c..5e112c69 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -5,7 +5,7 @@ from pytest import fixture, raises from os import listdir from json import load -from rougail import objspace, annotator +from rougail import Rougail, annotator from rougail.error import DictConsistencyError from rougail.config import Config @@ -54,7 +54,7 @@ def test_dir_error(request): def launch_flattener(test_dir, test_ok=False): - eolobj = objspace.RougailObjSpace(Config['dtdfilename']) + eolobj = Rougail(Config['dtdfilename']) dirs = [test_dir] subfolder = join(test_dir, 'subfolder') if isdir(subfolder): @@ -81,22 +81,6 @@ def launch_flattener(test_dir, test_ok=False): assert tiramisu_objects == tiramisu_objects_ori -def fake_traduc(txt): - return txt - - -def setup_module(module): - module.traduc_ori = objspace._ - objspace._ = fake_traduc - annotator._ = fake_traduc - objspace.ServiceAnnotator = getattr(annotator, 'ServiceAnnotator') - - -def teardown_module(module): - objspace._ = module.traduc_ori - annotator._ = module.traduc_ori - - def test_dictionary(test_dir): assert getcwd() == ORI_DIR test_dir = join(dico_dirs, test_dir) @@ -121,4 +105,4 @@ def test_error_dictionary(test_dir_error): def test_no_dtd(): with raises(IOError): - eolobj = objspace.RougailObjSpace('notexists.dtd') + eolobj = Rougail('notexists.dtd') From f9885a023c37b23b1a8b2a9e82645d8f64dfce16 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 17:37:14 +0100 Subject: [PATCH 021/168] restore tests --- src/rougail/annotator/constrainte.py | 2 +- src/rougail/tiramisureflector.py | 2 +- .../10valid_enum_eosfunc/tiramisu/base.py | 11 ------ .../10valid_enum_python/__init__.py | 0 .../10valid_enum_python/tiramisu/__init__.py | 0 .../10valid_enum_python/tiramisu/base.py | 11 ------ .../00-base.xml | 34 +++++++++++++++++++ .../makedict/base.json | 1 + .../tiramisu/base.py | 19 ++++++++++- .../11valid_enum_variable/00-base.xml | 22 ++++++++++++ .../__init__.py | 0 .../11valid_enum_variable/makedict/base.json | 1 + .../tiramisu/__init__.py | 0 .../11valid_enum_variable/tiramisu/base.py | 15 ++++++++ .../20family_dynamic_calc/00-base.xml | 25 ++++++++++++++ .../20family_dynamic_calc/makedict/base.json | 1 + .../20family_dynamic_calc/tiramisu/base.py | 9 ++++- .../30mandatory_withoutvaluecalc/00-base.xml | 15 ++++++++ .../makedict/base.json | 1 + .../tiramisu/base.py | 5 ++- .../30mandatory_withvaluecalc/00-base.xml | 13 +++++++ .../makedict/base.json | 2 +- .../tiramisu/base.py | 5 ++- .../dictionaries/40ifin_validenum/00-base.xml | 33 ++++++++++++++++++ .../40ifin_validenum/makedict/base.json | 1 + .../40ifin_validenum/tiramisu/base.py | 8 ++++- .../51redefine_validenum/00-base.xml | 17 ++++++++++ .../51redefine_validenum/01-redefine.xml | 16 +++++++++ .../51redefine_validenum/makedict/base.json | 1 + .../51redefine_validenum/tiramisu/base.py | 5 ++- tests/test_1_flattener.py | 7 ++-- tests/test_2_makedict.py | 2 +- 32 files changed, 250 insertions(+), 34 deletions(-) delete mode 100644 tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py delete mode 100644 tests/dictionaries/10valid_enum_python/__init__.py delete mode 100644 tests/dictionaries/10valid_enum_python/tiramisu/__init__.py delete mode 100644 tests/dictionaries/10valid_enum_python/tiramisu/base.py create mode 100644 tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml create mode 100644 tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json create mode 100644 tests/dictionaries/11valid_enum_variable/00-base.xml rename tests/dictionaries/{10valid_enum_eosfunc => 11valid_enum_variable}/__init__.py (100%) create mode 100644 tests/dictionaries/11valid_enum_variable/makedict/base.json rename tests/dictionaries/{10valid_enum_eosfunc => 11valid_enum_variable}/tiramisu/__init__.py (100%) create mode 100644 tests/dictionaries/11valid_enum_variable/tiramisu/base.py create mode 100644 tests/dictionaries/20family_dynamic_calc/00-base.xml create mode 100644 tests/dictionaries/20family_dynamic_calc/makedict/base.json create mode 100644 tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml create mode 100644 tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json create mode 100644 tests/dictionaries/30mandatory_withvaluecalc/00-base.xml create mode 100644 tests/dictionaries/40ifin_validenum/00-base.xml create mode 100644 tests/dictionaries/40ifin_validenum/makedict/base.json create mode 100644 tests/dictionaries/51redefine_validenum/00-base.xml create mode 100644 tests/dictionaries/51redefine_validenum/01-redefine.xml create mode 100644 tests/dictionaries/51redefine_validenum/makedict/base.json diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index a65f6a45..5821b31c 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -396,7 +396,7 @@ class ConstrainteAnnotator: # build choice variable.choice = [] if isinstance(values, str): - choice = self.objectspace.choice() + choice = self.objectspace.choice(variable.xmlfiles) choice.type = 'calculation' choice.name = values variable.choice.append(choice) diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 1da99e17..0e3519ab 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -480,10 +480,10 @@ class Family(Common): if 'properties' in self.attrib: self.attrib['properties'] = "'" + "', '".join(sorted(list(self.attrib['properties']))) + "'" if hasattr(self.elt, 'property'): - #self.attrib['properties'] = '' for child in self.elt.property: self.populate_properties(child) if not self.attrib['properties']: + # remove empty property del self.attrib['properties'] def get_object_name(self): diff --git a/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py b/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py deleted file mode 100644 index 0f8b1858..00000000 --- a/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py +++ /dev/null @@ -1,11 +0,0 @@ -from importlib.machinery import SourceFileLoader -func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() -for key, value in dict(locals()).items(): - if key != ['SourceFileLoader', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) diff --git a/tests/dictionaries/10valid_enum_python/__init__.py b/tests/dictionaries/10valid_enum_python/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dictionaries/10valid_enum_python/tiramisu/__init__.py b/tests/dictionaries/10valid_enum_python/tiramisu/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dictionaries/10valid_enum_python/tiramisu/base.py b/tests/dictionaries/10valid_enum_python/tiramisu/base.py deleted file mode 100644 index 0f8b1858..00000000 --- a/tests/dictionaries/10valid_enum_python/tiramisu/base.py +++ /dev/null @@ -1,11 +0,0 @@ -from importlib.machinery import SourceFileLoader -func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() -for key, value in dict(locals()).items(): - if key != ['SourceFileLoader', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml new file mode 100644 index 00000000..27eb9ad0 --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + non + + + + + + + + + non + statique + + + statique + afilllist + + + diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json new file mode 100644 index 00000000..1a2b116f --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json @@ -0,0 +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} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index 0f8b1858..bb308145 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -8,4 +8,21 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('non', 'statique')) +option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_10 = StrOption(name='group', doc='group', multi=False, default='root') +option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') +option_12 = StrOption(name='name', doc='name', multi=False, default='/tmp/file') +option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') +option_14 = StrOption(name='source', doc='source', multi=False, default='file') +option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) +option_16 = BoolOption(properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('statique'), 'reverse_condition': ParamValue(True)}))}), name='activate', doc='activate', multi=False, default=True) +option_9 = OptionDescription(name='file', doc='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) +option_8 = OptionDescription(name='files', doc='files', children=[option_9]) +option_7 = OptionDescription(name='test', doc='test', children=[option_8]) +option_7.impl_set_information("manage", True) +option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) diff --git a/tests/dictionaries/11valid_enum_variable/00-base.xml b/tests/dictionaries/11valid_enum_variable/00-base.xml new file mode 100644 index 00000000..0a63345c --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/00-base.xml @@ -0,0 +1,22 @@ + + + + + + a + + + a + b + c + + + + + + var + + + + diff --git a/tests/dictionaries/10valid_enum_eosfunc/__init__.py b/tests/dictionaries/11valid_enum_variable/__init__.py similarity index 100% rename from tests/dictionaries/10valid_enum_eosfunc/__init__.py rename to tests/dictionaries/11valid_enum_variable/__init__.py diff --git a/tests/dictionaries/11valid_enum_variable/makedict/base.json b/tests/dictionaries/11valid_enum_variable/makedict/base.json new file mode 100644 index 00000000..2c5c721d --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "a", "rougail.general.var": ["a", "b", "c"]} diff --git a/tests/dictionaries/10valid_enum_eosfunc/tiramisu/__init__.py b/tests/dictionaries/11valid_enum_variable/tiramisu/__init__.py similarity index 100% rename from tests/dictionaries/10valid_enum_eosfunc/tiramisu/__init__.py rename to tests/dictionaries/11valid_enum_variable/tiramisu/__init__.py diff --git a/tests/dictionaries/11valid_enum_variable/tiramisu/base.py b/tests/dictionaries/11valid_enum_variable/tiramisu/base.py new file mode 100644 index 00000000..2d839033 --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/tiramisu/base.py @@ -0,0 +1,15 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='var', doc='New variable', multi=True, default=['a', 'b', 'c'], default_multi='c') +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='a', values=Calculation(func.calc_value, Params((ParamOption(option_4))))) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc/00-base.xml b/tests/dictionaries/20family_dynamic_calc/00-base.xml new file mode 100644 index 00000000..7fa2ca78 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc/00-base.xml @@ -0,0 +1,25 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + vardynval1 + + + diff --git a/tests/dictionaries/20family_dynamic_calc/makedict/base.json b/tests/dictionaries/20family_dynamic_calc/makedict/base.json new file mode 100644 index 00000000..c26e3740 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": "val"} diff --git a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py index 0f8b1858..97a2c397 100644 --- a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py @@ -8,4 +8,11 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['val1', 'val2'], default_multi='val2') +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_5 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='vardyn', doc='No change', multi=False, default='val') +option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_5]) +option_7 = StrOption(properties=frozenset({'normal'}), name='newvar', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamDynOption(option_5, 'val1', option_4, notraisepropertyerror=False, todict=False)), kwargs={}))) +option_6 = OptionDescription(name='new', doc='new', properties=frozenset({'normal'}), children=[option_7]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4, option_6]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml b/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml new file mode 100644 index 00000000..aec57606 --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + + + value + + + + diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json new file mode 100644 index 00000000..5f62f349 --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "value"} diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py index 0f8b1858..79ef128f 100644 --- a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py @@ -8,4 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("value")), kwargs={}))) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml b/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml new file mode 100644 index 00000000..93ae7b1f --- /dev/null +++ b/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml @@ -0,0 +1,13 @@ + + + + + + + + + + value + + + diff --git a/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json b/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json index 0967ef42..5f62f349 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json +++ b/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json @@ -1 +1 @@ -{} +{"rougail.general.mode_conteneur_actif": "value"} diff --git a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py index 0f8b1858..6d9d1435 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py @@ -8,4 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = StrOption(properties=frozenset({'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("value")), kwargs={}))) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/40ifin_validenum/00-base.xml b/tests/dictionaries/40ifin_validenum/00-base.xml new file mode 100644 index 00000000..478637d5 --- /dev/null +++ b/tests/dictionaries/40ifin_validenum/00-base.xml @@ -0,0 +1,33 @@ + + + + + + non + + + + + + + a + b + c + + + d + mode_conteneur_actif + + + d + mode_conteneur_actif2 + + + + diff --git a/tests/dictionaries/40ifin_validenum/makedict/base.json b/tests/dictionaries/40ifin_validenum/makedict/base.json new file mode 100644 index 00000000..6b1c9cf7 --- /dev/null +++ b/tests/dictionaries/40ifin_validenum/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "rougail.general2.mode_conteneur_actif3": "a"} diff --git a/tests/dictionaries/40ifin_validenum/tiramisu/base.py b/tests/dictionaries/40ifin_validenum/tiramisu/base.py index 0f8b1858..dac6ba60 100644 --- a/tests/dictionaries/40ifin_validenum/tiramisu/base.py +++ b/tests/dictionaries/40ifin_validenum/tiramisu/base.py @@ -8,4 +8,10 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_5 = ChoiceOption(properties=frozenset({'disabled', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif3', doc='No change', multi=False, default='a', values=('a', 'b', 'c')) +option_4 = OptionDescription(name='general2', doc='general2', properties=frozenset({'hidden', 'normal'}), children=[option_5, option_6]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/51redefine_validenum/00-base.xml b/tests/dictionaries/51redefine_validenum/00-base.xml new file mode 100644 index 00000000..a2ae1b83 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/00-base.xml @@ -0,0 +1,17 @@ + + + + + + + + + a + b + c + + + + diff --git a/tests/dictionaries/51redefine_validenum/01-redefine.xml b/tests/dictionaries/51redefine_validenum/01-redefine.xml new file mode 100644 index 00000000..faf00307 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/01-redefine.xml @@ -0,0 +1,16 @@ + + + + + + + + + + a + b + + + + diff --git a/tests/dictionaries/51redefine_validenum/makedict/base.json b/tests/dictionaries/51redefine_validenum/makedict/base.json new file mode 100644 index 00000000..ef30ef31 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "a"} diff --git a/tests/dictionaries/51redefine_validenum/tiramisu/base.py b/tests/dictionaries/51redefine_validenum/tiramisu/base.py index 0f8b1858..4956fadb 100644 --- a/tests/dictionaries/51redefine_validenum/tiramisu/base.py +++ b/tests/dictionaries/51redefine_validenum/tiramisu/base.py @@ -8,4 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Redefine description', multi=False, default='a', values=('a', 'b')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 5e112c69..8cf309c4 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -5,7 +5,7 @@ from pytest import fixture, raises from os import listdir from json import load -from rougail import Rougail, annotator +from rougail import Rougail from rougail.error import DictConsistencyError from rougail.config import Config @@ -28,9 +28,10 @@ excludes = set([]) #excludes = set(['01base_file_utfchar']) test_ok -= excludes test_raise -= excludes -#test_ok = ['40condition_base_add'] +#test_ok = ['10valid_enum_eosfunc'] #test_ok = [] #test_raise = ['80redefine_double_error'] +#test_raise = [] ORI_DIR = getcwd() @@ -70,6 +71,8 @@ def launch_flattener(test_dir, test_ok=False): Config['patch_dir'] = join(test_dir, 'patches') eolobj.space_visitor(eosfunc) tiramisu_objects = eolobj.save() + if 'children=[]' in tiramisu_objects.split('\n')[-2]: + raise Exception('empty tiramisu object?') tiramisu_dir = join(test_dir, 'tiramisu') if isdir(tiramisu_dir): tiramisu_file = join(tiramisu_dir, 'base.py') diff --git a/tests/test_2_makedict.py b/tests/test_2_makedict.py index 05b48895..90e29de9 100644 --- a/tests/test_2_makedict.py +++ b/tests/test_2_makedict.py @@ -50,7 +50,7 @@ async def launch_flattener(test_dir): if config_dict: if not isdir(makedict_dir): mkdir(makedict_dir) - if debug: + if not isfile(makedict_file) or debug: with open(makedict_file, 'w') as fh: dump(config_dict, fh) fh.write('\n') From 942b3f718c363cf0f002edbaecd4116d494a04e4 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 17:52:14 +0100 Subject: [PATCH 022/168] test information in param --- src/rougail/tiramisureflector.py | 3 --- .../dictionaries/10fill_information/00-base.xml | 16 ++++++++++++++++ .../dictionaries/10fill_information/__init__.py | 0 .../10fill_information/makedict/base.json | 1 + .../10fill_information/tiramisu/__init__.py | 0 .../10fill_information/tiramisu/base.py | 14 ++++++++++++++ tests/test_2_makedict.py | 1 + 7 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 tests/dictionaries/10fill_information/00-base.xml create mode 100644 tests/dictionaries/10fill_information/__init__.py create mode 100644 tests/dictionaries/10fill_information/makedict/base.json create mode 100644 tests/dictionaries/10fill_information/tiramisu/__init__.py create mode 100644 tests/dictionaries/10fill_information/tiramisu/base.py diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 0e3519ab..7d11612b 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -482,9 +482,6 @@ class Family(Common): if hasattr(self.elt, 'property'): for child in self.elt.property: self.populate_properties(child) - if not self.attrib['properties']: - # remove empty property - del self.attrib['properties'] def get_object_name(self): if 'suffixes' in self.attrib: diff --git a/tests/dictionaries/10fill_information/00-base.xml b/tests/dictionaries/10fill_information/00-base.xml new file mode 100644 index 00000000..94989d2d --- /dev/null +++ b/tests/dictionaries/10fill_information/00-base.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + test_information + + + + diff --git a/tests/dictionaries/10fill_information/__init__.py b/tests/dictionaries/10fill_information/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10fill_information/makedict/base.json b/tests/dictionaries/10fill_information/makedict/base.json new file mode 100644 index 00000000..5f62f349 --- /dev/null +++ b/tests/dictionaries/10fill_information/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "value"} diff --git a/tests/dictionaries/10fill_information/tiramisu/__init__.py b/tests/dictionaries/10fill_information/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10fill_information/tiramisu/base.py b/tests/dictionaries/10fill_information/tiramisu/base.py new file mode 100644 index 00000000..fc27b03c --- /dev/null +++ b/tests/dictionaries/10fill_information/tiramisu/base.py @@ -0,0 +1,14 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(properties=frozenset({'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamInformation("test_information", None)), kwargs={}))) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/test_2_makedict.py b/tests/test_2_makedict.py index 90e29de9..e70525a8 100644 --- a/tests/test_2_makedict.py +++ b/tests/test_2_makedict.py @@ -43,6 +43,7 @@ async def launch_flattener(test_dir): for token in modulepath.split(".")[1:]: mod = getattr(mod, token) config = await Config(mod.option_0) + await config.information.set('test_information', 'value') await config.property.read_only() await config.property.pop('mandatory') await config.information.set('info', 'value') From 6a771913e06b5c4120f154e600331af5444b7649 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 18:26:15 +0100 Subject: [PATCH 023/168] test suffix --- src/rougail/annotator/constrainte.py | 18 +++++++++---- src/rougail/path.py | 5 ++++ .../20family_dynamic_calc_suffix/00-base.xml | 25 +++++++++++++++++++ .../20family_dynamic_calc_suffix/__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/__init__.py | 0 .../tiramisu/base.py | 18 +++++++++++++ .../00-base.xml | 25 +++++++++++++++++++ .../__init__.py | 0 .../80family_not_dynamic_calc_suffix/errno_53 | 0 10 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml create mode 100644 tests/dictionaries/20family_dynamic_calc_suffix/__init__.py create mode 100644 tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json create mode 100644 tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/__init__.py create mode 100644 tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py create mode 100644 tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml create mode 100644 tests/dictionaries/80family_not_dynamic_calc_suffix/__init__.py create mode 100644 tests/dictionaries/80family_not_dynamic_calc_suffix/errno_53 diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 5821b31c..df4d2c03 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -504,7 +504,8 @@ class ConstrainteAnnotator: targets.append(fill.target) # if fill.name not in self.functions: - raise DictConsistencyError(_('cannot find fill function {}').format(fill.name), 25) + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + raise DictConsistencyError(_(f'cannot find fill function {fill.name} in {xmlfiles}'), 25) namespace = fill.namespace # let's replace the target by the path @@ -513,7 +514,8 @@ class ConstrainteAnnotator: with_suffix=True, ) if suffix is not None: - raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}"'), 26) + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}" in {xmlfiles}'), 26) variable = self.objectspace.paths.get_variable_obj(fill.target) value = self.objectspace.value(variable.xmlfiles) value.type = 'calculation' @@ -522,9 +524,15 @@ class ConstrainteAnnotator: param_to_delete = [] for fill_idx, param in enumerate(fill.param): if param.type not in ['suffix', 'string'] and not hasattr(param, 'text'): - raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}"), 27) - if param.type == 'suffix' and hasattr(param, 'text'): - raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}"), 28) + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target} in {xmlfiles}"), 27) + if param.type == 'suffix': + if hasattr(param, 'text'): + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target} in {xmlfiles}"), 28) + if not self.objectspace.paths.variable_is_dynamic(fill.target): + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + raise DictConsistencyError(_(f'Cannot set suffix target to the none dynamic variable "{fill.target}" in {xmlfiles}'), 53) if param.type == 'string': if not hasattr(param, 'text'): param.text = None diff --git a/src/rougail/path.py b/src/rougail/path.py index b8374b16..59899970 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -174,6 +174,11 @@ class Path: return True return name in self.variables + def variable_is_dynamic(self, + name: str, + ) -> bool: + return self._get_variable(name)['is_dynamic'] + def _get_variable(self, name: str, with_suffix: bool=False, diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml b/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml new file mode 100644 index 00000000..a8e758a8 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml @@ -0,0 +1,25 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + + + + diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/__init__.py b/tests/dictionaries/20family_dynamic_calc_suffix/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json new file mode 100644 index 00000000..09b64ff8 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val1", "rougail.dynval2.vardynval2": "val2", "rougail.new.newvar": null} diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/__init__.py b/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py new file mode 100644 index 00000000..f4cb9beb --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py @@ -0,0 +1,18 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['val1', 'val2'], default_multi='val2') +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_5 = StrOption(properties=frozenset({'normal'}), name='vardyn', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamSuffix()), kwargs={}))) +option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_5]) +option_7 = StrOption(properties=frozenset({'normal'}), name='newvar', doc='No change', multi=False) +option_6 = OptionDescription(name='new', doc='new', properties=frozenset({'normal'}), children=[option_7]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4, option_6]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml b/tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml new file mode 100644 index 00000000..04b287be --- /dev/null +++ b/tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml @@ -0,0 +1,25 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + + + + diff --git a/tests/dictionaries/80family_not_dynamic_calc_suffix/__init__.py b/tests/dictionaries/80family_not_dynamic_calc_suffix/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_not_dynamic_calc_suffix/errno_53 b/tests/dictionaries/80family_not_dynamic_calc_suffix/errno_53 new file mode 100644 index 00000000..e69de29b From 0ef5429577790a457cadde9898814aee8414f1a5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 18:31:13 +0100 Subject: [PATCH 024/168] simplify get_children --- src/rougail/tiramisureflector.py | 73 +++++++++++--------------------- 1 file changed, 24 insertions(+), 49 deletions(-) diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 7d11612b..512d62b8 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -44,9 +44,7 @@ class TiramisuReflector: ) def get_root_family(self): - family = Family(BaseElt('baseoption', - 'baseoption', - ), + family = Family(BaseElt(), self.storage, False, '.', @@ -158,15 +156,9 @@ class TiramisuReflector: class BaseElt: - def __init__(self, - name, - doc, - ): - self.name = name - self.doc = doc - - def __iter__(self): - return iter([]) + def __init__(self) -> None: + self.name = 'baseoption' + self.doc = 'baseoption' class ElementStorage: @@ -181,13 +173,9 @@ class ElementStorage: self.index += 1 def get(self, path): - if path not in self.paths or self.paths[path][0] is None: - raise LoaderError(_('there is no element for path {}').format(path)) return self.paths[path][0] def get_name(self, path): - if path not in self.paths: - raise LoaderError(_('there is no element for index {}').format(path)) return f'option_{self.paths[path][1]}' @@ -207,15 +195,13 @@ class Common: self.storage.add(self.path, self) def populate_properties(self, child): - if child.type == 'calculation': - action = f"ParamValue('{child.name}')" - option_name = self.storage.get(child.source).get() - kwargs = f"'condition': ParamOption({option_name}, todict=True), 'expected': ParamValue('{child.expected}')" - if child.inverse: - kwargs += ", 'reverse_condition': ParamValue(True)" - prop = 'Calculation(calc_value, Params(' + action + ', kwargs={' + kwargs + '}))' - else: - prop = "'" + child.text + "'" + assert child.type == 'calculation' + action = f"ParamValue('{child.name}')" + option_name = self.storage.get(child.source).get() + kwargs = f"'condition': ParamOption({option_name}, todict=True), 'expected': ParamValue('{child.expected}')" + if child.inverse: + kwargs += ", 'reverse_condition': ParamValue(True)" + prop = 'Calculation(calc_value, Params(' + action + ', kwargs={' + kwargs + '}))' if self.attrib['properties']: self.attrib['properties'] += ', ' self.attrib['properties'] += prop @@ -263,15 +249,8 @@ class Common: ): for attr in dir(space): if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES: - value = getattr(space, attr) - if isinstance(value, (list, dict)): - children = getattr(space, attr) - if children.__class__.__name__ == 'Family': - children = [children] - if isinstance(children, dict): - children = list(children.values()) - if children and isinstance(children, list): - yield attr, children + if isinstance(getattr(space, attr), list): + yield attr, getattr(space, attr) class Variable(Common): @@ -314,7 +293,7 @@ class Variable(Common): for key in self.get_attributes(self.elt): value = getattr(self.elt, key) if key in FORCE_INFORMATIONS: - if key == 'test': + if key == 'test': # pragma: no cover value = value.split(',') if self.object_type == 'IntOption': value = [int(v) for v in value] @@ -368,19 +347,15 @@ class Variable(Common): def calculation_value(self, child, args): kwargs = [] - if hasattr(child, 'name'): - # has parameters - function = child.name - if hasattr(child, 'param'): - for param in child.param: - value = self.populate_param(function, param) - if not hasattr(param, 'name'): - args.append(str(value)) - else: - kwargs.append(f"'{param.name}': " + value) - else: - # function without any parameter - function = child.text.strip() + # has parameters + function = child.name + if hasattr(child, 'param'): + for param in child.param: + value = self.populate_param(function, param) + if not hasattr(param, 'name'): + args.append(str(value)) + else: + kwargs.append(f"'{param.name}': " + value) ret = f"Calculation(func.{function}, Params((" + ', '.join(args) + "), kwargs=" + "{" + ', '.join(kwargs) + "})" if hasattr(child, 'warnings_only'): ret += f', warnings_only={child.warnings_only}' @@ -406,7 +381,7 @@ class Variable(Common): return f'ParamInformation("{param.text}", None)' elif param.type == 'suffix': return f'ParamSuffix()' - raise LoaderError(_('unknown param type {}').format(param.type)) + raise LoaderError(_('unknown param type {}').format(param.type)) # pragma: no cover def populate_value(self, child, From 2d0ccc6896be0c7e18752946c5860ff53978c6d9 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 18:47:21 +0100 Subject: [PATCH 025/168] test redefine valid_enum without remove_check --- .../80valid_enum_base_redefine/00-base.xml | 33 +++++++++++++++++++ .../80valid_enum_base_redefine/01-base.xml | 19 +++++++++++ .../80valid_enum_base_redefine/__init__.py | 0 .../80valid_enum_base_redefine/errno_3 | 0 4 files changed, 52 insertions(+) create mode 100644 tests/dictionaries/80valid_enum_base_redefine/00-base.xml create mode 100644 tests/dictionaries/80valid_enum_base_redefine/01-base.xml create mode 100644 tests/dictionaries/80valid_enum_base_redefine/__init__.py create mode 100644 tests/dictionaries/80valid_enum_base_redefine/errno_3 diff --git a/tests/dictionaries/80valid_enum_base_redefine/00-base.xml b/tests/dictionaries/80valid_enum_base_redefine/00-base.xml new file mode 100644 index 00000000..b9d58f5c --- /dev/null +++ b/tests/dictionaries/80valid_enum_base_redefine/00-base.xml @@ -0,0 +1,33 @@ + + + + + + non + + + + + c + + + c + + + + + + + a + b + c + + + a + b + c + + + + diff --git a/tests/dictionaries/80valid_enum_base_redefine/01-base.xml b/tests/dictionaries/80valid_enum_base_redefine/01-base.xml new file mode 100644 index 00000000..1615f5ec --- /dev/null +++ b/tests/dictionaries/80valid_enum_base_redefine/01-base.xml @@ -0,0 +1,19 @@ + + + + + + c + + + + + + + a + c + + + + diff --git a/tests/dictionaries/80valid_enum_base_redefine/__init__.py b/tests/dictionaries/80valid_enum_base_redefine/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_base_redefine/errno_3 b/tests/dictionaries/80valid_enum_base_redefine/errno_3 new file mode 100644 index 00000000..e69de29b From 71b9b7075525415e8dce75d90d10905a2ca7eb50 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 19:53:49 +0100 Subject: [PATCH 026/168] add valid_enum tests --- src/rougail/annotator/constrainte.py | 15 ++++++---- .../80valid_enum_multi_param/00-base.xml | 23 +++++++++++++++ .../80valid_enum_multi_param/__init__.py | 0 .../80valid_enum_multi_param/errno_7 | 0 .../80valid_enum_multi_variable/00-base.xml | 28 +++++++++++++++++++ .../80valid_enum_multi_variable/__init__.py | 0 .../80valid_enum_multi_variable/errno_5 | 0 .../80valid_enum_no_param/00-base.xml | 22 +++++++++++++++ .../80valid_enum_no_param/__init__.py | 0 .../80valid_enum_no_param/errno_4 | 0 .../00-base.xml | 20 +++++++++++++ .../__init__.py | 0 .../80valid_enum_none_multi_variable/errno_6 | 0 .../00-base.xml | 22 +++++++++++++++ .../__init__.py | 0 .../80valid_enum_number_without_value/errno_8 | 0 16 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 tests/dictionaries/80valid_enum_multi_param/00-base.xml create mode 100644 tests/dictionaries/80valid_enum_multi_param/__init__.py create mode 100644 tests/dictionaries/80valid_enum_multi_param/errno_7 create mode 100644 tests/dictionaries/80valid_enum_multi_variable/00-base.xml create mode 100644 tests/dictionaries/80valid_enum_multi_variable/__init__.py create mode 100644 tests/dictionaries/80valid_enum_multi_variable/errno_5 create mode 100644 tests/dictionaries/80valid_enum_no_param/00-base.xml create mode 100644 tests/dictionaries/80valid_enum_no_param/__init__.py create mode 100644 tests/dictionaries/80valid_enum_no_param/errno_4 create mode 100644 tests/dictionaries/80valid_enum_none_multi_variable/00-base.xml create mode 100644 tests/dictionaries/80valid_enum_none_multi_variable/__init__.py create mode 100644 tests/dictionaries/80valid_enum_none_multi_variable/errno_6 create mode 100644 tests/dictionaries/80valid_enum_number_without_value/00-base.xml create mode 100644 tests/dictionaries/80valid_enum_number_without_value/__init__.py create mode 100644 tests/dictionaries/80valid_enum_number_without_value/errno_8 diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index df4d2c03..8e9e4d7c 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -126,7 +126,8 @@ class ConstrainteAnnotator: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?'), 3) if not hasattr(check, 'param'): - raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}'), 4) + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable "{check.target}" in {xmlfiles}'), 4) variable = self.objectspace.paths.get_variable_obj(check.target) values = self.load_params_in_valid_enum(check.param, variable.name, @@ -153,18 +154,22 @@ class ConstrainteAnnotator: for param in params: if param.type == 'variable': if has_variable is not None: - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}'), 5) + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 5) has_variable = True variable = self.objectspace.paths.get_variable_obj(param.text) if not variable.multi: - raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable {variable_name}'), 6) + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 6) values = param.text else: if has_variable: - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}'), 7) + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'only one parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 7) if not hasattr(param, 'text'): if param.type == 'number': - raise DictConsistencyError(_(f'value is mandatory for valid_enum of variable {variable_name}'), 8) + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'param type is number, so value is mandatory for valid_enum of variable "{variable_name}" in {xmlfiles}'), 8) values.append(None) else: values.append(param.text) diff --git a/tests/dictionaries/80valid_enum_multi_param/00-base.xml b/tests/dictionaries/80valid_enum_multi_param/00-base.xml new file mode 100644 index 00000000..cc026b8e --- /dev/null +++ b/tests/dictionaries/80valid_enum_multi_param/00-base.xml @@ -0,0 +1,23 @@ + + + + + + a + + + a + b + c + + + + + + var + d + + + + diff --git a/tests/dictionaries/80valid_enum_multi_param/__init__.py b/tests/dictionaries/80valid_enum_multi_param/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_multi_param/errno_7 b/tests/dictionaries/80valid_enum_multi_param/errno_7 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_multi_variable/00-base.xml b/tests/dictionaries/80valid_enum_multi_variable/00-base.xml new file mode 100644 index 00000000..52d0748d --- /dev/null +++ b/tests/dictionaries/80valid_enum_multi_variable/00-base.xml @@ -0,0 +1,28 @@ + + + + + + a + + + a + b + c + + + a + b + c + + + + + + var + var2 + + + + diff --git a/tests/dictionaries/80valid_enum_multi_variable/__init__.py b/tests/dictionaries/80valid_enum_multi_variable/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_multi_variable/errno_5 b/tests/dictionaries/80valid_enum_multi_variable/errno_5 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_no_param/00-base.xml b/tests/dictionaries/80valid_enum_no_param/00-base.xml new file mode 100644 index 00000000..1796ffd3 --- /dev/null +++ b/tests/dictionaries/80valid_enum_no_param/00-base.xml @@ -0,0 +1,22 @@ + + + + + + non + + + + + c + + + + + + + + + + diff --git a/tests/dictionaries/80valid_enum_no_param/__init__.py b/tests/dictionaries/80valid_enum_no_param/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_no_param/errno_4 b/tests/dictionaries/80valid_enum_no_param/errno_4 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_none_multi_variable/00-base.xml b/tests/dictionaries/80valid_enum_none_multi_variable/00-base.xml new file mode 100644 index 00000000..aec6f36f --- /dev/null +++ b/tests/dictionaries/80valid_enum_none_multi_variable/00-base.xml @@ -0,0 +1,20 @@ + + + + + + a + + + a + + + + + + var + + + + diff --git a/tests/dictionaries/80valid_enum_none_multi_variable/__init__.py b/tests/dictionaries/80valid_enum_none_multi_variable/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_none_multi_variable/errno_6 b/tests/dictionaries/80valid_enum_none_multi_variable/errno_6 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_number_without_value/00-base.xml b/tests/dictionaries/80valid_enum_number_without_value/00-base.xml new file mode 100644 index 00000000..3986eae3 --- /dev/null +++ b/tests/dictionaries/80valid_enum_number_without_value/00-base.xml @@ -0,0 +1,22 @@ + + + + + + non + + + + + + + + + + + + + + + diff --git a/tests/dictionaries/80valid_enum_number_without_value/__init__.py b/tests/dictionaries/80valid_enum_number_without_value/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_number_without_value/errno_8 b/tests/dictionaries/80valid_enum_number_without_value/errno_8 new file mode 100644 index 00000000..e69de29b From 13b1e9bf546f420c93e09cdeaa569092b8a1e1c7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 26 Dec 2020 15:15:51 +0100 Subject: [PATCH 027/168] update tests --- src/rougail/annotator/constrainte.py | 212 +++++++---------- src/rougail/annotator/family.py | 4 + src/rougail/path.py | 113 ++++----- src/rougail/template.py | 217 +++++++----------- src/rougail/tiramisureflector.py | 4 +- tests/dictionaries/10check_base/00-base.xml | 4 +- .../10check_optional/tiramisu/base.py | 2 +- .../10check_valid_differ/tiramisu/base.py | 2 +- .../10check_valid_differ_add/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../10check_valid_ipnetmask/tiramisu/base.py | 2 +- .../10leadership_append/makedict/base.json | 2 +- .../10leadership_auto/makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../10leadership_mandatory/makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../10leadership_multi/makedict/base.json | 2 +- .../10load_frozenifnotin/00-base.xml | 26 +++ .../__init__.py | 0 .../10load_frozenifnotin/makedict/base.json | 1 + .../tiramisu/__init__.py | 0 .../10load_frozenifnotin/tiramisu/base.py | 16 ++ .../10load_frozenifnotin_noexist/00-base.xml | 36 +++ .../__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/__init__.py} | 0 .../tiramisu/base.py | 16 ++ .../10load_leadership/makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../10load_leadership_name/makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../makedict/base.json | 2 +- .../00-base.xml | 36 +++ .../__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/__init__.py | 0 .../tiramisu/base.py | 16 ++ .../10valid_enum_leader/makedict/base.json | 2 +- .../10valid_enum_param_empty/00-base.xml | 22 ++ .../10valid_enum_param_empty/__init__.py | 0 .../makedict/base.json | 1 + .../10valid_enum_param_empty/tiramisu/base.py | 17 ++ .../10valid_enum_param_empty2/00-base.xml | 22 ++ .../10valid_enum_param_empty2/__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 17 ++ .../20family_dynamic_calc2/00-base.xml | 26 +++ .../20family_dynamic_calc2/__init__.py | 0 .../20family_dynamic_calc2/makedict/base.json | 1 + .../tiramisu/__init__.py | 0 .../20family_dynamic_calc2/tiramisu/base.py | 18 ++ .../makedict/base.json | 2 +- .../40condition_optional_empty/00-base.xml | 25 ++ .../40condition_optional_empty/__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/__init__.py | 0 .../tiramisu/base.py | 16 ++ .../makedict/base.json | 2 +- .../40ifin_leadership/makedict/base.json | 2 +- .../40ifin_leadershipauto/00-base.xml | 10 +- .../40ifin_leadershipauto/makedict/base.json | 2 +- .../40ifin_leadershipauto/result/etc/mailname | 2 + .../40ifin_leadershipauto/tiramisu/base.py | 16 +- .../40ifin_leadershipauto/tmpl/mailname | 9 + .../00-base.xml | 35 +++ .../__init__.py | 0 .../makedict/base.json | 1 + .../result/etc/mailname | 5 + .../tiramisu/base.py | 31 +++ .../tmpl/mailname | 9 + .../60extra_group/makedict/base.json | 2 +- .../60extra_group/result/etc/mailname | 12 +- .../dictionaries/60extra_group/tmpl/mailname | 34 ++- tests/dictionaries/61extra_dyn/00-base.xml | 12 + tests/dictionaries/61extra_dyn/__init__.py | 0 .../61extra_dyn/extra_dirs/extra/00-base.xml | 9 + .../61extra_dyn/makedict/base.json | 1 + .../dictionaries/61extra_dyn/tiramisu/base.py | 17 ++ .../61extra_dyn_extra/00-base.xml | 12 + .../61extra_dyn_extra/__init__.py | 0 .../extra_dirs/extra/00-base.xml | 14 ++ .../61extra_dyn_extra/makedict/base.json | 1 + .../61extra_dyn_extra/tiramisu/base.py | 19 ++ .../70container_files/tmpl/mailname | 4 +- .../00-base.xml | 22 ++ .../__init__.py | 0 .../makedict/base.json | 1 + .../result/etc/mailname | 1 + .../tiramisu/__init__.py | 0 .../tiramisu/base.py | 29 +++ .../tmpl/mailname | 1 + .../makedict/base.json | 2 +- .../80check_without_target/00-base.xml | 20 ++ .../80check_without_target/__init__.py | 0 .../80check_without_target/errno_43 | 0 .../00-base.xml | 20 ++ .../__init__.py | 0 .../80condition_not_exists_error_var/errno_42 | 0 .../80condition_without_target/00-base.xml | 27 +++ .../80condition_without_target/__init__.py | 0 .../80condition_without_target/errno_9 | 0 .../00-base.xml | 25 ++ .../__init__.py | 0 .../errno_28 | 0 .../80family_dynamic_not_multi/00-base.xml | 14 ++ .../80family_dynamic_not_multi/__init__.py | 0 .../80family_dynamic_not_multi/errno_16 | 0 .../80family_only_on_suffix/00-base.xml | 20 ++ .../80family_only_on_suffix/__init__.py | 0 .../80family_only_on_suffix/errno_26 | 0 .../80fill_not_exists/00-base.xml | 23 ++ .../80fill_not_exists/__init__.py | 0 tests/dictionaries/80fill_not_exists/errno_42 | 0 .../80fill_unknown_function/00-base.xml | 19 ++ .../80fill_unknown_function/__init__.py | 0 .../80fill_unknown_function/errno_25 | 0 .../80hidden_if_in_dynamic/00-base.xml | 26 +++ .../80hidden_if_in_dynamic/__init__.py | 0 .../80hidden_if_in_dynamic/errno_20 | 0 .../80valid_entier_invalid_param/00-base.xml | 19 ++ .../80valid_entier_invalid_param/__init__.py | 0 .../80valid_entier_invalid_param/errno_19 | 0 .../80valid_entier_not_number/00-base.xml | 20 ++ .../80valid_entier_not_number/__init__.py | 0 .../80valid_entier_not_number/errno_18 | 0 .../80valid_entier_without_param/00-base.xml | 17 ++ .../80valid_entier_without_param/__init__.py | 0 .../80valid_entier_without_param/errno_17 | 0 .../80valid_enum_multi_param/errno_5 | 0 .../88valid_enum_not_number2/00-base.xml | 24 ++ .../88valid_enum_not_number2/__init__.py | 0 .../88valid_enum_not_number2/errno_7 | 0 .../00-base.xml | 22 ++ .../__init__.py | 0 .../88valid_enum_variable_optional/errno_14 | 0 tests/test_2_makedict.py | 2 +- tests/test_3_template.py | 2 +- 146 files changed, 1170 insertions(+), 371 deletions(-) create mode 100644 tests/dictionaries/10load_frozenifnotin/00-base.xml rename tests/dictionaries/{10check_valid_differ_add/tiramisu => 10load_frozenifnotin}/__init__.py (100%) create mode 100644 tests/dictionaries/10load_frozenifnotin/makedict/base.json rename tests/dictionaries/{10check_valid_differ_removecheck => 10load_frozenifnotin}/tiramisu/__init__.py (100%) create mode 100644 tests/dictionaries/10load_frozenifnotin/tiramisu/base.py create mode 100644 tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml rename tests/dictionaries/{10check_valid_ipnetmask/tiramisu => 10load_frozenifnotin_noexist}/__init__.py (100%) create mode 100644 tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json rename tests/dictionaries/{80valid_enum_multi_param/errno_7 => 10load_frozenifnotin_noexist/tiramisu/__init__.py} (100%) create mode 100644 tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py create mode 100644 tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml create mode 100644 tests/dictionaries/10load_mandatoryifnotin_noexist/__init__.py create mode 100644 tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json create mode 100644 tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/__init__.py create mode 100644 tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py create mode 100644 tests/dictionaries/10valid_enum_param_empty/00-base.xml create mode 100644 tests/dictionaries/10valid_enum_param_empty/__init__.py create mode 100644 tests/dictionaries/10valid_enum_param_empty/makedict/base.json create mode 100644 tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py create mode 100644 tests/dictionaries/10valid_enum_param_empty2/00-base.xml create mode 100644 tests/dictionaries/10valid_enum_param_empty2/__init__.py create mode 100644 tests/dictionaries/10valid_enum_param_empty2/makedict/base.json create mode 100644 tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py create mode 100644 tests/dictionaries/20family_dynamic_calc2/00-base.xml create mode 100644 tests/dictionaries/20family_dynamic_calc2/__init__.py create mode 100644 tests/dictionaries/20family_dynamic_calc2/makedict/base.json create mode 100644 tests/dictionaries/20family_dynamic_calc2/tiramisu/__init__.py create mode 100644 tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py create mode 100644 tests/dictionaries/40condition_optional_empty/00-base.xml create mode 100644 tests/dictionaries/40condition_optional_empty/__init__.py create mode 100644 tests/dictionaries/40condition_optional_empty/makedict/base.json create mode 100644 tests/dictionaries/40condition_optional_empty/tiramisu/__init__.py create mode 100644 tests/dictionaries/40condition_optional_empty/tiramisu/base.py create mode 100644 tests/dictionaries/40ifin_leadershipauto/result/etc/mailname create mode 100644 tests/dictionaries/40ifin_leadershipauto/tmpl/mailname create mode 100644 tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml create mode 100644 tests/dictionaries/40ifin_leadershipauto_follower/__init__.py create mode 100644 tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json create mode 100644 tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname create mode 100644 tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py create mode 100644 tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname create mode 100644 tests/dictionaries/61extra_dyn/00-base.xml create mode 100644 tests/dictionaries/61extra_dyn/__init__.py create mode 100644 tests/dictionaries/61extra_dyn/extra_dirs/extra/00-base.xml create mode 100644 tests/dictionaries/61extra_dyn/makedict/base.json create mode 100644 tests/dictionaries/61extra_dyn/tiramisu/base.py create mode 100644 tests/dictionaries/61extra_dyn_extra/00-base.xml create mode 100644 tests/dictionaries/61extra_dyn_extra/__init__.py create mode 100644 tests/dictionaries/61extra_dyn_extra/extra_dirs/extra/00-base.xml create mode 100644 tests/dictionaries/61extra_dyn_extra/makedict/base.json create mode 100644 tests/dictionaries/61extra_dyn_extra/tiramisu/base.py create mode 100644 tests/dictionaries/70container_files_symlink_variable/00-base.xml create mode 100644 tests/dictionaries/70container_files_symlink_variable/__init__.py create mode 100644 tests/dictionaries/70container_files_symlink_variable/makedict/base.json create mode 100644 tests/dictionaries/70container_files_symlink_variable/result/etc/mailname create mode 100644 tests/dictionaries/70container_files_symlink_variable/tiramisu/__init__.py create mode 100644 tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py create mode 100644 tests/dictionaries/70container_files_symlink_variable/tmpl/mailname create mode 100644 tests/dictionaries/80check_without_target/00-base.xml create mode 100644 tests/dictionaries/80check_without_target/__init__.py create mode 100644 tests/dictionaries/80check_without_target/errno_43 create mode 100644 tests/dictionaries/80condition_not_exists_error_var/00-base.xml create mode 100644 tests/dictionaries/80condition_not_exists_error_var/__init__.py create mode 100644 tests/dictionaries/80condition_not_exists_error_var/errno_42 create mode 100644 tests/dictionaries/80condition_without_target/00-base.xml create mode 100644 tests/dictionaries/80condition_without_target/__init__.py create mode 100644 tests/dictionaries/80condition_without_target/errno_9 create mode 100644 tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml create mode 100644 tests/dictionaries/80family_dynamic_calc_invalid_suffix/__init__.py create mode 100644 tests/dictionaries/80family_dynamic_calc_invalid_suffix/errno_28 create mode 100644 tests/dictionaries/80family_dynamic_not_multi/00-base.xml create mode 100644 tests/dictionaries/80family_dynamic_not_multi/__init__.py create mode 100644 tests/dictionaries/80family_dynamic_not_multi/errno_16 create mode 100644 tests/dictionaries/80family_only_on_suffix/00-base.xml create mode 100644 tests/dictionaries/80family_only_on_suffix/__init__.py create mode 100644 tests/dictionaries/80family_only_on_suffix/errno_26 create mode 100644 tests/dictionaries/80fill_not_exists/00-base.xml create mode 100644 tests/dictionaries/80fill_not_exists/__init__.py create mode 100644 tests/dictionaries/80fill_not_exists/errno_42 create mode 100644 tests/dictionaries/80fill_unknown_function/00-base.xml create mode 100644 tests/dictionaries/80fill_unknown_function/__init__.py create mode 100644 tests/dictionaries/80fill_unknown_function/errno_25 create mode 100644 tests/dictionaries/80hidden_if_in_dynamic/00-base.xml create mode 100644 tests/dictionaries/80hidden_if_in_dynamic/__init__.py create mode 100644 tests/dictionaries/80hidden_if_in_dynamic/errno_20 create mode 100644 tests/dictionaries/80valid_entier_invalid_param/00-base.xml create mode 100644 tests/dictionaries/80valid_entier_invalid_param/__init__.py create mode 100644 tests/dictionaries/80valid_entier_invalid_param/errno_19 create mode 100644 tests/dictionaries/80valid_entier_not_number/00-base.xml create mode 100644 tests/dictionaries/80valid_entier_not_number/__init__.py create mode 100644 tests/dictionaries/80valid_entier_not_number/errno_18 create mode 100644 tests/dictionaries/80valid_entier_without_param/00-base.xml create mode 100644 tests/dictionaries/80valid_entier_without_param/__init__.py create mode 100644 tests/dictionaries/80valid_entier_without_param/errno_17 create mode 100644 tests/dictionaries/80valid_enum_multi_param/errno_5 create mode 100644 tests/dictionaries/88valid_enum_not_number2/00-base.xml create mode 100644 tests/dictionaries/88valid_enum_not_number2/__init__.py create mode 100644 tests/dictionaries/88valid_enum_not_number2/errno_7 create mode 100644 tests/dictionaries/88valid_enum_variable_optional/00-base.xml create mode 100644 tests/dictionaries/88valid_enum_variable_optional/__init__.py create mode 100644 tests/dictionaries/88valid_enum_variable_optional/errno_14 diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 8e9e4d7c..f00f3b49 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -46,8 +46,6 @@ class ConstrainteAnnotator: self.remove_constraints() def convert_auto_freeze(self): # pylint: disable=C0111 - if not hasattr(self.objectspace.space, 'variables'): - return def _convert_auto_freeze(variable, namespace): if variable.auto_freeze: if namespace != Config['variable_namespace']: @@ -129,52 +127,14 @@ class ConstrainteAnnotator: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable "{check.target}" in {xmlfiles}'), 4) variable = self.objectspace.paths.get_variable_obj(check.target) - values = self.load_params_in_valid_enum(check.param, - variable.name, - variable.type, - ) self._set_valid_enum(variable, - values, - variable.type, - check.target, - check.xmlfiles, + check, ) remove_indexes.append(idx) remove_indexes.sort(reverse=True) for idx in remove_indexes: del self.objectspace.space.constraints.check[idx] - def load_params_in_valid_enum(self, - params, - variable_name, - variable_type, - ): - has_variable = None - values = [] - for param in params: - if param.type == 'variable': - if has_variable is not None: - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 5) - has_variable = True - variable = self.objectspace.paths.get_variable_obj(param.text) - if not variable.multi: - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 6) - values = param.text - else: - if has_variable: - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'only one parameter is allowed for valid_enum of variable "{variable_name}" in {xmlfiles}'), 7) - if not hasattr(param, 'text'): - if param.type == 'number': - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'param type is number, so value is mandatory for valid_enum of variable "{variable_name}" in {xmlfiles}'), 8) - values.append(None) - else: - values.append(param.text) - return values - def check_change_warning(self): #convert level to "warnings_only" for check in self.objectspace.space.constraints.check: @@ -201,7 +161,8 @@ class ConstrainteAnnotator: def check_params_target(self): for condition in self.objectspace.space.constraints.condition: if not hasattr(condition, 'target'): - raise DictConsistencyError(_('target is mandatory in condition'), 9) + xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) + raise DictConsistencyError(_(f'target is mandatory in a condition for source "{condition.source}" in {xmlfiles}'), 9) for target in condition.target: if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']: xmlfiles = self.objectspace.display_xmlfiles(target.xmlfiles) @@ -217,9 +178,10 @@ class ConstrainteAnnotator: try: target_names = [normalize_family(name) for name in target.name.split('.')] target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace) - except DictConsistencyError: + except DictConsistencyError as err: # for optional variable - pass + if not target.optional or err.errno != 42: + raise err elif target.type == 'family': try: target_names = [normalize_family(name) for name in target.name.split('.')] @@ -305,9 +267,17 @@ class ConstrainteAnnotator: remove_conditions = [] for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): namespace = condition.namespace - condition.source = self.objectspace.paths.get_variable_path(condition.source, namespace, allow_source=True) + condition.source, suffix = self.objectspace.paths.get_variable_path(condition.source, + namespace, + allow_source=True, + with_suffix=True, + ) + if suffix: + xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) + raise DictConsistencyError(_(f'the source "{condition.source}" in condition cannot be a dynamic variable in {xmlfiles}'), 20) src_variable = self.objectspace.paths.get_variable_obj(condition.source) valid_enum = None + # FIXME only string? if condition.source in self.valid_enums and self.valid_enums[condition.source]['type'] == 'string': valid_enum = self.valid_enums[condition.source]['values'] if valid_enum is not None: @@ -319,7 +289,6 @@ class ConstrainteAnnotator: for idx in remove_param: del condition.param[idx] if condition.param == []: - remove_targets = [] for target in condition.target: leader_or_variable, variables = self._get_family_variables_from_target(target) if condition.name == 'disabled_if_not_in': @@ -330,11 +299,7 @@ class ConstrainteAnnotator: variable.frozen = True variable.force_default_on_freeze = True elif condition.name == 'mandatory_if_not_in': - variable.mandatory = True - remove_targets = list(set(remove_targets)) - remove_targets.sort(reverse=True) - for target_idx in remove_targets: - condition.target.pop(target_idx) + leader_or_variable.mandatory = True remove_conditions.append(condition_idx) remove_conditions = list(set(remove_conditions)) remove_conditions.sort(reverse=True) @@ -342,11 +307,8 @@ class ConstrainteAnnotator: self.objectspace.space.constraints.condition.pop(idx) def remove_condition_with_empty_target(self): - remove_conditions = [] - for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): - if not condition.target: - remove_conditions.append(condition_idx) - remove_conditions = list(set(remove_conditions)) + # optional target are remove, condition could be empty + remove_conditions = [condition_idx for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition) if not condition.target] remove_conditions.sort(reverse=True) for idx in remove_conditions: self.objectspace.space.constraints.condition.pop(idx) @@ -391,58 +353,72 @@ class ConstrainteAnnotator: def _set_valid_enum(self, variable, - values, - type_, - target: str, - xmlfiles: List[str], + check, ): + type_ = variable.type + target = check.target # value for choice's variable is mandatory variable.mandatory = True # build choice variable.choice = [] - if isinstance(values, str): + variable.type = 'choice' + + has_variable = False + values = [] + for param in check.param: + if has_variable: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable "{variable.name}" in {xmlfiles}'), 5) + param_type = type_ + if param.type == 'variable': + has_variable = True + param_variable = self.objectspace.paths.get_variable_obj(param.text) + if param.optional is True: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'optional parameter in valid_enum for variable "{variable.name}" is not allowed in {xmlfiles}'), 14) + if not param_variable.multi: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable "{variable.name}" in {xmlfiles}'), 6) + param_type = 'calculation' + value = param.text + else: + if 'type' in vars(param) and type_ != param.type: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'parameter in valid_enum has incompatible type "{param.type}" with type of the variable "{variable.name}" ("{type_}") in {xmlfiles}'), 7) + if hasattr(param, 'text'): + try: + value = CONVERT_OPTION[type_].get('func', str)(param.text) + except: + raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{param.text}" is not a valid "{type_}" for "{variable.name}"'), 13) + else: + if param.type == 'number': + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + raise DictConsistencyError(_(f'param type is number, so value is mandatory for valid_enum of variable "{variable.name}" in {xmlfiles}'), 8) + value = None + values.append(value) choice = self.objectspace.choice(variable.xmlfiles) - choice.type = 'calculation' - choice.name = values + choice.name = value + choice.type = param_type variable.choice.append(choice) - else: + if has_variable: + return + + # FIXME really? + if param_type != 'calculation': self.valid_enums[target] = {'type': type_, 'values': values, - 'xmlfiles': xmlfiles, + 'xmlfiles': check.xmlfiles, } - choices = [] - for value in values: - choice = self.objectspace.choice(variable.xmlfiles) - try: - if value is not None: - choice.name = CONVERT_OPTION[type_].get('func', str)(value) - else: - choice.name = value - except: - raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"'), 13) - if choice.name == '': - choice.name = None - choices.append(choice.name) - choice.type = type_ - variable.choice.append(choice) - # check value or set first choice value has default value - if hasattr(variable, 'value'): - for value in variable.value: - value.type = type_ - try: - cvalue = CONVERT_OPTION[type_].get('func', str)(value.name) - except: - raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'), 14) - if cvalue not in choices: - raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices), 15) - else: - new_value = self.objectspace.value(variable.xmlfiles) - new_value.name = choices[0] - new_value.type = type_ - variable.value = [new_value] - if not variable.choice: - raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name), 16) - variable.type = 'choice' + # check value or set first choice value has default value + if hasattr(variable, 'value'): + for value in variable.value: + if value.name not in values: + raise DictConsistencyError(_(f'value "{value.name}" of variable "{variable.name}" is not in list of all expected values ({values})'), 15) + else: + new_value = self.objectspace.value(check.xmlfiles) + new_value.name = values[0] + new_value.type = type_ + variable.value = [new_value] def convert_check(self): for check in self.objectspace.space.constraints.check: @@ -452,39 +428,18 @@ class ConstrainteAnnotator: if not hasattr(check, 'param'): raise DictConsistencyError(_('{} must have, at least, 1 param').format(name), 17) for param in check.param: - if param.type not in ['string', 'number']: - raise DictConsistencyError(_(f'param in "valid_entier" must not be a "{param.type}"'), 18) + if param.type != 'number': + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'param in "valid_entier" must be an "integer", not "{param.type}" in {xmlfiles}'), 18) if param.name == 'mini': variable.min_number = int(param.text) elif param.name == 'maxi': variable.max_number = int(param.text) else: - raise DictConsistencyError(_(f'unknown parameter {param.text} in check "valid_entier" for variable {check.target}'), 19) + xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) + raise DictConsistencyError(_(f'unknown parameter "{param.name}" in check "valid_entier" for variable "{check.target}" in {xmlfiles}'), 19) else: check_ = self.objectspace.check(variable.xmlfiles) - if name == 'valid_differ': - name = 'valid_not_equal' - elif name == 'valid_network_netmask': - params_len = 1 - if len(check.param) != params_len: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 20) - elif name == 'valid_ipnetmask': - params_len = 1 - if len(check.param) != params_len: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 21) - name = 'valid_ip_netmask' - elif name == 'valid_broadcast': - params_len = 2 - if len(check.param) != params_len: - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 22) - elif name == 'valid_in_network': - if len(check.param) not in (1, 2): - params_len = 2 - xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'{name} must have {params_len} param in {xmlfiles}'), 23) check_.name = name check_.warnings_only = check.warnings_only if hasattr(check, 'param'): @@ -510,7 +465,7 @@ class ConstrainteAnnotator: # if fill.name not in self.functions: xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'cannot find fill function {fill.name} in {xmlfiles}'), 25) + raise DictConsistencyError(_(f'cannot find fill function "{fill.name}" in {xmlfiles}'), 25) namespace = fill.namespace # let's replace the target by the path @@ -520,7 +475,7 @@ class ConstrainteAnnotator: ) if suffix is not None: xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}" in {xmlfiles}'), 26) + raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only for the suffix "{suffix}" in {xmlfiles}'), 26) variable = self.objectspace.paths.get_variable_obj(fill.target) value = self.objectspace.value(variable.xmlfiles) value.type = 'calculation' @@ -534,7 +489,7 @@ class ConstrainteAnnotator: if param.type == 'suffix': if hasattr(param, 'text'): xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target} in {xmlfiles}"), 28) + raise DictConsistencyError(_(f'"{param.type}" variables must not have a value in order to calculate "{fill.target}" in {xmlfiles}'), 28) if not self.objectspace.paths.variable_is_dynamic(fill.target): xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) raise DictConsistencyError(_(f'Cannot set suffix target to the none dynamic variable "{fill.target}" in {xmlfiles}'), 53) @@ -570,7 +525,6 @@ class ConstrainteAnnotator: del self.objectspace.space.constraints.index del self.objectspace.space.constraints.namespace del self.objectspace.space.constraints.xmlfiles - if vars(self.objectspace.space.constraints): + if vars(self.objectspace.space.constraints): # pragma: no cover raise Exception('constraints again?') del self.objectspace.space.constraints - diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 43d3ceb4..fe4a438b 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -73,6 +73,10 @@ class FamilyAnnotator: if 'dynamic' in vars(family): namespace = self.objectspace.paths.get_variable_namespace(family.dynamic) varpath = self.objectspace.paths.get_variable_path(family.dynamic, namespace) + obj = self.objectspace.paths.get_variable_obj(varpath) + if not obj.multi: + xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles) + raise DictConsistencyError(_(f'dynamic family "{family.name}" must be linked to multi variable in {xmlfiles}'), 16) family.dynamic = varpath def annotate_variable(self, variable, family_mode, path, is_follower=False): diff --git a/src/rougail/path.py b/src/rougail/path.py index 59899970..9e826c2c 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -27,43 +27,46 @@ class Path: self.full_paths_families[name] = full_name else: full_name = name - if full_name in self.families and self.families[full_name]['variableobj'] != variableobj: - raise DictConsistencyError(_(f'Duplicate family name {name}'), 37) + if full_name in self.families and self.families[full_name]['variableobj'] != variableobj: # pragma: no cover + raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 37) self.families[full_name] = dict(name=name, namespace=namespace, variableobj=variableobj, ) + def _get_family(self, + name: str, + namespace: str=None, + ): + # if main namespace, get full_path + if '.' not in name and namespace in [None, Config['variable_namespace']] and name in self.full_paths_families: + name = self.full_paths_families[name] + dico = self.families[name] + if namespace and dico['namespace'] != Config['variable_namespace'] and namespace != dico['namespace']: + raise DictConsistencyError(_(f'A family located in the "{dico["namespace"]}" namespace shall not be used in the "{namespace}" namespace'), 38) + return dico + def get_family_path(self, name: str, - current_namespace: str, + namespace: str, ) -> str: # pylint: disable=C0111 - #name = normalize_family(name) - if '.' not in name and current_namespace == Config['variable_namespace'] and name in self.full_paths_families: - name = self.full_paths_families[name] - if current_namespace is None: # pragma: no cover - raise OperationError('current_namespace must not be None') - dico = self.families[name] - if dico['namespace'] != Config['variable_namespace'] and current_namespace != dico['namespace']: - raise DictConsistencyError(_(f'A family located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 38) - return dico['name'] + return self._get_family(name, + namespace, + )['name'] def get_family_obj(self, name: str, ) -> 'Family': # pylint: disable=C0111 - if '.' not in name and name in self.full_paths_families: - name = self.full_paths_families[name] - if name not in self.families: - raise DictConsistencyError(_('unknown family {}').format(name), 39) - dico = self.families[name] - return dico['variableobj'] + return self._get_family(name)['variableobj'] def family_is_defined(self, - name: str, - ) -> str: # pylint: disable=C0111 - if '.' not in name and name not in self.families and name in self.full_paths_families: + name: str, + ) -> str: # pylint: disable=C0111 + try: + self._get_family(name) return True - return name in self.families + except KeyError: + return False # Leadership def set_leader(self, @@ -74,24 +77,11 @@ class Path: ) -> None: # pylint: disable=C0111 # need rebuild path and move object in new path old_path = namespace + '.' + leader_family_name + '.' + name - dico = self._get_variable(old_path) - del self.variables[old_path] new_path = namespace + '.' + leader_family_name + '.' + leader_name + '.' + name - self.add_variable(namespace, - new_path, - dico['family'], - False, - dico['variableobj'], - ) + self.variables[new_path] = self.variables.pop(old_path) + self.variables[new_path]['leader'] = leader_name if namespace == Config['variable_namespace']: self.full_paths_variables[name] = new_path - else: - name = new_path - dico = self._get_variable(name) - if dico['leader'] != None: - raise DictConsistencyError(_('Already defined leader {} for variable' - ' {}'.format(dico['leader'], name)), 40) - dico['leader'] = leader_name def get_leader(self, name): # pylint: disable=C0111 return self._get_variable(name)['leader'] @@ -109,14 +99,13 @@ class Path: self.full_paths_variables[name] = full_name else: full_name = name - if namespace == Config['variable_namespace']: - name = name.rsplit('.', 1)[1] self.variables[full_name] = dict(name=name, family=family, namespace=namespace, leader=None, is_dynamic=is_dynamic, - variableobj=variableobj) + variableobj=variableobj, + ) def get_variable_name(self, name, @@ -152,17 +141,13 @@ class Path: ) else: dico = self._get_variable(name) - if not allow_source: - if dico['namespace'] not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']: + if not allow_source and dico['namespace'] not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']: raise DictConsistencyError(_(f'A variable located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 41) - if '.' in dico['name']: - value = dico['name'] - else: - list_path = [dico['namespace'], dico['family']] - if dico['leader'] is not None: - list_path.append(dico['leader']) - list_path.append(dico['name']) - value = '.'.join(list_path) + list_path = [dico['namespace'], dico['family']] + if dico['leader'] is not None: + list_path.append(dico['leader']) + list_path.append(dico['name']) + value = '.'.join(list_path) if with_suffix: return value, suffix return value @@ -184,24 +169,16 @@ class Path: with_suffix: bool=False, ) -> str: if name not in self.variables: - if name not in self.variables: - if '.' not in name and name in self.full_paths_variables: - name = self.full_paths_variables[name] - if name not in self.variables: - for var_name, variable in self.variables.items(): - if variable['is_dynamic'] and name.startswith(var_name): - if not with_suffix: - raise Exception('This option is dynamic, should use "with_suffix" attribute') - return variable, name[len(var_name):] - if '.' not in name: - for var_name, path in self.full_paths_variables.items(): - if name.startswith(var_name): - variable = self.variables[self.full_paths_variables[var_name]] - if variable['is_dynamic']: - if not with_suffix: - raise Exception('This option is dynamic, should use "with_suffix" attribute') - return variable, name[len(var_name):] - raise DictConsistencyError(_('unknown option {}').format(name), 42) + if '.' not in name and name in self.full_paths_variables: + name = self.full_paths_variables[name] + elif with_suffix: + for var_name, full_path in self.full_paths_variables.items(): + if name.startswith(var_name): + variable = self._get_variable(full_path) + if variable['is_dynamic']: + return variable, name[len(var_name):] + if name not in self.variables: + raise DictConsistencyError(_('unknown option {}').format(name), 42) if with_suffix: return self.variables[name], None return self.variables[name] diff --git a/src/rougail/template.py b/src/rougail/template.py index 60e70c08..95821697 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -17,8 +17,8 @@ from Cheetah.NameMapper import NotFound as CheetahNotFound try: from tiramisu3 import Config - from tiramisu3.error import PropertiesOptionError -except: + from tiramisu3.error import PropertiesOptionError # pragma: no cover +except: # pragma: no cover from tiramisu import Config from tiramisu.error import PropertiesOptionError @@ -32,28 +32,6 @@ log = logging.getLogger(__name__) log.addHandler(logging.NullHandler()) -class IsDefined: - """ - filtre permettant de ne pas lever d'exception au cas où - la variable Creole n'est pas définie - """ - def __init__(self, context): - self.context = context - - def __call__(self, varname): - if '.' in varname: - splitted_var = varname.split('.') - if len(splitted_var) != 2: - msg = _("Group variables must be of type leader.follower") - raise KeyError(msg) - leader, follower = splitted_var - if leader in self.context: - return follower in self.context[leader].follower.keys() - return False - else: - return varname in self.context - - @classmethod def cl_compile(kls, *args, **kwargs): kwargs['compilerSettings'] = {'directiveStartToken' : '%', @@ -83,8 +61,7 @@ class CheetahTemplate(ChtTemplate): ): """Initialize Creole CheetahTemplate """ - extra_context = {'is_defined' : IsDefined(context), - 'normalize_family': normalize_family, + extra_context = {'normalize_family': normalize_family, 'rougail_filename': destfilename } if variable: @@ -93,7 +70,7 @@ class CheetahTemplate(ChtTemplate): file=filename, searchList=[context, eosfunc, extra_context]) - # FORK of Cheetah fonction, do not replace '\\' by '/' + # FORK of Cheetah function, do not replace '\\' by '/' def serverSidePath(self, path=None, normpath=normpath, @@ -105,119 +82,103 @@ class CheetahTemplate(ChtTemplate): path = self if path: return normpath(abspath(path)) -# return normpath(abspath(path.replace("\\", '/'))) - elif hasattr(self, '_filePath') and self._filePath: +# original code return normpath(abspath(path.replace("\\", '/'))) + elif hasattr(self, '_filePath') and self._filePath: # pragma: no cover return normpath(abspath(self._filePath)) - else: + else: # pragma: no cover return None -class CreoleLeader: - def __init__(self, value, follower=None, index=None): - """ - On rend la variable itérable pour pouvoir faire: - for ip in iplist: - print(ip.network) - print(ip.netmask) - print(ip) - index is used for CreoleLint - """ +class CreoleValue: + def __str__(self): + return str(self._value) + + +class CreoleLeaderIndex(CreoleValue): + def __init__(self, + value, + follower, + index, + ) -> None: self._value = value - if follower is not None: - self.follower = follower - else: - self.follower = {} + self._follower = follower self._index = index def __getattr__(self, name): - """Get follower variable or attribute of leader value. + if name not in self._follower: + raise AttributeError() + value = self._follower[name] + if isinstance(value, PropertiesOptionError): + raise AttributeError() + return value - If the attribute is a name of a follower variable, return its value. - Otherwise, returns the requested attribute of leader value. - """ - if name in self.follower: - value = self.follower[name] - if isinstance(value, PropertiesOptionError): - raise AttributeError() - return value - else: - return getattr(self._value, name) + def __lt__(self, value): + return self._value.__lt__(value) + + def __le__(self, value): + return self._value.__le__(value) + + def __eq__(self, value): + return self._value.__eq__(value) + + def __ne__(self, value): + return self._value.__ne__(value) + + def __gt__(self, value): + return self._value.__gt__(value) + + def __ge__(self, value): + return self._value >= value + + def __add__(self, value): + return self._value.__add__(value) + + def __radd__(self, value): + return value + self._value + + +class CreoleLeader(CreoleValue): + def __init__(self, + value, + ) -> None: + self._value = value + self._follower = {} def __getitem__(self, index): """Get a leader.follower at requested index. """ - ret = {} - for key, values in self.follower.items(): - ret[key] = values[index] - return CreoleLeader(self._value[index], ret, index) + followers = {key: values[index] for key, values in self._follower.items()} + return CreoleLeaderIndex(self._value[index], + followers, + index, + ) def __iter__(self): """Iterate over leader.follower. Return synchronised value of leader.follower. """ - for i in range(len(self._value)): - ret = {} - for key, values in self.follower.items(): - ret[key] = values[i] - yield CreoleLeader(self._value[i], ret, i) + for index in range(len(self._value)): + yield self.__getitem__(index) def __len__(self): - """Delegate to leader value - """ return len(self._value) - def __repr__(self): - """Show CreoleLeader as dictionary. + def __contains__(self, value): + return self._value.__contains__(value) - The leader value is stored under 'value' key. - The followers are stored under 'follower' key. - """ - return repr({'value': self._value, 'follower': self.follower}) - - def __eq__(self, value): - return value == self._value - - def __ne__(self, value): - return value != self._value - - def __lt__(self, value): - return self._value < value - - def __le__(self, value): - return self._value <= value - - def __gt__(self, value): - return self._value > value - - def __ge__(self, value): - return self._value >= value - - def __str__(self): - """Delegate to leader value - """ - return str(self._value) - - def __add__(self, val): - return self._value.__add__(val) - - def __radd__(self, val): - return val + self._value - - def __contains__(self, item): - return item in self._value - - async def add_follower(self, config, name, path): - if isinstance(self._value, list): - values = [] - for idx in range(len(self._value)): - try: - values.append(await config.option(path, idx).value.get()) - except PropertiesOptionError as err: - values.append(err) - else: - raise Exception('hu?') - self.follower[name] = values + async def add_follower(self, + config, + name: str, + path: str, + ): + self._follower[name] = [] + for index in range(len(self._value)): + try: + value = await config.option(path, index).value.get() + except PropertiesOptionError as err: + value = err + self._follower[name].append(value) class CreoleExtra: @@ -229,9 +190,6 @@ class CreoleExtra: key: str) -> Any: return self.suboption[key] - def __repr__(self): - return self.suboption.__str__() - def __iter__(self): return iter(self.suboption.values()) @@ -260,7 +218,8 @@ class CreoleTemplateEngine: self.rougail_variables_dict = {} async def load_eole_variables_rougail(self, - optiondescription): + optiondescription, + ): for option in await optiondescription.list('all'): if await option.option.isoptiondescription(): if await option.option.isleadership(): @@ -270,8 +229,9 @@ class CreoleTemplateEngine: self.rougail_variables_dict[await suboption.option.name()] = leader else: await leader.add_follower(self.config, - await suboption.option.name(), - await suboption.option.path()) + await suboption.option.name(), + await suboption.option.path(), + ) else: await self.load_eole_variables_rougail(option) else: @@ -292,8 +252,9 @@ class CreoleTemplateEngine: leader_name = await suboption.option.name() else: await leader.add_follower(self.config, - await suboption.option.name(), - await suboption.option.path()) + await suboption.option.name(), + await suboption.option.path(), + ) variables[leader_name] = leader else: subfamilies = await self.load_eole_variables(await variable.option.name(), @@ -320,7 +281,7 @@ class CreoleTemplateEngine: log.info(_("Patching template '{filename}' with '{patch_file}'")) rel_patch_file = relpath(patch_file, tmp_dir) ret = call(patch_cmd + patch_no_debug + ['-i', rel_patch_file]) - if ret: + if ret: # pragma: no cover patch_cmd_err = ' '.join(patch_cmd + ['-i', rel_patch_file]) log.error(_(f"Error applying patch: '{rel_patch_file}'\nTo reproduce and fix this error {patch_cmd_err}")) copy(join(self.distrib_dir, filename), tmp_dir) @@ -355,10 +316,10 @@ class CreoleTemplateEngine: variable, ) data = str(cheetah_template) - except CheetahNotFound as err: + except CheetahNotFound as err: # pragma: no cover varname = err.args[0][13:-1] raise TemplateError(_(f"Error: unknown variable used in template {source} to {destfilename} : {varname}")) - except Exception as err: + except Exception as err: # pragma: no cover raise TemplateError(_(f"Error while instantiating template {source} to {destfilename}: {err}")) with open(destfilename, 'w') as file_h: @@ -424,7 +385,7 @@ class CreoleTemplateEngine: for fill_obj in await fills.list('all'): fill = await fill_obj.value.dict() filename = fill['source'] - if not isfile(filename): + if not isfile(filename): # pragma: no cover raise FileNotFound(_(f"File {filename} does not exist.")) if fill.get('activate', False): self.instance_file(fill, diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 512d62b8..86ebf65e 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -7,7 +7,7 @@ from .error import LoaderError from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION -FUNC_TO_DICT = ['valid_not_equal'] +FUNC_TO_DICT = [] FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage'] ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi') @@ -395,7 +395,7 @@ class Variable(Common): self.attrib['default'].append(value) if not self.is_leader: self.attrib['default_multi'] = value - elif isinstance(value, (int, float)): + elif isinstance(value, (int, float)) or value is None: self.attrib['default'].append(value) else: self.attrib['default'].append("'" + value + "'") diff --git a/tests/dictionaries/10check_base/00-base.xml b/tests/dictionaries/10check_base/00-base.xml index 40b7ebfa..c5786883 100644 --- a/tests/dictionaries/10check_base/00-base.xml +++ b/tests/dictionaries/10check_base/00-base.xml @@ -11,8 +11,8 @@ - 0 - 100 + 0 + 100 diff --git a/tests/dictionaries/10check_optional/tiramisu/base.py b/tests/dictionaries/10check_optional/tiramisu/base.py index 2e3a50e3..6294b7cd 100644 --- a/tests/dictionaries/10check_optional/tiramisu/base.py +++ b/tests/dictionaries/10check_optional/tiramisu/base.py @@ -10,7 +10,7 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='b') option_5 = IntOption(properties=frozenset({'normal'}), name='int2', doc='No change', multi=False) -option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False) +option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10check_valid_differ/tiramisu/base.py b/tests/dictionaries/10check_valid_differ/tiramisu/base.py index 932d3384..534ded43 100644 --- a/tests/dictionaries/10check_valid_differ/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ/tiramisu/base.py @@ -9,7 +9,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py index 2aac2277..3105aeea 100644 --- a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py @@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui') +option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui') option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py index 889721ea..fc7dc232 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py @@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui') +option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui') option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py index 74b4048f..a014f254 100644 --- a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py @@ -10,7 +10,7 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) option_4 = IPOption(private_only=True, warnings_only=True, properties=frozenset({'basic', 'mandatory'}), name='adresse_ip_eth0', doc='Adresse IP de la carte', multi=False) -option_5 = NetmaskOption(properties=frozenset({'basic', 'mandatory'}), validators=[Calculation(func.valid_ip_netmask, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=True)], name='adresse_netmask_eth0', doc='Masque de sous réseau de la carte', multi=False) +option_5 = NetmaskOption(properties=frozenset({'basic', 'mandatory'}), validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=True)], name='adresse_netmask_eth0', doc='Masque de sous réseau de la carte', multi=False) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4, option_5]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10leadership_append/makedict/base.json b/tests/dictionaries/10leadership_append/makedict/base.json index 346b748d..9e804f6a 100644 --- a/tests/dictionaries/10leadership_append/makedict/base.json +++ b/tests/dictionaries/10leadership_append/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": [], "rougail.general1.leader.follower3": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} diff --git a/tests/dictionaries/10leadership_auto/makedict/base.json b/tests/dictionaries/10leadership_auto/makedict/base.json index 330c847d..107d7b1c 100644 --- a/tests/dictionaries/10leadership_auto/makedict/base.json +++ b/tests/dictionaries/10leadership_auto/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": [], "rougail.general.leader.follower3": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10leadership_autoleader/makedict/base.json b/tests/dictionaries/10leadership_autoleader/makedict/base.json index 3ff8a0ae..107d7b1c 100644 --- a/tests/dictionaries/10leadership_autoleader/makedict/base.json +++ b/tests/dictionaries/10leadership_autoleader/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json b/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json index 903d2481..1691edbc 100644 --- a/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json +++ b/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []} diff --git a/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json b/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json index 3ff8a0ae..107d7b1c 100644 --- a/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json +++ b/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10leadership_familyaccent/makedict/base.json b/tests/dictionaries/10leadership_familyaccent/makedict/base.json index 3ff8a0ae..107d7b1c 100644 --- a/tests/dictionaries/10leadership_familyaccent/makedict/base.json +++ b/tests/dictionaries/10leadership_familyaccent/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10leadership_leader_hidden/makedict/base.json b/tests/dictionaries/10leadership_leader_hidden/makedict/base.json index 903d2481..1691edbc 100644 --- a/tests/dictionaries/10leadership_leader_hidden/makedict/base.json +++ b/tests/dictionaries/10leadership_leader_hidden/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []} diff --git a/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json b/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json index 903d2481..1691edbc 100644 --- a/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json +++ b/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []} diff --git a/tests/dictionaries/10leadership_leadermandatory/makedict/base.json b/tests/dictionaries/10leadership_leadermandatory/makedict/base.json index 3ff8a0ae..107d7b1c 100644 --- a/tests/dictionaries/10leadership_leadermandatory/makedict/base.json +++ b/tests/dictionaries/10leadership_leadermandatory/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10leadership_mandatory/makedict/base.json b/tests/dictionaries/10leadership_mandatory/makedict/base.json index 3ff8a0ae..107d7b1c 100644 --- a/tests/dictionaries/10leadership_mandatory/makedict/base.json +++ b/tests/dictionaries/10leadership_mandatory/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json b/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json index c61597eb..e40cb9a7 100644 --- a/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json +++ b/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.nut_monitor_netmask.nut_monitor_netmask": [], "rougail.general.nut_monitor_netmask.nut_monitor_host": []} +{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.nut_monitor_netmask.nut_monitor_netmask": []} diff --git a/tests/dictionaries/10leadership_multi/makedict/base.json b/tests/dictionaries/10leadership_multi/makedict/base.json index 3e5c28c6..1b4d93cb 100644 --- a/tests/dictionaries/10leadership_multi/makedict/base.json +++ b/tests/dictionaries/10leadership_multi/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": [], "rougail.general1.leader1.leader1": [], "rougail.general1.leader1.follower11": [], "rougail.general1.leader1.follower21": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader1.leader1": []} diff --git a/tests/dictionaries/10load_frozenifnotin/00-base.xml b/tests/dictionaries/10load_frozenifnotin/00-base.xml new file mode 100644 index 00000000..dc295858 --- /dev/null +++ b/tests/dictionaries/10load_frozenifnotin/00-base.xml @@ -0,0 +1,26 @@ + + + + + + non + + + non + + + non + + + + + + + oui + mode_conteneur_actif + mode_conteneur_actif2 + + + + diff --git a/tests/dictionaries/10check_valid_differ_add/tiramisu/__init__.py b/tests/dictionaries/10load_frozenifnotin/__init__.py similarity index 100% rename from tests/dictionaries/10check_valid_differ_add/tiramisu/__init__.py rename to tests/dictionaries/10load_frozenifnotin/__init__.py diff --git a/tests/dictionaries/10load_frozenifnotin/makedict/base.json b/tests/dictionaries/10load_frozenifnotin/makedict/base.json new file mode 100644 index 00000000..25db64a2 --- /dev/null +++ b/tests/dictionaries/10load_frozenifnotin/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} diff --git a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/__init__.py b/tests/dictionaries/10load_frozenifnotin/tiramisu/__init__.py similarity index 100% rename from tests/dictionaries/10check_valid_differ_removecheck/tiramisu/__init__.py rename to tests/dictionaries/10load_frozenifnotin/tiramisu/__init__.py diff --git a/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py new file mode 100644 index 00000000..1c54443d --- /dev/null +++ b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py @@ -0,0 +1,16 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml b/tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml new file mode 100644 index 00000000..fa5cf511 --- /dev/null +++ b/tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml @@ -0,0 +1,36 @@ + + + + + + + + tous + + + non + + + non + + + + + + + + tous + authentifié + aucun + + + oui + non + mode_conteneur_actif + mode_conteneur_actif2 + + + + + diff --git a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/__init__.py b/tests/dictionaries/10load_frozenifnotin_noexist/__init__.py similarity index 100% rename from tests/dictionaries/10check_valid_ipnetmask/tiramisu/__init__.py rename to tests/dictionaries/10load_frozenifnotin_noexist/__init__.py diff --git a/tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json b/tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json new file mode 100644 index 00000000..3e41cfc3 --- /dev/null +++ b/tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} diff --git a/tests/dictionaries/80valid_enum_multi_param/errno_7 b/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/__init__.py similarity index 100% rename from tests/dictionaries/80valid_enum_multi_param/errno_7 rename to tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/__init__.py diff --git a/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py b/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py new file mode 100644 index 00000000..099f9f5b --- /dev/null +++ b/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py @@ -0,0 +1,16 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='tous', values=('tous', 'authentifié', 'aucun')) +option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10load_leadership/makedict/base.json b/tests/dictionaries/10load_leadership/makedict/base.json index a84a00cf..9e804f6a 100644 --- a/tests/dictionaries/10load_leadership/makedict/base.json +++ b/tests/dictionaries/10load_leadership/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} diff --git a/tests/dictionaries/10load_leadership_default_multi/makedict/base.json b/tests/dictionaries/10load_leadership_default_multi/makedict/base.json index bab2c504..3a48366f 100644 --- a/tests/dictionaries/10load_leadership_default_multi/makedict/base.json +++ b/tests/dictionaries/10load_leadership_default_multi/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json b/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json index 63ea34ae..a4b5c0a4 100644 --- a/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json +++ b/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": ["leader"], "rougail.general.leader.follower1": [["value"]], "rougail.general.leader.follower2": [["value1", "value2"]]} +{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [{"rougail.general.leader.leader": "leader", "rougail.general.leader.follower1": ["value"], "rougail.general.leader.follower2": ["value1", "value2"]}]} diff --git a/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json b/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json index ef51ba28..64540f5e 100644 --- a/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json +++ b/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": ["value"], "rougail.general.leader.follower1": [null], "rougail.general.leader.follower2": [null]} +{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [{"rougail.general.leader.leader": "value", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}]} diff --git a/tests/dictionaries/10load_leadership_description/makedict/base.json b/tests/dictionaries/10load_leadership_description/makedict/base.json index a84a00cf..9e804f6a 100644 --- a/tests/dictionaries/10load_leadership_description/makedict/base.json +++ b/tests/dictionaries/10load_leadership_description/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} diff --git a/tests/dictionaries/10load_leadership_name/makedict/base.json b/tests/dictionaries/10load_leadership_name/makedict/base.json index e02048af..9e804f6a 100644 --- a/tests/dictionaries/10load_leadership_name/makedict/base.json +++ b/tests/dictionaries/10load_leadership_name/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.other_name.leader": [], "rougail.general1.other_name.follower1": [], "rougail.general1.other_name.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} diff --git a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json b/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json index c2596da8..9cdf5c3e 100644 --- a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json +++ b/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general_1.leader.leader": [], "rougail.general_1.leader.follower1": [], "rougail.general_1.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general_1.leader.leader": []} diff --git a/tests/dictionaries/10load_leadership_submulti/makedict/base.json b/tests/dictionaries/10load_leadership_submulti/makedict/base.json index a84a00cf..9e804f6a 100644 --- a/tests/dictionaries/10load_leadership_submulti/makedict/base.json +++ b/tests/dictionaries/10load_leadership_submulti/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml b/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml new file mode 100644 index 00000000..30f24f77 --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml @@ -0,0 +1,36 @@ + + + + + + + + tous + + + + + + + + + + tous + authentifié + aucun + + + oui + non + mode_conteneur_actif + mode_conteneur_actif2 + + + + + diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/__init__.py b/tests/dictionaries/10load_mandatoryifnotin_noexist/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json new file mode 100644 index 00000000..3e41cfc3 --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/__init__.py b/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py new file mode 100644 index 00000000..099f9f5b --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py @@ -0,0 +1,16 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='tous', values=('tous', 'authentifié', 'aucun')) +option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_leader/makedict/base.json b/tests/dictionaries/10valid_enum_leader/makedict/base.json index 3ff8a0ae..107d7b1c 100644 --- a/tests/dictionaries/10valid_enum_leader/makedict/base.json +++ b/tests/dictionaries/10valid_enum_leader/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/10valid_enum_param_empty/00-base.xml b/tests/dictionaries/10valid_enum_param_empty/00-base.xml new file mode 100644 index 00000000..a73090a6 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/00-base.xml @@ -0,0 +1,22 @@ + + + + + + non + + + + + + + + + + + + + + + diff --git a/tests/dictionaries/10valid_enum_param_empty/__init__.py b/tests/dictionaries/10valid_enum_param_empty/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10valid_enum_param_empty/makedict/base.json b/tests/dictionaries/10valid_enum_param_empty/makedict/base.json new file mode 100644 index 00000000..9f9d92af --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": null} diff --git a/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py b/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py new file mode 100644 index 00000000..eb614366 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py @@ -0,0 +1,17 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) +option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, values=(None,)) +option_5.impl_set_information("help", "bla bla bla") +option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_param_empty2/00-base.xml b/tests/dictionaries/10valid_enum_param_empty2/00-base.xml new file mode 100644 index 00000000..e2dcfadb --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/00-base.xml @@ -0,0 +1,22 @@ + + + + + + non + + + + + + + + + + + + + + + diff --git a/tests/dictionaries/10valid_enum_param_empty2/__init__.py b/tests/dictionaries/10valid_enum_param_empty2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json b/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json new file mode 100644 index 00000000..9f9d92af --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": null} diff --git a/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py b/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py new file mode 100644 index 00000000..eb614366 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py @@ -0,0 +1,17 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) +option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, values=(None,)) +option_5.impl_set_information("help", "bla bla bla") +option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc2/00-base.xml b/tests/dictionaries/20family_dynamic_calc2/00-base.xml new file mode 100644 index 00000000..9020ece0 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/00-base.xml @@ -0,0 +1,26 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + non + dyn + + + diff --git a/tests/dictionaries/20family_dynamic_calc2/__init__.py b/tests/dictionaries/20family_dynamic_calc2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/20family_dynamic_calc2/makedict/base.json b/tests/dictionaries/20family_dynamic_calc2/makedict/base.json new file mode 100644 index 00000000..82b6fff8 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": null} diff --git a/tests/dictionaries/20family_dynamic_calc2/tiramisu/__init__.py b/tests/dictionaries/20family_dynamic_calc2/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py new file mode 100644 index 00000000..b834b573 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py @@ -0,0 +1,18 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['val1', 'val2'], default_multi='val2') +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) +option_7 = StrOption(properties=frozenset({'normal'}), name='newvar', doc='No change', multi=False) +option_5 = StrOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('non')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('non')}))}), name='vardyn', doc='No change', multi=False, default='val') +option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('non')}))}), children=[option_5]) +option_6 = OptionDescription(name='new', doc='new', properties=frozenset({'normal'}), children=[option_7]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4, option_6]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/20family_modeleadership/makedict/base.json b/tests/dictionaries/20family_modeleadership/makedict/base.json index 3ff8a0ae..107d7b1c 100644 --- a/tests/dictionaries/20family_modeleadership/makedict/base.json +++ b/tests/dictionaries/20family_modeleadership/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/40condition_optional_empty/00-base.xml b/tests/dictionaries/40condition_optional_empty/00-base.xml new file mode 100644 index 00000000..85a25ecc --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/00-base.xml @@ -0,0 +1,25 @@ + + + + + + non + + + non + + + non + + + + + + + oui + mode_conteneur_actif2 + + + + diff --git a/tests/dictionaries/40condition_optional_empty/__init__.py b/tests/dictionaries/40condition_optional_empty/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/40condition_optional_empty/makedict/base.json b/tests/dictionaries/40condition_optional_empty/makedict/base.json new file mode 100644 index 00000000..6008a9ce --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non"} diff --git a/tests/dictionaries/40condition_optional_empty/tiramisu/__init__.py b/tests/dictionaries/40condition_optional_empty/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/40condition_optional_empty/tiramisu/base.py b/tests/dictionaries/40condition_optional_empty/tiramisu/base.py new file mode 100644 index 00000000..5f746d25 --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/tiramisu/base.py @@ -0,0 +1,16 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json index 8e8eadbe..944631ab 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json +++ b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": ["non"], "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": ["non"]} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": [{"rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": "non"}]} diff --git a/tests/dictionaries/40ifin_leadership/makedict/base.json b/tests/dictionaries/40ifin_leadership/makedict/base.json index ef2026a8..22441eab 100644 --- a/tests/dictionaries/40ifin_leadership/makedict/base.json +++ b/tests/dictionaries/40ifin_leadership/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": []} diff --git a/tests/dictionaries/40ifin_leadershipauto/00-base.xml b/tests/dictionaries/40ifin_leadershipauto/00-base.xml index d4556f38..dff4a4b1 100644 --- a/tests/dictionaries/40ifin_leadershipauto/00-base.xml +++ b/tests/dictionaries/40ifin_leadershipauto/00-base.xml @@ -1,17 +1,23 @@ + + + + + non - + + a + - follower1 diff --git a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json index ef2026a8..9c202b00 100644 --- a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [], "rougail.general.leader.follower2": []} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/40ifin_leadershipauto/result/etc/mailname b/tests/dictionaries/40ifin_leadershipauto/result/etc/mailname new file mode 100644 index 00000000..155aa30c --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto/result/etc/mailname @@ -0,0 +1,2 @@ +leader: a +follower2: diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index 7daf47d8..28d08a4b 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -10,10 +10,22 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='condition', multi=False, default='oui', values=('oui', 'non')) -option_6 = StrOption(name='leader', doc='leader', multi=True) +option_6 = StrOption(properties=frozenset({'mandatory'}), name='leader', doc='leader', multi=True, default=['a']) option_7 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")}))) option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True) option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8]) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_13 = StrOption(name='group', doc='group', multi=False, default='root') +option_14 = StrOption(name='mode', doc='mode', multi=False, default='0644') +option_15 = StrOption(name='name', doc='name', multi=False, default='/etc/mailname') +option_16 = StrOption(name='owner', doc='owner', multi=False, default='root') +option_17 = StrOption(name='source', doc='source', multi=False, default='mailname') +option_18 = BoolOption(name='templating', doc='templating', multi=False, default=True) +option_19 = BoolOption(name='activate', doc='activate', multi=False, default=True) +option_12 = OptionDescription(name='mailname', doc='mailname', children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19]) +option_11 = OptionDescription(name='files', doc='files', children=[option_12]) +option_10 = OptionDescription(name='test', doc='test', children=[option_11]) +option_10.impl_set_information("manage", True) +option_9 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_10]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_9]) diff --git a/tests/dictionaries/40ifin_leadershipauto/tmpl/mailname b/tests/dictionaries/40ifin_leadershipauto/tmpl/mailname new file mode 100644 index 00000000..43dbe7d1 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto/tmpl/mailname @@ -0,0 +1,9 @@ +%for %%lead in %%leader +leader: %%lead +%if %%hasattr(%%lead, 'follower1') +follower1: %%lead.follower1 +%end if +%if %%hasattr(%%lead, 'follower2') +follower2: %%lead.follower2 +%end if +%end for diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml b/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml new file mode 100644 index 00000000..032b0814 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + non + + + + a + b + + + + + + + + follower1 + follower2 + + + valfill + + + a + follower1 + + + diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/__init__.py b/tests/dictionaries/40ifin_leadershipauto_follower/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json new file mode 100644 index 00000000..9aa54e37 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}, {"rougail.general.leader.leader": "b", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname b/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname new file mode 100644 index 00000000..b7cbd32c --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname @@ -0,0 +1,5 @@ +leader: a +follower2: +leader: b +follower1: +follower2: diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py new file mode 100644 index 00000000..4dac5790 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -0,0 +1,31 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='condition', multi=False, default='oui', values=('oui', 'non')) +option_6 = StrOption(properties=frozenset({'mandatory'}), name='leader', doc='leader', multi=True, default=['a', 'b']) +option_7 = StrOption(properties=frozenset({'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_6, todict=True), 'expected': ParamValue('a')}))}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")}))) +option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True) +option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8]) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_13 = StrOption(name='group', doc='group', multi=False, default='root') +option_14 = StrOption(name='mode', doc='mode', multi=False, default='0644') +option_15 = StrOption(name='name', doc='name', multi=False, default='/etc/mailname') +option_16 = StrOption(name='owner', doc='owner', multi=False, default='root') +option_17 = StrOption(name='source', doc='source', multi=False, default='mailname') +option_18 = BoolOption(name='templating', doc='templating', multi=False, default=True) +option_19 = BoolOption(name='activate', doc='activate', multi=False, default=True) +option_12 = OptionDescription(name='mailname', doc='mailname', children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19]) +option_11 = OptionDescription(name='files', doc='files', children=[option_12]) +option_10 = OptionDescription(name='test', doc='test', children=[option_11]) +option_10.impl_set_information("manage", True) +option_9 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_10]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_9]) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname b/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname new file mode 100644 index 00000000..43dbe7d1 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname @@ -0,0 +1,9 @@ +%for %%lead in %%leader +leader: %%lead +%if %%hasattr(%%lead, 'follower1') +follower1: %%lead.follower1 +%end if +%if %%hasattr(%%lead, 'follower2') +follower2: %%lead.follower2 +%end if +%end for diff --git a/tests/dictionaries/60extra_group/makedict/base.json b/tests/dictionaries/60extra_group/makedict/base.json index 0e2661fc..c5fedd54 100644 --- a/tests/dictionaries/60extra_group/makedict/base.json +++ b/tests/dictionaries/60extra_group/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": ["test"], "extra.ejabberd.description.mode": ["pre"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": [{"extra.ejabberd.description.description": "test", "extra.ejabberd.description.mode": "pre"}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/60extra_group/result/etc/mailname b/tests/dictionaries/60extra_group/result/etc/mailname index ecca61d9..dc34cc5b 100644 --- a/tests/dictionaries/60extra_group/result/etc/mailname +++ b/tests/dictionaries/60extra_group/result/etc/mailname @@ -1 +1,11 @@ -pre +contain test +1 +leader: test +follower: pre +supeq +sup +diff +testpre +pretest +leader2: test +follower2: pre diff --git a/tests/dictionaries/60extra_group/tmpl/mailname b/tests/dictionaries/60extra_group/tmpl/mailname index da3e807a..de1500e6 100644 --- a/tests/dictionaries/60extra_group/tmpl/mailname +++ b/tests/dictionaries/60extra_group/tmpl/mailname @@ -1,3 +1,35 @@ +%if 'test' in %%extra.ejabberd.description +contain test +%end if +%%len(%%extra.ejabberd.description) +%if 'a' in %%extra.ejabberd.description +contain a +%end if %for %%description in %%extra.ejabberd.description -%%description.mode +leader: %%description +follower: %%description.mode +%if %%description <= %%description.mode +infeq +%end if +%if %%description >= %%description.mode +supeq +%end if +%if %%description < %%description.mode +inf +%end if +%if %%description > %%description.mode +sup +%end if +%if %%description == %%description.mode +eq +%end if +%if %%description != %%description.mode +diff +%end if +%set %%var = %%description + %%description.mode +%%var +%set %%var = %%description.mode + %%description +%%var %end for +leader2: %%extra.ejabberd.description[0] +follower2: %%extra.ejabberd.description[0].mode diff --git a/tests/dictionaries/61extra_dyn/00-base.xml b/tests/dictionaries/61extra_dyn/00-base.xml new file mode 100644 index 00000000..c243504c --- /dev/null +++ b/tests/dictionaries/61extra_dyn/00-base.xml @@ -0,0 +1,12 @@ + + + + + + a + + + + + diff --git a/tests/dictionaries/61extra_dyn/__init__.py b/tests/dictionaries/61extra_dyn/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/61extra_dyn/extra_dirs/extra/00-base.xml b/tests/dictionaries/61extra_dyn/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..b8b0ca1f --- /dev/null +++ b/tests/dictionaries/61extra_dyn/extra_dirs/extra/00-base.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/dictionaries/61extra_dyn/makedict/base.json b/tests/dictionaries/61extra_dyn/makedict/base.json new file mode 100644 index 00000000..4df71f24 --- /dev/null +++ b/tests/dictionaries/61extra_dyn/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.varname": ["a"], "extra.ejabberda.modea": null} diff --git a/tests/dictionaries/61extra_dyn/tiramisu/base.py b/tests/dictionaries/61extra_dyn/tiramisu/base.py new file mode 100644 index 00000000..899034f2 --- /dev/null +++ b/tests/dictionaries/61extra_dyn/tiramisu/base.py @@ -0,0 +1,17 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['a'], default_multi='a') +option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_6 = StrOption(properties=frozenset({'normal'}), name='mode', doc='mode', multi=False) +option_5 = ConvertDynOptionDescription(name='ejabberd', doc='ejabberd', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_6]) +option_4 = OptionDescription(name='extra', doc='extra', children=[option_5]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4]) diff --git a/tests/dictionaries/61extra_dyn_extra/00-base.xml b/tests/dictionaries/61extra_dyn_extra/00-base.xml new file mode 100644 index 00000000..c243504c --- /dev/null +++ b/tests/dictionaries/61extra_dyn_extra/00-base.xml @@ -0,0 +1,12 @@ + + + + + + a + + + + + diff --git a/tests/dictionaries/61extra_dyn_extra/__init__.py b/tests/dictionaries/61extra_dyn_extra/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/61extra_dyn_extra/extra_dirs/extra/00-base.xml b/tests/dictionaries/61extra_dyn_extra/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..b799098d --- /dev/null +++ b/tests/dictionaries/61extra_dyn_extra/extra_dirs/extra/00-base.xml @@ -0,0 +1,14 @@ + + + + + + + a + + + + + + + diff --git a/tests/dictionaries/61extra_dyn_extra/makedict/base.json b/tests/dictionaries/61extra_dyn_extra/makedict/base.json new file mode 100644 index 00000000..27255994 --- /dev/null +++ b/tests/dictionaries/61extra_dyn_extra/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.varname": ["a"], "extra.general.varname": ["a"], "extra.ejabberda.modea": null} diff --git a/tests/dictionaries/61extra_dyn_extra/tiramisu/base.py b/tests/dictionaries/61extra_dyn_extra/tiramisu/base.py new file mode 100644 index 00000000..67aab539 --- /dev/null +++ b/tests/dictionaries/61extra_dyn_extra/tiramisu/base.py @@ -0,0 +1,19 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['a'], default_multi='a') +option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['a'], default_multi='a') +option_5 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_6]) +option_8 = StrOption(properties=frozenset({'normal'}), name='mode', doc='mode', multi=False) +option_7 = ConvertDynOptionDescription(name='ejabberd', doc='ejabberd', suffixes=Calculation(func.calc_value, Params((ParamOption(option_6)))), properties=frozenset({'normal'}), children=[option_8]) +option_4 = OptionDescription(name='extra', doc='extra', children=[option_5, option_7]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_files/tmpl/mailname b/tests/dictionaries/70container_files/tmpl/mailname index ee573d64..3ae41fab 100644 --- a/tests/dictionaries/70container_files/tmpl/mailname +++ b/tests/dictionaries/70container_files/tmpl/mailname @@ -1,6 +1,6 @@ -%if %%is_defined('mode_conteneur_actif') +%if %%varExists('mode_conteneur_actif') %%mode_conteneur_actif %end if -%if %%is_defined('mode_conteneur_actif3') +%if %%varExists('mode_conteneur_actif3') %%mode_conteneur_actif3 %end if diff --git a/tests/dictionaries/70container_files_symlink_variable/00-base.xml b/tests/dictionaries/70container_files_symlink_variable/00-base.xml new file mode 100644 index 00000000..186ade03 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_variable/00-base.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + /etc/mailname + + + mailname + + + + + diff --git a/tests/dictionaries/70container_files_symlink_variable/__init__.py b/tests/dictionaries/70container_files_symlink_variable/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json new file mode 100644 index 00000000..3e00b14c --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": "/etc/mailname", "rougail.general.var": "mailname", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/70container_files_symlink_variable/result/etc/mailname b/tests/dictionaries/70container_files_symlink_variable/result/etc/mailname new file mode 100644 index 00000000..0288f489 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_variable/result/etc/mailname @@ -0,0 +1 @@ +mailname diff --git a/tests/dictionaries/70container_files_symlink_variable/tiramisu/__init__.py b/tests/dictionaries/70container_files_symlink_variable/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py new file mode 100644 index 00000000..09830090 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py @@ -0,0 +1,29 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) +option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='file_name', doc='file_name', multi=False, default='/etc/mailname') +option_5 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='var', doc='var', multi=False, default='mailname') +option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_10 = StrOption(name='group', doc='group', multi=False, default='root') +option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') +option_12 = SymLinkOption(name='name', opt=option_4) +option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') +option_14 = StrOption(name='source', doc='source', multi=False, default='mailname') +option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) +option_16 = SymLinkOption(name='variable', opt=option_5) +option_17 = BoolOption(name='activate', doc='activate', multi=False, default=True) +option_9 = OptionDescription(name='mailname', doc='mailname', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_8 = OptionDescription(name='files', doc='files', children=[option_9]) +option_7 = OptionDescription(name='test', doc='test', children=[option_8]) +option_7.impl_set_information("manage", True) +option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) diff --git a/tests/dictionaries/70container_files_symlink_variable/tmpl/mailname b/tests/dictionaries/70container_files_symlink_variable/tmpl/mailname new file mode 100644 index 00000000..5ecb01bb --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_variable/tmpl/mailname @@ -0,0 +1 @@ +%%rougail_variable diff --git a/tests/dictionaries/70container_pathaccess_leadership/makedict/base.json b/tests/dictionaries/70container_pathaccess_leadership/makedict/base.json index 91903fe8..1938aa84 100644 --- a/tests/dictionaries/70container_pathaccess_leadership/makedict/base.json +++ b/tests/dictionaries/70container_pathaccess_leadership/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.nut_monitor_netmask.nut_monitor_netmask": [], "rougail.general.nut_monitor_netmask.nut_monitor_host": [], "services.ntp.ips.nut_monitor_host.interface": "auto", "services.ntp.ips.nut_monitor_host.name": [], "services.ntp.ips.nut_monitor_host.netmask": [], "services.ntp.ips.nut_monitor_host.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.nut_monitor_netmask.nut_monitor_netmask": [], "services.ntp.ips.nut_monitor_host.interface": "auto", "services.ntp.ips.nut_monitor_host.name": [], "services.ntp.ips.nut_monitor_host.netmask": [], "services.ntp.ips.nut_monitor_host.activate": true} diff --git a/tests/dictionaries/80check_without_target/00-base.xml b/tests/dictionaries/80check_without_target/00-base.xml new file mode 100644 index 00000000..a586fe52 --- /dev/null +++ b/tests/dictionaries/80check_without_target/00-base.xml @@ -0,0 +1,20 @@ + + + + + + b + + + + + + + + 0 + 100 + + + + diff --git a/tests/dictionaries/80check_without_target/__init__.py b/tests/dictionaries/80check_without_target/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80check_without_target/errno_43 b/tests/dictionaries/80check_without_target/errno_43 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80condition_not_exists_error_var/00-base.xml b/tests/dictionaries/80condition_not_exists_error_var/00-base.xml new file mode 100644 index 00000000..adf99a27 --- /dev/null +++ b/tests/dictionaries/80condition_not_exists_error_var/00-base.xml @@ -0,0 +1,20 @@ + + + + + + non + + + + + + + + oui + notexists + + + + diff --git a/tests/dictionaries/80condition_not_exists_error_var/__init__.py b/tests/dictionaries/80condition_not_exists_error_var/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80condition_not_exists_error_var/errno_42 b/tests/dictionaries/80condition_not_exists_error_var/errno_42 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80condition_without_target/00-base.xml b/tests/dictionaries/80condition_without_target/00-base.xml new file mode 100644 index 00000000..b371fef1 --- /dev/null +++ b/tests/dictionaries/80condition_without_target/00-base.xml @@ -0,0 +1,27 @@ + + + + + + non + + + non + + + non + + + non + + + + + + + oui + + + + diff --git a/tests/dictionaries/80condition_without_target/__init__.py b/tests/dictionaries/80condition_without_target/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80condition_without_target/errno_9 b/tests/dictionaries/80condition_without_target/errno_9 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml b/tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml new file mode 100644 index 00000000..10766b76 --- /dev/null +++ b/tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml @@ -0,0 +1,25 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + unknown + + + diff --git a/tests/dictionaries/80family_dynamic_calc_invalid_suffix/__init__.py b/tests/dictionaries/80family_dynamic_calc_invalid_suffix/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_dynamic_calc_invalid_suffix/errno_28 b/tests/dictionaries/80family_dynamic_calc_invalid_suffix/errno_28 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_dynamic_not_multi/00-base.xml b/tests/dictionaries/80family_dynamic_not_multi/00-base.xml new file mode 100644 index 00000000..b8871d57 --- /dev/null +++ b/tests/dictionaries/80family_dynamic_not_multi/00-base.xml @@ -0,0 +1,14 @@ + + + + + + + val1 + + + + + + + diff --git a/tests/dictionaries/80family_dynamic_not_multi/__init__.py b/tests/dictionaries/80family_dynamic_not_multi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_dynamic_not_multi/errno_16 b/tests/dictionaries/80family_dynamic_not_multi/errno_16 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_only_on_suffix/00-base.xml b/tests/dictionaries/80family_only_on_suffix/00-base.xml new file mode 100644 index 00000000..7fac5b7d --- /dev/null +++ b/tests/dictionaries/80family_only_on_suffix/00-base.xml @@ -0,0 +1,20 @@ + + + + + + + val1 + val2 + + + + + + + + + value + + + diff --git a/tests/dictionaries/80family_only_on_suffix/__init__.py b/tests/dictionaries/80family_only_on_suffix/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_only_on_suffix/errno_26 b/tests/dictionaries/80family_only_on_suffix/errno_26 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80fill_not_exists/00-base.xml b/tests/dictionaries/80fill_not_exists/00-base.xml new file mode 100644 index 00000000..f1e179c3 --- /dev/null +++ b/tests/dictionaries/80fill_not_exists/00-base.xml @@ -0,0 +1,23 @@ + + + + + + + non + + + + + + + mode_conteneur_actif4 + mode_conteneur_actif1 + mode_conteneur_actif3 + + + + diff --git a/tests/dictionaries/80fill_not_exists/__init__.py b/tests/dictionaries/80fill_not_exists/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80fill_not_exists/errno_42 b/tests/dictionaries/80fill_not_exists/errno_42 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80fill_unknown_function/00-base.xml b/tests/dictionaries/80fill_unknown_function/00-base.xml new file mode 100644 index 00000000..46757b25 --- /dev/null +++ b/tests/dictionaries/80fill_unknown_function/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + non + + + + + + + mode_conteneur_actif1 + + + + diff --git a/tests/dictionaries/80fill_unknown_function/__init__.py b/tests/dictionaries/80fill_unknown_function/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80fill_unknown_function/errno_25 b/tests/dictionaries/80fill_unknown_function/errno_25 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80hidden_if_in_dynamic/00-base.xml b/tests/dictionaries/80hidden_if_in_dynamic/00-base.xml new file mode 100644 index 00000000..ed1e19e6 --- /dev/null +++ b/tests/dictionaries/80hidden_if_in_dynamic/00-base.xml @@ -0,0 +1,26 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + non + new + + + diff --git a/tests/dictionaries/80hidden_if_in_dynamic/__init__.py b/tests/dictionaries/80hidden_if_in_dynamic/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80hidden_if_in_dynamic/errno_20 b/tests/dictionaries/80hidden_if_in_dynamic/errno_20 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_entier_invalid_param/00-base.xml b/tests/dictionaries/80valid_entier_invalid_param/00-base.xml new file mode 100644 index 00000000..feba4a36 --- /dev/null +++ b/tests/dictionaries/80valid_entier_invalid_param/00-base.xml @@ -0,0 +1,19 @@ + + + + + + b + + + + + + + + 0 + + + + diff --git a/tests/dictionaries/80valid_entier_invalid_param/__init__.py b/tests/dictionaries/80valid_entier_invalid_param/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_entier_invalid_param/errno_19 b/tests/dictionaries/80valid_entier_invalid_param/errno_19 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_entier_not_number/00-base.xml b/tests/dictionaries/80valid_entier_not_number/00-base.xml new file mode 100644 index 00000000..9c527301 --- /dev/null +++ b/tests/dictionaries/80valid_entier_not_number/00-base.xml @@ -0,0 +1,20 @@ + + + + + + b + + + + + + + + 0 + 100 + + + + diff --git a/tests/dictionaries/80valid_entier_not_number/__init__.py b/tests/dictionaries/80valid_entier_not_number/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_entier_not_number/errno_18 b/tests/dictionaries/80valid_entier_not_number/errno_18 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_entier_without_param/00-base.xml b/tests/dictionaries/80valid_entier_without_param/00-base.xml new file mode 100644 index 00000000..bba116f0 --- /dev/null +++ b/tests/dictionaries/80valid_entier_without_param/00-base.xml @@ -0,0 +1,17 @@ + + + + + + b + + + + + + + + + + diff --git a/tests/dictionaries/80valid_entier_without_param/__init__.py b/tests/dictionaries/80valid_entier_without_param/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_entier_without_param/errno_17 b/tests/dictionaries/80valid_entier_without_param/errno_17 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80valid_enum_multi_param/errno_5 b/tests/dictionaries/80valid_enum_multi_param/errno_5 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/88valid_enum_not_number2/00-base.xml b/tests/dictionaries/88valid_enum_not_number2/00-base.xml new file mode 100644 index 00000000..65dbcef1 --- /dev/null +++ b/tests/dictionaries/88valid_enum_not_number2/00-base.xml @@ -0,0 +1,24 @@ + + + + + + non + + + + + non + + + + + + + + 1 + + + + diff --git a/tests/dictionaries/88valid_enum_not_number2/__init__.py b/tests/dictionaries/88valid_enum_not_number2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/88valid_enum_not_number2/errno_7 b/tests/dictionaries/88valid_enum_not_number2/errno_7 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/88valid_enum_variable_optional/00-base.xml b/tests/dictionaries/88valid_enum_variable_optional/00-base.xml new file mode 100644 index 00000000..bca1ec01 --- /dev/null +++ b/tests/dictionaries/88valid_enum_variable_optional/00-base.xml @@ -0,0 +1,22 @@ + + + + + + a + + + a + b + c + + + + + + var + + + + diff --git a/tests/dictionaries/88valid_enum_variable_optional/__init__.py b/tests/dictionaries/88valid_enum_variable_optional/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/88valid_enum_variable_optional/errno_14 b/tests/dictionaries/88valid_enum_variable_optional/errno_14 new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_2_makedict.py b/tests/test_2_makedict.py index e70525a8..617cbe7b 100644 --- a/tests/test_2_makedict.py +++ b/tests/test_2_makedict.py @@ -47,7 +47,7 @@ async def launch_flattener(test_dir): await config.property.read_only() await config.property.pop('mandatory') await config.information.set('info', 'value') - config_dict = await config.value.dict() + config_dict = await config.value.dict(leader_to_list=True) if config_dict: if not isdir(makedict_dir): mkdir(makedict_dir) diff --git a/tests/test_3_template.py b/tests/test_3_template.py index bbb0d944..549071d5 100644 --- a/tests/test_3_template.py +++ b/tests/test_3_template.py @@ -13,7 +13,7 @@ excludes = set([]) #excludes = set(['01base_file_utfchar']) test_ok = {f for f in listdir(template_dirs) if not f.startswith('_') and isdir(join(template_dirs, f, 'tmpl'))} test_ok -= excludes -#test_ok = ['60extra_group'] +#test_ok = ['40ifin_leadershipauto'] @fixture(scope="module", params=test_ok) From a6bafd89bd317dc46750cd0c6da5e1d64c91714b Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 26 Dec 2020 17:06:56 +0100 Subject: [PATCH 028/168] pylint --- src/rougail/annotator/constrainte.py | 28 +++++++-------- src/rougail/annotator/family.py | 53 ++++++++++++++-------------- src/rougail/annotator/group.py | 1 - src/rougail/annotator/property.py | 2 +- src/rougail/annotator/service.py | 2 +- src/rougail/annotator/variable.py | 3 +- src/rougail/config.py | 18 +++++----- src/rougail/error.py | 1 - src/rougail/objspace.py | 12 ++----- src/rougail/path.py | 3 +- src/rougail/template.py | 25 +++++-------- src/rougail/tiramisu.py | 2 +- src/rougail/tiramisureflector.py | 27 +++++++------- src/rougail/utils.py | 1 - src/rougail/xmlreflector.py | 4 +-- 15 files changed, 78 insertions(+), 104 deletions(-) diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index f00f3b49..17feee3c 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -1,4 +1,3 @@ -from typing import List from importlib.machinery import SourceFileLoader from .variable import CONVERT_OPTION @@ -105,13 +104,13 @@ class ConstrainteAnnotator: del self.objectspace.space.constraints.check[idx] def check_replace_text(self): - for check_idx, check in enumerate(self.objectspace.space.constraints.check): + for check in self.objectspace.space.constraints.check: namespace = check.namespace if hasattr(check, 'param'): - for idx, param in enumerate(check.param): + for param in check.param: if param.type == 'variable': param.text = self.objectspace.paths.get_variable_path(param.text, namespace) - check.is_in_leadership = self.objectspace.paths.get_leader(check.target) != None + check.is_in_leadership = self.objectspace.paths.get_leader(check.target) is not None # let's replace the target by the path check.target = self.objectspace.paths.get_variable_path(check.target, namespace) @@ -169,9 +168,9 @@ class ConstrainteAnnotator: raise DictConsistencyError(_(f'target "{target.type}" not allow in condition "{condition.name}" in {xmlfiles}'), 10) def filter_targets(self): # pylint: disable=C0111 - for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): + for condition in self.objectspace.space.constraints.condition: namespace = condition.namespace - for idx, target in enumerate(condition.target): + for target in condition.target: if target.type == 'variable': if condition.source == target.name: raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source), 11) @@ -191,7 +190,7 @@ class ConstrainteAnnotator: def convert_xxxlist_to_variable(self): # pylint: disable=C0111 # transform *list to variable or family - for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): + for condition in self.objectspace.space.constraints.condition: new_targets = [] remove_targets = [] for target_idx, target in enumerate(condition.target): @@ -240,13 +239,13 @@ class ConstrainteAnnotator: remove_targets = [] # optional - for idx, target in enumerate(condition.target): + for index, target in enumerate(condition.target): if target.optional is True and not self.objectspace.paths.path_is_defined(target.name): - remove_targets.append(idx) + remove_targets.append(index) remove_targets = list(set(remove_targets)) remove_targets.sort(reverse=True) - for idx in remove_targets: - condition.target.pop(idx) + for index in remove_targets: + condition.target.pop(index) remove_conditions = list(set(remove_conditions)) remove_conditions.sort(reverse=True) for idx in remove_conditions: @@ -255,11 +254,11 @@ class ConstrainteAnnotator: def _get_condition_actions(self, condition_name): if condition_name.startswith('disabled_if_'): return ['disabled'] - elif condition_name.startswith('hidden_if_'): + if condition_name.startswith('hidden_if_'): return ['hidden', 'frozen', 'force_default_on_freeze'] - elif condition_name.startswith('mandatory_if_'): + if condition_name.startswith('mandatory_if_'): return ['mandatory'] - elif condition_name == 'auto_hidden_if_not_in': + if condition_name == 'auto_hidden_if_not_in': return ['auto_frozen'] def check_choice_option_condition(self): @@ -275,7 +274,6 @@ class ConstrainteAnnotator: if suffix: xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) raise DictConsistencyError(_(f'the source "{condition.source}" in condition cannot be a dynamic variable in {xmlfiles}'), 20) - src_variable = self.objectspace.paths.get_variable_obj(condition.source) valid_enum = None # FIXME only string? if condition.source in self.valid_enums and self.valid_enums[condition.source]['type'] == 'string': diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index fe4a438b..496bc012 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -6,7 +6,7 @@ from ..error import DictConsistencyError modes_level = ('basic', 'normal', 'expert') -class Mode(object): +class Mode: def __init__(self, name, level): self.name = name self.level = level @@ -40,8 +40,8 @@ class FamilyAnnotator: if hasattr(family, 'family'): space = family.family removed_families = [] - for family_name, family in space.items(): - if not hasattr(family, 'variable') or len(family.variable) == 0: + for family_name, sfamily in space.items(): + if not hasattr(sfamily, 'variable') or len(sfamily.variable) == 0: removed_families.append(family_name) for family_name in removed_families: del space[family_name] @@ -51,9 +51,9 @@ class FamilyAnnotator: return for family in self.objectspace.space.variables.values(): if hasattr(family, 'family'): - for family in family.family.values(): + for vfamily in family.family.values(): mode = modes_level[-1] - for variable in family.variable.values(): + for variable in vfamily.variable.values(): if isinstance(variable, self.objectspace.leadership): variable_mode = variable.variable[0].mode variable.variable[0].mode = None @@ -62,24 +62,28 @@ class FamilyAnnotator: variable_mode = variable.mode if variable_mode is not None and modes[mode] > modes[variable_mode]: mode = variable_mode - family.mode = mode + vfamily.mode = mode def dynamic_families(self): # pylint: disable=C0111 if not hasattr(self.objectspace.space, 'variables'): return for family in self.objectspace.space.variables.values(): if hasattr(family, 'family'): - for family in family.family.values(): - if 'dynamic' in vars(family): - namespace = self.objectspace.paths.get_variable_namespace(family.dynamic) - varpath = self.objectspace.paths.get_variable_path(family.dynamic, namespace) + for vfamily in family.family.values(): + if 'dynamic' in vars(vfamily): + namespace = self.objectspace.paths.get_variable_namespace(vfamily.dynamic) + varpath = self.objectspace.paths.get_variable_path(vfamily.dynamic, namespace) obj = self.objectspace.paths.get_variable_obj(varpath) if not obj.multi: - xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles) - raise DictConsistencyError(_(f'dynamic family "{family.name}" must be linked to multi variable in {xmlfiles}'), 16) - family.dynamic = varpath + xmlfiles = self.objectspace.display_xmlfiles(vfamily.xmlfiles) + raise DictConsistencyError(_(f'dynamic family "{vfamily.name}" must be linked to multi variable in {xmlfiles}'), 16) + vfamily.dynamic = varpath - def annotate_variable(self, variable, family_mode, path, is_follower=False): + def annotate_variable(self, + variable, + family_mode: str, + is_follower=False, + ) -> None: # if the variable is mandatory and doesn't have any value # then the variable's mode is set to 'basic' if not hasattr(variable, 'value') and variable.type == 'boolean': @@ -92,21 +96,16 @@ class FamilyAnnotator: for value in variable.value: if value.type == 'calculation': has_value = False - has_variable = False if hasattr(value, 'param'): for param in value.param: if param.type == 'variable': - has_variable = True break - #if not has_variable: - # # if one parameter is a variable, let variable choice if it's mandatory - # variable.mandatory = True if has_value: # if has value but without any calculation variable.mandatory = True if variable.mandatory is True and (not hasattr(variable, 'value') or is_follower): variable.mode = modes_level[0] - if variable.mode != None and modes[variable.mode] < modes[family_mode] and (not is_follower or variable.mode != modes_level[0]): + if variable.mode is not None and modes[variable.mode] < modes[family_mode] and (not is_follower or variable.mode != modes_level[0]): variable.mode = family_mode if variable.hidden is True: variable.frozen = True @@ -117,7 +116,6 @@ class FamilyAnnotator: if not hasattr(self.objectspace.space, 'variables'): return for variables in self.objectspace.space.variables.values(): - namespace = variables.name if hasattr(variables, 'family'): for family in variables.family.values(): family_mode = family.mode @@ -125,7 +123,6 @@ class FamilyAnnotator: for variable in family.variable.values(): if isinstance(variable, self.objectspace.leadership): - mode = modes_level[-1] for idx, follower in enumerate(variable.variable): if follower.auto_save is True: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) @@ -134,8 +131,10 @@ class FamilyAnnotator: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) raise DictConsistencyError(_(f'leader/followers "{follower.name}" could not be auto_freeze in {xmlfiles}'), 30) is_follower = idx != 0 - path = '{}.{}.{}'.format(family.path, variable.name, follower.name) - self.annotate_variable(follower, family_mode, path, is_follower) + self.annotate_variable(follower, + family_mode, + is_follower, + ) # leader's mode is minimum level if modes[variable.variable[0].mode] > modes[follower.mode]: follower.mode = variable.variable[0].mode @@ -147,6 +146,6 @@ class FamilyAnnotator: # auto_freeze's variable is set in 'basic' mode if its mode is 'normal' if variable.auto_freeze is True and variable.mode != modes_level[-1]: variable.mode = modes_level[0] - path = '{}.{}'.format(family.path, variable.name) - self.annotate_variable(variable, family_mode, path) - + self.annotate_variable(variable, + family_mode, + ) diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py index aaba954a..0c404d21 100644 --- a/src/rougail/annotator/group.py +++ b/src/rougail/annotator/group.py @@ -136,4 +136,3 @@ class GroupAnnotator: variable.name, leader_name, ) - diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py index 6a2aebbe..945d4ddd 100644 --- a/src/rougail/annotator/property.py +++ b/src/rougail/annotator/property.py @@ -18,7 +18,7 @@ class PropertyAnnotator: properties = [] for prop in PROPERTIES: if hasattr(variable, prop): - if getattr(variable, prop) == True: + if getattr(variable, prop) is True: for subprop in CONVERT_PROPERTIES.get(prop, [prop]): properties.append(subprop) setattr(variable, prop, None) diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index c5daabd4..d99fd279 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -45,7 +45,7 @@ class ServiceAnnotator: self.objectspace.space.services.name = 'services' self.objectspace.space.services.doc = 'services' families = {} - for idx, service_name in enumerate(self.objectspace.space.services.service.keys()): + for service_name in self.objectspace.space.services.service.keys(): service = self.objectspace.space.services.service[service_name] new_service = self.objectspace.service(service.xmlfiles) for elttype, values in vars(service).items(): diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index e258f60f..daa1f8ed 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -141,7 +141,7 @@ class VariableAnnotator: if not hasattr(family, 'separators'): continue if hasattr(family.separators, 'separator'): - for idx, separator in enumerate(family.separators.separator): + for separator in family.separators.separator: option = self.objectspace.paths.get_variable_obj(separator.name) if hasattr(option, 'separator'): subpath = self.objectspace.paths.get_variable_path(separator.name, @@ -151,4 +151,3 @@ class VariableAnnotator: raise DictConsistencyError(_(f'{subpath} already has a separator in {xmlfiles}'), 35) option.separator = separator.text del family.separators - diff --git a/src/rougail/config.py b/src/rougail/config.py index 948b8f62..196ad2fe 100644 --- a/src/rougail/config.py +++ b/src/rougail/config.py @@ -6,17 +6,15 @@ fichier de configuration pour rougail from os.path import join, abspath, dirname -rougailroot = '/var/rougail' -dtddir = join(dirname(abspath(__file__)), 'data') +ROUGAILROOT = '/var/rougail' +DTDDIR = join(dirname(abspath(__file__)), 'data') -Config = {'rougailroot': rougailroot, - 'patch_dir': join(rougailroot, 'patches'), - 'manifests_dir': join(rougailroot, 'manifests'), - 'templates_dir': join(rougailroot, 'templates'), - 'dtdfilename': join(dtddir, 'rougail.dtd'), - 'dtddir': dtddir, - # chemin du répertoire source des fichiers templates - 'patch_dir': '/srv/rougail/patch', +Config = {'rougailroot': ROUGAILROOT, + 'patch_dir': join(ROUGAILROOT, 'patches'), + 'manifests_dir': join(ROUGAILROOT, 'manifests'), + 'templates_dir': join(ROUGAILROOT, 'templates'), + 'dtdfilename': join(DTDDIR, 'rougail.dtd'), + 'dtddir': DTDDIR, 'variable_namespace': 'rougail', } diff --git a/src/rougail/error.py b/src/rougail/error.py index 68252f61..9148621d 100644 --- a/src/rougail/error.py +++ b/src/rougail/error.py @@ -11,7 +11,6 @@ class TemplateError(ConfigError): class TemplateDisabled(TemplateError): """Template is disabled. """ - pass class OperationError(Exception): diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 94c76231..a8645746 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -1,6 +1,3 @@ - -from typing import List - from .i18n import _ from .xmlreflector import XMLReflector from .utils import normalize_family @@ -111,7 +108,6 @@ class RougailObjSpace: if name.endswith('_'): name = name[:-1] setattr(self, elt, type(name, (RootRougailObject,), dict())) - self.Leadership = self.leadership def display_xmlfiles(self, xmlfiles: list, @@ -165,8 +161,7 @@ class RougailObjSpace: self.remove(child, variableobj, ) - self.set_path(space, - child, + self.set_path(child, namespace, document, variableobj, @@ -200,7 +195,7 @@ class RougailObjSpace: child, namespace, ) - elif Atom in obj.__mro__: + if Atom in obj.__mro__: if child.tag in vars(space): # Atom instance has to be a singleton here # we do not re-create it, we reuse it @@ -368,7 +363,6 @@ class RougailObjSpace: self.space.constraints.fill.pop(idx) def set_path(self, - space, child, namespace, document, @@ -382,7 +376,7 @@ class RougailObjSpace: self.paths.add_variable(namespace, child.attrib['name'], family_name, - document.attrib.get('dynamic') != None, + document.attrib.get('dynamic') is not None, variableobj, ) if child.attrib.get('redefine', 'False') == 'True': diff --git a/src/rougail/path.py b/src/rougail/path.py index 9e826c2c..7f36dcac 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -1,5 +1,4 @@ from .i18n import _ -from .utils import normalize_family from .error import OperationError, DictConsistencyError from .config import Config @@ -142,7 +141,7 @@ class Path: else: dico = self._get_variable(name) if not allow_source and dico['namespace'] not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']: - raise DictConsistencyError(_(f'A variable located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 41) + raise DictConsistencyError(_(f'A variable located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 41) list_path = [dico['namespace'], dico['family']] if dico['leader'] is not None: list_path.append(dico['leader']) diff --git a/src/rougail/template.py b/src/rougail/template.py index 95821697..92b34531 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -18,7 +18,7 @@ from Cheetah.NameMapper import NotFound as CheetahNotFound try: from tiramisu3 import Config from tiramisu3.error import PropertiesOptionError # pragma: no cover -except: # pragma: no cover +except ModuleNotFoundError: # pragma: no cover from tiramisu import Config from tiramisu.error import PropertiesOptionError @@ -212,8 +212,8 @@ class CreoleTemplateEngine: if eosfunc_file is not None: eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() for func in dir(eosfunc): - if not func.startswith('_'): - eos[func] = getattr(eosfunc, func) + if not func.startswith('_'): + eos[func] = getattr(eosfunc, func) self.eosfunc = eos self.rougail_variables_dict = {} @@ -238,8 +238,8 @@ class CreoleTemplateEngine: self.rougail_variables_dict[await option.option.name()] = await option.value.get() async def load_eole_variables(self, - namespace, - optiondescription): + optiondescription, + ): families = {} for family in await optiondescription.list('all'): variables = {} @@ -257,9 +257,7 @@ class CreoleTemplateEngine: ) variables[leader_name] = leader else: - subfamilies = await self.load_eole_variables(await variable.option.name(), - variable, - ) + subfamilies = await self.load_eole_variables(variable) variables[await variable.option.name()] = subfamilies else: variables[await variable.option.name()] = await variable.value.get() @@ -301,7 +299,6 @@ class CreoleTemplateEngine: source: str, true_destfilename: str, destfilename: str, - filevar: Dict, variable: Any, ): """Process a cheetah template @@ -327,7 +324,6 @@ class CreoleTemplateEngine: def instance_file(self, filevar: Dict, - service_name: str, tmp_dir: str, dest_dir: str, ) -> None: @@ -355,8 +351,8 @@ class CreoleTemplateEngine: self.process(source, filename, destfilename, - filevar, - var) + var, + ) else: copy(source, destfilename) @@ -373,13 +369,11 @@ class CreoleTemplateEngine: if namespace == Config['variable_namespace']: await self.load_eole_variables_rougail(option) else: - families = await self.load_eole_variables(namespace, - option) + families = await self.load_eole_variables(option) self.rougail_variables_dict[namespace] = families for template in listdir('.'): self.prepare_template(template, tmp_dir, patch_dir) for service_obj in await self.config.option('services').list('all'): - service_name = await service_obj.option.doc() for fills in await service_obj.list('all'): if await fills.option.name() in ['files', 'overrides']: for fill_obj in await fills.list('all'): @@ -389,7 +383,6 @@ class CreoleTemplateEngine: raise FileNotFound(_(f"File {filename} does not exist.")) if fill.get('activate', False): self.instance_file(fill, - service_name, tmp_dir, dest_dir, ) diff --git a/src/rougail/tiramisu.py b/src/rougail/tiramisu.py index f09f297d..a2b6754c 100644 --- a/src/rougail/tiramisu.py +++ b/src/rougail/tiramisu.py @@ -1,6 +1,6 @@ try: from tiramisu3 import DynOptionDescription -except: +except ModuleNotFoundError: from tiramisu import DynOptionDescription from .utils import normalize_family diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 86ebf65e..be6f161b 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -181,7 +181,6 @@ class ElementStorage: class Common: def __init__(self, - elt, storage, is_leader, path, @@ -206,7 +205,7 @@ class Common: self.attrib['properties'] += ', ' self.attrib['properties'] += prop - def get_attrib(self, attrib): + def get_attrib(self): ret_list = [] for key, value in self.attrib.items(): if value is None: @@ -261,8 +260,7 @@ class Variable(Common): is_leader, path, ): - super().__init__(elt, - storage, + super().__init__(storage, is_leader, path, ) @@ -283,7 +281,7 @@ class Variable(Common): self.attrib['opt'] = self.storage.get(self.attrib['opt']).get() else: self.parse_children() - attrib = self.get_attrib(self.attrib) + attrib = self.get_attrib() self.option_name = self.storage.get_name(self.path) self.storage.text.append(f'{self.option_name} = {self.object_type}({attrib})') self.populate_informations() @@ -304,7 +302,7 @@ class Variable(Common): self.attrib[key] = value def parse_children(self): - if not 'default' in self.attrib or self.attrib['multi']: + if 'default' not in self.attrib or self.attrib['multi']: self.attrib['default'] = [] if self.attrib['multi'] == 'submulti' and self.is_follower: self.attrib['default_multi'] = [] @@ -367,9 +365,9 @@ class Variable(Common): ): if param.type == 'string': return f'ParamValue("{param.text}")' - elif param.type == 'number': + if param.type == 'number': return f'ParamValue({param.text})' - elif param.type == 'variable': + if param.type == 'variable': value = {'option': param.text, 'notraisepropertyerror': param.notraisepropertyerror, 'todict': function in FUNC_TO_DICT, @@ -377,10 +375,10 @@ class Variable(Common): if hasattr(param, 'suffix'): value['suffix'] = param.suffix return self.build_param(value) - elif param.type == 'information': + if param.type == 'information': return f'ParamInformation("{param.text}", None)' - elif param.type == 'suffix': - return f'ParamSuffix()' + if param.type == 'suffix': + return 'ParamSuffix()' raise LoaderError(_('unknown param type {}').format(param.type)) # pragma: no cover def populate_value(self, @@ -418,8 +416,7 @@ class Family(Common): is_leader, path, ): - super().__init__(elt, - storage, + super().__init__(storage, is_leader, path, ) @@ -435,7 +432,7 @@ class Family(Common): self.parse_children() self.option_name = self.storage.get_name(self.path) object_name = self.get_object_name() - attrib = self.get_attrib(self.attrib) + ', children=[' + ', '.join([child.get() for child in self.children]) + ']' + attrib = self.get_attrib() + ', children=[' + ', '.join([child.get() for child in self.children]) + ']' self.storage.text.append(f'{self.option_name} = {object_name}({attrib})') self.populate_informations() return self.option_name @@ -461,6 +458,6 @@ class Family(Common): def get_object_name(self): if 'suffixes' in self.attrib: return 'ConvertDynOptionDescription' - elif not self.is_leader: + if not self.is_leader: return 'OptionDescription' return 'Leadership' diff --git a/src/rougail/utils.py b/src/rougail/utils.py index 5a1fc93f..0bb53d1e 100644 --- a/src/rougail/utils.py +++ b/src/rougail/utils.py @@ -2,7 +2,6 @@ utilitaires créole """ from unicodedata import normalize, combining -from .i18n import _ def normalize_family(family_name: str) -> str: diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index 77d75811..a920e337 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -3,13 +3,13 @@ from typing import List from os.path import join, isfile from os import listdir -from lxml.etree import DTD, parse, tostring, XMLSyntaxError +from lxml.etree import DTD, parse, XMLSyntaxError from .i18n import _ from .error import DictConsistencyError -class XMLReflector(object): +class XMLReflector: """Helper class for loading the Creole XML file, parsing it, validating against the Creole DTD, writing the xml result on the disk From 1e0cb96b342ca9d2de7ff1b82f3b6ff344223abb Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 2 Jan 2021 21:22:59 +0100 Subject: [PATCH 029/168] pylint annotator/constrainte.py --- src/rougail/annotator/constrainte.py | 652 ++++++++++-------- src/rougail/data/rougail.dtd | 2 +- src/rougail/template.py | 15 +- .../01fill_only_optional/00-base.xml | 21 + .../01fill_only_optional/__init__.py | 0 .../01fill_only_optional/makedict/base.json | 1 + .../01fill_only_optional/tiramisu/__init__.py | 0 .../01fill_only_optional/tiramisu/base.py | 15 + 8 files changed, 412 insertions(+), 294 deletions(-) create mode 100644 tests/dictionaries/01fill_only_optional/00-base.xml create mode 100644 tests/dictionaries/01fill_only_optional/__init__.py create mode 100644 tests/dictionaries/01fill_only_optional/makedict/base.json create mode 100644 tests/dictionaries/01fill_only_optional/tiramisu/__init__.py create mode 100644 tests/dictionaries/01fill_only_optional/tiramisu/base.py diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 17feee3c..4f246888 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -1,4 +1,7 @@ +"""Annotate constraints +""" from importlib.machinery import SourceFileLoader +from typing import List, Any from .variable import CONVERT_OPTION @@ -12,7 +15,32 @@ FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier'] +def get_actions_from_condition(condition_name: str, + ) -> List[str]: + """get action's name from a condition + """ + if condition_name.startswith('hidden_if_'): + return ['hidden', 'frozen', 'force_default_on_freeze'] + if condition_name == 'auto_frozen_if_not_in': + return ['auto_frozen'] + return [condition_name.split('_', 1)[0]] + + +def check_valid_enum_value(variable, + values, + ) -> None: + """check that values in valid_enum are valid + """ + for value in variable.value: + if value.name not in values: + msg = _(f'value "{value.name}" of variable "{variable.name}" is not in list ' + f'of all expected values ({values})') + raise DictConsistencyError(msg, 15) + + class ConstrainteAnnotator: + """Annotate constrainte + """ def __init__(self, objectspace, eosfunc_file, @@ -23,18 +51,16 @@ class ConstrainteAnnotator: eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() self.functions = dir(eosfunc) self.functions.extend(INTERNAL_FUNCTIONS) + self.valid_enums = {} self.convert_auto_freeze() - self.valid_enums = {} if hasattr(self.objectspace.space.constraints, 'check'): self.check_check() - self.check_replace_text() self.check_valid_enum() self.check_change_warning() self.convert_check() if hasattr(self.objectspace.space.constraints, 'condition'): - self.check_params_target() - self.filter_targets() + self.convert_condition_target() self.convert_xxxlist_to_variable() self.check_condition_fallback_optional() self.check_choice_option_condition() @@ -42,16 +68,19 @@ class ConstrainteAnnotator: self.convert_condition() if hasattr(self.objectspace.space.constraints, 'fill'): self.convert_fill() - self.remove_constraints() + del self.objectspace.space.constraints - def convert_auto_freeze(self): # pylint: disable=C0111 + def convert_auto_freeze(self): + """convert auto_freeze to continue + """ def _convert_auto_freeze(variable, namespace): if variable.auto_freeze: if namespace != Config['variable_namespace']: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - raise DictConsistencyError(_(f'auto_freeze is not allowed in extra "{namespace}" in {xmlfiles}'), 49) + msg = _(f'auto_freeze is not allowed in extra "{namespace}" in {xmlfiles}') + raise DictConsistencyError(msg, 49) new_condition = self.objectspace.condition(variable.xmlfiles) - new_condition.name = 'auto_hidden_if_not_in' + new_condition.name = 'auto_frozen_if_not_in' new_condition.namespace = namespace new_condition.source = FREEZE_AUTOFREEZE_VARIABLE new_param = self.objectspace.param(variable.xmlfiles) @@ -65,82 +94,176 @@ class ConstrainteAnnotator: self.objectspace.space.constraints.condition = [] self.objectspace.space.constraints.condition.append(new_condition) for variables in self.objectspace.space.variables.values(): - if hasattr(variables, 'family'): - namespace = variables.name - for family in variables.family.values(): - if hasattr(family, 'variable'): - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - for follower in variable.variable: - _convert_auto_freeze(follower, namespace) - else: - _convert_auto_freeze(variable, namespace) + if not hasattr(variables, 'family'): + continue + for family in variables.family.values(): + if not hasattr(family, 'variable'): + continue + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + for follower in variable.variable: + _convert_auto_freeze(follower, + variables.namespace, + ) + else: + _convert_auto_freeze(variable, + variables.namespace, + ) def check_check(self): + """valid and manage + """ remove_indexes = [] for check_idx, check in enumerate(self.objectspace.space.constraints.check): if not check.name in self.functions: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'cannot find check function "{check.name}" in {xmlfiles}'), 1) - if hasattr(check, 'param'): - param_option_indexes = [] - for idx, param in enumerate(check.param): - if param.type == 'variable' and not self.objectspace.paths.path_is_defined(param.text): - if param.optional is True: - param_option_indexes.append(idx) - else: + msg = _(f'cannot find check function "{check.name}" in {xmlfiles}') + raise DictConsistencyError(msg, 1) + if not hasattr(check, 'param'): + continue + param_option_indexes = [] + for idx, param in enumerate(check.param): + if param.type == 'variable': + if not self.objectspace.paths.path_is_defined(param.text): + if not param.optional: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'cannot find check param "{param.text}" in {xmlfiles}'), 2) - if param.type != 'variable': - param.notraisepropertyerror = None - param_option_indexes = list(set(param_option_indexes)) - param_option_indexes.sort(reverse=True) - for idx in param_option_indexes: - check.param.pop(idx) - if check.param == []: - remove_indexes.append(check_idx) + msg = _(f'cannot find check param "{param.text}" in {xmlfiles}') + raise DictConsistencyError(msg, 2) + param_option_indexes.append(idx) + else: + # let's replace params by the path + param.text = self.objectspace.paths.get_variable_path(param.text, + check.namespace, + ) + param_option_indexes.sort(reverse=True) + for idx in param_option_indexes: + check.param.pop(idx) + if check.param == []: + remove_indexes.append(check_idx) + continue + # let's replace the target by the path + check.target = self.objectspace.paths.get_variable_path(check.target, + check.namespace, + ) + check.is_in_leadership = self.objectspace.paths.get_leader(check.target) is not None remove_indexes.sort(reverse=True) for idx in remove_indexes: del self.objectspace.space.constraints.check[idx] - def check_replace_text(self): - for check in self.objectspace.space.constraints.check: - namespace = check.namespace - if hasattr(check, 'param'): - for param in check.param: - if param.type == 'variable': - param.text = self.objectspace.paths.get_variable_path(param.text, namespace) - check.is_in_leadership = self.objectspace.paths.get_leader(check.target) is not None - # let's replace the target by the path - check.target = self.objectspace.paths.get_variable_path(check.target, namespace) - def check_valid_enum(self): + """verify valid_enum + """ remove_indexes = [] for idx, check in enumerate(self.objectspace.space.constraints.check): if check.name == 'valid_enum': if check.target in self.valid_enums: - old_xmlfiles = self.objectspace.display_xmlfiles(self.valid_enums[check.target]['xmlfiles']) + check_xmlfiles = self.valid_enums[check.target]['xmlfiles'] + old_xmlfiles = self.objectspace.display_xmlfiles(check_xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?'), 3) + msg = _(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} ' + f'for "{check.target}", did you forget remove_check?') + raise DictConsistencyError(msg, 3) if not hasattr(check, 'param'): xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable "{check.target}" in {xmlfiles}'), 4) + msg = _(f'param is mandatory for a valid_enum of variable "{check.target}" ' + f'in {xmlfiles}') + raise DictConsistencyError(msg, 4) variable = self.objectspace.paths.get_variable_obj(check.target) - self._set_valid_enum(variable, - check, - ) + variable_type = variable.type + values = self._set_valid_enum(variable, + check, + ) + if values: + if hasattr(variable, 'value'): + # check value + check_valid_enum_value(variable, values) + else: + # no value, set the first choice has default value + new_value = self.objectspace.value(check.xmlfiles) + new_value.name = values[0] + new_value.type = variable_type + variable.value = [new_value] remove_indexes.append(idx) remove_indexes.sort(reverse=True) for idx in remove_indexes: del self.objectspace.space.constraints.check[idx] - def check_change_warning(self): - #convert level to "warnings_only" - for check in self.objectspace.space.constraints.check: - if check.level == 'warning': - check.warnings_only = True + def _set_valid_enum(self, + variable, + check, + ) -> List[Any]: + # value for choice's variable is mandatory + variable.mandatory = True + # build choice + variable.choice = [] + variable_type = variable.type + variable.type = 'choice' + + has_variable = False + values = [] + for param in check.param: + if has_variable: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + msg = _(f'only one "variable" parameter is allowed for valid_enum ' + f'of variable "{variable.name}" in {xmlfiles}') + raise DictConsistencyError(msg, 5) + param_type = variable_type + if param.type == 'variable': + has_variable = True + if param.optional is True: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + msg = _(f'optional parameter in valid_enum for variable "{variable.name}" ' + f'is not allowed in {xmlfiles}') + raise DictConsistencyError(msg, 14) + param_variable = self.objectspace.paths.get_variable_obj(param.text) + if not param_variable.multi: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + msg = _(f'only multi "variable" parameter is allowed for valid_enum ' + f'of variable "{variable.name}" in {xmlfiles}') + raise DictConsistencyError(msg, 6) + param_type = 'calculation' + value = param.text else: - check.warnings_only = False + if 'type' in vars(param) and variable_type != param.type: + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + msg = _(f'parameter in valid_enum has incompatible type "{param.type}" ' + f'with type of the variable "{variable.name}" ("{variable_type}") ' + f'in {xmlfiles}') + raise DictConsistencyError(msg, 7) + if hasattr(param, 'text'): + try: + value = CONVERT_OPTION[variable_type].get('func', str)(param.text) + except ValueError as err: + msg = _(f'unable to change type of a valid_enum entry "{param.text}" ' + f'is not a valid "{variable_type}" for "{variable.name}"') + raise DictConsistencyError(msg, 13) from err + else: + if param.type == 'number': + xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) + msg = _('param type is number, so value is mandatory for valid_enum ' + f'of variable "{variable.name}" in {xmlfiles}') + raise DictConsistencyError(msg, 8) + value = None + values.append(value) + choice = self.objectspace.choice(variable.xmlfiles) + choice.name = value + choice.type = param_type + variable.choice.append(choice) + + if has_variable: + return None + + self.valid_enums[check.target] = {'type': variable_type, + 'values': values, + 'xmlfiles': check.xmlfiles, + } + return values + + def check_change_warning(self): + """convert level to "warnings_only" + """ + for check in self.objectspace.space.constraints.check: + check.warnings_only = check.level == 'warning' check.level = None def _get_family_variables_from_target(self, @@ -157,39 +280,49 @@ class ConstrainteAnnotator: variable = self.objectspace.paths.get_family_obj(target.name) return variable, list(variable.variable.values()) - def check_params_target(self): + def convert_condition_target(self): + """verify and manage target in condition + """ for condition in self.objectspace.space.constraints.condition: if not hasattr(condition, 'target'): xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) - raise DictConsistencyError(_(f'target is mandatory in a condition for source "{condition.source}" in {xmlfiles}'), 9) - for target in condition.target: - if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']: - xmlfiles = self.objectspace.display_xmlfiles(target.xmlfiles) - raise DictConsistencyError(_(f'target "{target.type}" not allow in condition "{condition.name}" in {xmlfiles}'), 10) - - def filter_targets(self): # pylint: disable=C0111 - for condition in self.objectspace.space.constraints.condition: - namespace = condition.namespace + msg = _(f'target is mandatory in a condition for source "{condition.source}" ' + f'in {xmlfiles}') + raise DictConsistencyError(msg, 9) for target in condition.target: if target.type == 'variable': if condition.source == target.name: - raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source), 11) + msg = f'target name and source name must be different: {condition.source}' + raise DictConsistencyError(_(msg), 11) + target_names = '.'.join([normalize_family(name) \ + for name in target.name.split('.')]) try: - target_names = [normalize_family(name) for name in target.name.split('.')] - target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace) + target.name = self.objectspace.paths.get_variable_path(target_names, + condition.namespace, + ) except DictConsistencyError as err: # for optional variable if not target.optional or err.errno != 42: raise err elif target.type == 'family': + target_names = '.'.join([normalize_family(name) \ + for name in target.name.split('.')]) try: - target_names = [normalize_family(name) for name in target.name.split('.')] - target.name = self.objectspace.paths.get_family_path('.'.join(target_names), namespace) + target.name = self.objectspace.paths.get_family_path(target_names, + condition.namespace, + ) except KeyError: - raise DictConsistencyError(_('cannot found family {}').format(target.name), 12) + raise DictConsistencyError(_(f'cannot found family {target.name}'), 12) + elif target.type.endswith('list') and \ + condition.name not in ['disabled_if_in', 'disabled_if_not_in']: + xmlfiles = self.objectspace.display_xmlfiles(target.xmlfiles) + msg = _(f'target "{target.type}" not allow in condition "{condition.name}" ' + f'in {xmlfiles}') + raise DictConsistencyError(msg, 10) - def convert_xxxlist_to_variable(self): # pylint: disable=C0111 - # transform *list to variable or family + def convert_xxxlist_to_variable(self): + """transform *list to variable or family + """ for condition in self.objectspace.space.constraints.condition: new_targets = [] remove_targets = [] @@ -214,33 +347,28 @@ class ConstrainteAnnotator: condition.target.extend(new_targets) def check_condition_fallback_optional(self): - # a condition with a fallback **and** the source variable doesn't exist + """a condition with a fallback **and** the source variable doesn't exist + """ remove_conditions = [] for idx, condition in enumerate(self.objectspace.space.constraints.condition): # fallback - if condition.fallback is True and not self.objectspace.paths.path_is_defined(condition.source): + if condition.fallback is True and \ + not self.objectspace.paths.path_is_defined(condition.source): apply_action = False if condition.name in ['disabled_if_in', 'mandatory_if_in', 'hidden_if_in']: apply_action = not condition.force_condition_on_fallback else: apply_action = condition.force_inverse_condition_on_fallback - if apply_action: - actions = self._get_condition_actions(condition.name) - for target in condition.target: - leader_or_variable, variables = self._get_family_variables_from_target(target) - for action_idx, action in enumerate(actions): - if action_idx == 0: - setattr(leader_or_variable, action, True) - else: - for variable in variables: - setattr(variable, action, True) remove_conditions.append(idx) + if apply_action: + self.force_actions_to_variable(condition) continue remove_targets = [] # optional for index, target in enumerate(condition.target): - if target.optional is True and not self.objectspace.paths.path_is_defined(target.name): + if target.optional is True and \ + not self.objectspace.paths.path_is_defined(target.name): remove_targets.append(index) remove_targets = list(set(remove_targets)) remove_targets.sort(reverse=True) @@ -251,18 +379,24 @@ class ConstrainteAnnotator: for idx in remove_conditions: self.objectspace.space.constraints.condition.pop(idx) - def _get_condition_actions(self, condition_name): - if condition_name.startswith('disabled_if_'): - return ['disabled'] - if condition_name.startswith('hidden_if_'): - return ['hidden', 'frozen', 'force_default_on_freeze'] - if condition_name.startswith('mandatory_if_'): - return ['mandatory'] - if condition_name == 'auto_hidden_if_not_in': - return ['auto_frozen'] + def force_actions_to_variable(self, + condition: 'self.objectspace.condition', + ) -> None: + """force property to a variable + for example disabled_if_not_in => variable.disabled = True + """ + actions = 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] + setattr(leader_or_var, main_action, True) + for action in actions[1:]: + for variable in variables: + setattr(variable, action, True) def check_choice_option_condition(self): - # remove condition for ChoiceOption that don't have param + """remove condition for ChoiceOption that don't have param + """ remove_conditions = [] for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition): namespace = condition.namespace @@ -273,54 +407,48 @@ class ConstrainteAnnotator: ) if suffix: xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) - raise DictConsistencyError(_(f'the source "{condition.source}" in condition cannot be a dynamic variable in {xmlfiles}'), 20) - valid_enum = None + msg = _(f'the source "{condition.source}" in condition cannot be a dynamic ' + f'variable in {xmlfiles}') + raise DictConsistencyError(msg, 20) # FIXME only string? - if condition.source in self.valid_enums and self.valid_enums[condition.source]['type'] == 'string': + if condition.source in self.valid_enums and \ + self.valid_enums[condition.source]['type'] == 'string': valid_enum = self.valid_enums[condition.source]['values'] - if valid_enum is not None: - remove_param = [] - for param_idx, param in enumerate(condition.param): - if param.text not in valid_enum: - remove_param.append(param_idx) + remove_param = [param_idx for param_idx, param in enumerate(condition.param) \ + if param.text not in valid_enum] remove_param.sort(reverse=True) for idx in remove_param: del condition.param[idx] - if condition.param == []: - for target in condition.target: - leader_or_variable, variables = self._get_family_variables_from_target(target) - if condition.name == 'disabled_if_not_in': - leader_or_variable.disabled = True - elif condition.name == 'hidden_if_not_in': - leader_or_variable.hidden = True - for variable in variables: - variable.frozen = True - variable.force_default_on_freeze = True - elif condition.name == 'mandatory_if_not_in': - leader_or_variable.mandatory = True + if not condition.param and condition.name.endswith('_if_not_in'): + self.force_actions_to_variable(condition) remove_conditions.append(condition_idx) - remove_conditions = list(set(remove_conditions)) remove_conditions.sort(reverse=True) for idx in remove_conditions: self.objectspace.space.constraints.condition.pop(idx) def remove_condition_with_empty_target(self): + """remove condition with empty target + """ # optional target are remove, condition could be empty - remove_conditions = [condition_idx for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition) if not condition.target] + remove_conditions = [condition_idx for condition_idx, condition in \ + enumerate(self.objectspace.space.constraints.condition) \ + if not condition.target] remove_conditions.sort(reverse=True) for idx in remove_conditions: self.objectspace.space.constraints.condition.pop(idx) def convert_condition(self): + """valid and manage + """ for condition in self.objectspace.space.constraints.condition: - inverse = condition.name.endswith('_if_not_in') - actions = self._get_condition_actions(condition.name) + actions = get_actions_from_condition(condition.name) for param in condition.param: text = getattr(param, 'text', None) for target in condition.target: leader_or_variable, variables = self._get_family_variables_from_target(target) # if option is already disable, do not apply disable_if_in - # check only the first action (example of multiple actions: 'hidden', 'frozen', 'force_default_on_freeze') + # check only the first action (example of multiple actions: + # 'hidden', 'frozen', 'force_default_on_freeze') main_action = actions[0] if getattr(leader_or_variable, main_action, False) is True: continue @@ -328,201 +456,155 @@ class ConstrainteAnnotator: (leader_or_variable.auto_save or leader_or_variable.auto_freeze) and \ 'force_default_on_freeze' in actions: xmlfiles = self.objectspace.display_xmlfiles(leader_or_variable.xmlfiles) - raise DictConsistencyError(_(f'cannot have auto_freeze or auto_store with the hidden_if_in or hidden_if_not_in variable "{leader_or_variable.name}" in {xmlfiles}'), 51) - for idx, action in enumerate(actions): - prop = self.objectspace.property_(leader_or_variable.xmlfiles) - prop.type = 'calculation' - prop.inverse = inverse - prop.source = condition.source - prop.expected = text - prop.name = action - if idx == 0: - # main action is for the variable or family - if not hasattr(leader_or_variable, 'property'): - leader_or_variable.property = [] - leader_or_variable.property.append(prop) - else: - # other actions are set to the variable or children of family - for variable in variables: - if not hasattr(variable, 'property'): - variable.property = [] - variable.property.append(prop) - del self.objectspace.space.constraints.condition + msg = _(f'cannot have auto_freeze or auto_store with the hidden_if_in or ' + f'hidden_if_not_in variable "{leader_or_variable.name}" ' + f'in {xmlfiles}') + raise DictConsistencyError(msg, 51) + self.build_property(leader_or_variable, + text, + condition, + main_action, + ) + for action in actions[1:]: + # other actions are set to the variable or children of family + for variable in variables: + self.build_property(variable, + text, + condition, + action, + ) - def _set_valid_enum(self, - variable, - check, - ): - type_ = variable.type - target = check.target - # value for choice's variable is mandatory - variable.mandatory = True - # build choice - variable.choice = [] - variable.type = 'choice' + def build_property(self, + obj, + text: Any, + condition: 'self.objectspace.condition', + action: str, + ) -> 'self.objectspace.property_': + """build property_ for a condition + """ + prop = self.objectspace.property_(obj.xmlfiles) + prop.type = 'calculation' + prop.inverse = condition.name.endswith('_if_not_in') + prop.source = condition.source + prop.expected = text + prop.name = action + if not hasattr(obj, 'property'): + obj.property = [] + obj.property.append(prop) - has_variable = False - values = [] - for param in check.param: - if has_variable: - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable "{variable.name}" in {xmlfiles}'), 5) - param_type = type_ - if param.type == 'variable': - has_variable = True - param_variable = self.objectspace.paths.get_variable_obj(param.text) - if param.optional is True: - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'optional parameter in valid_enum for variable "{variable.name}" is not allowed in {xmlfiles}'), 14) - if not param_variable.multi: - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable "{variable.name}" in {xmlfiles}'), 6) - param_type = 'calculation' - value = param.text - else: - if 'type' in vars(param) and type_ != param.type: - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'parameter in valid_enum has incompatible type "{param.type}" with type of the variable "{variable.name}" ("{type_}") in {xmlfiles}'), 7) - if hasattr(param, 'text'): - try: - value = CONVERT_OPTION[type_].get('func', str)(param.text) - except: - raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{param.text}" is not a valid "{type_}" for "{variable.name}"'), 13) - else: - if param.type == 'number': - xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles) - raise DictConsistencyError(_(f'param type is number, so value is mandatory for valid_enum of variable "{variable.name}" in {xmlfiles}'), 8) - value = None - values.append(value) - choice = self.objectspace.choice(variable.xmlfiles) - choice.name = value - choice.type = param_type - variable.choice.append(choice) - if has_variable: - return - - # FIXME really? - if param_type != 'calculation': - self.valid_enums[target] = {'type': type_, - 'values': values, - 'xmlfiles': check.xmlfiles, - } - # check value or set first choice value has default value - if hasattr(variable, 'value'): - for value in variable.value: - if value.name not in values: - raise DictConsistencyError(_(f'value "{value.name}" of variable "{variable.name}" is not in list of all expected values ({values})'), 15) - else: - new_value = self.objectspace.value(check.xmlfiles) - new_value.name = values[0] - new_value.type = type_ - variable.value = [new_value] - - def convert_check(self): + def convert_check(self) -> None: + """valid and manage + """ for check in self.objectspace.space.constraints.check: variable = self.objectspace.paths.get_variable_obj(check.target) - name = check.name - if name == 'valid_entier': + if check.name == 'valid_entier': if not hasattr(check, 'param'): - raise DictConsistencyError(_('{} must have, at least, 1 param').format(name), 17) + msg = _(f'{check.name} must have, at least, 1 param') + raise DictConsistencyError(msg, 17) for param in check.param: if param.type != 'number': xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'param in "valid_entier" must be an "integer", not "{param.type}" in {xmlfiles}'), 18) + msg = _(f'param in "valid_entier" must be an "integer", not "{param.type}"' + f' in {xmlfiles}') + raise DictConsistencyError(msg, 18) if param.name == 'mini': variable.min_number = int(param.text) elif param.name == 'maxi': variable.max_number = int(param.text) else: xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) - raise DictConsistencyError(_(f'unknown parameter "{param.name}" in check "valid_entier" for variable "{check.target}" in {xmlfiles}'), 19) + msg = _(f'unknown parameter "{param.name}" in check "valid_entier" ' + f'for variable "{check.target}" in {xmlfiles}') + raise DictConsistencyError(msg, 19) else: - check_ = self.objectspace.check(variable.xmlfiles) - check_.name = name - check_.warnings_only = check.warnings_only - if hasattr(check, 'param'): - check_.param = check.param if not hasattr(variable, 'check'): variable.check = [] - variable.check.append(check_) - del self.objectspace.space.constraints.check + variable.check.append(check) - def convert_fill(self): # pylint: disable=C0111,R0912 - # sort fill/auto by index - fills = {fill.index: fill for idx, fill in enumerate(self.objectspace.space.constraints.fill)} - indexes = list(fills.keys()) - indexes.sort() + def convert_fill(self) -> None: + """valid and manage + """ targets = [] - for idx in indexes: - fill = fills[idx] + for fill in self.objectspace.space.constraints.fill: # test if it's redefined calculation if fill.target in targets: xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}'), 24) + msg = _(f'A fill already exists for the target of "{fill.target}" created ' + f'in {xmlfiles}') + raise DictConsistencyError(msg, 24) targets.append(fill.target) - # + + # test if the function exists if fill.name not in self.functions: xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'cannot find fill function "{fill.name}" in {xmlfiles}'), 25) + msg = _(f'cannot find fill function "{fill.name}" in {xmlfiles}') + raise DictConsistencyError(msg, 25) - namespace = fill.namespace # let's replace the target by the path fill.target, suffix = self.objectspace.paths.get_variable_path(fill.target, - namespace, + fill.namespace, with_suffix=True, ) if suffix is not None: xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only for the suffix "{suffix}" in {xmlfiles}'), 26) + msg = _(f'Cannot add fill function to "{fill.target}" only ' + f'for the suffix "{suffix}" in {xmlfiles}') + raise DictConsistencyError(msg, 26) + + # get the target variable variable = self.objectspace.paths.get_variable_obj(fill.target) - value = self.objectspace.value(variable.xmlfiles) + + # create an object value + value = self.objectspace.value(fill.xmlfiles) value.type = 'calculation' value.name = fill.name - if hasattr(fill, 'param'): - param_to_delete = [] - for fill_idx, param in enumerate(fill.param): - if param.type not in ['suffix', 'string'] and not hasattr(param, 'text'): - xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target} in {xmlfiles}"), 27) - if param.type == 'suffix': - if hasattr(param, 'text'): - xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'"{param.type}" variables must not have a value in order to calculate "{fill.target}" in {xmlfiles}'), 28) - if not self.objectspace.paths.variable_is_dynamic(fill.target): - xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) - raise DictConsistencyError(_(f'Cannot set suffix target to the none dynamic variable "{fill.target}" in {xmlfiles}'), 53) - if param.type == 'string': - if not hasattr(param, 'text'): - param.text = None - if param.type == 'variable': - try: - param.text, suffix = self.objectspace.paths.get_variable_path(param.text, - namespace, - with_suffix=True, - ) - if suffix: - param.suffix = suffix - except DictConsistencyError as err: - if err.errno != 42: - raise err - if param.optional is False: - raise err - param_to_delete.append(fill_idx) - continue - else: - param.notraisepropertyerror = None - param_to_delete.sort(reverse=True) - for param_idx in param_to_delete: - fill.param.pop(param_idx) - value.param = fill.param variable.value = [value] - del self.objectspace.space.constraints.fill - def remove_constraints(self): - if hasattr(self.objectspace.space.constraints, 'index'): - del self.objectspace.space.constraints.index - del self.objectspace.space.constraints.namespace - del self.objectspace.space.constraints.xmlfiles - if vars(self.objectspace.space.constraints): # pragma: no cover - raise Exception('constraints again?') - del self.objectspace.space.constraints + # manage params + if not hasattr(fill, 'param'): + continue + self.convert_fill_param(fill) + if fill.param: + value.param = fill.param + + def convert_fill_param(self, + fill: "self.objectspace.fill", + ) -> None: + """ valid and convert fill's param + """ + param_to_delete = [] + for param_idx, param in enumerate(fill.param): + if param.type == 'string' and not hasattr(param, 'text'): + param.text = None + if param.type == 'suffix': + if hasattr(param, 'text'): + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + msg = _(f'"{param.type}" variables must not have a value in order ' + f'to calculate "{fill.target}" in {xmlfiles}') + raise DictConsistencyError(msg, 28) + if not self.objectspace.paths.variable_is_dynamic(fill.target): + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + msg = _('Cannot set suffix target to the none dynamic variable ' + f'"{fill.target}" in {xmlfiles}') + raise DictConsistencyError(msg, 53) + elif not hasattr(param, 'text'): + xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) + msg = _(f'All "{param.type}" variables must have a value in order ' + f'to calculate "{fill.target}" in {xmlfiles}') + raise DictConsistencyError(msg, 27) + if param.type == 'variable': + try: + text, suffix = self.objectspace.paths.get_variable_path(param.text, + fill.namespace, + with_suffix=True, + ) + param.text = text + if suffix: + param.suffix = suffix + except DictConsistencyError as err: + if err.errno != 42 or not param.optional: + raise err + param_to_delete.append(param_idx) + param_to_delete.sort(reverse=True) + for param_idx in param_to_delete: + fill.param.pop(param_idx) diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index e41596ee..9985dc55 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -125,7 +125,7 @@ - + diff --git a/src/rougail/template.py b/src/rougail/template.py index 92b34531..67baebcf 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -89,12 +89,7 @@ class CheetahTemplate(ChtTemplate): return None -class CreoleValue: - def __str__(self): - return str(self._value) - - -class CreoleLeaderIndex(CreoleValue): +class CreoleLeaderIndex: def __init__(self, value, follower, @@ -112,6 +107,9 @@ class CreoleLeaderIndex(CreoleValue): raise AttributeError() return value + def __str__(self): + return str(self._value) + def __lt__(self, value): return self._value.__lt__(value) @@ -137,7 +135,7 @@ class CreoleLeaderIndex(CreoleValue): return value + self._value -class CreoleLeader(CreoleValue): +class CreoleLeader: def __init__(self, value, ) -> None: @@ -187,7 +185,8 @@ class CreoleExtra: self.suboption = suboption def __getattr__(self, - key: str) -> Any: + key: str, + ) -> Any: return self.suboption[key] def __iter__(self): diff --git a/tests/dictionaries/01fill_only_optional/00-base.xml b/tests/dictionaries/01fill_only_optional/00-base.xml new file mode 100644 index 00000000..531bcdec --- /dev/null +++ b/tests/dictionaries/01fill_only_optional/00-base.xml @@ -0,0 +1,21 @@ + + + + + + + non + + + + + + + mode_conteneur_actif4 + + + + diff --git a/tests/dictionaries/01fill_only_optional/__init__.py b/tests/dictionaries/01fill_only_optional/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/01fill_only_optional/makedict/base.json b/tests/dictionaries/01fill_only_optional/makedict/base.json new file mode 100644 index 00000000..86ba9458 --- /dev/null +++ b/tests/dictionaries/01fill_only_optional/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"} diff --git a/tests/dictionaries/01fill_only_optional/tiramisu/__init__.py b/tests/dictionaries/01fill_only_optional/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/01fill_only_optional/tiramisu/base.py b/tests/dictionaries/01fill_only_optional/tiramisu/base.py new file mode 100644 index 00000000..982e80ee --- /dev/null +++ b/tests/dictionaries/01fill_only_optional/tiramisu/base.py @@ -0,0 +1,15 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((), kwargs={})), values=('oui', 'non')) +option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) From 8a078922761c42548776daca7db07214920e07c7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 6 Jan 2021 21:50:53 +0100 Subject: [PATCH 030/168] pylint --- src/rougail/annotator/group.py | 53 +++++++++++-------- src/rougail/annotator/property.py | 86 +++++++++++++++++++------------ 2 files changed, 85 insertions(+), 54 deletions(-) diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py index 0c404d21..892d7554 100644 --- a/src/rougail/annotator/group.py +++ b/src/rougail/annotator/group.py @@ -1,3 +1,5 @@ +"""Annotate group +""" from typing import List from ..i18n import _ @@ -5,15 +7,20 @@ from ..error import DictConsistencyError class GroupAnnotator: + """Annotate group + """ def __init__(self, objectspace, ): self.objectspace = objectspace - if not hasattr(self.objectspace.space, 'constraints') or not hasattr(self.objectspace.space.constraints, 'group'): + if not hasattr(self.objectspace.space, 'constraints') or \ + not hasattr(self.objectspace.space.constraints, 'group'): return self.convert_groups() def convert_groups(self): # pylint: disable=C0111 + """convert groups + """ for group in self.objectspace.space.constraints.group: leader_fullname = group.leader leader_family_name = self.objectspace.paths.get_variable_family_name(leader_fullname) @@ -23,18 +30,20 @@ class GroupAnnotator: leader_fullname = '.'.join([namespace, leader_family_name, leader_fullname]) follower_names = list(group.follower.keys()) has_a_leader = False - ori_leader_family = self.objectspace.paths.get_family_obj(leader_fullname.rsplit('.', 1)[0]) + leader_family = leader_fullname.rsplit('.', 1)[0] + ori_leader_family = self.objectspace.paths.get_family_obj(leader_family) for variable in list(ori_leader_family.variable.values()): if has_a_leader: # it's a follower - self.manage_follower(namespace, - leader_family_name, + self.manage_follower(leader_family_name, variable, leadership_name, follower_names, - leader_space, - leader_is_hidden, ) + if leader_is_hidden: + variable.frozen = True + variable.force_default_on_freeze = True + leader_space.variable.append(variable) ori_leader_family.variable.pop(variable.name) if follower_names == []: # no more follower @@ -56,7 +65,6 @@ class GroupAnnotator: leader_family_name, leadership_name, leader_name, - namespace, variable, group, leader_fullname, @@ -65,7 +73,9 @@ class GroupAnnotator: else: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) joined = '", "'.join(follower_names) - raise DictConsistencyError(_(f'when parsing leadership, we espect to find those followers "{joined}" in {xmlfiles}'), 31) + msg = _(f'when parsing leadership, we espect to find those followers "{joined}" ' + f'in {xmlfiles}') + raise DictConsistencyError(msg, 31) del self.objectspace.space.constraints.group def manage_leader(self, @@ -73,15 +83,16 @@ class GroupAnnotator: leader_family_name: str, leadership_name: str, leader_name: str, - namespace: str, variable: 'Variable', group: 'Group', leader_fullname: str, ) -> None: - # manage leader's variable + """manage leader's variable + """ if variable.multi is not True: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - raise DictConsistencyError(_(f'the variable "{variable.name}" in a group must be multi in {xmlfiles}'), 32) + msg = _(f'the variable "{variable.name}" in a group must be multi in {xmlfiles}') + raise DictConsistencyError(msg, 32) leader_space.variable = [] leader_space.name = leadership_name leader_space.hidden = variable.hidden @@ -98,6 +109,7 @@ class GroupAnnotator: leader_space.doc = variable.description else: leader_space.doc = variable.name + namespace = variable.namespace leadership_path = namespace + '.' + leader_family_name + '.' + leadership_name self.objectspace.paths.add_family(namespace, leadership_path, @@ -115,23 +127,20 @@ class GroupAnnotator: return leader_is_hidden def manage_follower(self, - namespace: str, leader_family_name: str, variable: 'Variable', leader_name: str, follower_names: List[str], - leader_space: 'Leadership', - leader_is_hidden: bool, ) -> None: - if variable.name != follower_names[0]: + """manage follower + """ + follower_name = follower_names.pop(0) + if variable.name != follower_name: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - raise DictConsistencyError(_(f'when parsing leadership, we espect to find the follower "{follower_names[0]}" but we found "{variable.name}" in {xmlfiles}'), 33) - follower_names.remove(variable.name) - if leader_is_hidden: - variable.frozen = True - variable.force_default_on_freeze = True - leader_space.variable.append(variable) # pylint: disable=E1101 - self.objectspace.paths.set_leader(namespace, + msg = _('when parsing leadership, we espect to find the follower ' + f'"{follower_name}" but we found "{variable.name}" in {xmlfiles}') + raise DictConsistencyError(msg, 33) + self.objectspace.paths.set_leader(variable.namespace, leader_family_name, variable.name, leader_name, diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py index 945d4ddd..88b1e61b 100644 --- a/src/rougail/annotator/property.py +++ b/src/rougail/annotator/property.py @@ -1,20 +1,31 @@ +"""Annotate properties +""" from ..i18n import _ from ..error import DictConsistencyError PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze', 'force_store_value', 'disabled', 'mandatory') -CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force_store_value', 'auto_freeze']} +CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], + 'auto_freeze': ['force_store_value', 'auto_freeze'], + } class PropertyAnnotator: + """Annotate properties + """ def __init__(self, objectspace): self.objectspace = objectspace - self.convert_annotator() + if hasattr(self.objectspace.space, 'services'): + self.convert_services() + if hasattr(self.objectspace.space, 'variables'): + self.convert_variables() def convert_property(self, variable, - ): + ) -> None: + """convert properties + """ properties = [] for prop in PROPERTIES: if hasattr(variable, prop): @@ -27,35 +38,46 @@ class PropertyAnnotator: variable.mode = None if 'force_store_value' in properties and 'force_default_on_freeze' in properties: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - raise DictConsistencyError(_(f'cannot have auto_freeze or auto_store with the hidden variable "{variable.name}" in {xmlfiles}'), 50) + msg = _('cannot have auto_freeze or auto_store with the hidden ' + f'variable "{variable.name}" in {xmlfiles}') + raise DictConsistencyError(msg, 50) if properties: variable.properties = frozenset(properties) - def convert_annotator(self): # pylint: disable=C0111 - if hasattr(self.objectspace.space, 'services'): - self.convert_property(self.objectspace.space.services) - for services in self.objectspace.space.services.service.values(): - self.convert_property(services) - for service in vars(services).values(): - if isinstance(service, self.objectspace.family): - self.convert_property(service) - if hasattr(service, 'family'): - self.convert_property(service) - for family in service.family: - self.convert_property(family) - if hasattr(family, 'variable'): - for variable in family.variable: - self.convert_property(variable) - if hasattr(self.objectspace.space, 'variables'): - for variables in self.objectspace.space.variables.values(): - if hasattr(variables, 'family'): - for family in variables.family.values(): - self.convert_property(family) - if hasattr(family, 'variable'): - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - self.convert_property(variable) - for follower in variable.variable: - self.convert_property(follower) - else: - self.convert_property(variable) + def convert_services(self) -> None: + """convert services + """ + self.convert_property(self.objectspace.space.services) + for services in self.objectspace.space.services.service.values(): + self.convert_property(services) + for service in vars(services).values(): + if not isinstance(service, self.objectspace.family): + continue + self.convert_property(service) + if not hasattr(service, 'family'): + continue + self.convert_property(service) + for family in service.family: + self.convert_property(family) + if not hasattr(family, 'variable'): + continue + for variable in family.variable: + self.convert_property(variable) + + def convert_variables(self) -> None: + """convert variables + """ + for variables in self.objectspace.space.variables.values(): + if not hasattr(variables, 'family'): + continue + for family in variables.family.values(): + self.convert_property(family) + if not hasattr(family, 'variable'): + continue + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + self.convert_property(variable) + for follower in variable.variable: + self.convert_property(follower) + else: + self.convert_property(variable) From 1a77416e6d75778a6d991303a4aff8a7516fcf3b Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 6 Jan 2021 22:20:33 +0100 Subject: [PATCH 031/168] support auto_freeze with auto --- src/rougail/annotator/constrainte.py | 6 +++--- src/rougail/annotator/family.py | 4 +++- .../00-base.xml | 0 .../__init__.py | 0 .../01auto_autofreeze/makedict/base.json | 1 + .../01auto_autofreeze/tiramisu/base.py | 15 +++++++++++++++ tests/dictionaries/80auto_autofreeze/errno_50 | 0 tests/test_1_flattener.py | 4 ++-- 8 files changed, 24 insertions(+), 6 deletions(-) rename tests/dictionaries/{80auto_autofreeze => 01auto_autofreeze}/00-base.xml (100%) rename tests/dictionaries/{80auto_autofreeze => 01auto_autofreeze}/__init__.py (100%) create mode 100644 tests/dictionaries/01auto_autofreeze/makedict/base.json create mode 100644 tests/dictionaries/01auto_autofreeze/tiramisu/base.py delete mode 100644 tests/dictionaries/80auto_autofreeze/errno_50 diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 4f246888..c047ab44 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -15,8 +15,7 @@ FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier'] -def get_actions_from_condition(condition_name: str, - ) -> List[str]: +def get_actions_from_condition(condition_name: str) -> List[str]: """get action's name from a condition """ if condition_name.startswith('hidden_if_'): @@ -71,7 +70,8 @@ class ConstrainteAnnotator: del self.objectspace.space.constraints def convert_auto_freeze(self): - """convert auto_freeze to continue + """convert auto_freeze + only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen """ def _convert_auto_freeze(variable, namespace): if variable.auto_freeze: diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 496bc012..8a494647 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -109,7 +109,9 @@ class FamilyAnnotator: variable.mode = family_mode if variable.hidden is True: variable.frozen = True - if not variable.auto_save is True and 'force_default_on_freeze' not in vars(variable): + if not variable.auto_save is True and \ + not variable.auto_freeze and \ + 'force_default_on_freeze' not in vars(variable): variable.force_default_on_freeze = True def change_variable_mode(self): # pylint: disable=C0111 diff --git a/tests/dictionaries/80auto_autofreeze/00-base.xml b/tests/dictionaries/01auto_autofreeze/00-base.xml similarity index 100% rename from tests/dictionaries/80auto_autofreeze/00-base.xml rename to tests/dictionaries/01auto_autofreeze/00-base.xml diff --git a/tests/dictionaries/80auto_autofreeze/__init__.py b/tests/dictionaries/01auto_autofreeze/__init__.py similarity index 100% rename from tests/dictionaries/80auto_autofreeze/__init__.py rename to tests/dictionaries/01auto_autofreeze/__init__.py diff --git a/tests/dictionaries/01auto_autofreeze/makedict/base.json b/tests/dictionaries/01auto_autofreeze/makedict/base.json new file mode 100644 index 00000000..8b4451f4 --- /dev/null +++ b/tests/dictionaries/01auto_autofreeze/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.module_instancie": "non", "rougail.general.mode_conteneur_actif": "oui"} diff --git a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py new file mode 100644 index 00000000..0a298cfa --- /dev/null +++ b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py @@ -0,0 +1,15 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'frozen', 'hidden', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={})), values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/80auto_autofreeze/errno_50 b/tests/dictionaries/80auto_autofreeze/errno_50 deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 8cf309c4..5fb38cc6 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -28,9 +28,9 @@ excludes = set([]) #excludes = set(['01base_file_utfchar']) test_ok -= excludes test_raise -= excludes -#test_ok = ['10valid_enum_eosfunc'] +#test_ok = ['01auto_autofreeze'] #test_ok = [] -#test_raise = ['80redefine_double_error'] +#test_raise = ['80auto_autofreeze'] #test_raise = [] ORI_DIR = getcwd() From d5ed39c1f35c3a96abebe1ea891647beda11fd24 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 6 Jan 2021 22:33:55 +0100 Subject: [PATCH 032/168] support auto_freeze with hidden_if_in --- src/rougail/annotator/constrainte.py | 12 +++------ .../01hidden_if_in_autofreeze/00-base.xml | 25 +++++++++++++++++++ .../__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 15 +++++++++++ .../00-base.xml | 0 .../__init__.py} | 0 .../02autosave_hidden_frozenifin/errno_51 | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 15 +++++++++++ 10 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml rename tests/dictionaries/{80autosave_hidden_frozenifin => 01hidden_if_in_autofreeze}/__init__.py (100%) create mode 100644 tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json create mode 100644 tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py rename tests/dictionaries/{80autosave_hidden_frozenifin => 02autosave_hidden_frozenifin}/00-base.xml (100%) rename tests/dictionaries/{80autosave_hidden_frozenifin/errno_51 => 02autosave_hidden_frozenifin/__init__.py} (100%) create mode 100644 tests/dictionaries/02autosave_hidden_frozenifin/errno_51 create mode 100644 tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json create mode 100644 tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index c047ab44..921918b5 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -452,19 +452,15 @@ class ConstrainteAnnotator: main_action = actions[0] if getattr(leader_or_variable, main_action, False) is True: continue - if isinstance(leader_or_variable, self.objectspace.variable) and \ - (leader_or_variable.auto_save or leader_or_variable.auto_freeze) and \ - 'force_default_on_freeze' in actions: - xmlfiles = self.objectspace.display_xmlfiles(leader_or_variable.xmlfiles) - msg = _(f'cannot have auto_freeze or auto_store with the hidden_if_in or ' - f'hidden_if_not_in variable "{leader_or_variable.name}" ' - f'in {xmlfiles}') - raise DictConsistencyError(msg, 51) self.build_property(leader_or_variable, text, condition, main_action, ) + if isinstance(leader_or_variable, self.objectspace.variable) and \ + (leader_or_variable.auto_save or leader_or_variable.auto_freeze) and \ + 'force_default_on_freeze' in actions: + continue for action in actions[1:]: # other actions are set to the variable or children of family for variable in variables: diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml b/tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml new file mode 100644 index 00000000..6d9be17d --- /dev/null +++ b/tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml @@ -0,0 +1,25 @@ + + + + + + non + + + non + + + + + + + oui + + + oui + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/80autosave_hidden_frozenifin/__init__.py b/tests/dictionaries/01hidden_if_in_autofreeze/__init__.py similarity index 100% rename from tests/dictionaries/80autosave_hidden_frozenifin/__init__.py rename to tests/dictionaries/01hidden_if_in_autofreeze/__init__.py diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json new file mode 100644 index 00000000..8b4451f4 --- /dev/null +++ b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.module_instancie": "non", "rougail.general.mode_conteneur_actif": "oui"} diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py new file mode 100644 index 00000000..bb1661e4 --- /dev/null +++ b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py @@ -0,0 +1,15 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={})), values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/80autosave_hidden_frozenifin/00-base.xml b/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml similarity index 100% rename from tests/dictionaries/80autosave_hidden_frozenifin/00-base.xml rename to tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml diff --git a/tests/dictionaries/80autosave_hidden_frozenifin/errno_51 b/tests/dictionaries/02autosave_hidden_frozenifin/__init__.py similarity index 100% rename from tests/dictionaries/80autosave_hidden_frozenifin/errno_51 rename to tests/dictionaries/02autosave_hidden_frozenifin/__init__.py diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/errno_51 b/tests/dictionaries/02autosave_hidden_frozenifin/errno_51 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json b/tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json new file mode 100644 index 00000000..2a8f28f8 --- /dev/null +++ b/tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": "oui"} diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py b/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py new file mode 100644 index 00000000..60047cec --- /dev/null +++ b/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py @@ -0,0 +1,15 @@ +from importlib.machinery import SourceFileLoader +func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module() +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = StrOption(properties=frozenset({'basic', 'force_store_value', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='autosavevar', doc='autosave variable', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={}))) +option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3, option_4]) +option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) +option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) From 85ab95288286b909473d5d9ec26fe26f63313f88 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 10 Jan 2021 09:07:22 +0100 Subject: [PATCH 033/168] pylint variable.py --- src/rougail/annotator/group.py | 6 +- src/rougail/annotator/variable.py | 201 +++++++++--------- src/rougail/path.py | 15 +- .../02autosave_hidden_frozenifin/errno_51 | 0 4 files changed, 116 insertions(+), 106 deletions(-) delete mode 100644 tests/dictionaries/02autosave_hidden_frozenifin/errno_51 diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py index 892d7554..4662d717 100644 --- a/src/rougail/annotator/group.py +++ b/src/rougail/annotator/group.py @@ -67,8 +67,8 @@ class GroupAnnotator: leader_name, variable, group, - leader_fullname, ) + leader_space.path = leader_fullname has_a_leader = True else: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) @@ -85,7 +85,6 @@ class GroupAnnotator: leader_name: str, variable: 'Variable', group: 'Group', - leader_fullname: str, ) -> None: """manage leader's variable """ @@ -121,9 +120,8 @@ class GroupAnnotator: self.objectspace.paths.set_leader(namespace, leader_family_name, leader_name, - leader_name, + leadership_name, ) - leader_space.path = leader_fullname return leader_is_hidden def manage_follower(self, diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index daa1f8ed..3e75a6a9 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -1,3 +1,5 @@ +"""Annotate variable +""" from ..i18n import _ from ..utils import normalize_family from ..error import DictConsistencyError @@ -15,14 +17,19 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), 'date': dict(opttype="DateOption"), 'unix_user': dict(opttype="UsernameOption"), 'ip': dict(opttype="IPOption", initkwargs={'allow_reserved': True}), - 'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, 'warnings_only': True}), + 'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, + 'warnings_only': True}), 'netmask': dict(opttype="NetmaskOption"), 'network': dict(opttype="NetworkOption"), 'broadcast': dict(opttype="BroadcastOption"), - 'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}), - 'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}), - 'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}), - 'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}), + 'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', + 'warnings_only': True}), + 'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', + 'allow_ip': False}), + 'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', + 'allow_ip': False}), + 'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, + 'allow_without_dot': True}), 'port': dict(opttype="PortOption", initkwargs={'allow_private': True}), 'mac': dict(opttype="MACOption"), 'cidr': dict(opttype="IPOption", initkwargs={'cidr': True}), @@ -41,102 +48,106 @@ RENAME_ATTIBUTES = {'description': 'doc'} class VariableAnnotator: + """Annotate variable + """ def __init__(self, objectspace, ): self.objectspace = objectspace - self.convert_variable() - self.convert_separators() + if hasattr(self.objectspace.space, 'variables'): + self.convert_variable() + self.convert_separators() + + def _convert_variable(self, + namespace: str, + variable, + variable_type: str, + ) -> None: + if not hasattr(variable, 'type'): + variable.type = 'string' + if variable.type != 'symlink' and not hasattr(variable, 'description'): + variable.description = variable.name + if hasattr(variable, 'value'): + for value in variable.value: + if not hasattr(value, 'type'): + value.type = variable.type + value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name) + for key, value in RENAME_ATTIBUTES.items(): + setattr(variable, value, getattr(variable, key)) + setattr(variable, key, None) + if variable_type == 'follower': + if variable.multi is True: + variable.multi = 'submulti' + else: + variable.multi = True + self._convert_valid_enum(namespace, + variable, + ) + self._valid_type(variable) + + def _convert_valid_enum(self, + namespace, + variable, + ): + """some types are, in fact, choices + convert this kind of variables into choice + """ + if variable.type in FORCE_CHOICE: + if not hasattr(self.objectspace.space, 'constraints'): + xmlfiles = variable.xmlfiles + self.objectspace.space.constraints = self.objectspace.constraints(xmlfiles) + self.objectspace.space.constraints.namespace = namespace + if not hasattr(self.objectspace.space.constraints, 'check'): + self.objectspace.space.constraints.check = [] + check = self.objectspace.check(variable.xmlfiles) + check.name = 'valid_enum' + check.target = variable.path + check.namespace = namespace + check.param = [] + for value in FORCE_CHOICE[variable.type]: + param = self.objectspace.param(variable.xmlfiles) + param.text = value + check.param.append(param) + self.objectspace.space.constraints.check.append(check) + variable.type = 'string' + + def _valid_type(self, + variable + ) -> None: + if variable.type not in CONVERT_OPTION: + xmlf = self.objectspace.display_xmlfiles(variable.xmlfiles) + msg = _(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlf}') + raise DictConsistencyError(msg, 36) def convert_variable(self): - def _convert_variable(variable, - variable_type, - ): - if not hasattr(variable, 'type'): - variable.type = 'string' - if variable.type != 'symlink' and not hasattr(variable, 'description'): - variable.description = variable.name - if hasattr(variable, 'value'): - for value in variable.value: - if not hasattr(value, 'type'): - value.type = variable.type - value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name) - for key, value in RENAME_ATTIBUTES.items(): - setattr(variable, value, getattr(variable, key)) - setattr(variable, key, None) - if variable_type == 'follower': - if variable.multi is True: - variable.multi = 'submulti' - else: - variable.multi = True - - def _convert_valid_enum(namespace, - variable, - path, - ): - if variable.type in FORCE_CHOICE: - check = self.objectspace.check(variable.xmlfiles) - check.name = 'valid_enum' - check.target = path - check.namespace = namespace - check.param = [] - for value in FORCE_CHOICE[variable.type]: - param = self.objectspace.param(variable.xmlfiles) - param.text = value - check.param.append(param) - if not hasattr(self.objectspace.space, 'constraints'): - self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) - self.objectspace.space.constraints.namespace = namespace - if not hasattr(self.objectspace.space.constraints, 'check'): - self.objectspace.space.constraints.check = [] - self.objectspace.space.constraints.check.append(check) - variable.type = 'string' - - def _valid_type(variable): - if variable.type not in CONVERT_OPTION: - xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - raise DictConsistencyError(_(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlfiles}'), 36) - - if not hasattr(self.objectspace.space, 'variables'): - return + """convert variable + """ for families in self.objectspace.space.variables.values(): - namespace = families.name - if hasattr(families, 'family'): - families.doc = families.name - for family in families.family.values(): - family.doc = family.name - family.name = normalize_family(family.name) - if hasattr(family, 'variable'): - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - for idx, follower in enumerate(variable.variable): - if idx == 0: - variable_type = 'master' - else: - variable_type = 'follower' - path = '{}.{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name, follower.name) - _convert_variable(follower, - variable_type, - ) - _convert_valid_enum(namespace, - follower, - path, - ) - _valid_type(follower) - else: - path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name) - _convert_variable(variable, - 'variable', - ) - _convert_valid_enum(namespace, - variable, - path, - ) - _valid_type(variable) + if not hasattr(families, 'family'): + continue + families.doc = families.name + for family in families.family.values(): + family.doc = family.name + family.name = normalize_family(family.name) + if not hasattr(family, 'variable'): + continue + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.leadership): + # first variable is a leader, others are follower + variable_type = 'leader' + for follower in variable.variable: + self._convert_variable(families.name, + follower, + variable_type, + ) + variable_type = 'follower' + else: + self._convert_variable(families.name, + variable, + 'variable', + ) def convert_separators(self): # pylint: disable=C0111,R0201 - if not hasattr(self.objectspace.space, 'variables'): - return for family in self.objectspace.space.variables.values(): if not hasattr(family, 'separators'): continue @@ -144,10 +155,8 @@ class VariableAnnotator: for separator in family.separators.separator: option = self.objectspace.paths.get_variable_obj(separator.name) if hasattr(option, 'separator'): - subpath = self.objectspace.paths.get_variable_path(separator.name, - separator.namespace, - ) xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles) - raise DictConsistencyError(_(f'{subpath} already has a separator in {xmlfiles}'), 35) + msg = _(f'{separator.name} already has a separator in {xmlfiles}') + raise DictConsistencyError(msg, 35) option.separator = separator.text del family.separators diff --git a/src/rougail/path.py b/src/rougail/path.py index 7f36dcac..cb9212fa 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -79,6 +79,7 @@ class Path: new_path = namespace + '.' + leader_family_name + '.' + leader_name + '.' + name self.variables[new_path] = self.variables.pop(old_path) self.variables[new_path]['leader'] = leader_name + self.variables[new_path]['variableobj'].path = new_path if namespace == Config['variable_namespace']: self.full_paths_variables[name] = new_path @@ -94,11 +95,13 @@ class Path: variableobj, ) -> str: # pylint: disable=C0111 if '.' not in name: - full_name = '.'.join([namespace, family, name]) - self.full_paths_variables[name] = full_name + full_path = '.'.join([namespace, family, name]) + if namespace == Config['variable_namespace']: + self.full_paths_variables[name] = full_path else: - full_name = name - self.variables[full_name] = dict(name=name, + full_path = name + variableobj.path = full_path + self.variables[full_path] = dict(name=name, family=family, namespace=namespace, leader=None, @@ -107,12 +110,12 @@ class Path: ) def get_variable_name(self, - name, + name: str, ): # pylint: disable=C0111 return self._get_variable(name)['name'] def get_variable_obj(self, - name:str, + name: str, ) -> 'Variable': # pylint: disable=C0111 return self._get_variable(name)['variableobj'] diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/errno_51 b/tests/dictionaries/02autosave_hidden_frozenifin/errno_51 deleted file mode 100644 index e69de29b..00000000 From 25d4fb9db4edd2c5a9b925c3b9713456694cbf8e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 10 Jan 2021 16:53:41 +0100 Subject: [PATCH 034/168] remove oui/non yes/no ... types --- .../80unknown_type/errno_36 => FIXME | 0 src/rougail/annotator/constrainte.py | 28 ++++++++----------- src/rougail/annotator/property.py | 20 ++++--------- src/rougail/annotator/service.py | 2 +- src/rougail/annotator/variable.py | 21 ++------------ src/rougail/data/rougail.dtd | 2 +- src/rougail/tiramisureflector.py | 1 - .../00load_autofreeze/00-base.xml | 4 +-- .../00load_autofreeze/tiramisu/base.py | 4 +-- .../00load_autofreezeexpert/00-base.xml | 4 +-- .../00load_autofreezeexpert/tiramisu/base.py | 4 +-- .../dictionaries/00load_autosave/00-base.xml | 2 +- .../00load_autosave/tiramisu/base.py | 2 +- .../00load_autosaveexpert/00-base.xml | 2 +- .../00load_autosaveexpert/tiramisu/base.py | 2 +- tests/dictionaries/00load_comment/00-base.xml | 2 +- .../00load_comment/tiramisu/base.py | 2 +- tests/dictionaries/00load_notype/00-base.xml | 2 +- .../00load_notype/tiramisu/base.py | 2 +- tests/dictionaries/00load_save/00-base.xml | 2 +- .../dictionaries/00load_save/tiramisu/base.py | 2 +- .../dictionaries/00load_subfolder/99-base.xml | 2 +- .../00load_subfolder/subfolder/00-base.xml | 2 +- .../00load_subfolder/tiramisu/base.py | 4 +-- .../01auto_autofreeze/00-base.xml | 4 +-- .../01auto_autofreeze/tiramisu/base.py | 4 +-- tests/dictionaries/01auto_base/00-base.xml | 4 +-- .../dictionaries/01auto_base/tiramisu/base.py | 4 +-- .../01auto_withoutparam/00-base.xml | 4 +-- .../01auto_withoutparam/tiramisu/base.py | 4 +-- .../01base_file_include/00-base.xml | 2 +- .../01base_file_include/tiramisu/base.py | 2 +- .../01base_file_patch/00-base.xml | 2 +- .../01base_file_patch/tiramisu/base.py | 2 +- .../01base_file_utfchar/00-base.xml | 2 +- .../01base_file_utfchar/tiramisu/base.py | 2 +- tests/dictionaries/01base_multi/00-base.xml | 2 +- .../01base_multi/tiramisu/base.py | 2 +- .../01base_var_name_same_family/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../01fill_autofreeze/00-base.xml | 6 ++-- .../01fill_autofreeze/tiramisu/base.py | 6 ++-- .../dictionaries/01fill_autosave/00-base.xml | 4 +-- .../01fill_autosave/tiramisu/base.py | 4 +-- tests/dictionaries/01fill_base/00-base.xml | 4 +-- .../dictionaries/01fill_base/tiramisu/base.py | 4 +-- .../01fill_baseaccent/00-base.xml | 4 +-- .../01fill_baseaccent/tiramisu/base.py | 4 +-- .../dictionaries/01fill_mandatory/00-base.xml | 4 +-- .../01fill_mandatory/tiramisu/base.py | 4 +-- tests/dictionaries/01fill_number/00-base.xml | 2 +- .../01fill_number/tiramisu/base.py | 2 +- .../01fill_only_optional/00-base.xml | 4 +-- .../01fill_only_optional/tiramisu/base.py | 4 +-- .../dictionaries/01fill_optional/00-base.xml | 4 +-- .../01fill_optional/tiramisu/base.py | 4 +-- .../01hidden_if_in_autofreeze/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../dictionaries/01separator_base/00-base.xml | 2 +- .../01separator_base/tiramisu/base.py | 2 +- .../01separator_neverhidden/00-base.xml | 2 +- .../01separator_neverhidden/tiramisu/base.py | 2 +- .../02autosave_hidden_frozenifin/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10autosave_hidden/00-base.xml | 2 +- .../10autosave_hidden/tiramisu/base.py | 2 +- .../10check_valid_differ/00-base.xml | 4 +-- .../10check_valid_differ/tiramisu/base.py | 4 +-- .../10check_valid_differ_add/00-base.xml | 6 ++-- .../10check_valid_differ_add/tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../10check_valid_in_network/00-base.xml | 2 +- .../10check_valid_in_network/tiramisu/base.py | 2 +- .../10check_valid_in_network_cidr/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10check_valid_ipnetmask/00-base.xml | 2 +- .../10check_valid_ipnetmask/tiramisu/base.py | 2 +- .../10leadership_append/00-base.xml | 2 +- .../10leadership_append/tiramisu/base.py | 2 +- .../10leadership_auto/00-base.xml | 2 +- .../10leadership_auto/tiramisu/base.py | 2 +- .../10leadership_autoleader/00-base.xml | 2 +- .../10leadership_autoleader/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_autosaveexpert/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_familyaccent/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_leader_hidden/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_leadermandatory/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_mandatory/00-base.xml | 2 +- .../10leadership_mandatory/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10leadership_multi/00-base.xml | 2 +- .../10leadership_multi/tiramisu/base.py | 2 +- .../10load_disabled_if_in/00-base.xml | 6 ++-- .../10load_disabled_if_in/tiramisu/base.py | 6 ++-- .../10load_disabled_if_in_none/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../00-base.xml | 8 +++--- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../10load_disabledifin_fallback/00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../10load_frozenifin/00-base.xml | 6 ++-- .../10load_frozenifin/tiramisu/base.py | 6 ++-- .../10load_frozenifin_auto/00-base.xml | 6 ++-- .../10load_frozenifin_auto/tiramisu/base.py | 6 ++-- .../10load_frozenifin_multiparam/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_frozenifin_noexist/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_frozenifnotin/00-base.xml | 6 ++-- .../10load_frozenifnotin/tiramisu/base.py | 6 ++-- .../10load_frozenifnotin_noexist/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_hidden_if_family/00-base.xml | 8 +++--- .../10load_hidden_if_family/tiramisu/base.py | 8 +++--- .../10load_leadership/00-base.xml | 2 +- .../10load_leadership/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_leadership_description/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_leadership_name/00-base.xml | 2 +- .../10load_leadership_name/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_leadership_submulti/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10load_mandatoryifin/00-base.xml | 2 +- .../10load_mandatoryifin/tiramisu/base.py | 2 +- .../00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../10load_multivalue/00-base.xml | 2 +- .../10load_multivalue/tiramisu/base.py | 2 +- .../10valid_enum_accent/00-base.xml | 2 +- .../10valid_enum_accent/tiramisu/base.py | 2 +- .../10valid_enum_base/00-base.xml | 2 +- .../10valid_enum_base/tiramisu/base.py | 2 +- .../10valid_enum_base_redefine/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10valid_enum_leader/00-base.xml | 2 +- .../10valid_enum_leader/tiramisu/base.py | 2 +- .../10valid_enum_mandatory/00-base.xml | 2 +- .../10valid_enum_mandatory/tiramisu/base.py | 2 +- .../10valid_enum_multi/00-base.xml | 2 +- .../10valid_enum_multi/tiramisu/base.py | 2 +- .../10valid_enum_none/00-base.xml | 2 +- .../10valid_enum_none/tiramisu/base.py | 2 +- .../10valid_enum_number/00-base.xml | 2 +- .../10valid_enum_number/tiramisu/base.py | 2 +- .../10valid_enum_numberdefault/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../10valid_enum_param_empty/00-base.xml | 2 +- .../10valid_enum_param_empty/tiramisu/base.py | 2 +- .../10valid_enum_param_empty2/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../11disabled_if_in_filelist/00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../00-base.xml | 4 +-- .../tiramisu/base.py | 4 +-- .../dictionaries/20family_append/00-base.xml | 2 +- .../dictionaries/20family_append/01-base.xml | 2 +- .../20family_append/tiramisu/base.py | 4 +-- .../20family_appendaccent/00-base.xml | 4 +-- .../20family_appendaccent/01-base.xml | 2 +- .../20family_appendaccent/02-base.xml | 2 +- .../20family_appendaccent/tiramisu/base.py | 8 +++--- tests/dictionaries/20family_empty/00-base.xml | 2 +- .../20family_empty/tiramisu/base.py | 2 +- .../dictionaries/20family_hidden/00-base.xml | 2 +- .../20family_hidden/tiramisu/base.py | 2 +- tests/dictionaries/20family_mode/00-base.xml | 2 +- .../20family_mode/tiramisu/base.py | 2 +- .../20family_modeleadership/00-base.xml | 2 +- .../20family_modeleadership/tiramisu/base.py | 2 +- tests/dictionaries/20notemplating/00-base.xml | 2 +- .../20notemplating/tiramisu/base.py | 2 +- tests/dictionaries/20override/00-base.xml | 2 +- .../dictionaries/20override/tiramisu/base.py | 2 +- tests/dictionaries/21family_empty/00-base.xml | 2 +- .../21family_empty/tiramisu/base.py | 2 +- .../dictionaries/40condition_base/00-base.xml | 8 +++--- .../40condition_base/tiramisu/base.py | 8 +++--- .../40condition_base_add/00-base.xml | 8 +++--- .../40condition_base_add/tiramisu/base.py | 8 +++--- .../40condition_fallback/00-base.xml | 8 +++--- .../40condition_fallback/tiramisu/base.py | 8 +++--- .../40condition_optional/00-base.xml | 6 ++-- .../40condition_optional/tiramisu/base.py | 6 ++-- .../40condition_optional_empty/00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../40hidden_if_in_group_fallback/00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../40ifin_leadership/00-base.xml | 6 ++-- .../40ifin_leadership/tiramisu/base.py | 4 +-- .../40ifin_leadershipauto/00-base.xml | 8 ++++-- .../40ifin_leadershipauto/tiramisu/base.py | 4 +-- .../00-base.xml | 8 ++++-- .../tiramisu/base.py | 4 +-- tests/dictionaries/40ifin_multi/00-base.xml | 6 ++-- .../40ifin_multi/tiramisu/base.py | 6 ++-- .../dictionaries/40ifin_validenum/00-base.xml | 4 +-- .../40ifin_validenum/tiramisu/base.py | 4 +-- .../dictionaries/50exists_exists/00-base.xml | 2 +- .../dictionaries/50exists_exists/01-base.xml | 2 +- .../50exists_exists/tiramisu/base.py | 2 +- .../50redefine_description/00-base.xml | 2 +- .../50redefine_description/tiramisu/base.py | 2 +- .../51exists_nonexists/00-base.xml | 4 +-- .../51exists_nonexists/01-base.xml | 2 +- .../51exists_nonexists/tiramisu/base.py | 6 ++-- .../51exists_redefine/00-base.xml | 2 +- .../51exists_redefine/tiramisu/base.py | 2 +- .../dictionaries/51redefine_auto/00-base.xml | 2 +- .../51redefine_auto/tiramisu/base.py | 2 +- .../51redefine_autofill/00-base.xml | 2 +- .../51redefine_autofill/tiramisu/base.py | 2 +- .../51redefine_family/00-base.xml | 4 +-- .../51redefine_family/tiramisu/base.py | 4 +-- .../dictionaries/51redefine_fill/00-base.xml | 2 +- .../51redefine_fill/tiramisu/base.py | 2 +- .../51redefine_fillauto/00-base.xml | 2 +- .../51redefine_fillauto/tiramisu/base.py | 2 +- .../dictionaries/51redefine_help/00-base.xml | 2 +- .../51redefine_help/tiramisu/base.py | 2 +- .../51redefine_hidden/00-base.xml | 2 +- .../51redefine_hidden/tiramisu/base.py | 2 +- .../dictionaries/51redefine_multi/00-base.xml | 2 +- .../51redefine_remove_condition/00-base.xml | 8 +++--- .../tiramisu/base.py | 8 +++--- .../00-base.xml | 10 +++---- .../tiramisu/base.py | 10 +++---- .../dictionaries/51redefine_type/00-base.xml | 2 +- .../dictionaries/51redefine_value/00-base.xml | 4 +-- .../51redefine_value/tiramisu/base.py | 4 +-- tests/dictionaries/51remove_fill/00-base.xml | 6 ++-- .../51remove_fill/tiramisu/base.py | 4 +-- .../52exists_redefine/00-base.xml | 2 +- .../52exists_redefine/tiramisu/base.py | 2 +- .../60action_external/00-base.xml | 2 +- .../60action_external/tiramisu/base.py | 2 +- .../60extra_externalspace/00-base.xml | 2 +- .../60extra_externalspaceauto/00-base.xml | 2 +- .../00-base.xml | 6 ++-- .../tiramisu/base.py | 6 ++-- .../00-base.xml | 2 +- .../00-base.xml | 2 +- tests/dictionaries/60extra_group/00-base.xml | 4 +-- .../60extra_group/tiramisu/base.py | 4 +-- tests/dictionaries/60extra_help/00-base.xml | 4 +-- .../60extra_help/tiramisu/base.py | 4 +-- tests/dictionaries/60extra_load/00-base.xml | 4 +-- .../60extra_load/tiramisu/base.py | 4 +-- .../60extra_mandatory/00-base.xml | 4 +-- .../60extra_mandatory/tiramisu/base.py | 4 +-- .../60extra_name_family/00-base.xml | 4 +-- .../60extra_name_family/tiramisu/base.py | 4 +-- .../dictionaries/60extra_redefine/00-base.xml | 4 +-- .../60extra_redefine/tiramisu/base.py | 4 +-- .../60extra_separators/00-base.xml | 4 +-- .../60extra_separators/tiramisu/base.py | 4 +-- tests/dictionaries/60familyaction/00-base.xml | 2 +- .../60familyaction/tiramisu/base.py | 2 +- .../60familyaction_accent/00-base.xml | 2 +- .../60familyaction_accent/tiramisu/base.py | 2 +- .../60familyaction_mandatory/00-base.xml | 2 +- .../60familyaction/00-base.xml | 2 +- .../60familyaction_mandatory/tiramisu/base.py | 2 +- .../70container_files/00-base.xml | 2 +- .../70container_files/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../70container_files_twice/00-base.xml | 2 +- .../70container_files_twice/tiramisu/base.py | 2 +- .../70container_filesmulti/00-base.xml | 2 +- .../70container_filesmulti/tiramisu/base.py | 2 +- .../70container_filesredefine/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../dictionaries/70container_new/00-base.xml | 2 +- .../70container_new/tiramisu/base.py | 2 +- .../70container_newnocont/00-base.xml | 2 +- .../70container_newnocont/tiramisu/base.py | 2 +- .../70container_newwithip/00-base.xml | 2 +- .../70container_newwithip/tiramisu/base.py | 2 +- .../70container_pathaccess/00-base.xml | 2 +- .../70container_pathaccess/tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../dictionaries/70container_save/00-base.xml | 2 +- .../70container_save/tiramisu/base.py | 2 +- .../70container_serviceaccess/00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 2 +- .../tiramisu/base.py | 2 +- .../70container_services/00-base.xml | 2 +- .../70container_services/tiramisu/base.py | 2 +- .../70services_unmanage/00-base.xml | 2 +- .../70services_unmanage/tiramisu/base.py | 2 +- .../80condition_not_exists_error/00-base.xml | 2 +- .../00-base.xml | 2 +- .../80condition_without_target/00-base.xml | 8 +++--- .../00-base.xml | 2 +- .../00-base.xml | 2 +- .../80extra_auto_freeze/00-base.xml | 4 +-- .../dictionaries/80family_change/00-base.xml | 4 +-- .../80family_changeaccent/00-base.xml | 4 +-- .../dictionaries/80family_several/00-base.xml | 2 +- tests/dictionaries/80fill_error/00-base.xml | 2 +- tests/dictionaries/80fill_multi/00-base.xml | 4 +-- .../80fill_not_exists/00-base.xml | 4 +-- .../80fill_unknown_function/00-base.xml | 4 +-- .../80hidden_if_in_filelist/00-base.xml | 4 +-- .../80leadership_auto_save/00-base.xml | 2 +- .../80leadership_autofreeze/00-base.xml | 2 +- .../80leadership_leader_not_multi/00-base.xml | 2 +- .../00-base.xml | 2 +- .../80leadership_not_ordered/00-base.xml | 2 +- .../80leadership_not_same_family/00-base.xml | 2 +- .../80leadership_notexists/00-base.xml | 2 +- .../80redefine_double_error/00-base.xml | 2 +- .../dictionaries/80redefine_error/00-base.xml | 2 +- .../80redefine_error/01-redefine.xml | 2 +- .../80redefine_fillerror/00-base.xml | 2 +- .../80redefine_notexists/00-base.xml | 2 +- .../80separator_multi/00-base.xml | 2 +- .../80separator_multi2/00-base.xml | 2 +- .../80separator_nonexists/00-base.xml | 2 +- tests/dictionaries/80unknown_type/errno_43 | 0 .../80valid_enum_base_redefine/00-base.xml | 2 +- .../80valid_enum_no_param/00-base.xml | 2 +- .../00-base.xml | 2 +- .../88valid_enum_not_number/00-base.xml | 2 +- .../88valid_enum_not_number2/00-base.xml | 2 +- .../00-base.xml | 2 +- 370 files changed, 618 insertions(+), 640 deletions(-) rename tests/dictionaries/80unknown_type/errno_36 => FIXME (100%) create mode 100644 tests/dictionaries/80unknown_type/errno_43 diff --git a/tests/dictionaries/80unknown_type/errno_36 b/FIXME similarity index 100% rename from tests/dictionaries/80unknown_type/errno_36 rename to FIXME diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 921918b5..4a62c9e2 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -44,15 +44,15 @@ class ConstrainteAnnotator: objectspace, eosfunc_file, ): - if not hasattr(objectspace.space, 'constraints'): - return self.objectspace = objectspace eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module() self.functions = dir(eosfunc) self.functions.extend(INTERNAL_FUNCTIONS) self.valid_enums = {} - - self.convert_auto_freeze() + if hasattr(objectspace.space, 'variables'): + self.convert_auto_freeze() + if not hasattr(objectspace.space, 'constraints'): + return if hasattr(self.objectspace.space.constraints, 'check'): self.check_check() self.check_valid_enum() @@ -73,15 +73,15 @@ class ConstrainteAnnotator: """convert auto_freeze only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen """ - def _convert_auto_freeze(variable, namespace): + def _convert_auto_freeze(variable): if variable.auto_freeze: - if namespace != Config['variable_namespace']: + if variable.namespace != Config['variable_namespace']: xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) - msg = _(f'auto_freeze is not allowed in extra "{namespace}" in {xmlfiles}') + msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}" in {xmlfiles}') raise DictConsistencyError(msg, 49) new_condition = self.objectspace.condition(variable.xmlfiles) new_condition.name = 'auto_frozen_if_not_in' - new_condition.namespace = namespace + new_condition.namespace = variable.namespace new_condition.source = FREEZE_AUTOFREEZE_VARIABLE new_param = self.objectspace.param(variable.xmlfiles) new_param.text = 'oui' @@ -90,25 +90,21 @@ class ConstrainteAnnotator: new_target.type = 'variable' new_target.name = variable.name new_condition.target = [new_target] + if not hasattr(self.objectspace.space, 'constraints'): + self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) if not hasattr(self.objectspace.space.constraints, 'condition'): self.objectspace.space.constraints.condition = [] self.objectspace.space.constraints.condition.append(new_condition) for variables in self.objectspace.space.variables.values(): - if not hasattr(variables, 'family'): - continue for family in variables.family.values(): if not hasattr(family, 'variable'): continue for variable in family.variable.values(): if isinstance(variable, self.objectspace.leadership): for follower in variable.variable: - _convert_auto_freeze(follower, - variables.namespace, - ) + _convert_auto_freeze(follower) else: - _convert_auto_freeze(variable, - variables.namespace, - ) + _convert_auto_freeze(variable) def check_check(self): """valid and manage diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py index 88b1e61b..bfdceb73 100644 --- a/src/rougail/annotator/property.py +++ b/src/rougail/annotator/property.py @@ -54,13 +54,8 @@ class PropertyAnnotator: if not isinstance(service, self.objectspace.family): continue self.convert_property(service) - if not hasattr(service, 'family'): - continue - self.convert_property(service) for family in service.family: self.convert_property(family) - if not hasattr(family, 'variable'): - continue for variable in family.variable: self.convert_property(variable) @@ -68,16 +63,11 @@ class PropertyAnnotator: """convert variables """ for variables in self.objectspace.space.variables.values(): - if not hasattr(variables, 'family'): - continue for family in variables.family.values(): self.convert_property(family) - if not hasattr(family, 'variable'): - continue for variable in family.variable.values(): - if isinstance(variable, self.objectspace.leadership): - self.convert_property(variable) - for follower in variable.variable: - self.convert_property(follower) - else: - self.convert_property(variable) + self.convert_property(variable) + if not isinstance(variable, self.objectspace.leadership): + continue + for follower in variable.variable: + self.convert_property(follower) diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index d99fd279..588afa3e 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -7,7 +7,7 @@ from ..error import DictConsistencyError # that shall not be present in the exported (flatened) XML ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace', 'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership', - 'level', 'remove_fill', 'xmlfiles') + 'level', 'remove_fill', 'xmlfiles', 'type') KEY_TYPE = {'variable': 'symlink', diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 3e75a6a9..d490276d 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -37,11 +37,9 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), } -FORCE_CHOICE = {'oui/non': ['oui', 'non'], - 'on/off': ['on', 'off'], - 'yes/no': ['yes', 'no'], - 'schedule': ['none', 'daily', 'weekly', 'monthly'], - 'schedulemod': ['pre', 'post']} +FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'], + 'schedulemod': ['pre', 'post'], + } RENAME_ATTIBUTES = {'description': 'doc'} @@ -63,8 +61,6 @@ class VariableAnnotator: variable, variable_type: str, ) -> None: - if not hasattr(variable, 'type'): - variable.type = 'string' if variable.type != 'symlink' and not hasattr(variable, 'description'): variable.description = variable.name if hasattr(variable, 'value'): @@ -83,7 +79,6 @@ class VariableAnnotator: self._convert_valid_enum(namespace, variable, ) - self._valid_type(variable) def _convert_valid_enum(self, namespace, @@ -111,20 +106,10 @@ class VariableAnnotator: self.objectspace.space.constraints.check.append(check) variable.type = 'string' - def _valid_type(self, - variable - ) -> None: - if variable.type not in CONVERT_OPTION: - xmlf = self.objectspace.display_xmlfiles(variable.xmlfiles) - msg = _(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlf}') - raise DictConsistencyError(msg, 36) - def convert_variable(self): """convert variable """ for families in self.objectspace.space.variables.values(): - if not hasattr(families, 'family'): - continue families.doc = families.name for family in families.family.values(): family.doc = family.name diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 9985dc55..aa9cbe68 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -90,7 +90,7 @@ - + diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index be6f161b..aef03d03 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -266,7 +266,6 @@ class Variable(Common): ) self.is_follower = is_follower convert_option = CONVERT_OPTION[elt.type] - del elt.type self.object_type = convert_option['opttype'] self.attrib.update(convert_option.get('initkwargs', {})) if self.object_type != 'SymLinkOption': diff --git a/tests/dictionaries/00load_autofreeze/00-base.xml b/tests/dictionaries/00load_autofreeze/00-base.xml index aefd954e..fd503179 100644 --- a/tests/dictionaries/00load_autofreeze/00-base.xml +++ b/tests/dictionaries/00load_autofreeze/00-base.xml @@ -2,10 +2,10 @@ - + non - + non diff --git a/tests/dictionaries/00load_autofreeze/tiramisu/base.py b/tests/dictionaries/00load_autofreeze/tiramisu/base.py index f54bce7f..8e2f715b 100644 --- a/tests/dictionaries/00load_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreeze/tiramisu/base.py @@ -8,8 +8,8 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non') +option_3 = StrOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3, option_4]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/00load_autofreezeexpert/00-base.xml b/tests/dictionaries/00load_autofreezeexpert/00-base.xml index 2c66f0dc..f344cdef 100644 --- a/tests/dictionaries/00load_autofreezeexpert/00-base.xml +++ b/tests/dictionaries/00load_autofreezeexpert/00-base.xml @@ -2,10 +2,10 @@ - + non - + non diff --git a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py index 34cd6727..f01b4ad9 100644 --- a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py @@ -8,8 +8,8 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'expert', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non') +option_3 = StrOption(properties=frozenset({'auto_freeze', 'expert', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/00load_autosave/00-base.xml b/tests/dictionaries/00load_autosave/00-base.xml index 8825e85b..8be2a32d 100644 --- a/tests/dictionaries/00load_autosave/00-base.xml +++ b/tests/dictionaries/00load_autosave/00-base.xml @@ -2,7 +2,7 @@ - + non diff --git a/tests/dictionaries/00load_autosave/tiramisu/base.py b/tests/dictionaries/00load_autosave/tiramisu/base.py index 0353b8dd..fd39dd72 100644 --- a/tests/dictionaries/00load_autosave/tiramisu/base.py +++ b/tests/dictionaries/00load_autosave/tiramisu/base.py @@ -8,7 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'basic', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_3 = StrOption(properties=frozenset({'basic', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/00load_autosaveexpert/00-base.xml b/tests/dictionaries/00load_autosaveexpert/00-base.xml index 7fa79f58..0ed16b71 100644 --- a/tests/dictionaries/00load_autosaveexpert/00-base.xml +++ b/tests/dictionaries/00load_autosaveexpert/00-base.xml @@ -2,7 +2,7 @@ - + non diff --git a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py index a2270173..0e5f43a9 100644 --- a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py @@ -8,7 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_3 = StrOption(properties=frozenset({'expert', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'expert'}), children=[option_3]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/00load_comment/00-base.xml b/tests/dictionaries/00load_comment/00-base.xml index a5e543fe..3b468b1f 100644 --- a/tests/dictionaries/00load_comment/00-base.xml +++ b/tests/dictionaries/00load_comment/00-base.xml @@ -3,7 +3,7 @@ - diff --git a/tests/dictionaries/00load_comment/tiramisu/base.py b/tests/dictionaries/00load_comment/tiramisu/base.py index 1706e7d2..e7b834cb 100644 --- a/tests/dictionaries/00load_comment/tiramisu/base.py +++ b/tests/dictionaries/00load_comment/tiramisu/base.py @@ -8,7 +8,7 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/00load_notype/00-base.xml b/tests/dictionaries/00load_notype/00-base.xml index aac6f7fe..05d4be90 100644 --- a/tests/dictionaries/00load_notype/00-base.xml +++ b/tests/dictionaries/00load_notype/00-base.xml @@ -2,7 +2,7 @@ - -Si l'utilisateur laisse la valeur 1 à "my_variable", la valeur par défault de la variable "my_calculated_variable" sera "non". -Si la valeur de "my_variable" est différent de 1, la valeur par défaut de la variable "my_calculated_variable" sera "oui". +Si l'utilisateur laisse la valeur 1 à "my_variable", la valeur par défault de la variable "my_calculated_variable" sera "no". +Si la valeur de "my_variable" est différent de 1, la valeur par défaut de la variable "my_calculated_variable" sera "yes". Paramètre dont la valeur est issue d'une information de la configuration ------------------------------------------------------------------------ @@ -148,7 +148,7 @@ Un paramètre de type "variable" peut être "optional" : - + @@ -263,7 +263,7 @@ Dans un premier dictionnaire déclarons notre variable et notre calcule : - + @@ -283,3 +283,28 @@ Dans un second dictionnaire il est possible de redéfinir le calcul : Dans ce cas, à aucun moment la fonction "return_no" ne sera exécuté. Seul la fonction "return_yes" le sera. +Redéfinition avec suppression d'un calcul +----------------------------------------- + +Il se peut que dans un dictionnaire on décide de définir une valeur par défaut à une variable via un calcul. + +Dans un second dictionnaire il est possible de supprimer ce calcul. + +Dans un premier dictionnaire déclarons notre variable et notre calcule : + + + + + + + + + + +Dans un second dictionnaire supprimer ce calcul : + + + + + + diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 00000000..e69de29b diff --git a/doc/mode.rst b/doc/mode.rst new file mode 100644 index 00000000..66bc294e --- /dev/null +++ b/doc/mode.rst @@ -0,0 +1,8 @@ +Mode +==== + +Il existe trois "mode" dans Rougail : + +- basic : variables indispensables à la mise en place d'un service +- normal : variables couramment modifié par l'utilisateur +- expert : variables a manipuler avec précausion et en toute connaissance de cause diff --git a/doc/variable.rst b/doc/variable.rst index f88ff313..66d86256 100644 --- a/doc/variable.rst +++ b/doc/variable.rst @@ -1,13 +1,189 @@ Variable ======== +Un variable +----------- + +Une variable est forcement dans une famille. Il faut donc déjà avoir créer une famille. + +Une variable est déjà un nom. C'est à dire qu'on pourra utiliser plus tard la variable via ce nom. + + + +Description et aide sur la variable +---------------------------------- + +En plus d'un nom, il est possible de mettre une "description" à la variable. C'est une information "utilisateur" qui nous permettra d'avoir des informations complémentaires sur le contenu de cette variable : + + + +En plus de la description, il est possible de préciser une aide complémentaire : + + + +Le type de la variable +---------------------- + +Une variable a un type. Ce type permet de définir les valeurs acceptées par cette variable : + +- string : chaine de caractère (type par défaut) +- number : un nombre +- float : un chiffre flottant +- boolean : True ou False si aucune valeur n'est défini la valeur par défaut cette variable sera True +- password : un mot de passe +- mail : une adresse mail +- filename : nom de fichier au sens Unix (exemple : '/etc/passwd') +- date : une date au format "%Y-%m-%d" (exemple : "2021-01-30") +- unix_user : nom d'utilisateur au sens Unix +- ip : n'importe quelle adresse IPv4 +- cidr : n'importe quelle adresse IPv4 au format CIDR +- local_ip : adresse IPv4 sur un réseau local, si l'adresse IPv4 n'est pas local, un warning sera afficher mais la valeur sera accepté tout de même +- netmask : masque d'une adresse IPv4 +- network : adresse réseau +- network_cidr : adresse réseau au format CIDR +- broadcast : adresse de diffusion +- netbios : nom netbios +- domain : nom de domaine +- hostname : nom d'hôte +- web_address : adresse web (http://www.cadoles.com/) +- port : port +- mac : adresse MAC +- schedule : périodicité du schedule, les valeurs possibles sont "none", "daily", "weekly" ou "monthly" +- schedulemod : type de schedule, les valeurs possibles sont "pre" ou "post" + +Pour définir le type d'une variable : + + + +Variable à valeur multiple +-------------------------- + +Par défaut une variable ne peut acceuillir qu'une seule valeur. Il peut être utile de pouvoir spécifier plusieurs valeurs à une même variable. + +Pour définir une variable à valeur multiple : + + + +Mode de la variable +------------------- + +Le mode par défaut d'une variable correspond au mode de la famille. + +Pour définir le mode : + + + +Cacher une variable +------------------- + +Il est possible de cacher une variable. + +Cacher une variable signifie qu'elle ne sera pas visible lorsqu'on modifie la configuration du service. +Par contre cette variable sont accessibles lorsqu'on va l'utiliser. + +Pour cacher une variable : + + +``` Puis créons la fonction "return_no" : -```def return_no(): - return 'no'``` +``` +def return_no(): + return 'no' +``` Dans ce cas, la valeur par défaut est la valeur retournée par la fonction (ici "no"), elle sera calculée tant que l'utilisateur n'a pas de spécifié une valeur à cette variable. Si l'utilisateur à définit une valeur par défaut à "my_calculated_variable" : -``` +``` + yes -``` + +``` Cette valeur par défaut sera complètement ignorée. @@ -34,7 +40,9 @@ Cette valeur par défaut sera complètement ignorée. En ajoutant le paramètre "hidden" à "True" dans la variable précédente, l'utilisateur n'aura plus la possibilité de modifié la valeur. La valeur de la variable sera donc systématiquement calculée : -`````` + +``` Si l'utilisateur laisse la valeur 1 à "my_variable", la valeur par défault de la variable "my_calculated_variable" sera "no". Si la valeur de "my_variable" est différent de 1, la valeur par défaut de la variable "my_calculated_variable" sera "yes". @@ -116,7 +136,8 @@ Si la valeur de "my_variable" est différent de 1, la valeur par défaut de la v Créons une variable et la contrainte : -``` +``` + @@ -125,7 +146,8 @@ Créons une variable et la contrainte : server_name -``` + +``` Dans ce cas, l'information de la configuration "server_name" sera utilisé comme valeur de la variable "my_calculated_variable". Si l'information n'existe pas, la paramètre aura la valeur "None". @@ -136,24 +158,24 @@ Suivant le contexte une variable peut exister ou ne pas exister. Un paramètre de type "variable" peut être "optional" : - - - - - - - - unknow_variable - - +``` + + + + + + + + unknow_variable + + +``` Dans ce cas la fonction "return_value" est exécuté sans paramètre. ## Paramètre avec variable potentiellement désactivée -FIXME : - - +FIXME : Il n'y a pas spécialement de test ! @@ -172,7 +194,8 @@ FIXME : Il est possible de faire un calcul avec comme paramètre une variable dynamique mais pour une suffix particulier : -``` +``` + val1 @@ -190,7 +213,8 @@ Il est possible de faire un calcul avec comme paramètre une variable dynamique vardynval1 -``` + +``` Dans ce cas, valeur du paramètre de la fonction "return_value" sera la valeur de la variable "vardyn" avec le suffix "val1". @@ -198,7 +222,8 @@ Dans ce cas, valeur du paramètre de la fonction "return_value" sera la valeur d Il est également possible de calculer une variable dynamique à partir d'une variable standard : -``` +``` + val1 @@ -218,7 +243,8 @@ Il est également possible de calculer une variable dynamique à partir d'une va my_variable -``` + +``` Dans ce cas, les variables dynamiques "my_calculated_variable_dyn_" seront calculés à partir de la valeur de la variable "my_variable". Que cela soit pour la variable "my_calculated_variable_dyn_val1" et "my_calculated_variable_dyn_val2". @@ -228,42 +254,50 @@ Si c'est ce que vous cherchez à faire, il faudra prévoir un traitement particu Dans ce cas, il faut explicitement demander la valeur du suffix dans la fonction : -``` +``` + my_variable -``` + +``` Et ainsi faire un traitement spécifique pour ce suffix : -```def return_value_suffix(value, suffix): +``` +def return_value_suffix(value, suffix): if suffix == 'val1': - return value``` + return value +``` ## Redéfinition des calcules Dans un premier dictionnaire déclarons notre variable et notre calcule : -``` +``` + -``` + +``` Dans un second dictionnaire il est possible de redéfinir le calcul : -``` +``` + -``` + +``` Dans ce cas, à aucun moment la fonction "return_no" ne sera exécuté. Seul la fonction "return_yes" le sera. @@ -275,19 +309,23 @@ Dans un second dictionnaire il est possible de supprimer ce calcul. Dans un premier dictionnaire déclarons notre variable et notre calcule : -``` +``` + -``` + +``` Dans un second dictionnaire supprimer ce calcul : -``` +``` + -``` + +``` diff --git a/doc/variable.md b/doc/variable.md index 07a5d763..9532ef26 100644 --- a/doc/variable.md +++ b/doc/variable.md @@ -79,7 +79,7 @@ Pour définir le [mode](./mode.md) : ``` -## Cacher une variable +## Variable invisible Il est possible de cacher une variable. @@ -92,7 +92,7 @@ Pour cacher une variable : ``` -Une valeur par défaut peut également être `une valeur calculer `. +Une valeur par défaut peut également être [une valeur calculer](fill.rst). ## Redéfinir une variable @@ -161,7 +161,7 @@ Il est parfois utile de créer une variable si elle n'existe pas dans un autre d ``` -Si cette variable existe dans un autre dictionnaire, elle ne sera pas modifier ni recréé +Si cette variable existe dans un autre dictionnaire, elle ne sera pas modifié ni recréé ## Redéfinir une variable si elle existe @@ -186,7 +186,7 @@ Voici une variable a valeur automatiquement modifiée : Dans ce cas la valeur est fixée à la valeur actuelle. Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne sera plus recalculée. -Ces variables sont généralement des variables obligatoires. En effet ces variable ne sont automatiquement modifiées que si elles sont une valeurs. +Ces variables sont généralement des variables obligatoires. En effet ces variable ne sont automatiquement modifiées que si elles ont une valeurs. ## Variable à valeur en lecture seule automatique From ac44b1857bfc8b504b65b4b39284b92eee93d4ac Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 6 Feb 2021 17:11:17 +0100 Subject: [PATCH 091/168] reorganise --- doc/family/REAME.md | 5 ++ doc/family/auto.md | 29 ++++++++ doc/{family.md => family/simple.md} | 33 +-------- doc/fill.md | 103 +++++++++++++++++----------- 4 files changed, 99 insertions(+), 71 deletions(-) create mode 100644 doc/family/REAME.md create mode 100644 doc/family/auto.md rename doc/{family.md => family/simple.md} (57%) diff --git a/doc/family/REAME.md b/doc/family/REAME.md new file mode 100644 index 00000000..1aff0572 --- /dev/null +++ b/doc/family/REAME.md @@ -0,0 +1,5 @@ +# Famille + + - [Une famille](simple.md) + - [Famille crée dynamiquement](auto.md) + diff --git a/doc/family/auto.md b/doc/family/auto.md new file mode 100644 index 00000000..a160285e --- /dev/null +++ b/doc/family/auto.md @@ -0,0 +1,29 @@ +# Famille crée dynamiquement + +Pour créer une famille dynamiquement, il faut créer une family fictive lié à une variable. +Le nom et la description de la famille et des variables qu'elle contient sera en réalité le prefix du nouveau nom/description. Le suffix viendra de la variable liée. + +Par exemple : + +``` + + + val1 + val2 + + + + + +``` + +Créera trois familles : + +- la famille : "my_family" +- la famille dynamique : "my_dyn_family_val1" avec la description "Describe val1" +- la famille dynamique : "my_dyn_family_val2" avec la description "Describe val2" + +Dans la famille dynamique "my_dyn_family_val1" on retrouvera une variable "my_dyn_var_val1". + +Bien évidement si le contenu de "varname" venait a évolué, de nouvelles familles dynamiques pouvent apparaitre ou des familles dynamiques peuvent disparaître. + diff --git a/doc/family.md b/doc/family/simple.md similarity index 57% rename from doc/family.md rename to doc/family/simple.md index 170e868d..76acb0d3 100644 --- a/doc/family.md +++ b/doc/family/simple.md @@ -1,6 +1,4 @@ -# Famille - -## Une famille +# Une famille Une famille est un conteneur de variables. @@ -56,32 +54,3 @@ Pour cacher une famille : ``` ``` + +FIXME + +### Paramètre de type information + +Le paramètre peut être la valeur est issue d'une information de la configuration. + +Créons une variable et la contrainte : + +``` + + + + + + + + server_name + + +``` + +Dans ce cas, l'information de la configuration "server_name" sera utilisé comme valeur de la variable "my_calculated_variable". +Si l'information n'existe pas, la paramètre aura la valeur "None". + From 62775f3fbe6916f3ca0f80e3fea76a8204984045 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 6 Feb 2021 17:13:55 +0100 Subject: [PATCH 092/168] reorganise --- doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index 33c501bc..ea7470d3 100644 --- a/doc/README.md +++ b/doc/README.md @@ -3,7 +3,7 @@ ## Les variables - [Le conteneur des variables](variables.md) - - [Les familles](family.md) + - [Les familles](family/README.md) - [Les variables](variable.md) ## Les contraintes From 5420c522d88e466c3ded623f04c09d8b2618b3bd Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 6 Feb 2021 17:33:08 +0100 Subject: [PATCH 093/168] reorganise --- doc/README.md | 4 +- doc/family/{REAME.md => README.md} | 0 doc/fill.md | 356 ----------------------------- doc/variable.md | 206 ----------------- 4 files changed, 2 insertions(+), 564 deletions(-) rename doc/family/{REAME.md => README.md} (100%) delete mode 100644 doc/fill.md delete mode 100644 doc/variable.md diff --git a/doc/README.md b/doc/README.md index ea7470d3..b31e5a66 100644 --- a/doc/README.md +++ b/doc/README.md @@ -4,8 +4,8 @@ - [Le conteneur des variables](variables.md) - [Les familles](family/README.md) - - [Les variables](variable.md) + - [Les variables](variable/README.md) ## Les contraintes - - [Les calcules automatiques](fill.md) + - [Les calcules automatiques](fill/README.md) diff --git a/doc/family/REAME.md b/doc/family/README.md similarity index 100% rename from doc/family/REAME.md rename to doc/family/README.md diff --git a/doc/fill.md b/doc/fill.md deleted file mode 100644 index a46c35a7..00000000 --- a/doc/fill.md +++ /dev/null @@ -1,356 +0,0 @@ -# Les variables calculées - -Une variable calculée est une variable donc sa valeur est le résultat d'une fonction python. - -## Valeur de la variable - -### Variable avec une valeur par défaut calculée - -Créons une variable dont la valeur est retournée par la fonction "return_no" : - -``` - - - - - - - - -``` - -Puis créons la fonction "return_no" : - -``` -def return_no(): - return 'no' -``` - -Dans ce cas, la valeur par défaut est la valeur retournée par la fonction (ici "no"), elle sera calculée tant que l'utilisateur n'a pas de spécifié une valeur à cette variable. - -Attention, si une valeur par défaut est définit dans la variable "my_calculated_variable" : - -``` - - yes - -``` - -Cette valeur par défaut sera complètement ignorée. C'est le calcul qui en définira la valeur. - -### Variable avec une valeur calculée - -En ajoutant le paramètre "hidden" à "True" dans la variable précédente, l'utilisateur n'aura plus la possibilité de modifié la valeur. La valeur de la variable sera donc systématiquement calculée : - -``` - diff --git a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py index 6ebbca2d..b53d674f 100644 --- a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", "frozen", "hidden", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", "frozen", "hidden", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01auto_base/00-base.xml b/tests/dictionaries/01auto_base/00-base.xml index 0f02345e..b049228f 100644 --- a/tests/dictionaries/01auto_base/00-base.xml +++ b/tests/dictionaries/01auto_base/00-base.xml @@ -12,8 +12,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/01auto_withoutparam/00-base.xml b/tests/dictionaries/01auto_withoutparam/00-base.xml index fa9c8f7b..f700d753 100644 --- a/tests/dictionaries/01auto_withoutparam/00-base.xml +++ b/tests/dictionaries/01auto_withoutparam/00-base.xml @@ -12,7 +12,8 @@ - + + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_autofreeze/00-base.xml b/tests/dictionaries/01fill_autofreeze/00-base.xml index d88573f7..4cb6b371 100644 --- a/tests/dictionaries/01fill_autofreeze/00-base.xml +++ b/tests/dictionaries/01fill_autofreeze/00-base.xml @@ -15,8 +15,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py index 1604838a..1f388973 100644 --- a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py @@ -14,7 +14,7 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01fill_autosave/00-base.xml b/tests/dictionaries/01fill_autosave/00-base.xml index 6cc494ad..e7f8557e 100644 --- a/tests/dictionaries/01fill_autosave/00-base.xml +++ b/tests/dictionaries/01fill_autosave/00-base.xml @@ -12,8 +12,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_base/00-base.xml b/tests/dictionaries/01fill_base/00-base.xml index c1af0f02..7f777ad0 100644 --- a/tests/dictionaries/01fill_base/00-base.xml +++ b/tests/dictionaries/01fill_base/00-base.xml @@ -10,8 +10,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_baseaccent/00-base.xml b/tests/dictionaries/01fill_baseaccent/00-base.xml index ce8bd9f0..113c5478 100644 --- a/tests/dictionaries/01fill_baseaccent/00-base.xml +++ b/tests/dictionaries/01fill_baseaccent/00-base.xml @@ -12,8 +12,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_mandatory/00-base.xml b/tests/dictionaries/01fill_mandatory/00-base.xml index 1573e3cf..99cd039b 100644 --- a/tests/dictionaries/01fill_mandatory/00-base.xml +++ b/tests/dictionaries/01fill_mandatory/00-base.xml @@ -10,8 +10,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_number/00-base.xml b/tests/dictionaries/01fill_number/00-base.xml index b42adf82..2407da8c 100644 --- a/tests/dictionaries/01fill_number/00-base.xml +++ b/tests/dictionaries/01fill_number/00-base.xml @@ -10,8 +10,9 @@ - + 3 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_only_optional/00-base.xml b/tests/dictionaries/01fill_only_optional/00-base.xml index b3b24923..a96d2757 100644 --- a/tests/dictionaries/01fill_only_optional/00-base.xml +++ b/tests/dictionaries/01fill_only_optional/00-base.xml @@ -12,8 +12,9 @@ - + mode_conteneur_actif4 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_optional/00-base.xml b/tests/dictionaries/01fill_optional/00-base.xml index f59abcab..d17069a7 100644 --- a/tests/dictionaries/01fill_optional/00-base.xml +++ b/tests/dictionaries/01fill_optional/00-base.xml @@ -12,10 +12,11 @@ - + mode_conteneur_actif4 mode_conteneur_actif1 mode_conteneur_actif3 + mode_conteneur_actif diff --git a/tests/dictionaries/01fill_quote/00-base.xml b/tests/dictionaries/01fill_quote/00-base.xml index 381d64da..173afe26 100644 --- a/tests/dictionaries/01fill_quote/00-base.xml +++ b/tests/dictionaries/01fill_quote/00-base.xml @@ -10,17 +10,21 @@ - + quote' + mode_conteneur_actif - + quote" + mode_conteneur_actif1 - + quote"' + mode_conteneur_actif2 - + quote"\' + mode_conteneur_actif3 diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml b/tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml index 233399af..270fdf2e 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml +++ b/tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml @@ -11,8 +11,9 @@ - + oui + mode_conteneur_actif oui diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py index 49bc4bc5..0efa3a90 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml b/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml index 2961ee33..9b73bdb7 100644 --- a/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml +++ b/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml @@ -9,8 +9,9 @@ - + oui + autosavevar oui diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py b/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py index 7fe23bdd..419b2527 100644 --- a/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py +++ b/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_4 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_4 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10autosave_hidden/00-base.xml b/tests/dictionaries/10autosave_hidden/00-base.xml index 64e97ce1..e2653fdc 100644 --- a/tests/dictionaries/10autosave_hidden/00-base.xml +++ b/tests/dictionaries/10autosave_hidden/00-base.xml @@ -10,8 +10,9 @@ - + oui + autosavevar diff --git a/tests/dictionaries/10check_base/00-base.xml b/tests/dictionaries/10check_base/00-base.xml index 69c8fede..63b9e332 100644 --- a/tests/dictionaries/10check_base/00-base.xml +++ b/tests/dictionaries/10check_base/00-base.xml @@ -9,9 +9,10 @@ - + 0 100 + int diff --git a/tests/dictionaries/10check_no_param/00-base.xml b/tests/dictionaries/10check_no_param/00-base.xml index f2d3626a..207cea76 100644 --- a/tests/dictionaries/10check_no_param/00-base.xml +++ b/tests/dictionaries/10check_no_param/00-base.xml @@ -10,7 +10,9 @@ - + + int + diff --git a/tests/dictionaries/60extra_externalspace/__init__.py b/tests/dictionaries/10load_disabled_if_in_variable/__init__.py similarity index 100% rename from tests/dictionaries/60extra_externalspace/__init__.py rename to tests/dictionaries/10load_disabled_if_in_variable/__init__.py diff --git a/tests/dictionaries/10load_disabled_if_in_variable/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_variable/makedict/base.json new file mode 100644 index 00000000..6c66feb5 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_variable/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "tous"} diff --git a/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py new file mode 100644 index 00000000..d4e091e9 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py @@ -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 * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="tous", properties=frozenset({"mandatory", "normal"})) +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), 'expected': ParamOption(option_4)}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabled_if_in_variable2/00-base.xml b/tests/dictionaries/10load_disabled_if_in_variable2/00-base.xml new file mode 100644 index 00000000..726c5fb1 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_variable2/00-base.xml @@ -0,0 +1,34 @@ + + + + + + + + tous + + + aucun + + + non + + + + + + + tous + authentifié + aucun + condition + + + mode_conteneur_actif + mode_conteneur_actif2 + + + + + diff --git a/tests/dictionaries/60extra_externalspace/errno_41 b/tests/dictionaries/10load_disabled_if_in_variable2/__init__.py similarity index 100% rename from tests/dictionaries/60extra_externalspace/errno_41 rename to tests/dictionaries/10load_disabled_if_in_variable2/__init__.py diff --git a/tests/dictionaries/10load_disabled_if_in_variable2/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_variable2/makedict/base.json new file mode 100644 index 00000000..fb7866b3 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_variable2/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "aucun", "rougail.general.mode_conteneur_actif2": "non"} diff --git a/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py new file mode 100644 index 00000000..8c174a44 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py @@ -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 * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="aucun", properties=frozenset({"mandatory", "normal"})) +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), 'expected': ParamOption(option_4)}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py index 13ebd570..358d96f8 100644 --- a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py @@ -13,10 +13,10 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue('oui')}))})) +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), '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), '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), 'expected': ParamValue('oui')}))})) +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), '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]) diff --git a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py index 06006abe..0ce154b0 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py @@ -14,7 +14,7 @@ except: from rougail.tiramisu import ConvertDynOptionDescription 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({"disabled", "mandatory", "normal"})) -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), '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), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py index 39342d52..72702194 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue('oui')}))})) +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), '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), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py index 39342d52..72702194 100644 --- a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue('oui')}))})) +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), '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), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin/tiramisu/base.py b/tests/dictionaries/10load_frozenifin/tiramisu/base.py index e59e0d50..54513960 100644 --- a/tests/dictionaries/10load_frozenifin/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin_auto/00-base.xml b/tests/dictionaries/10load_frozenifin_auto/00-base.xml index 0882d249..38704bb4 100644 --- a/tests/dictionaries/10load_frozenifin_auto/00-base.xml +++ b/tests/dictionaries/10load_frozenifin_auto/00-base.xml @@ -20,8 +20,9 @@ mode_conteneur_actif mode_conteneur_actif2 - + non + mode_conteneur_actif diff --git a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py index e6299a6e..2d9d359f 100644 --- a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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=Calculation(func.calc_val, Params((ParamValue("non")))), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("non")))), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml b/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml index c3512f52..3006f138 100644 --- a/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml +++ b/tests/dictionaries/10load_frozenifin_multiparam/00-base.xml @@ -15,10 +15,11 @@ - + tous authentifié aucun + condition tous diff --git a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py index 1267d620..6ce4c30f 100644 --- a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')}))})) -option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin_noexist/00-base.xml b/tests/dictionaries/10load_frozenifin_noexist/00-base.xml index 71ad9db5..4cefd881 100644 --- a/tests/dictionaries/10load_frozenifin_noexist/00-base.xml +++ b/tests/dictionaries/10load_frozenifin_noexist/00-base.xml @@ -17,10 +17,11 @@ - + tous authentifié aucun + condition oui diff --git a/tests/dictionaries/10load_frozenifin_variable/00-base.xml b/tests/dictionaries/10load_frozenifin_variable/00-base.xml index cac5aee5..ed067251 100644 --- a/tests/dictionaries/10load_frozenifin_variable/00-base.xml +++ b/tests/dictionaries/10load_frozenifin_variable/00-base.xml @@ -17,10 +17,11 @@ - + tous authentifié aucun + condition mode_conteneur_actif diff --git a/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py index c3cac38d..40d7ae20 100644 --- a/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py @@ -14,7 +14,7 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="tous", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('mode_conteneur_actif')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('mode_conteneur_actif')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('mode_conteneur_actif')}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py index e76e90e8..07ded3ca 100644 --- a/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) -option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml b/tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml index 07d2c45b..ed047181 100644 --- a/tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml +++ b/tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml @@ -17,10 +17,11 @@ - + tous authentifié aucun + condition oui diff --git a/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py b/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py index a0554aee..4cdd465d 100644 --- a/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py +++ b/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py index 5e09a009..77e4029e 100644 --- a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py +++ b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py @@ -13,10 +13,10 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) -option_6 = OptionDescription(name="general2", doc="Général2", children=[option_7], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_7 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_6 = OptionDescription(name="general2", doc="Général2", children=[option_7], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=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]) diff --git a/tests/dictionaries/10load_leadership/00-base.xml b/tests/dictionaries/10load_leadership/00-base.xml index 05dc32ef..e89d1b86 100644 --- a/tests/dictionaries/10load_leadership/00-base.xml +++ b/tests/dictionaries/10load_leadership/00-base.xml @@ -14,11 +14,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/10load_leadership_description/00-base.xml b/tests/dictionaries/10load_leadership_description/00-base.xml index bc4f10f7..3be9613d 100644 --- a/tests/dictionaries/10load_leadership_description/00-base.xml +++ b/tests/dictionaries/10load_leadership_description/00-base.xml @@ -13,11 +13,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/10load_leadership_name/00-base.xml b/tests/dictionaries/10load_leadership_name/00-base.xml index 365e95b0..d5e535f5 100644 --- a/tests/dictionaries/10load_leadership_name/00-base.xml +++ b/tests/dictionaries/10load_leadership_name/00-base.xml @@ -13,11 +13,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/10load_leadership_submulti/00-base.xml b/tests/dictionaries/10load_leadership_submulti/00-base.xml index ca044ac2..cb244da4 100644 --- a/tests/dictionaries/10load_leadership_submulti/00-base.xml +++ b/tests/dictionaries/10load_leadership_submulti/00-base.xml @@ -14,11 +14,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py index 5972505d..f5aa4a72 100644 --- a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py +++ b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml b/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml index f73b4da4..1506b72e 100644 --- a/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml @@ -17,10 +17,11 @@ - + tous authentifié aucun + condition oui diff --git a/tests/dictionaries/10valid_enum_accent/00-base.xml b/tests/dictionaries/10valid_enum_accent/00-base.xml index ea86a187..dd814cc2 100644 --- a/tests/dictionaries/10valid_enum_accent/00-base.xml +++ b/tests/dictionaries/10valid_enum_accent/00-base.xml @@ -14,11 +14,12 @@ - + a b c é + enumvar diff --git a/tests/dictionaries/10valid_enum_base/00-base.xml b/tests/dictionaries/10valid_enum_base/00-base.xml index 3a461cb1..0c6eca09 100644 --- a/tests/dictionaries/10valid_enum_base/00-base.xml +++ b/tests/dictionaries/10valid_enum_base/00-base.xml @@ -14,10 +14,11 @@ - + a b c + enumvar diff --git a/tests/dictionaries/10valid_enum_base_redefine/00-base.xml b/tests/dictionaries/10valid_enum_base_redefine/00-base.xml index e4986d76..c0b42eda 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/00-base.xml +++ b/tests/dictionaries/10valid_enum_base_redefine/00-base.xml @@ -17,15 +17,17 @@ - + a b c + enumvar - + a b c + enumvar2 diff --git a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml index 0a3e784f..2e2d62a6 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml +++ b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml @@ -9,9 +9,10 @@ - + a c + enumvar diff --git a/tests/dictionaries/10valid_enum_leader/00-base.xml b/tests/dictionaries/10valid_enum_leader/00-base.xml index dac27254..f8e4d55e 100644 --- a/tests/dictionaries/10valid_enum_leader/00-base.xml +++ b/tests/dictionaries/10valid_enum_leader/00-base.xml @@ -12,10 +12,11 @@ - + a b c + follower1 follower1 diff --git a/tests/dictionaries/10valid_enum_mandatory/00-base.xml b/tests/dictionaries/10valid_enum_mandatory/00-base.xml index 98475c8a..8fcf4d05 100644 --- a/tests/dictionaries/10valid_enum_mandatory/00-base.xml +++ b/tests/dictionaries/10valid_enum_mandatory/00-base.xml @@ -13,10 +13,11 @@ - + a b c + enumvar diff --git a/tests/dictionaries/10valid_enum_multi/00-base.xml b/tests/dictionaries/10valid_enum_multi/00-base.xml index d9605f61..1434167d 100644 --- a/tests/dictionaries/10valid_enum_multi/00-base.xml +++ b/tests/dictionaries/10valid_enum_multi/00-base.xml @@ -10,10 +10,11 @@ - + a b c + multi diff --git a/tests/dictionaries/10valid_enum_none/00-base.xml b/tests/dictionaries/10valid_enum_none/00-base.xml index 0f34cb86..1e9d5272 100644 --- a/tests/dictionaries/10valid_enum_none/00-base.xml +++ b/tests/dictionaries/10valid_enum_none/00-base.xml @@ -14,10 +14,11 @@ - + a b - + + enumvar diff --git a/tests/dictionaries/10valid_enum_number/00-base.xml b/tests/dictionaries/10valid_enum_number/00-base.xml index 1d00d64d..78749169 100644 --- a/tests/dictionaries/10valid_enum_number/00-base.xml +++ b/tests/dictionaries/10valid_enum_number/00-base.xml @@ -12,10 +12,11 @@ - + 1 2 3 + enumvar diff --git a/tests/dictionaries/10valid_enum_numberdefault/00-base.xml b/tests/dictionaries/10valid_enum_numberdefault/00-base.xml index b0bd9dc0..3cab8e15 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/00-base.xml +++ b/tests/dictionaries/10valid_enum_numberdefault/00-base.xml @@ -14,10 +14,11 @@ - + 1 2 3 + enumvar diff --git a/tests/dictionaries/10valid_enum_param_empty/00-base.xml b/tests/dictionaries/10valid_enum_param_empty/00-base.xml index 1910723e..35b0865e 100644 --- a/tests/dictionaries/10valid_enum_param_empty/00-base.xml +++ b/tests/dictionaries/10valid_enum_param_empty/00-base.xml @@ -12,8 +12,9 @@ - - + + + enumvar diff --git a/tests/dictionaries/10valid_enum_param_empty2/00-base.xml b/tests/dictionaries/10valid_enum_param_empty2/00-base.xml index 6edacb81..1fbf9075 100644 --- a/tests/dictionaries/10valid_enum_param_empty2/00-base.xml +++ b/tests/dictionaries/10valid_enum_param_empty2/00-base.xml @@ -12,8 +12,9 @@ - - + + + enumvar diff --git a/tests/dictionaries/10valid_enum_quote/00-base.xml b/tests/dictionaries/10valid_enum_quote/00-base.xml index 8e1bfbef..216c4a3e 100644 --- a/tests/dictionaries/10valid_enum_quote/00-base.xml +++ b/tests/dictionaries/10valid_enum_quote/00-base.xml @@ -12,10 +12,11 @@ - + quote' quote" quote"' + enumvar diff --git a/tests/dictionaries/10valid_enum_value/00-base.xml b/tests/dictionaries/10valid_enum_value/00-base.xml index fd8b959d..93d61123 100644 --- a/tests/dictionaries/10valid_enum_value/00-base.xml +++ b/tests/dictionaries/10valid_enum_value/00-base.xml @@ -9,10 +9,11 @@ - + a b c + mode_conteneur_actif diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 9a2845c5..486a9947 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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), 'expected': ParamValue('oui')}))})) -option_5 = BoolOption(name="mode_conteneur_actif2", doc="No change", default=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +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), 'expected': ParamValue("oui")}))})) +option_5 = BoolOption(name="mode_conteneur_actif2", doc="No change", default=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) 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_10 = StrOption(name="group", doc="group", default="root") 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 183b570b..cde57edf 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="oui", 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), '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), 'expected': ParamValue('oui')}))})) +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), '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), 'expected': ParamValue("oui")}))})) 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_10 = StrOption(name="group", doc="group", default="root") 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 7b968e92..08882174 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue('oui')}))})) +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), '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), 'expected': ParamValue("oui")}))})) 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_10 = StrOption(name="group", doc="group", default="root") diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml index 7451d99c..c761c403 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml @@ -22,9 +22,10 @@ - + non statique + condition statique diff --git a/tests/dictionaries/11valid_enum_variable/00-base.xml b/tests/dictionaries/11valid_enum_variable/00-base.xml index 0a63345c..631ea131 100644 --- a/tests/dictionaries/11valid_enum_variable/00-base.xml +++ b/tests/dictionaries/11valid_enum_variable/00-base.xml @@ -13,8 +13,9 @@ - + var + mode_conteneur_actif diff --git a/tests/dictionaries/20family_appendaccent/tiramisu/base.py b/tests/dictionaries/20family_appendaccent/tiramisu/base.py index 826dc53a..1258876e 100644 --- a/tests/dictionaries/20family_appendaccent/tiramisu/base.py +++ b/tests/dictionaries/20family_appendaccent/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription 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), 'expected': ParamValue('non')}))})) +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), '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"})) diff --git a/tests/dictionaries/20family_dynamic_calc/00-base.xml b/tests/dictionaries/20family_dynamic_calc/00-base.xml index 7fa2ca78..ee895a57 100644 --- a/tests/dictionaries/20family_dynamic_calc/00-base.xml +++ b/tests/dictionaries/20family_dynamic_calc/00-base.xml @@ -18,8 +18,9 @@ - + vardynval1 + newvar diff --git a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py index e63b1d6d..2dc884f9 100644 --- a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py @@ -15,8 +15,8 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_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), 'expected': ParamValue('non')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=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), '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), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=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), 'expected': ParamValue("non")}))})) option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml b/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml index a8e758a8..dfb734d7 100644 --- a/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml +++ b/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml @@ -18,8 +18,9 @@ - + + vardyn diff --git a/tests/dictionaries/20family_dynamic_number/00-base.xml b/tests/dictionaries/20family_dynamic_number/00-base.xml index b085ce9c..a155322d 100644 --- a/tests/dictionaries/20family_dynamic_number/00-base.xml +++ b/tests/dictionaries/20family_dynamic_number/00-base.xml @@ -18,8 +18,9 @@ - + vardyn1 + newvar diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml b/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml index aec57606..9622b3d7 100644 --- a/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml @@ -6,8 +6,9 @@ - + value + mode_conteneur_actif diff --git a/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml b/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml index 93ae7b1f..a5a6f5d4 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml +++ b/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml @@ -6,8 +6,9 @@ - + value + mode_conteneur_actif diff --git a/tests/dictionaries/40condition_base/tiramisu/base.py b/tests/dictionaries/40condition_base/tiramisu/base.py index da6cce64..7a977d97 100644 --- a/tests/dictionaries/40condition_base/tiramisu/base.py +++ b/tests/dictionaries/40condition_base/tiramisu/base.py @@ -14,8 +14,8 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))})) -option_6 = 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_4, todict=True), 'expected': ParamValue('oui')}))})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) +option_6 = 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_4, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_base_add/tiramisu/base.py b/tests/dictionaries/40condition_base_add/tiramisu/base.py index da6cce64..7a977d97 100644 --- a/tests/dictionaries/40condition_base_add/tiramisu/base.py +++ b/tests/dictionaries/40condition_base_add/tiramisu/base.py @@ -14,8 +14,8 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))})) -option_6 = 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_4, todict=True), 'expected': ParamValue('oui')}))})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) +option_6 = 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_4, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_optional/tiramisu/base.py b/tests/dictionaries/40condition_optional/tiramisu/base.py index 0aba831c..cc646169 100644 --- a/tests/dictionaries/40condition_optional/tiramisu/base.py +++ b/tests/dictionaries/40condition_optional/tiramisu/base.py @@ -14,7 +14,7 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40empty_param/00_base.xml b/tests/dictionaries/40empty_param/00_base.xml index 00a7a201..63ffbb72 100644 --- a/tests/dictionaries/40empty_param/00_base.xml +++ b/tests/dictionaries/40empty_param/00_base.xml @@ -13,8 +13,9 @@ - - + + + toto1 diff --git a/tests/dictionaries/40empty_param2/00_base.xml b/tests/dictionaries/40empty_param2/00_base.xml index 9c0fa4f0..f3b38b92 100644 --- a/tests/dictionaries/40empty_param2/00_base.xml +++ b/tests/dictionaries/40empty_param2/00_base.xml @@ -13,8 +13,9 @@ - - + + + toto1 diff --git a/tests/dictionaries/40ifin_leadership/tiramisu/base.py b/tests/dictionaries/40ifin_leadership/tiramisu/base.py index 3cde0a55..259523c8 100644 --- a/tests/dictionaries/40ifin_leadership/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadership/tiramisu/base.py @@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True) -option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) 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({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/40ifin_leadershipauto/00-base.xml b/tests/dictionaries/40ifin_leadershipauto/00-base.xml index d4613e66..e5d2cd44 100644 --- a/tests/dictionaries/40ifin_leadershipauto/00-base.xml +++ b/tests/dictionaries/40ifin_leadershipauto/00-base.xml @@ -25,8 +25,9 @@ follower1 follower2 - + valfill + follower1 oui diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index ba89cd83..c6ea2ee4 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a'], properties=frozenset({"mandatory"})) -option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) 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({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml b/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml index 1ca1d604..d9fc0573 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml +++ b/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml @@ -26,8 +26,9 @@ follower1 follower2 - + valfill + follower1 a diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py index c48b5326..d63bfaa4 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a', 'b'], properties=frozenset({"mandatory"})) -option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_6, todict=True), 'expected': ParamValue('a')}))})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_6, todict=True), 'expected': ParamValue("a")}))})) 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({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/40ifin_multi/tiramisu/base.py b/tests/dictionaries/40ifin_multi/tiramisu/base.py index 6ef07e5c..45e840c3 100644 --- a/tests/dictionaries/40ifin_multi/tiramisu/base.py +++ b/tests/dictionaries/40ifin_multi/tiramisu/base.py @@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription 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="non", 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), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui')}))})) +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), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=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]) diff --git a/tests/dictionaries/40ifin_validenum/00-base.xml b/tests/dictionaries/40ifin_validenum/00-base.xml index ba3fcb34..6385a45f 100644 --- a/tests/dictionaries/40ifin_validenum/00-base.xml +++ b/tests/dictionaries/40ifin_validenum/00-base.xml @@ -14,10 +14,11 @@ - + a b c + mode_conteneur_actif3 d diff --git a/tests/dictionaries/51redefine_auto/00-base.xml b/tests/dictionaries/51redefine_auto/00-base.xml index a1ceb0c4..7626870e 100644 --- a/tests/dictionaries/51redefine_auto/00-base.xml +++ b/tests/dictionaries/51redefine_auto/00-base.xml @@ -9,8 +9,9 @@ - + non + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_auto/01-base.xml b/tests/dictionaries/51redefine_auto/01-base.xml index 17a39f9b..3ddb1d5e 100644 --- a/tests/dictionaries/51redefine_auto/01-base.xml +++ b/tests/dictionaries/51redefine_auto/01-base.xml @@ -7,8 +7,9 @@ - + non + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_autofill/00-base.xml b/tests/dictionaries/51redefine_autofill/00-base.xml index c3241c4d..d9a4c31f 100644 --- a/tests/dictionaries/51redefine_autofill/00-base.xml +++ b/tests/dictionaries/51redefine_autofill/00-base.xml @@ -9,8 +9,9 @@ - + oui + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_autofill/01-base.xml b/tests/dictionaries/51redefine_autofill/01-base.xml index 712a6b98..3c60a472 100644 --- a/tests/dictionaries/51redefine_autofill/01-base.xml +++ b/tests/dictionaries/51redefine_autofill/01-base.xml @@ -7,8 +7,9 @@ - + non + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_family/tiramisu/base.py b/tests/dictionaries/51redefine_family/tiramisu/base.py index ab362993..030c7c00 100644 --- a/tests/dictionaries/51redefine_family/tiramisu/base.py +++ b/tests/dictionaries/51redefine_family/tiramisu/base.py @@ -15,6 +15,6 @@ from rougail.tiramisu import ConvertDynOptionDescription 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="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_4 = OptionDescription(name="general2", doc="general2", children=[option_5], properties=frozenset({"hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) +option_4 = OptionDescription(name="general2", doc="general2", children=[option_5], properties=frozenset({"hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_fill/00-base.xml b/tests/dictionaries/51redefine_fill/00-base.xml index c3241c4d..d9a4c31f 100644 --- a/tests/dictionaries/51redefine_fill/00-base.xml +++ b/tests/dictionaries/51redefine_fill/00-base.xml @@ -9,8 +9,9 @@ - + oui + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_fill/01-base.xml b/tests/dictionaries/51redefine_fill/01-base.xml index 17a39f9b..3ddb1d5e 100644 --- a/tests/dictionaries/51redefine_fill/01-base.xml +++ b/tests/dictionaries/51redefine_fill/01-base.xml @@ -7,8 +7,9 @@ - + non + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_fillauto/00-base.xml b/tests/dictionaries/51redefine_fillauto/00-base.xml index 0a3aee45..e1a35194 100644 --- a/tests/dictionaries/51redefine_fillauto/00-base.xml +++ b/tests/dictionaries/51redefine_fillauto/00-base.xml @@ -9,8 +9,9 @@ - + oui + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_fillauto/01-base.xml b/tests/dictionaries/51redefine_fillauto/01-base.xml index 1c9d3331..ed410ea5 100644 --- a/tests/dictionaries/51redefine_fillauto/01-base.xml +++ b/tests/dictionaries/51redefine_fillauto/01-base.xml @@ -7,8 +7,9 @@ - + non + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_remove_check/00-base.xml b/tests/dictionaries/51redefine_remove_check/00-base.xml index 4b82d1d1..e4777675 100644 --- a/tests/dictionaries/51redefine_remove_check/00-base.xml +++ b/tests/dictionaries/51redefine_remove_check/00-base.xml @@ -7,10 +7,11 @@ - + a b c + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py index 61ce69ef..86daaadf 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_7 = StrOption(name="module_instancie", 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({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_6 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/51redefine_validenum/00-base.xml b/tests/dictionaries/51redefine_validenum/00-base.xml index a2ae1b83..bce705c5 100644 --- a/tests/dictionaries/51redefine_validenum/00-base.xml +++ b/tests/dictionaries/51redefine_validenum/00-base.xml @@ -6,10 +6,11 @@ - + a b c + mode_conteneur_actif diff --git a/tests/dictionaries/51redefine_validenum/01-redefine.xml b/tests/dictionaries/51redefine_validenum/01-redefine.xml index faf00307..7b54aef9 100644 --- a/tests/dictionaries/51redefine_validenum/01-redefine.xml +++ b/tests/dictionaries/51redefine_validenum/01-redefine.xml @@ -6,9 +6,10 @@ - + a b + mode_conteneur_actif diff --git a/tests/dictionaries/51remove_fill/00-base.xml b/tests/dictionaries/51remove_fill/00-base.xml index 4dd0c58b..a51dfd6c 100644 --- a/tests/dictionaries/51remove_fill/00-base.xml +++ b/tests/dictionaries/51remove_fill/00-base.xml @@ -12,8 +12,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml b/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml index 12840066..35d9a786 100644 --- a/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml @@ -10,8 +10,9 @@ - + http://localhost/ + extra.test.calc_url diff --git a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml b/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml index 1b015543..2745b5d7 100644 --- a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml +++ b/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml @@ -9,11 +9,12 @@ - + non extra.ejabberd.day none daily + extra1.external.description diff --git a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py index 2ee00311..113bc42d 100644 --- a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py +++ b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_5 = StrOption(name="module_instancie", 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({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="activer_ejabberd", 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({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) @@ -23,6 +23,6 @@ option_10 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), defaul option_7 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_8, option_9, option_10], properties=frozenset({"normal"})) option_6 = OptionDescription(name="extra", doc="extra", children=[option_7]) option_13 = StrOption(name="description", doc="description", default="test", properties=frozenset({"mandatory", "normal"})) -option_12 = OptionDescription(name="external", doc="external", children=[option_13], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_8, todict=True), 'expected': ParamValue('non')}))})) +option_12 = OptionDescription(name="external", doc="external", children=[option_13], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_8, todict=True), 'expected': ParamValue("non")}))})) option_11 = OptionDescription(name="extra1", doc="extra1", children=[option_12]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6, option_11]) diff --git a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml index 9fc5d561..f751c2bc 100644 --- a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml @@ -13,11 +13,12 @@ - + non activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml index 884da0f4..adb57b0e 100644 --- a/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml @@ -13,11 +13,12 @@ - + non activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml index e6d6ccd1..cca67d91 100644 --- a/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml @@ -12,11 +12,12 @@ - + non activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml index 884da0f4..adb57b0e 100644 --- a/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml @@ -13,11 +13,12 @@ - + non activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_no_condition/tiramisu/base.py b/tests/dictionaries/60extra_no_condition/tiramisu/base.py index 3ca1790f..a8d37abd 100644 --- a/tests/dictionaries/60extra_no_condition/tiramisu/base.py +++ b/tests/dictionaries/60extra_no_condition/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_5 = StrOption(name="module_instancie", 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({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="activer_ejabberd", 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({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml index 884da0f4..adb57b0e 100644 --- a/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml @@ -13,11 +13,12 @@ - + non activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/80auto_family/00-base.xml b/tests/dictionaries/80auto_family/00-base.xml new file mode 100644 index 00000000..61d6b9dc --- /dev/null +++ b/tests/dictionaries/80auto_family/00-base.xml @@ -0,0 +1,18 @@ + + + + + + no + + + + + + oui + general + + + + diff --git a/tests/dictionaries/80check_unknown_var/errno_2 b/tests/dictionaries/80auto_family/__init__.py similarity index 100% rename from tests/dictionaries/80check_unknown_var/errno_2 rename to tests/dictionaries/80auto_family/__init__.py diff --git a/tests/dictionaries/80check_without_target/errno_43 b/tests/dictionaries/80auto_family/errno_2 similarity index 100% rename from tests/dictionaries/80check_without_target/errno_43 rename to tests/dictionaries/80auto_family/errno_2 diff --git a/tests/dictionaries/80check_unknown/00-base.xml b/tests/dictionaries/80check_unknown/00-base.xml index b8600cd7..46304593 100644 --- a/tests/dictionaries/80check_unknown/00-base.xml +++ b/tests/dictionaries/80check_unknown/00-base.xml @@ -10,9 +10,10 @@ - + 0 100 + int diff --git a/tests/dictionaries/80check_unknown_var/00-base.xml b/tests/dictionaries/80check_unknown_var/00-base.xml index d5e0f432..cb9eedb8 100644 --- a/tests/dictionaries/80check_unknown_var/00-base.xml +++ b/tests/dictionaries/80check_unknown_var/00-base.xml @@ -9,8 +9,9 @@ - + int3 + mode_conteneur_actif diff --git a/tests/dictionaries/80family_dynamic_check/errno_22 b/tests/dictionaries/80check_unknown_var/errno_42 similarity index 100% rename from tests/dictionaries/80family_dynamic_check/errno_22 rename to tests/dictionaries/80check_unknown_var/errno_42 diff --git a/tests/dictionaries/80family_only_on_suffix/errno_26 b/tests/dictionaries/80check_without_target/errno_9 similarity index 100% rename from tests/dictionaries/80family_only_on_suffix/errno_26 rename to tests/dictionaries/80check_without_target/errno_9 diff --git a/tests/dictionaries/80empty_param_number/00_base.xml b/tests/dictionaries/80empty_param_number/00_base.xml index f2a2228d..55d9aa1a 100644 --- a/tests/dictionaries/80empty_param_number/00_base.xml +++ b/tests/dictionaries/80empty_param_number/00_base.xml @@ -13,8 +13,9 @@ - + + toto1 diff --git a/tests/dictionaries/80empty_typeeole_eole/00_base.xml b/tests/dictionaries/80empty_typeeole_eole/00_base.xml index 31ce99fb..1d6518c7 100644 --- a/tests/dictionaries/80empty_typeeole_eole/00_base.xml +++ b/tests/dictionaries/80empty_typeeole_eole/00_base.xml @@ -13,11 +13,12 @@ - + non 3128 toto2 + toto1 diff --git a/tests/dictionaries/80empty_typeeole_number/00_base.xml b/tests/dictionaries/80empty_typeeole_number/00_base.xml index d878380d..0075c541 100644 --- a/tests/dictionaries/80empty_typeeole_number/00_base.xml +++ b/tests/dictionaries/80empty_typeeole_number/00_base.xml @@ -13,11 +13,12 @@ - + non 3128 toto2 + toto1 diff --git a/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml b/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml index f9173523..012ae57a 100644 --- a/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml +++ b/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml @@ -13,11 +13,12 @@ - + non activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml b/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml index 884da0f4..adb57b0e 100644 --- a/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml +++ b/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml @@ -13,11 +13,12 @@ - + non activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml b/tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml index 10766b76..024c1fdd 100644 --- a/tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml +++ b/tests/dictionaries/80family_dynamic_calc_invalid_suffix/00-base.xml @@ -18,8 +18,9 @@ - + unknown + vardyn diff --git a/tests/dictionaries/80family_dynamic_check/00-base.xml b/tests/dictionaries/80family_dynamic_check/00-base.xml index 571af0c3..f6497d08 100644 --- a/tests/dictionaries/80family_dynamic_check/00-base.xml +++ b/tests/dictionaries/80family_dynamic_check/00-base.xml @@ -13,9 +13,10 @@ - + 0 100 + vardynval1 diff --git a/tests/dictionaries/80valid_enum_number_without_value/errno_8 b/tests/dictionaries/80family_dynamic_check/errno_35 similarity index 100% rename from tests/dictionaries/80valid_enum_number_without_value/errno_8 rename to tests/dictionaries/80family_dynamic_check/errno_35 diff --git a/tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml b/tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml index 04b287be..b3f8b786 100644 --- a/tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml +++ b/tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml @@ -18,8 +18,9 @@ - + + newvar diff --git a/tests/dictionaries/80family_only_on_suffix/00-base.xml b/tests/dictionaries/80family_only_on_suffix/00-base.xml index 7fac5b7d..ce92e943 100644 --- a/tests/dictionaries/80family_only_on_suffix/00-base.xml +++ b/tests/dictionaries/80family_only_on_suffix/00-base.xml @@ -13,8 +13,9 @@ - + value + vardynval1 diff --git a/tests/dictionaries/80family_only_on_suffix/errno_35 b/tests/dictionaries/80family_only_on_suffix/errno_35 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_several/00-base.xml b/tests/dictionaries/80family_several/00-base.xml index 294dc202..ca54b102 100644 --- a/tests/dictionaries/80family_several/00-base.xml +++ b/tests/dictionaries/80family_several/00-base.xml @@ -14,11 +14,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/80fill_error/00-base.xml b/tests/dictionaries/80fill_error/00-base.xml index 843e24ba..a0dc5190 100644 --- a/tests/dictionaries/80fill_error/00-base.xml +++ b/tests/dictionaries/80fill_error/00-base.xml @@ -10,11 +10,13 @@ - + valeur + mode_conteneur_actif - + valeur2 + mode_conteneur_actif diff --git a/tests/dictionaries/80fill_multi/00-base.xml b/tests/dictionaries/80fill_multi/00-base.xml index 0be70367..639475ab 100644 --- a/tests/dictionaries/80fill_multi/00-base.xml +++ b/tests/dictionaries/80fill_multi/00-base.xml @@ -12,11 +12,13 @@ - + value + mode_conteneur_actif - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/80fill_not_exists/00-base.xml b/tests/dictionaries/80fill_not_exists/00-base.xml index ff5660eb..6c080b91 100644 --- a/tests/dictionaries/80fill_not_exists/00-base.xml +++ b/tests/dictionaries/80fill_not_exists/00-base.xml @@ -12,10 +12,11 @@ - + mode_conteneur_actif4 mode_conteneur_actif1 mode_conteneur_actif3 + mode_conteneur_actif diff --git a/tests/dictionaries/80fill_unknown_function/00-base.xml b/tests/dictionaries/80fill_unknown_function/00-base.xml index e4a59aee..4cf1dd5a 100644 --- a/tests/dictionaries/80fill_unknown_function/00-base.xml +++ b/tests/dictionaries/80fill_unknown_function/00-base.xml @@ -10,8 +10,9 @@ - + mode_conteneur_actif1 + mode_conteneur_actif diff --git a/tests/dictionaries/80frozenifin_unknown/00-base.xml b/tests/dictionaries/80frozenifin_unknown/00-base.xml index 483361f6..734a13da 100644 --- a/tests/dictionaries/80frozenifin_unknown/00-base.xml +++ b/tests/dictionaries/80frozenifin_unknown/00-base.xml @@ -13,10 +13,11 @@ - + 1 2 3 + enumvar 4 diff --git a/tests/dictionaries/80leadership_auto_save/00-base.xml b/tests/dictionaries/80leadership_auto_save/00-base.xml index d0c0160c..eaee21c5 100644 --- a/tests/dictionaries/80leadership_auto_save/00-base.xml +++ b/tests/dictionaries/80leadership_auto_save/00-base.xml @@ -12,11 +12,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/80leadership_autofreeze/00-base.xml b/tests/dictionaries/80leadership_autofreeze/00-base.xml index b157a1c1..28c7ec47 100644 --- a/tests/dictionaries/80leadership_autofreeze/00-base.xml +++ b/tests/dictionaries/80leadership_autofreeze/00-base.xml @@ -10,11 +10,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml b/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml index 847e0d30..e5844f8b 100644 --- a/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml +++ b/tests/dictionaries/80leadership_none_follower_between_follower/00-base.xml @@ -12,11 +12,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/80leadership_not_ordered/00-base.xml b/tests/dictionaries/80leadership_not_ordered/00-base.xml index 4f01b972..f5cce43e 100644 --- a/tests/dictionaries/80leadership_not_ordered/00-base.xml +++ b/tests/dictionaries/80leadership_not_ordered/00-base.xml @@ -14,11 +14,13 @@ - + valfill + follower1 - + follower1 + follower2 follower2 diff --git a/tests/dictionaries/80leadership_not_same_family/00-base.xml b/tests/dictionaries/80leadership_not_same_family/00-base.xml index cb55755a..6f5b92a8 100644 --- a/tests/dictionaries/80leadership_not_same_family/00-base.xml +++ b/tests/dictionaries/80leadership_not_same_family/00-base.xml @@ -16,11 +16,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/80leadership_notexists/00-base.xml b/tests/dictionaries/80leadership_notexists/00-base.xml index a1e0cdff..60410746 100644 --- a/tests/dictionaries/80leadership_notexists/00-base.xml +++ b/tests/dictionaries/80leadership_notexists/00-base.xml @@ -12,11 +12,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/80nil_with_value/00-base.xml b/tests/dictionaries/80nil_with_value/00-base.xml new file mode 100644 index 00000000..979b33a9 --- /dev/null +++ b/tests/dictionaries/80nil_with_value/00-base.xml @@ -0,0 +1,27 @@ + + + + + + non + + + + + + + + + value + mode_conteneur_actif + mode_conteneur_actif2 + afilllist + + + + diff --git a/tests/dictionaries/80nil_with_value/__init__.py b/tests/dictionaries/80nil_with_value/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80nil_with_value/errno_40 b/tests/dictionaries/80nil_with_value/errno_40 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80redefine_fillerror/00-base.xml b/tests/dictionaries/80redefine_fillerror/00-base.xml index 493cb616..2e2049b8 100644 --- a/tests/dictionaries/80redefine_fillerror/00-base.xml +++ b/tests/dictionaries/80redefine_fillerror/00-base.xml @@ -9,8 +9,9 @@ - + valeur + mode_conteneur_actif diff --git a/tests/dictionaries/80redefine_fillerror/01-base.xml b/tests/dictionaries/80redefine_fillerror/01-base.xml index 7be7528f..626ef87c 100644 --- a/tests/dictionaries/80redefine_fillerror/01-base.xml +++ b/tests/dictionaries/80redefine_fillerror/01-base.xml @@ -1,8 +1,9 @@ - + valeur + mode_conteneur_actif diff --git a/tests/dictionaries/80valid_entier_invalid_param/00-base.xml b/tests/dictionaries/80valid_entier_invalid_param/00-base.xml index feba4a36..3898a551 100644 --- a/tests/dictionaries/80valid_entier_invalid_param/00-base.xml +++ b/tests/dictionaries/80valid_entier_invalid_param/00-base.xml @@ -10,8 +10,9 @@ - + 0 + int diff --git a/tests/dictionaries/80valid_entier_not_number/00-base.xml b/tests/dictionaries/80valid_entier_not_number/00-base.xml index 9c527301..251e87d6 100644 --- a/tests/dictionaries/80valid_entier_not_number/00-base.xml +++ b/tests/dictionaries/80valid_entier_not_number/00-base.xml @@ -10,9 +10,10 @@ - + 0 100 + int diff --git a/tests/dictionaries/80valid_entier_without_param/00-base.xml b/tests/dictionaries/80valid_entier_without_param/00-base.xml index bba116f0..feccef2b 100644 --- a/tests/dictionaries/80valid_entier_without_param/00-base.xml +++ b/tests/dictionaries/80valid_entier_without_param/00-base.xml @@ -10,7 +10,9 @@ - + + int + - + @@ -45,17 +45,16 @@ - + - - + - + @@ -63,7 +62,7 @@ - + @@ -71,17 +70,17 @@ - + - + - + - + @@ -110,7 +109,7 @@ - + @@ -127,7 +126,7 @@ - + diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index d915c874..253382b8 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -43,7 +43,9 @@ UNREDEFINABLE = ('multi', 'type') # RougailObjSpace's elements that did not created automaticly FORCE_ELEMENTS = ('choice', 'property_', 'leadership', 'information') # XML text are convert has name -FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target') +FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value',) + +FORCE_TAG = {'family': 'variable'} # _____________________________________________________________________________ @@ -236,7 +238,8 @@ class RougailObjSpace: """ retrieves or creates Rougail Object Subspace objects """ - obj = getattr(self, child.tag) + tag = FORCE_TAG.get(child.tag, child.tag) + obj = getattr(self, tag) name = self._get_name(child, namespace) if Redefinable in obj.__mro__: return self.create_or_update_redefinable_object(xmlfile, @@ -314,8 +317,9 @@ class RougailObjSpace: # cannot redefine an inexistant object msg = _(f'Redefined object: "{name}" does not exist yet') raise DictConsistencyError(msg, 46, xmlfile) - if child.tag not in vars(space): - setattr(space, child.tag, {}) + tag = FORCE_TAG.get(child.tag, child.tag) + if tag not in vars(space): + setattr(space, tag, {}) return getattr(self, child.tag)(xmlfile, name) def get_existed_obj(self, @@ -328,7 +332,7 @@ class RougailObjSpace: """ if child.tag in ['variable', 'family']: name = normalize_family(name) - if isinstance(space, self.family): # pylint: disable=E1101 + if child.tag == 'variable': # pylint: disable=E1101 if namespace != Config['variable_namespace']: name = space.path + '.' + name if not self.paths.path_is_defined(name): @@ -340,7 +344,8 @@ class RougailObjSpace: raise DictConsistencyError(msg, 47, space.xmlfiles) return self.paths.get_variable(name) # it's not a family - children = getattr(space, child.tag, {}) + tag = FORCE_TAG.get(child.tag, child.tag) + children = getattr(space, tag, {}) if name in children: return children[name] return None @@ -458,7 +463,10 @@ class RougailObjSpace: """Fill self.paths attributes """ if isinstance(variableobj, self.variable): # pylint: disable=E1101 - family_name = normalize_family(document.attrib['name']) + if 'name' in document.attrib: + family_name = normalize_family(document.attrib['name']) + else: + family_name = namespace self.paths.add_variable(namespace, normalize_family(variableobj.name), namespace + '.' + family_name, @@ -485,9 +493,10 @@ class RougailObjSpace: variableobj.namespace = namespace if isinstance(variableobj, Redefinable): name = variableobj.name + tag = FORCE_TAG.get(child.tag, child.tag) if child.tag in ['family', 'variable']: name = normalize_family(name) - getattr(space, child.tag)[name] = variableobj + getattr(space, tag)[name] = variableobj elif isinstance(variableobj, UnRedefinable): getattr(space, child.tag).append(variableobj) else: diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index 698c7627..be06e9e7 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -62,11 +62,11 @@ class XMLReflector: try: document = parse(xmlfile) except XMLSyntaxError as err: - raise DictConsistencyError(_(f'not an XML file: {err}'), 52, xmlfile) from err + raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err if not self.dtd.validate(document): dtd_error = self.dtd.error_log.filter_from_errors()[0] msg = _(f'not a valid XML file: {dtd_error}') - raise DictConsistencyError(msg, 43, xmlfile) + raise DictConsistencyError(msg, 43, [xmlfile]) return document.getroot() @staticmethod diff --git a/tests/dictionaries/00empty/tiramisu/base.py b/tests/dictionaries/00empty/tiramisu/base.py index 2f801c40..f0778708 100644 --- a/tests/dictionaries/00empty/tiramisu/base.py +++ b/tests/dictionaries/00empty/tiramisu/base.py @@ -13,6 +13,5 @@ except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription option_2 = OptionDescription(name="tata", doc="tata", children=[]) -option_2.impl_set_information('manage', True) option_1 = OptionDescription(name="services", doc="services", children=[option_2], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01base_file_include/tiramisu/base.py b/tests/dictionaries/01base_file_include/tiramisu/base.py index 0df8f15d..311679a6 100644 --- a/tests/dictionaries/01base_file_include/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include/tiramisu/base.py @@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_patch/tiramisu/base.py b/tests/dictionaries/01base_file_patch/tiramisu/base.py index 0df8f15d..311679a6 100644 --- a/tests/dictionaries/01base_file_patch/tiramisu/base.py +++ b/tests/dictionaries/01base_file_patch/tiramisu/base.py @@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py index 07bcfaf3..39cdeedb 100644 --- a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py +++ b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py @@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="systemd_makefs@dev_disk_by\\x2dpartlabel", doc="systemd-makefs@dev-disk-by\\x2dpartlabel", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py index 337d191f..a9b12a7d 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py index 96c59b82..5c50c31d 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py index c169005c..e1ddbaed 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py index 01e8aac3..5e6ced41 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py index 674df539..d62efc9f 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py index e992c244..825becf9 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py index b099cb85..fc1335fc 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py index 547a9583..43ff6b21 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py @@ -26,6 +26,5 @@ option_15 = BoolOption(name="activate", doc="activate", default=True) option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) option_6 = OptionDescription(name="test", doc="test", children=[option_7]) -option_6.impl_set_information('manage', True) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 486a9947..19be003b 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_boolean/00-base.xml new file mode 100644 index 00000000..2e7aca5f --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/00-base.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + True + afilllist + + + + diff --git a/tests/dictionaries/70services_unmanage/__init__.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/__init__.py similarity index 100% rename from tests/dictionaries/70services_unmanage/__init__.py rename to tests/dictionaries/11disabled_if_in_filelist_boolean/__init__.py diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json new file mode 100644 index 00000000..2d49c86e --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": true, "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py new file mode 100644 index 00000000..d2ec032e --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py @@ -0,0 +1,29 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="group", doc="group", default="root") +option_9 = StrOption(name="mode", doc="mode", default="0644") +option_10 = StrOption(name="name", doc="name", default="/tmp/file1") +option_11 = StrOption(name="owner", doc="owner", default="root") +option_12 = StrOption(name="source", doc="source", default="file1") +option_13 = BoolOption(name="templating", doc="templating", default=True) +option_14 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)}))) +option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) 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 cde57edf..3aa56651 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) 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 08882174..e4aa43a4 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -35,6 +35,5 @@ option_24 = BoolOption(name="activate", doc="activate", default=Calculation(func option_17 = OptionDescription(name="file2", doc="file2", children=[option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_17]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 0dfdbff7..667e6465 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 0dfdbff7..667e6465 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index 8a25d6d4..01495ace 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index 4e5b6958..cfebd589 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -27,6 +27,5 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) 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 5f0c6bcc..db8148e9 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -26,6 +26,5 @@ option_15 = BoolOption(name="activate", doc="activate", default=False) option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) option_6 = OptionDescription(name="test", doc="test", children=[option_7]) -option_6.impl_set_information('manage', True) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/20notemplating/tiramisu/base.py b/tests/dictionaries/20notemplating/tiramisu/base.py index dc686986..ca14130a 100644 --- a/tests/dictionaries/20notemplating/tiramisu/base.py +++ b/tests/dictionaries/20notemplating/tiramisu/base.py @@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override/tiramisu/base.py b/tests/dictionaries/20override/tiramisu/base.py index 8cdb67b5..d8b52f16 100644 --- a/tests/dictionaries/20override/tiramisu/base.py +++ b/tests/dictionaries/20override/tiramisu/base.py @@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index c6ea2ee4..272306ac 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -30,6 +30,5 @@ option_19 = BoolOption(name="activate", doc="activate", default=True) option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19]) option_11 = OptionDescription(name="files", doc="files", children=[option_12]) option_10 = OptionDescription(name="test", doc="test", children=[option_11]) -option_10.impl_set_information('manage', True) option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9]) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py index d63bfaa4..19c6bc0b 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -30,6 +30,5 @@ option_19 = BoolOption(name="activate", doc="activate", default=True) option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19]) option_11 = OptionDescription(name="files", doc="files", children=[option_12]) option_10 = OptionDescription(name="test", doc="test", children=[option_11]) -option_10.impl_set_information('manage', True) option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9]) diff --git a/tests/dictionaries/45multi_family/00-base.xml b/tests/dictionaries/45multi_family/00-base.xml new file mode 100644 index 00000000..9870c76e --- /dev/null +++ b/tests/dictionaries/45multi_family/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/45multi_family/__init__.py b/tests/dictionaries/45multi_family/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/45multi_family/makedict/base.json b/tests/dictionaries/45multi_family/makedict/base.json new file mode 100644 index 00000000..536366a7 --- /dev/null +++ b/tests/dictionaries/45multi_family/makedict/base.json @@ -0,0 +1 @@ +{"rougail.base.subfamily.variable": null} diff --git a/tests/dictionaries/70services_unmanage/tiramisu/base.py b/tests/dictionaries/45multi_family/tiramisu/base.py similarity index 54% rename from tests/dictionaries/70services_unmanage/tiramisu/base.py rename to tests/dictionaries/45multi_family/tiramisu/base.py index a733bf70..9d00f696 100644 --- a/tests/dictionaries/70services_unmanage/tiramisu/base.py +++ b/tests/dictionaries/45multi_family/tiramisu/base.py @@ -12,10 +12,8 @@ try: except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) +option_4 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"})) +option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"normal"})) +option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[]) -option_5.impl_set_information('manage', False) -option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) -option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45multi_family_order/00-base.xml b/tests/dictionaries/45multi_family_order/00-base.xml new file mode 100644 index 00000000..7360ee0b --- /dev/null +++ b/tests/dictionaries/45multi_family_order/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/tests/dictionaries/45multi_family_order/__init__.py b/tests/dictionaries/45multi_family_order/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/45multi_family_order/makedict/base.json b/tests/dictionaries/45multi_family_order/makedict/base.json new file mode 100644 index 00000000..69da8f2d --- /dev/null +++ b/tests/dictionaries/45multi_family_order/makedict/base.json @@ -0,0 +1 @@ +{"rougail.variable1": null, "rougail.base.variable2": null, "rougail.base.subfamily.variable3": null, "rougail.base.variable4": null} diff --git a/tests/dictionaries/45multi_family_order/tiramisu/base.py b/tests/dictionaries/45multi_family_order/tiramisu/base.py new file mode 100644 index 00000000..ee00f16d --- /dev/null +++ b/tests/dictionaries/45multi_family_order/tiramisu/base.py @@ -0,0 +1,22 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_2 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal"})) +option_4 = StrOption(name="variable2", doc="variable2", properties=frozenset({"normal"})) +option_6 = StrOption(name="variable3", doc="variable3", properties=frozenset({"normal"})) +option_5 = OptionDescription(name="subfamily", doc="subfamily", children=[option_6], properties=frozenset({"normal"})) +option_7 = StrOption(name="variable4", doc="variable4", properties=frozenset({"normal"})) +option_3 = OptionDescription(name="base", doc="base", children=[option_4, option_5, option_7], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45without_family/00-base.xml b/tests/dictionaries/45without_family/00-base.xml new file mode 100644 index 00000000..d4970166 --- /dev/null +++ b/tests/dictionaries/45without_family/00-base.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/dictionaries/45without_family/__init__.py b/tests/dictionaries/45without_family/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/45without_family/makedict/base.json b/tests/dictionaries/45without_family/makedict/base.json new file mode 100644 index 00000000..1aa60ad0 --- /dev/null +++ b/tests/dictionaries/45without_family/makedict/base.json @@ -0,0 +1 @@ +{"rougail.variable": null} diff --git a/tests/dictionaries/45without_family/tiramisu/base.py b/tests/dictionaries/45without_family/tiramisu/base.py new file mode 100644 index 00000000..8adb1991 --- /dev/null +++ b/tests/dictionaries/45without_family/tiramisu/base.py @@ -0,0 +1,17 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_2 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/60extra_group/tiramisu/base.py b/tests/dictionaries/60extra_group/tiramisu/base.py index 532355e5..c13aad45 100644 --- a/tests/dictionaries/60extra_group/tiramisu/base.py +++ b/tests/dictionaries/60extra_group/tiramisu/base.py @@ -31,6 +31,5 @@ option_20 = BoolOption(name="activate", doc="activate", default=True) option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20]) option_12 = OptionDescription(name="files", doc="files", children=[option_13]) option_11 = OptionDescription(name="test", doc="test", children=[option_12]) -option_11.impl_set_information('manage', True) option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10]) diff --git a/tests/dictionaries/60extra_help/tiramisu/base.py b/tests/dictionaries/60extra_help/tiramisu/base.py index fe32ba0e..21ba425b 100644 --- a/tests/dictionaries/60extra_help/tiramisu/base.py +++ b/tests/dictionaries/60extra_help/tiramisu/base.py @@ -32,6 +32,5 @@ option_20 = BoolOption(name="activate", doc="activate", default=True) option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20]) option_12 = OptionDescription(name="files", doc="files", children=[option_13]) option_11 = OptionDescription(name="test", doc="test", children=[option_12]) -option_11.impl_set_information('manage', True) option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10]) diff --git a/tests/dictionaries/70container_files/tiramisu/base.py b/tests/dictionaries/70container_files/tiramisu/base.py index 194dfcfb..69a25f6b 100644 --- a/tests/dictionaries/70container_files/tiramisu/base.py +++ b/tests/dictionaries/70container_files/tiramisu/base.py @@ -33,6 +33,5 @@ option_22 = BoolOption(name="activate", doc="activate", default=True) option_15 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py index c4c7f9d6..0be03ee9 100644 --- a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py @@ -26,6 +26,5 @@ option_15 = BoolOption(name="activate", doc="activate", default=True) option_8 = OptionDescription(name="mailname", doc="mailname", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) option_6 = OptionDescription(name="test", doc="test", children=[option_7]) -option_6.impl_set_information('manage', True) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py index 00063e63..41ab17cb 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py @@ -28,6 +28,5 @@ option_17 = BoolOption(name="activate", doc="activate", default=True) option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py index ad5cbdaa..dac9f496 100644 --- a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py @@ -28,6 +28,5 @@ option_17 = BoolOption(name="activate", doc="activate", default=True) option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/70container_files_twice/tiramisu/base.py b/tests/dictionaries/70container_files_twice/tiramisu/base.py index f572c374..d2a16652 100644 --- a/tests/dictionaries/70container_files_twice/tiramisu/base.py +++ b/tests/dictionaries/70container_files_twice/tiramisu/base.py @@ -41,6 +41,5 @@ option_30 = BoolOption(name="activate", doc="activate", default=True) option_23 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_24, option_25, option_26, option_27, option_28, option_29, option_30]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15, option_23]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_filesmulti/tiramisu/base.py b/tests/dictionaries/70container_filesmulti/tiramisu/base.py index 3148b1bf..19597612 100644 --- a/tests/dictionaries/70container_filesmulti/tiramisu/base.py +++ b/tests/dictionaries/70container_filesmulti/tiramisu/base.py @@ -33,6 +33,5 @@ option_22 = BoolOption(name="activate", doc="activate", default=True) option_15 = OptionDescription(name="mailname2", doc="mailname2", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_filesredefine/tiramisu/base.py b/tests/dictionaries/70container_filesredefine/tiramisu/base.py index aa82cf4f..154f6af4 100644 --- a/tests/dictionaries/70container_filesredefine/tiramisu/base.py +++ b/tests/dictionaries/70container_filesredefine/tiramisu/base.py @@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname_new", doc="mailname.new", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_new/tiramisu/base.py b/tests/dictionaries/70container_new/tiramisu/base.py index 1d63ac77..f899d6b9 100644 --- a/tests/dictionaries/70container_new/tiramisu/base.py +++ b/tests/dictionaries/70container_new/tiramisu/base.py @@ -16,6 +16,5 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui" option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_5 = OptionDescription(name="test", doc="test", children=[]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_newnocont/tiramisu/base.py b/tests/dictionaries/70container_newnocont/tiramisu/base.py index f8a4fcf2..38e64569 100644 --- a/tests/dictionaries/70container_newnocont/tiramisu/base.py +++ b/tests/dictionaries/70container_newnocont/tiramisu/base.py @@ -16,6 +16,5 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non" option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_5 = OptionDescription(name="test", doc="test", children=[]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_newwithip/tiramisu/base.py b/tests/dictionaries/70container_newwithip/tiramisu/base.py index 505b95d3..6f246395 100644 --- a/tests/dictionaries/70container_newwithip/tiramisu/base.py +++ b/tests/dictionaries/70container_newwithip/tiramisu/base.py @@ -17,6 +17,5 @@ option_4 = IPOption(name="adresse_ip_test", doc="No change", allow_reserved=True option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_6 = OptionDescription(name="test", doc="test", children=[]) -option_6.impl_set_information('manage', True) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/70container_pathaccess/tiramisu/base.py b/tests/dictionaries/70container_pathaccess/tiramisu/base.py index 72c4263f..25c12451 100644 --- a/tests/dictionaries/70container_pathaccess/tiramisu/base.py +++ b/tests/dictionaries/70container_pathaccess/tiramisu/base.py @@ -24,6 +24,5 @@ option_13 = BoolOption(name="activate", doc="activate", default=True) option_9 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_10, option_11, option_12, option_13]) option_8 = OptionDescription(name="ips", doc="ips", children=[option_9]) option_7 = OptionDescription(name="nut", doc="nut", children=[option_8]) -option_7.impl_set_information('manage', True) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py b/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py index b3f13f23..1eb86e33 100644 --- a/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py +++ b/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py @@ -25,6 +25,5 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_10 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_11, option_12, option_13, option_14]) option_9 = OptionDescription(name="ips", doc="ips", children=[option_10]) option_8 = OptionDescription(name="ntp", doc="ntp", children=[option_9]) -option_8.impl_set_information('manage', True) option_7 = OptionDescription(name="services", doc="services", children=[option_8], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_7]) diff --git a/tests/dictionaries/70container_serviceaccess/tiramisu/base.py b/tests/dictionaries/70container_serviceaccess/tiramisu/base.py index 88962eae..a4583417 100644 --- a/tests/dictionaries/70container_serviceaccess/tiramisu/base.py +++ b/tests/dictionaries/70container_serviceaccess/tiramisu/base.py @@ -21,6 +21,5 @@ option_10 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="123", doc="123", children=[option_8, option_9, option_10]) option_6 = OptionDescription(name="ports", doc="ports", children=[option_7]) option_5 = OptionDescription(name="ntp", doc="ntp", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_servicerestriction/tiramisu/base.py b/tests/dictionaries/70container_servicerestriction/tiramisu/base.py index 7b307a0e..015197f3 100644 --- a/tests/dictionaries/70container_servicerestriction/tiramisu/base.py +++ b/tests/dictionaries/70container_servicerestriction/tiramisu/base.py @@ -22,6 +22,5 @@ option_11 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="192_168_1_1", doc="192.168.1.1", children=[option_8, option_9, option_10, option_11]) option_6 = OptionDescription(name="ips", doc="ips", children=[option_7]) option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[option_6]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_services/tiramisu/base.py b/tests/dictionaries/70container_services/tiramisu/base.py index c36ee703..20fd844f 100644 --- a/tests/dictionaries/70container_services/tiramisu/base.py +++ b/tests/dictionaries/70container_services/tiramisu/base.py @@ -16,6 +16,5 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui" option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[]) -option_5.impl_set_information('manage', True) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70services_unmanage/00-base.xml b/tests/dictionaries/70services_unmanage/00-base.xml deleted file mode 100644 index 15b0f914..00000000 --- a/tests/dictionaries/70services_unmanage/00-base.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/70services_unmanage/makedict/base.json b/tests/dictionaries/70services_unmanage/makedict/base.json deleted file mode 100644 index eb10bec4..00000000 --- a/tests/dictionaries/70services_unmanage/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "oui"} diff --git a/tests/dictionaries/80family_dynamic_with_family/00-base.xml b/tests/dictionaries/80family_dynamic_with_family/00-base.xml new file mode 100644 index 00000000..a74126d8 --- /dev/null +++ b/tests/dictionaries/80family_dynamic_with_family/00-base.xml @@ -0,0 +1,16 @@ + + + + + + + val1 + val2 + + + + + + + + diff --git a/tests/dictionaries/80family_dynamic_with_family/__init__.py b/tests/dictionaries/80family_dynamic_with_family/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_dynamic_with_family/errno_2 b/tests/dictionaries/80family_dynamic_with_family/errno_2 new file mode 100644 index 00000000..e69de29b From 5f760655971a912667ebc91276dee0d40fc411ea Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 12 Feb 2021 18:08:28 +0100 Subject: [PATCH 102/168] better support type in params --- doc/README.md | 7 +- doc/check/README.md | 2 +- doc/condition.rst | 3 + doc/family/auto.md | 3 +- doc/family/simple.md | 19 ++- doc/fill/README.md | 2 +- doc/service/README.md | 5 - doc/service/file.md | 153 ++++++++++++++++-- doc/service/override.md | 36 ++++- doc/service/port.md | 62 ++++++- doc/variable/simple.md | 11 +- doc/variables.md | 4 +- src/rougail/annotator/check.py | 37 ++--- src/rougail/annotator/condition.py | 27 ++-- src/rougail/annotator/param.py | 25 ++- src/rougail/annotator/variable.py | 4 +- src/rougail/data/rougail.dtd | 4 +- src/rougail/objspace.py | 34 ++-- src/rougail/template.py | 2 +- src/rougail/tiramisureflector.py | 87 +++++----- .../01base_file_include/makedict/base.json | 2 +- .../01base_file_include/tiramisu/base.py | 2 +- .../01base_file_patch/makedict/base.json | 2 +- .../01base_file_patch/tiramisu/base.py | 2 +- .../01base_file_utfchar/makedict/base.json | 2 +- .../01base_file_utfchar/tiramisu/base.py | 2 +- tests/dictionaries/10check_option/00-base.xml | 2 +- .../10check_option/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 +- .../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 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 24 +++ .../__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 29 ++++ .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../makedict/base.json | 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 +- tests/dictionaries/20notemplating/00-base.xml | 2 +- .../20notemplating/makedict/base.json | 2 +- .../20notemplating/tiramisu/base.py | 2 +- .../20override/makedict/base.json | 2 +- .../dictionaries/20override/tiramisu/base.py | 2 +- .../20override_no_templating/00-base.xml | 19 +++ .../20override_no_templating/__init__.py | 0 .../makedict/base.json | 1 + .../system/test.service.d/rougail.conf | 1 + .../20override_no_templating/tiramisu/base.py | 29 ++++ .../tmpl/test.service | 1 + .../20override_source/00-base.xml | 19 +++ .../20override_source/__init__.py | 0 .../20override_source/makedict/base.json | 1 + .../system/test.service.d/rougail.conf | 1 + .../20override_source/tiramisu/base.py | 29 ++++ .../20override_source/tmpl/test2.service | 1 + .../40ifin_leadershipauto/makedict/base.json | 2 +- .../40ifin_leadershipauto/tiramisu/base.py | 2 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- .../60extra_group/makedict/base.json | 2 +- .../60extra_group/tiramisu/base.py | 2 +- .../60extra_help/makedict/base.json | 2 +- .../60extra_help/tiramisu/base.py | 2 +- .../70container_files/makedict/base.json | 2 +- .../70container_files/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 +- .../70container_files_twice/tiramisu/base.py | 6 +- .../70container_filesmulti/makedict/base.json | 2 +- .../70container_filesmulti/tiramisu/base.py | 4 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 2 +- 105 files changed, 615 insertions(+), 216 deletions(-) create mode 100644 tests/dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml create mode 100644 tests/dictionaries/11disabled_if_in_filelist_boolean2/__init__.py create mode 100644 tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json create mode 100644 tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py create mode 100644 tests/dictionaries/20override_no_templating/00-base.xml create mode 100644 tests/dictionaries/20override_no_templating/__init__.py create mode 100644 tests/dictionaries/20override_no_templating/makedict/base.json create mode 100644 tests/dictionaries/20override_no_templating/result/systemd/system/test.service.d/rougail.conf create mode 100644 tests/dictionaries/20override_no_templating/tiramisu/base.py create mode 100644 tests/dictionaries/20override_no_templating/tmpl/test.service create mode 100644 tests/dictionaries/20override_source/00-base.xml create mode 100644 tests/dictionaries/20override_source/__init__.py create mode 100644 tests/dictionaries/20override_source/makedict/base.json create mode 100644 tests/dictionaries/20override_source/result/systemd/system/test.service.d/rougail.conf create mode 100644 tests/dictionaries/20override_source/tiramisu/base.py create mode 100644 tests/dictionaries/20override_source/tmpl/test2.service diff --git a/doc/README.md b/doc/README.md index aa4bb4ca..7289514c 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,5 +1,10 @@ # Rougail +## Les dictionnaires + +FIXME : explications +FIXME : extra + ## Les variables - [Les familles](family/README.md) @@ -7,8 +12,6 @@ ## Les services - - [Les services](service/README.md) - - [La gestion d'un service](service/service.md) - [La gestion d'un fichier](service/file.md) - [La gestion d'un fichier de service systemd](service/override.md) - [La gestion d'un port](service/port.md) diff --git a/doc/check/README.md b/doc/check/README.md index a05c5ed4..64ca66d3 100644 --- a/doc/check/README.md +++ b/doc/check/README.md @@ -1,7 +1,7 @@ # Les vérifications des valeurs - [Fonction de vérification](function.md) - - [Cible de la fonction](../target/only_var.md) + - [Cible de la fonction](../target/variable.md) - [Paramètre de la fonction](../param/README.md) - [Réfinition](redefine.md) diff --git a/doc/condition.rst b/doc/condition.rst index 12542ce6..4790927a 100644 --- a/doc/condition.rst +++ b/doc/condition.rst @@ -8,3 +8,6 @@ FIXME + + +on peut mettre plusieurs param (oui ou maybe) diff --git a/doc/family/auto.md b/doc/family/auto.md index a160285e..a5dc7819 100644 --- a/doc/family/auto.md +++ b/doc/family/auto.md @@ -1,6 +1,6 @@ # Famille crée dynamiquement -Pour créer une famille dynamiquement, il faut créer une family fictive lié à une variable. +Pour créer une famille dynamiquement, il faut créer une famille fictive lié à une variable. Le nom et la description de la famille et des variables qu'elle contient sera en réalité le prefix du nouveau nom/description. Le suffix viendra de la variable liée. Par exemple : @@ -27,3 +27,4 @@ Dans la famille dynamique "my_dyn_family_val1" on retrouvera une variable "my_dy Bien évidement si le contenu de "varname" venait a évolué, de nouvelles familles dynamiques pouvent apparaitre ou des familles dynamiques peuvent disparaître. +Attention la variable lié à la famille doit être obligatoirement une variable multiple et il n'est pas possible de mettre une famille dans une famille dynamique. diff --git a/doc/family/simple.md b/doc/family/simple.md index 11f62ffe..c786aaf9 100644 --- a/doc/family/simple.md +++ b/doc/family/simple.md @@ -1,6 +1,6 @@ # Une famille -Une famille est un [conteneur de variables](../variables.md). +Une famille est un conteneur de variables. Elle peut contenir également des familles. Pour décrire une famille il faut mettre au minimum un nom : @@ -16,6 +16,17 @@ Cette famille doit être placé dans une balise [variables](../variables.md) : ``` +Ou dans une autre famille : + +``` + + + + + + +Attention, il famille vide sera automatiquement supprimée. + ## Description et aide de la famille En plus d'un nom, il est possible de mettre une "description" à la famille. C'est une information "utilisateur" qui nous permettra d'avoir des informations complémentaires sur le contenu de cette famille : @@ -32,9 +43,9 @@ En plus de la description, il est possible de préciser une aide complémentaire ## Mode de la famille -Le [mode](../mode.md) par défaut d'une famille correspond au [mode](../mode.md) le plus petite des variables dans cette famille. +Le [mode](../mode.md) par défaut d'une famille correspond au [mode](../mode.md) le plus petite des variables ou des familles qui sont contenu dans cette famille. -Changer le [mode](../mode.md) d'une famille permet de définir le [mode](../mode.md) par défaut des variables inclusent dans cette famille. +Changer le [mode](../mode.md) d'une famille permet de définir le [mode](../mode.md) par défaut des variables ou des familles inclusent dans cette famille. Pour définir le [mode](../mode.md) : @@ -44,7 +55,7 @@ Pour définir le [mode](../mode.md) : ## Famille invisible -Il est possible de cacher une famille, ainsi toutes les variables inclusent dans cette famille. +Il est possible de cacher une famille, ainsi toutes les variables et des familles inclusent dans cette famille. Cacher une famille signifie qu'elle ne sera pas visible lorsqu'on modifie la configuration du service. Par contre ces variables sont accessibles lorsqu'on va utiliser ces variables. diff --git a/doc/fill/README.md b/doc/fill/README.md index 1b29ac11..ea20a1df 100644 --- a/doc/fill/README.md +++ b/doc/fill/README.md @@ -3,6 +3,6 @@ Une variable calculée est une variable donc sa valeur est le résultat d'une fonction python. - [Valeur calculée de la variable](value.md) - - [Cible de la fonction](../target/only_var.md) + - [Cible de la fonction](../target/variable.md) - [Paramètre de la fonction](../param/README.md) - [Réfinition](redefine.md) diff --git a/doc/service/README.md b/doc/service/README.md index fbc65d2f..227a42cd 100644 --- a/doc/service/README.md +++ b/doc/service/README.md @@ -1,9 +1,4 @@ # Les services - - - - - diff --git a/doc/service/file.md b/doc/service/file.md index 5f4b322f..55369f80 100644 --- a/doc/service/file.md +++ b/doc/service/file.md @@ -1,18 +1,143 @@ -# Fichier +# La gestion d'un fichier -FIXME +## La balise file +La gestion des fichiers se fait dans un conteneur de [service](service.md). - - - - - - - - - - - - +La déclaration du fichier met de générer un fichier à partir d'un template pour le déposer à l'endroit prévu dans la déclaration de cette élément. +Il est nécessaire, au minimum, de spécifier le chemin complet du fichier : + +``` + + + + + +``` + +Dans ce cas, le nom du template est déduit du nom du fichier, ici ca sera "squid.conf". + +Si le template a un nom différent (par exemple si plusieurs template se retrouve avec le même nom), il est possible de changer le nom du template avec l'attribut source : + +``` + +``` + +## Les noms de fichiers dynamique + +Il est possible également de définir le nom du fichier dans une variable : + +``` + + + + + + + + /etc/squid/squid.conf + + +``` + +Dans le cas des fichiers dynamique, la source est obligatoire. + +Et même de définir une variable de type multiple, ce qui génèrera plusiers fichiers : + +``` + + + + + + + + /etc/squid1/squid.conf + /etc/squid2/squid.conf + + +``` + +Dans ce cas là, le fichier source est identique mais les fichiers de destination seront différent. + +Il peut être important de personnaliser le contenu du fichier suivant le fichier de destination. +Dans ce cas il y a deux possibilités : + +- la variable "rougail_filename" contient le nom de fichier de destination +- l'utilisateur de l'attribut "variable" + +En effet, il est possible de passer le contenu d'une variable au template : + +``` + + + + + + + + /etc/squid1/squid.conf + /etc/squid2/squid.conf + + + squid1 + squid2 + + +``` + +Dans ce cas, lors de la génération du fichier /etc/squid1/squid.conf on retrouvera la variable "rougail_variable" avec la valeur "squid1" et le fichier /etc/squid2/squid.conf on retrouvera la variable "rougail_variable" avec la valeur "squid2". + +Attention : les deux variables "my_variable1" et "my_variable2" doivent être multiple et de même longueur. + +## Les droits des fichiers + +Par défaut les droits du fichier généré sont "0644" avec comme utilisateur "root" et groupe "root". + +``` + +``` + +## Désactiver la génération d'un fichier + +Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise fichier : + +``` + + + + + + + + + + + + + False + squid + + +``` + +Dans ce cas, tous les fichiers avec un attribut filelist à "squid" seront désactivé si la variable "condition" est False. + +## Redéfinir une fichier + +Il est possible de redéfinir les éléments d'un fichier dans un dictionnaire différent en utilisant l'attribut redefine : + +``` + +``` + +## Choix du moteur de templating + +Par défaut, le moteur de templating est le moteur de templating compatible avec "creole". + +Aujourd'hui il est possible de désactiver la templatisation du fichier (il sera alors uniquement copié) : + +``` + +``` diff --git a/doc/service/override.md b/doc/service/override.md index e276eb55..d071982a 100644 --- a/doc/service/override.md +++ b/doc/service/override.md @@ -1,7 +1,35 @@ # Override -FIXME +## La balise override - - - +La balise override permet de redéfinir facilement un service systemd. + +Il suffit d'avoir un template dont le nom est par défaut le nom du service avec l'extension "service" et de déclarer la balise : + +``` + + + + + +``` + +Dans cette exemple, le template associé doit s'appeler squid.service + +Si le fichier service a un nom différent (par exemple si plusieurs template se retrouve avec le même nom), il est possible de changer le nom du template avec l'attribut source : + +``` + +``` + +Dans ce cas le fichier de destination aura le même nom. + +## Choix du moteur de templating + +Par défaut, le moteur de templating est le moteur de templating compatible avec "creole". + +Aujourd'hui il est possible de désactiver la templatisation du fichier (il sera alors uniquement copié) : + +``` + +``` diff --git a/doc/service/port.md b/doc/service/port.md index 471e7fba..0dc7f840 100644 --- a/doc/service/port.md +++ b/doc/service/port.md @@ -1,7 +1,61 @@ # Port - - - - +## La balise port +La balise port permet d'associer un port à service : + +``` + + + 3128 + + +``` + +Il est possible de choisir le protocole TCP ou UDP (TCP par défaut) : + +``` +123 +``` + +## Les numéros de port dynamique + +Il est possible également de définir le port dans une variable : + +``` + + + my_variable + + + + + 123 + + +``` + +## Désactiver le port + +Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise port : + +``` + + + 3128 + + + + + + + + + + False + squid + + +``` + +Dans ce cas, tous les ports avec un attribut portlist à "squid" seront désactivé si la variable "condition" est False. diff --git a/doc/variable/simple.md b/doc/variable/simple.md index df01decd..4ac5a286 100644 --- a/doc/variable/simple.md +++ b/doc/variable/simple.md @@ -2,12 +2,17 @@ ## Un variable -Une variable est forcement dans une [famille](../family/README.md). Il faut donc déjà avoir créer une [famille](../family/README.md). +Une variable est forcement dans [variables](../variables.md) ou dans une [famille](../family/README.md). Une variable est déjà un nom. C'est à dire qu'on pourra utiliser plus tard la variable via ce nom. ``` - + + + + + + ``` ## Description et aide sur la variable @@ -73,6 +78,8 @@ Pour définir une variable à valeur multiple : Le [mode](../mode.md) par défaut d'une variable correspond au [mode](../mode.md) de la [famille](../family/README.md). +Si la variable n'est pas dans une famille, la variable aura le mode "normal" par défaut. + Pour définir le [mode](../mode.md) : ``` diff --git a/doc/variables.md b/doc/variables.md index 6b95be14..b54758af 100644 --- a/doc/variables.md +++ b/doc/variables.md @@ -1,6 +1,8 @@ # Le conteneur des variables -La balise "variables" est le conteneur de l'ensemble des [familles](family/README.md) dans laquelle on pourra placer des [variables](variable/README.md) : +La balise "variables" est le conteneur de l'ensemble des [familles](family/README.md) et des [variables](variable/README.md). + +Il est placé à la racine du dictionnaire : ``` diff --git a/src/rougail/annotator/check.py b/src/rougail/annotator/check.py index bf3a3a96..2cc5e220 100644 --- a/src/rougail/annotator/check.py +++ b/src/rougail/annotator/check.py @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from typing import List, Any -from .variable import CONVERT_OPTION from .target import TargetAnnotator from .param import ParamAnnotator @@ -61,6 +60,17 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): self.convert_check() del objectspace.space.constraints.check + def valid_type_validation(self, + obj, + ) -> None: + variable_type = None + if obj.name == 'valid_enum': + for target in obj.target: + if variable_type and target.name.type != variable_type: + raise Exception('pfff') + variable_type = target.name.type + return variable_type + def check_check(self): # pylint: disable=R0912 """valid and manage """ @@ -119,7 +129,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): variable.mandatory = True # build choice variable.values = [] - variable_type = variable.type + variable.ori_type = variable.type variable.type = 'choice' has_variable = False @@ -129,7 +139,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): msg = _(f'only one "variable" parameter is allowed for valid_enum ' f'of variable "{variable.name}"') raise DictConsistencyError(msg, 5, param.xmlfiles) - param_type = variable_type + param_type = variable.ori_type if param.type == 'variable': has_variable = True if param.optional is True: @@ -141,24 +151,9 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): f'of variable "{variable.name}"') raise DictConsistencyError(msg, 6, param.xmlfiles) param_type = 'calculation' - value = param.text - elif param.type == 'nil': - value = None - else: - if 'type' in vars(param) and variable_type != param.type: - msg = _(f'parameter in valid_enum has incompatible type "{param.type}" ' - f'with type of the variable "{variable.name}" ("{variable_type}")') - raise DictConsistencyError(msg, 7, param.xmlfiles) - if hasattr(param, 'text'): - try: - value = CONVERT_OPTION[variable_type].get('func', str)(param.text) - except ValueError as err: - msg = _(f'unable to change type of a valid_enum entry "{param.text}" ' - f'is not a valid "{variable_type}" for "{variable.name}"') - raise DictConsistencyError(msg, 13, variable.xmlfiles) from err - values.append(value) + values.append(param.text) choice = self.objectspace.choice(variable.xmlfiles) - choice.name = value + choice.name = param.text choice.type = param_type variable.values.append(choice) @@ -166,7 +161,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): return None for target in check.target: - self.objectspace.valid_enums[target.name.path] = {'type': variable_type, + self.objectspace.valid_enums[target.name.path] = {'type': variable.ori_type, 'values': values, 'xmlfiles': check.xmlfiles, } diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 31567c89..21b1ed19 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -54,15 +54,22 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): self.target_is_uniq = False self.only_variable = False self.convert_target(self.objectspace.space.constraints.condition) + self.check_condition_fallback() + self.convert_condition_source() self.convert_param(self.objectspace.space.constraints.condition) self.check_source_target() - self.check_condition_fallback() self.convert_xxxlist() - self.convert_condition_source() self.check_choice_option_condition() self.remove_condition_with_empty_target() self.convert_condition() + def valid_type_validation(self, + obj, + ) -> None: + if obj.source.type == 'choice': + return obj.source.ori_type + return obj.source.type + def convert_auto_freeze(self): """convert auto_freeze only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen @@ -101,9 +108,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): for condition in self.objectspace.space.constraints.condition: for target in condition.target: if target.type == 'variable' and \ - condition.source in [target.name.name, target.name.path]: + condition.source.path == target.name.path: msg = _('target name and source name must be different: ' - f'{condition.source}') + f'{condition.source.path}') raise DictConsistencyError(msg, 11, condition.xmlfiles) def check_condition_fallback(self): @@ -242,11 +249,12 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): param3 = self.objectspace.param(target.xmlfiles) param3.name = f'condition_{fill.index}' param3.type = 'variable' - param3.text = condition.source + param3.text = condition.source.path fill.param.append(param3) param4 = self.objectspace.param(target.xmlfiles) param4.name = f'expected_{fill.index}' param4.text = values + param4.type = condition.param[0].type fill.param.append(param4) if condition.name != 'disabled_if_in': param5 = self.objectspace.param(target.xmlfiles) @@ -314,7 +322,6 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): for condition in self.objectspace.space.constraints.condition: actions = self.get_actions_from_condition(condition.name) for param in condition.param: - text = getattr(param, 'text', None) for target in condition.target: leader_or_variable, variables = self._get_family_variables_from_target(target) # if option is already disable, do not apply disable_if_in @@ -324,7 +331,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): if getattr(leader_or_variable, main_action, False) is True: continue self.build_property(leader_or_variable, - text, + param, condition, main_action, ) @@ -336,14 +343,14 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): # other actions are set to the variable or children of family for variable in variables: self.build_property(variable, - text, + param, condition, action, ) def build_property(self, obj, - text: Any, + param: 'self.objectspace.param', condition: 'self.objectspace.condition', action: str, ) -> 'self.objectspace.property_': @@ -353,7 +360,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): prop.type = 'calculation' prop.inverse = condition.name.endswith('_if_not_in') prop.source = condition.source - prop.expected = text + prop.expected = param prop.name = action if not hasattr(obj, 'properties'): obj.properties = [] diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index 079f6082..aa7545d0 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -24,11 +24,18 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +from .variable import CONVERT_OPTION + from ..i18n import _ from ..error import DictConsistencyError class ParamAnnotator: + def valid_type_validation(self, + obj, + ) -> None: + return None + def convert_param(self, objects) -> None: """ valid and convert param """ @@ -36,6 +43,7 @@ class ParamAnnotator: if not hasattr(obj, 'param'): continue param_to_delete = [] + variable_type = self.valid_type_validation(obj) for param_idx, param in enumerate(obj.param): if param.type == 'suffix': if hasattr(param, 'text'): @@ -50,15 +58,18 @@ class ParamAnnotator: if not param.type == 'nil': msg = _(f'"{param.type}" parameter must have a value') raise DictConsistencyError(msg, 27, obj.xmlfiles) + param.text = None elif param.type == 'nil': msg = _(f'"{param.type}" parameter must not have a value') raise DictConsistencyError(msg, 40, obj.xmlfiles) - if param.type == 'variable': + elif param.type == 'variable': try: path, suffix = self.objectspace.paths.get_variable_path(param.text, obj.namespace, ) param.text = self.objectspace.paths.get_variable(path) + if variable_type and param.text.type != variable_type: + raise Exception('pfff', variable_type, param.text.type) if suffix: param.suffix = suffix family_path = self.objectspace.paths.get_variable_family_path(path) @@ -69,6 +80,18 @@ class ParamAnnotator: if err.errno != 42 or not param.optional: raise err param_to_delete.append(param_idx) + elif variable_type: + if 'type' in vars(param) and variable_type != param.type: + msg = _(f'parameter has incompatible type "{param.type}" ' + f'with type "{variable_type}")') + raise DictConsistencyError(msg, 7, param.xmlfiles) + try: + param.text = CONVERT_OPTION[variable_type].get('func', str)(param.text) + except ValueError as err: + msg = _(f'unable to change type of "{param.text}" ' + f'is not a valid "{variable_type}"') + raise DictConsistencyError(msg, 13, param.xmlfiles) from err + param.type = variable_type param_to_delete.sort(reverse=True) for param_idx in param_to_delete: obj.param.pop(param_idx) diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 246c00e1..379d5001 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -25,6 +25,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +from ..objspace import convert_boolean + CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), 'float': dict(opttype="FloatOption", func=float), @@ -32,7 +34,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), 'string': dict(opttype="StrOption"), 'password': dict(opttype="PasswordOption"), 'mail': dict(opttype="EmailOption"), - 'boolean': dict(opttype="BoolOption"), + 'boolean': dict(opttype="BoolOption", func=convert_boolean), 'symlink': dict(opttype="SymLinkOption"), 'filename': dict(opttype="FilenameOption"), 'date': dict(opttype="DateOption"), diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 730d3464..d5f6fc39 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -72,11 +72,11 @@ - + - + diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 253382b8..9cfe6803 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -85,6 +85,16 @@ class ObjSpace: # pylint: disable=R0903 """ +def convert_boolean(value: str) -> bool: + """Boolean coercion. The Rougail XML may contain srings like `True` or `False` + """ + if isinstance(value, bool): + return value + if value == 'True': + return True + return False + + class RougailObjSpace: """Rougail ObjectSpace is an object's reflexion of the XML elements """ @@ -127,7 +137,7 @@ class RougailObjSpace: # set default value for this attribute default_value = dtd_attr.default_value if dtd_attr.name in self.booleans_attributs: - default_value = self.convert_boolean(default_value) + default_value = convert_boolean(default_value) attrs[dtd_attr.name] = default_value if dtd_attr.name == 'redefine': # has a redefine attribute, so it's a Redefinable object @@ -292,7 +302,7 @@ class RougailObjSpace: # if redefine is set to object, default value is False # otherwise it's always a redefinable object default_redefine = child.tag in FORCE_REDEFINABLES - redefine = self.convert_boolean(subspace.get('redefine', default_redefine)) + redefine = convert_boolean(subspace.get('redefine', default_redefine)) if redefine is True: if isinstance(existed_var, self.variable): # pylint: disable=E1101 if namespace == Config['variable_namespace']: @@ -301,18 +311,18 @@ class RougailObjSpace: redefine_variables.append(space.path + '.' + name) existed_var.xmlfiles.append(xmlfile) return existed_var - exists = self.convert_boolean(subspace.get('exists', True)) + exists = convert_boolean(subspace.get('exists', True)) if exists is False: raise SpaceObjShallNotBeUpdated() msg = _(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", ' f'already defined') raise DictConsistencyError(msg, 45, existed_var.xmlfiles) # object deos not exists - exists = self.convert_boolean(subspace.get('exists', False)) + exists = convert_boolean(subspace.get('exists', False)) if exists is True: # manage object only if already exists, so cancel raise SpaceObjShallNotBeUpdated() - redefine = self.convert_boolean(subspace.get('redefine', False)) + redefine = convert_boolean(subspace.get('redefine', False)) if redefine is True: # cannot redefine an inexistant object msg = _(f'Redefined object: "{name}" does not exist yet') @@ -350,16 +360,6 @@ class RougailObjSpace: return children[name] return None - @staticmethod - def convert_boolean(value: str) -> bool: - """Boolean coercion. The Rougail XML may contain srings like `True` or `False` - """ - if isinstance(value, bool): - return value - if value == 'True': - return True - return False - def set_text(self, child, variableobj, @@ -379,7 +379,7 @@ class RougailObjSpace: ): """ set attributes to an object """ - redefine = self.convert_boolean(child.attrib.get('redefine', False)) + redefine = convert_boolean(child.attrib.get('redefine', False)) if redefine and child.tag == 'variable': # delete old values has_value = hasattr(variableobj, 'value') @@ -391,7 +391,7 @@ class RougailObjSpace: f' in "{xmlfile}", already defined') raise DictConsistencyError(msg, 48, variableobj.xmlfiles[:-1]) if attr in self.booleans_attributs: - val = self.convert_boolean(val) + val = convert_boolean(val) if attr == 'name' and getattr(variableobj, 'name', None): # do not redefine name continue diff --git a/src/rougail/template.py b/src/rougail/template.py index 9badfd50..8fdbb49b 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -332,7 +332,7 @@ class CreoleTemplateEngine: else: var = None source = join(tmp_dir, filevar['source']) - if filevar['templating']: + if filevar['templating'] == 'creole': self.process(source, filename, destfilename, diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 140375ef..87361531 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -215,15 +215,8 @@ class Common: """Populate properties """ option_name = child.source.reflector_object.get() - kwargs = f"'condition': ParamOption({option_name}, todict=True), " - if child.expected is None or isinstance(child.expected, int): - kwargs += f"'expected': ParamValue({child.expected})" - elif isinstance(child.expected, str): - val = self.convert_str(child.expected) - kwargs += f"'expected': ParamValue({val})" - else: - val = child.expected.reflector_object.get() - kwargs += f"'expected': ParamOption({val})" + kwargs = (f"'condition': ParamOption({option_name}, todict=True), " + f"'expected': {self.populate_param(child.expected)}") if child.inverse: kwargs += ", 'reverse_condition': ParamValue(True)" return (f"Calculation(func.calc_value, Params(ParamValue('{child.name}'), " @@ -241,6 +234,40 @@ class Common: value = self.convert_str(value) self.text.append(f"{self.option_name}.impl_set_information('{key}', {value})") + def populate_param(self, + param, + ): + """Populate variable parameters + """ + if param.type in ['number', 'boolean', 'nil', 'string']: + value = param.text + if param.type == 'string' and value is not None: + value = self.convert_str(value) + return f'ParamValue({value})' + if param.type == 'variable': + return self.build_option_param(param) + if param.type == 'information': + return f'ParamInformation("{param.text}", None)' + if param.type == 'suffix': + return 'ParamSuffix()' + raise Exception(f'unknown type {param.type}') # pragma: no cover + + @staticmethod + def build_option_param(param, + ) -> str: + """build variable parameters + """ + option_name = param.text.reflector_object.get() + params = [f'{option_name}'] + if hasattr(param, 'suffix'): + param_type = 'ParamDynOption' + params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}']) + else: + param_type = 'ParamOption' + if not param.propertyerror: + params.append('notraisepropertyerror=True') + return "{}({})".format(param_type, ', '.join(params)) + class Variable(Common): """Manage variable @@ -297,7 +324,7 @@ class Variable(Common): function = child.name if hasattr(child, 'param'): for param in child.param: - value = self.populate_param(function, param) + value = self.populate_param(param) if not hasattr(param, 'name'): args.append(str(value)) else: @@ -310,46 +337,6 @@ class Variable(Common): ret += f', warnings_only={child.warnings_only}' return ret + ')' - def populate_param(self, - function: str, - param, - ): - """Populate variable parameters - """ - if param.type == 'string': - value = param.text - if value is not None: - value = self.convert_str(value) - return f"ParamValue({value})" - if param.type in ['number', 'boolean']: - return f'ParamValue({param.text})' - if param.type == 'nil': - return 'ParamValue(None)' - if param.type == 'variable': - return self.build_param(param, function) - if param.type == 'information': - return f'ParamInformation("{param.text}", None)' - if param.type == 'suffix': - return 'ParamSuffix()' - raise Exception(f'unknown type {param.type}') # pragma: no cover - - @staticmethod - def build_param(param, - function: str, # pylint: disable=W0613 - ) -> str: - """build variable parameters - """ - option_name = param.text.reflector_object.get() - params = [f'{option_name}'] - if hasattr(param, 'suffix'): - param_type = 'ParamDynOption' - params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}']) - else: - param_type = 'ParamOption' - if not param.propertyerror: - params.append('notraisepropertyerror=True') - return "{}({})".format(param_type, ', '.join(params)) - class Family(Common): """Manage family diff --git a/tests/dictionaries/01base_file_include/makedict/base.json b/tests/dictionaries/01base_file_include/makedict/base.json index ce547e52..145ff249 100644 --- a/tests/dictionaries/01base_file_include/makedict/base.json +++ b/tests/dictionaries/01base_file_include/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "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": true} +{"rougail.general.mode_conteneur_actif": "non", "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": "creole", "services.test.files.file.activate": true} diff --git a/tests/dictionaries/01base_file_include/tiramisu/base.py b/tests/dictionaries/01base_file_include/tiramisu/base.py index 311679a6..79179b1a 100644 --- a/tests/dictionaries/01base_file_include/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/file") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) diff --git a/tests/dictionaries/01base_file_patch/makedict/base.json b/tests/dictionaries/01base_file_patch/makedict/base.json index ce547e52..145ff249 100644 --- a/tests/dictionaries/01base_file_patch/makedict/base.json +++ b/tests/dictionaries/01base_file_patch/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "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": true} +{"rougail.general.mode_conteneur_actif": "non", "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": "creole", "services.test.files.file.activate": true} diff --git a/tests/dictionaries/01base_file_patch/tiramisu/base.py b/tests/dictionaries/01base_file_patch/tiramisu/base.py index 311679a6..79179b1a 100644 --- a/tests/dictionaries/01base_file_patch/tiramisu/base.py +++ b/tests/dictionaries/01base_file_patch/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/file") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) diff --git a/tests/dictionaries/01base_file_utfchar/makedict/base.json b/tests/dictionaries/01base_file_utfchar/makedict/base.json index 8dc1e947..7ac3705f 100644 --- a/tests/dictionaries/01base_file_utfchar/makedict/base.json +++ b/tests/dictionaries/01base_file_utfchar/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.templating": true, "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.templating": "creole", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true} diff --git a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py index 39cdeedb..edf414c9 100644 --- a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py +++ b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/systemd-makefs@dev-disk-by\\x2dpartlabel") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="systemd-makefs@dev-disk-by\\x2dpartlabel") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="systemd_makefs@dev_disk_by\\x2dpartlabel", doc="systemd-makefs@dev-disk-by\\x2dpartlabel", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) diff --git a/tests/dictionaries/10check_option/00-base.xml b/tests/dictionaries/10check_option/00-base.xml index f92370bf..58550eee 100644 --- a/tests/dictionaries/10check_option/00-base.xml +++ b/tests/dictionaries/10check_option/00-base.xml @@ -14,7 +14,7 @@ - 0 + 0 int2 int diff --git a/tests/dictionaries/10check_option/tiramisu/base.py b/tests/dictionaries/10check_option/tiramisu/base.py index 3be48e24..b6ac74dc 100644 --- a/tests/dictionaries/10check_option/tiramisu/base.py +++ b/tests/dictionaries/10check_option/tiramisu/base.py @@ -14,7 +14,7 @@ except: from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"})) option_4 = IntOption(name="int2", doc="No change", default=100, properties=frozenset({"mandatory", "normal"})) -option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption()), kwargs={'mini': ParamValue("0"), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"})) +option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption()), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json index 77bac874..62d0da02 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "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": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "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": "creole", "services.test.files.file1.activate": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py index a9b12a7d..3be43a0d 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json index 6cf6e009..2261fd96 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "no", "rougail.general.test_variable": "no", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true} +{"rougail.general.condition": "no", "rougail.general.condition2": "no", "rougail.general.test_variable": "no", "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": "creole", "services.test.files.file1.activate": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py index 5c50c31d..63bf2ed8 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json index 0fd7d633..4bd559bd 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "no", "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} +{"rougail.general.condition": "no", "rougail.general.condition2": "no", "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": "creole", "services.test.files.file1.activate": false} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py index e1ddbaed..62867e53 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json index 655b9346..28b06ee5 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "yes", "rougail.general.condition2": "no", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true} +{"rougail.general.condition": "yes", "rougail.general.condition2": "no", "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": "creole", "services.test.files.file1.activate": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py index 5e6ced41..b0dd1131 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json index 0db7cbde..ef7941be 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "yes", "rougail.general.condition2": "yes", "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} +{"rougail.general.condition": "yes", "rougail.general.condition2": "yes", "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": "creole", "services.test.files.file1.activate": false} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py index d62efc9f..99a45f26 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json index 121a8ae8..02631770 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "yes", "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} +{"rougail.general.condition": "no", "rougail.general.condition2": "yes", "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": "creole", "services.test.files.file1.activate": false} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py index 825becf9..1e84dc49 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json index 111c3669..87524c32 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "oui", "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} +{"rougail.general.condition": "oui", "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": "creole", "services.test.files.file1.activate": false} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py index fc1335fc..b8e43b80 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json b/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json index 69d0407c..509b7d49 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.disable_variable": "no", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true} +{"rougail.general.condition": "no", "rougail.general.disable_variable": "no", "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": "creole", "services.test.files.file1.activate": true} diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py index 43ff6b21..8abde318 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py @@ -21,7 +21,7 @@ option_10 = StrOption(name="mode", doc="mode", default="0644") 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_14 = StrOption(name="templating", doc="templating", default="creole") option_15 = BoolOption(name="activate", doc="activate", default=True) option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) diff --git a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json index 8841e51c..0d4b98d0 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": true, "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": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": true, "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": "creole", "services.test.files.file.activate": true} diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 19be003b..674c85e0 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("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]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json index 2d49c86e..0f7f4949 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": true, "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true} +{"rougail.general.condition": true, "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": "creole", "services.test.files.file1.activate": false} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py index d2ec032e..3f0768e1 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/tmp/file1") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file1") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)}))) option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml new file mode 100644 index 00000000..b2509cd5 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + False + + + + + + + True + afilllist + + + + diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/__init__.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json new file mode 100644 index 00000000..9905b399 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": false, "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": "creole", "services.test.files.file1.activate": true} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py new file mode 100644 index 00000000..f95f1117 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py @@ -0,0 +1,29 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = BoolOption(name="condition", doc="condition", default=False, properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="group", doc="group", default="root") +option_9 = StrOption(name="mode", doc="mode", default="0644") +option_10 = StrOption(name="name", doc="name", default="/tmp/file1") +option_11 = StrOption(name="owner", doc="owner", default="root") +option_12 = StrOption(name="source", doc="source", default="file1") +option_13 = StrOption(name="templating", doc="templating", default="creole") +option_14 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)}))) +option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) 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 41df076b..53f6a46c 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, "services.test.files.file.activate": false} +{"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": "creole", "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 3aa56651..d74947f9 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("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]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json index 02bbdbb6..be1aaa5d 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_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.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true, "services.test.files.file2.group": "root", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/tmp/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.templating": true, "services.test.files.file2.activate": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "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": "creole", "services.test.files.file1.activate": true, "services.test.files.file2.group": "root", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/tmp/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.templating": "creole", "services.test.files.file2.activate": true} 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 e4aa43a4..e2efec20 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("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") @@ -30,7 +30,7 @@ option_19 = StrOption(name="mode", doc="mode", default="0644") 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_23 = StrOption(name="templating", doc="templating", default="creole") option_24 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("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]) diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json index 775c5456..b05bc68e 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, "services.test.files.file.activate": false} +{"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": "creole", "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 667e6465..81e6c903 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) 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]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json index 775c5456..b05bc68e 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, "services.test.files.file.activate": false} +{"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": "creole", "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 667e6465..81e6c903 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) 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]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json index 775c5456..b05bc68e 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, "services.test.files.file.activate": false} +{"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": "creole", "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 01495ace..5f38ff7f 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True), 'condition_1': ParamOption(option_5), 'expected_1': ParamValue("oui"), 'reverse_condition_1': ParamValue(True), 'condition_operator': ParamValue("OR")}))) 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]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json index 775c5456..b05bc68e 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, "services.test.files.file.activate": false} +{"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": "creole", "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 cfebd589..62a1afa9 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") 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_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("statique"), 'reverse_condition_0': ParamValue(True)}))) 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]) 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 73d8047f..7673e135 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, "services.test.files.file1.activate": false} +{"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": "creole", "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 db8148e9..83e1a28e 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -21,7 +21,7 @@ option_10 = StrOption(name="mode", doc="mode", default="0644") 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_14 = StrOption(name="templating", doc="templating", default="creole") 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]) diff --git a/tests/dictionaries/20notemplating/00-base.xml b/tests/dictionaries/20notemplating/00-base.xml index 0644dd26..078eb116 100644 --- a/tests/dictionaries/20notemplating/00-base.xml +++ b/tests/dictionaries/20notemplating/00-base.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/dictionaries/20notemplating/makedict/base.json b/tests/dictionaries/20notemplating/makedict/base.json index 7f672f3d..c466b5b1 100644 --- a/tests/dictionaries/20notemplating/makedict/base.json +++ b/tests/dictionaries/20notemplating/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "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": false, "services.test.files.file.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "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": "none", "services.test.files.file.activate": true} diff --git a/tests/dictionaries/20notemplating/tiramisu/base.py b/tests/dictionaries/20notemplating/tiramisu/base.py index ca14130a..e9c74948 100644 --- a/tests/dictionaries/20notemplating/tiramisu/base.py +++ b/tests/dictionaries/20notemplating/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/file") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file") -option_13 = BoolOption(name="templating", doc="templating", default=False) +option_13 = StrOption(name="templating", doc="templating", default="none") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) diff --git a/tests/dictionaries/20override/makedict/base.json b/tests/dictionaries/20override/makedict/base.json index 4ea93c68..3199d814 100644 --- a/tests/dictionaries/20override/makedict/base.json +++ b/tests/dictionaries/20override/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.group": "root", "services.test.overrides.test_service.mode": "0644", "services.test.overrides.test_service.name": "/systemd/system/test.service.d/rougail.conf", "services.test.overrides.test_service.owner": "root", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.templating": true, "services.test.overrides.test_service.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.group": "root", "services.test.overrides.test_service.mode": "0644", "services.test.overrides.test_service.name": "/systemd/system/test.service.d/rougail.conf", "services.test.overrides.test_service.owner": "root", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.templating": "creole", "services.test.overrides.test_service.activate": true} diff --git a/tests/dictionaries/20override/tiramisu/base.py b/tests/dictionaries/20override/tiramisu/base.py index d8b52f16..a6a85d74 100644 --- a/tests/dictionaries/20override/tiramisu/base.py +++ b/tests/dictionaries/20override/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/systemd/system/test.service.d/rougail.conf") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="test.service") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) diff --git a/tests/dictionaries/20override_no_templating/00-base.xml b/tests/dictionaries/20override_no_templating/00-base.xml new file mode 100644 index 00000000..365aea1b --- /dev/null +++ b/tests/dictionaries/20override_no_templating/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + non + + + + + diff --git a/tests/dictionaries/20override_no_templating/__init__.py b/tests/dictionaries/20override_no_templating/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/20override_no_templating/makedict/base.json b/tests/dictionaries/20override_no_templating/makedict/base.json new file mode 100644 index 00000000..9f2b586c --- /dev/null +++ b/tests/dictionaries/20override_no_templating/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.group": "root", "services.test.overrides.test_service.mode": "0644", "services.test.overrides.test_service.name": "/systemd/system/test.service.d/rougail.conf", "services.test.overrides.test_service.owner": "root", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.templating": "none", "services.test.overrides.test_service.activate": true} diff --git a/tests/dictionaries/20override_no_templating/result/systemd/system/test.service.d/rougail.conf b/tests/dictionaries/20override_no_templating/result/systemd/system/test.service.d/rougail.conf new file mode 100644 index 00000000..a29cfeaf --- /dev/null +++ b/tests/dictionaries/20override_no_templating/result/systemd/system/test.service.d/rougail.conf @@ -0,0 +1 @@ +%%mode_conteneur_actif diff --git a/tests/dictionaries/20override_no_templating/tiramisu/base.py b/tests/dictionaries/20override_no_templating/tiramisu/base.py new file mode 100644 index 00000000..f32fc665 --- /dev/null +++ b/tests/dictionaries/20override_no_templating/tiramisu/base.py @@ -0,0 +1,29 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="group", doc="group", default="root") +option_9 = StrOption(name="mode", doc="mode", default="0644") +option_10 = StrOption(name="name", doc="name", default="/systemd/system/test.service.d/rougail.conf") +option_11 = StrOption(name="owner", doc="owner", default="root") +option_12 = StrOption(name="source", doc="source", default="test.service") +option_13 = StrOption(name="templating", doc="templating", default="none") +option_14 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) +option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) +option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override_no_templating/tmpl/test.service b/tests/dictionaries/20override_no_templating/tmpl/test.service new file mode 100644 index 00000000..a29cfeaf --- /dev/null +++ b/tests/dictionaries/20override_no_templating/tmpl/test.service @@ -0,0 +1 @@ +%%mode_conteneur_actif diff --git a/tests/dictionaries/20override_source/00-base.xml b/tests/dictionaries/20override_source/00-base.xml new file mode 100644 index 00000000..01d1538e --- /dev/null +++ b/tests/dictionaries/20override_source/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + non + + + + + diff --git a/tests/dictionaries/20override_source/__init__.py b/tests/dictionaries/20override_source/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/20override_source/makedict/base.json b/tests/dictionaries/20override_source/makedict/base.json new file mode 100644 index 00000000..645c0bb7 --- /dev/null +++ b/tests/dictionaries/20override_source/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test2_service.group": "root", "services.test.overrides.test2_service.mode": "0644", "services.test.overrides.test2_service.name": "/systemd/system/test.service.d/rougail.conf", "services.test.overrides.test2_service.owner": "root", "services.test.overrides.test2_service.source": "test2.service", "services.test.overrides.test2_service.templating": "creole", "services.test.overrides.test2_service.activate": true} diff --git a/tests/dictionaries/20override_source/result/systemd/system/test.service.d/rougail.conf b/tests/dictionaries/20override_source/result/systemd/system/test.service.d/rougail.conf new file mode 100644 index 00000000..d907505b --- /dev/null +++ b/tests/dictionaries/20override_source/result/systemd/system/test.service.d/rougail.conf @@ -0,0 +1 @@ +non diff --git a/tests/dictionaries/20override_source/tiramisu/base.py b/tests/dictionaries/20override_source/tiramisu/base.py new file mode 100644 index 00000000..5eacc5b1 --- /dev/null +++ b/tests/dictionaries/20override_source/tiramisu/base.py @@ -0,0 +1,29 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="group", doc="group", default="root") +option_9 = StrOption(name="mode", doc="mode", default="0644") +option_10 = StrOption(name="name", doc="name", default="/systemd/system/test.service.d/rougail.conf") +option_11 = StrOption(name="owner", doc="owner", default="root") +option_12 = StrOption(name="source", doc="source", default="test2.service") +option_13 = StrOption(name="templating", doc="templating", default="creole") +option_14 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="test2_service", doc="test2.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) +option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) +option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override_source/tmpl/test2.service b/tests/dictionaries/20override_source/tmpl/test2.service new file mode 100644 index 00000000..a29cfeaf --- /dev/null +++ b/tests/dictionaries/20override_source/tmpl/test2.service @@ -0,0 +1 @@ +%%mode_conteneur_actif diff --git a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json index 9c202b00..ea91c26f 100644 --- a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index 272306ac..239b6749 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -25,7 +25,7 @@ option_14 = StrOption(name="mode", doc="mode", default="0644") option_15 = StrOption(name="name", doc="name", default="/etc/mailname") option_16 = StrOption(name="owner", doc="owner", default="root") option_17 = StrOption(name="source", doc="source", default="mailname") -option_18 = BoolOption(name="templating", doc="templating", default=True) +option_18 = StrOption(name="templating", doc="templating", default="creole") option_19 = BoolOption(name="activate", doc="activate", default=True) option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19]) option_11 = OptionDescription(name="files", doc="files", children=[option_12]) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json index 9aa54e37..cc75c97e 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}, {"rougail.general.leader.leader": "b", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}, {"rougail.general.leader.leader": "b", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py index 19c6bc0b..46993ff9 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -25,7 +25,7 @@ option_14 = StrOption(name="mode", doc="mode", default="0644") option_15 = StrOption(name="name", doc="name", default="/etc/mailname") option_16 = StrOption(name="owner", doc="owner", default="root") option_17 = StrOption(name="source", doc="source", default="mailname") -option_18 = BoolOption(name="templating", doc="templating", default=True) +option_18 = StrOption(name="templating", doc="templating", default="creole") option_19 = BoolOption(name="activate", doc="activate", default=True) option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19]) option_11 = OptionDescription(name="files", doc="files", children=[option_12]) diff --git a/tests/dictionaries/60extra_group/makedict/base.json b/tests/dictionaries/60extra_group/makedict/base.json index c5fedd54..a1fcc232 100644 --- a/tests/dictionaries/60extra_group/makedict/base.json +++ b/tests/dictionaries/60extra_group/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": [{"extra.ejabberd.description.description": "test", "extra.ejabberd.description.mode": "pre"}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": [{"extra.ejabberd.description.description": "test", "extra.ejabberd.description.mode": "pre"}], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/60extra_group/tiramisu/base.py b/tests/dictionaries/60extra_group/tiramisu/base.py index c13aad45..0b56385e 100644 --- a/tests/dictionaries/60extra_group/tiramisu/base.py +++ b/tests/dictionaries/60extra_group/tiramisu/base.py @@ -26,7 +26,7 @@ option_15 = StrOption(name="mode", doc="mode", default="0644") option_16 = StrOption(name="name", doc="name", default="/etc/mailname") option_17 = StrOption(name="owner", doc="owner", default="root") option_18 = StrOption(name="source", doc="source", default="mailname") -option_19 = BoolOption(name="templating", doc="templating", default=True) +option_19 = StrOption(name="templating", doc="templating", default="creole") option_20 = BoolOption(name="activate", doc="activate", default=True) option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20]) option_12 = OptionDescription(name="files", doc="files", children=[option_13]) diff --git a/tests/dictionaries/60extra_help/makedict/base.json b/tests/dictionaries/60extra_help/makedict/base.json index 309d1341..d0618c66 100644 --- a/tests/dictionaries/60extra_help/makedict/base.json +++ b/tests/dictionaries/60extra_help/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/60extra_help/tiramisu/base.py b/tests/dictionaries/60extra_help/tiramisu/base.py index 21ba425b..859b5465 100644 --- a/tests/dictionaries/60extra_help/tiramisu/base.py +++ b/tests/dictionaries/60extra_help/tiramisu/base.py @@ -27,7 +27,7 @@ option_15 = StrOption(name="mode", doc="mode", default="0644") option_16 = StrOption(name="name", doc="name", default="/etc/mailname") option_17 = StrOption(name="owner", doc="owner", default="root") option_18 = StrOption(name="source", doc="source", default="mailname") -option_19 = BoolOption(name="templating", doc="templating", default=True) +option_19 = StrOption(name="templating", doc="templating", default="creole") option_20 = BoolOption(name="activate", doc="activate", default=True) option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20]) option_12 = OptionDescription(name="files", doc="files", children=[option_13]) diff --git a/tests/dictionaries/70container_files/makedict/base.json b/tests/dictionaries/70container_files/makedict/base.json index bfd55284..83da4f6b 100644 --- a/tests/dictionaries/70container_files/makedict/base.json +++ b/tests/dictionaries/70container_files/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true, "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.templating": true, "services.test.files.rougail_conf.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true, "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.templating": "creole", "services.test.files.rougail_conf.activate": true} diff --git a/tests/dictionaries/70container_files/tiramisu/base.py b/tests/dictionaries/70container_files/tiramisu/base.py index 69a25f6b..35f26d55 100644 --- a/tests/dictionaries/70container_files/tiramisu/base.py +++ b/tests/dictionaries/70container_files/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_16 = StrOption(name="group", doc="group", default="root") @@ -28,7 +28,7 @@ option_17 = StrOption(name="mode", doc="mode", default="0644") option_18 = StrOption(name="name", doc="name", default="/rougail.conf") option_19 = StrOption(name="owner", doc="owner", default="root") option_20 = StrOption(name="source", doc="source", default="rougail.conf") -option_21 = BoolOption(name="templating", doc="templating", default=True) +option_21 = StrOption(name="templating", doc="templating", default="creole") option_22 = BoolOption(name="activate", doc="activate", default=True) option_15 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15]) diff --git a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json index 2d3acb82..84fd8e1c 100644 --- a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py index 0be03ee9..192ff297 100644 --- a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py @@ -21,7 +21,7 @@ option_10 = StrOption(name="mode", doc="mode", default="0644") option_11 = SymLinkOption(name="name", opt=option_4) option_12 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="source", doc="source", default="mailname") -option_14 = BoolOption(name="templating", doc="templating", default=True) +option_14 = StrOption(name="templating", doc="templating", default="creole") option_15 = BoolOption(name="activate", doc="activate", default=True) option_8 = OptionDescription(name="mailname", doc="mailname", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json index a77c3815..470a20ea 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.general.var": ["mailname", "mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.variable": ["mailname", "mailname2"], "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.general.var": ["mailname", "mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.variable": ["mailname", "mailname2"], "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py index 41ab17cb..1700afe8 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") option_12 = SymLinkOption(name="name", opt=option_4) option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="mailname") -option_15 = BoolOption(name="templating", doc="templating", default=True) +option_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = SymLinkOption(name="variable", opt=option_5) option_17 = BoolOption(name="activate", doc="activate", default=True) option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) diff --git a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json index 3e00b14c..18ba2f42 100644 --- a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": "/etc/mailname", "rougail.general.var": "mailname", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": "/etc/mailname", "rougail.general.var": "mailname", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py index dac9f496..2c8b0aee 100644 --- a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py @@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") option_12 = SymLinkOption(name="name", opt=option_4) option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="mailname") -option_15 = BoolOption(name="templating", doc="templating", default=True) +option_15 = StrOption(name="templating", doc="templating", default="creole") option_16 = SymLinkOption(name="variable", opt=option_5) option_17 = BoolOption(name="activate", doc="activate", default=True) option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) diff --git a/tests/dictionaries/70container_files_twice/makedict/base.json b/tests/dictionaries/70container_files_twice/makedict/base.json index 8190b811..71769122 100644 --- a/tests/dictionaries/70container_files_twice/makedict/base.json +++ b/tests/dictionaries/70container_files_twice/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true, "services.test.files.mailname_1.group": "root", "services.test.files.mailname_1.mode": "0644", "services.test.files.mailname_1.name": "/etc/eole/mailname", "services.test.files.mailname_1.owner": "root", "services.test.files.mailname_1.source": "mailname", "services.test.files.mailname_1.templating": true, "services.test.files.mailname_1.activate": true, "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.templating": true, "services.test.files.rougail_conf.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true, "services.test.files.mailname_1.group": "root", "services.test.files.mailname_1.mode": "0644", "services.test.files.mailname_1.name": "/etc/eole/mailname", "services.test.files.mailname_1.owner": "root", "services.test.files.mailname_1.source": "mailname", "services.test.files.mailname_1.templating": "creole", "services.test.files.mailname_1.activate": true, "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.templating": "creole", "services.test.files.rougail_conf.activate": true} diff --git a/tests/dictionaries/70container_files_twice/tiramisu/base.py b/tests/dictionaries/70container_files_twice/tiramisu/base.py index d2a16652..70e58bb8 100644 --- a/tests/dictionaries/70container_files_twice/tiramisu/base.py +++ b/tests/dictionaries/70container_files_twice/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_16 = StrOption(name="group", doc="group", default="root") @@ -28,7 +28,7 @@ option_17 = StrOption(name="mode", doc="mode", default="0644") option_18 = StrOption(name="name", doc="name", default="/etc/eole/mailname") option_19 = StrOption(name="owner", doc="owner", default="root") option_20 = StrOption(name="source", doc="source", default="mailname") -option_21 = BoolOption(name="templating", doc="templating", default=True) +option_21 = StrOption(name="templating", doc="templating", default="creole") option_22 = BoolOption(name="activate", doc="activate", default=True) option_15 = OptionDescription(name="mailname_1", doc="mailname_1", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22]) option_24 = StrOption(name="group", doc="group", default="root") @@ -36,7 +36,7 @@ option_25 = StrOption(name="mode", doc="mode", default="0644") option_26 = StrOption(name="name", doc="name", default="/rougail.conf") option_27 = StrOption(name="owner", doc="owner", default="root") option_28 = StrOption(name="source", doc="source", default="rougail.conf") -option_29 = BoolOption(name="templating", doc="templating", default=True) +option_29 = StrOption(name="templating", doc="templating", default="creole") option_30 = BoolOption(name="activate", doc="activate", default=True) option_23 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_24, option_25, option_26, option_27, option_28, option_29, option_30]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15, option_23]) diff --git a/tests/dictionaries/70container_filesmulti/makedict/base.json b/tests/dictionaries/70container_filesmulti/makedict/base.json index 748995c7..f17a97d3 100644 --- a/tests/dictionaries/70container_filesmulti/makedict/base.json +++ b/tests/dictionaries/70container_filesmulti/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true, "services.test.files.mailname2.group": "root", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.templating": true, "services.test.files.mailname2.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true, "services.test.files.mailname2.group": "root", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.templating": "creole", "services.test.files.mailname2.activate": true} diff --git a/tests/dictionaries/70container_filesmulti/tiramisu/base.py b/tests/dictionaries/70container_filesmulti/tiramisu/base.py index 19597612..1daadaa5 100644 --- a/tests/dictionaries/70container_filesmulti/tiramisu/base.py +++ b/tests/dictionaries/70container_filesmulti/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_16 = StrOption(name="group", doc="group", default="root") @@ -28,7 +28,7 @@ option_17 = StrOption(name="mode", doc="mode", default="0644") option_18 = StrOption(name="name", doc="name", default="/etc/mailname2") option_19 = StrOption(name="owner", doc="owner", default="root") option_20 = StrOption(name="source", doc="source", default="mailname2") -option_21 = BoolOption(name="templating", doc="templating", default=True) +option_21 = StrOption(name="templating", doc="templating", default="creole") option_22 = BoolOption(name="activate", doc="activate", default=True) option_15 = OptionDescription(name="mailname2", doc="mailname2", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_15]) diff --git a/tests/dictionaries/70container_filesredefine/makedict/base.json b/tests/dictionaries/70container_filesredefine/makedict/base.json index 60e016e0..dcdb36b4 100644 --- a/tests/dictionaries/70container_filesredefine/makedict/base.json +++ b/tests/dictionaries/70container_filesredefine/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname_new.group": "root", "services.test.files.mailname_new.mode": "0644", "services.test.files.mailname_new.name": "/etc/mailname", "services.test.files.mailname_new.owner": "root", "services.test.files.mailname_new.source": "mailname.new", "services.test.files.mailname_new.templating": true, "services.test.files.mailname_new.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname_new.group": "root", "services.test.files.mailname_new.mode": "0644", "services.test.files.mailname_new.name": "/etc/mailname", "services.test.files.mailname_new.owner": "root", "services.test.files.mailname_new.source": "mailname.new", "services.test.files.mailname_new.templating": "creole", "services.test.files.mailname_new.activate": true} diff --git a/tests/dictionaries/70container_filesredefine/tiramisu/base.py b/tests/dictionaries/70container_filesredefine/tiramisu/base.py index 154f6af4..4ea6bace 100644 --- a/tests/dictionaries/70container_filesredefine/tiramisu/base.py +++ b/tests/dictionaries/70container_filesredefine/tiramisu/base.py @@ -20,7 +20,7 @@ option_9 = StrOption(name="mode", doc="mode", default="0644") option_10 = StrOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname.new") -option_13 = BoolOption(name="templating", doc="templating", default=True) +option_13 = StrOption(name="templating", doc="templating", default="creole") option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname_new", doc="mailname.new", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) From f9e2f48788820e1f3f51bf0c13c9a82b83d88bc0 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 12 Feb 2021 18:08:50 +0100 Subject: [PATCH 103/168] add doc --- doc/service/service.md | 16 ++++++++++++++++ doc/services.md | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 doc/service/service.md create mode 100644 doc/services.md diff --git a/doc/service/service.md b/doc/service/service.md new file mode 100644 index 00000000..6896fe3a --- /dev/null +++ b/doc/service/service.md @@ -0,0 +1,16 @@ +# La gestion d'un service + +Un service est inclut dans un conteneur [services](../services.md). + +Cette balise permet de définir tous les éléments (fichier, port, IP, ...) lié à un service ou à démon. + +Il faut, à la création du service, préciser son nom : + +``` + + + + + + +``` diff --git a/doc/services.md b/doc/services.md new file mode 100644 index 00000000..a7eb0b13 --- /dev/null +++ b/doc/services.md @@ -0,0 +1,14 @@ +# Le conteneur des services + +La balise "services" est le conteneur de l'ensemble des [services](service/service.md). + +Il est placé à la racine du dictionnaire : + +``` + + + + +``` + +Attention, cette balise ne peut pas être placé dans un dictionnaire "extra". From 0abd4398c707061234eaf7a73ce3af8d95c762a5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 14 Feb 2021 10:10:48 +0100 Subject: [PATCH 104/168] Simply library usage --- src/rougail/__init__.py | 6 +- src/rougail/annotator/condition.py | 4 +- src/rougail/annotator/family.py | 2 +- src/rougail/annotator/service.py | 1 + src/rougail/annotator/target.py | 2 +- src/rougail/config.py | 20 ++- src/rougail/{rougail.py => convert.py} | 65 +++++--- src/rougail/objspace.py | 36 ++-- src/rougail/path.py | 15 +- src/rougail/template.py | 156 ++++++------------ src/rougail/tiramisureflector.py | 47 +++--- src/rougail/xmlreflector.py | 4 +- tests/dictionaries/00empty/tiramisu/base.py | 1 - .../00load_autofreeze/tiramisu/base.py | 1 - .../00load_autofreezeexpert/tiramisu/base.py | 1 - .../00load_autosave/tiramisu/base.py | 1 - .../00load_autosaveexpert/tiramisu/base.py | 1 - .../00load_comment/tiramisu/base.py | 1 - .../00load_notype/tiramisu/base.py | 1 - .../dictionaries/00load_save/tiramisu/base.py | 1 - .../00load_subfolder/tiramisu/base.py | 1 - .../01auto_autofreeze/tiramisu/base.py | 1 - .../dictionaries/01auto_base/tiramisu/base.py | 1 - .../01auto_withoutparam/tiramisu/base.py | 1 - .../01base_domainname/tiramisu/base.py | 1 - tests/dictionaries/01base_file/00-base.xml | 19 +++ .../errno_2 => 01base_file/__init__.py} | 0 .../01base_file/makedict/base.json | 1 + .../dictionaries/01base_file/result/etc/file | 2 + .../dictionaries/01base_file/tiramisu/base.py | 28 ++++ tests/dictionaries/01base_file/tmpl/file | 2 + .../01base_file_include/tiramisu/base.py | 1 - .../01base_file_patch/tiramisu/base.py | 1 - .../01base_file_utfchar/tiramisu/base.py | 1 - .../01base_float/tiramisu/base.py | 1 - .../01base_help_quote/tiramisu/base.py | 1 - .../01base_multi/tiramisu/base.py | 1 - .../01base_value_doublequote/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../01base_value_multi_quote/tiramisu/base.py | 1 - .../01base_value_quote/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../01family_description/tiramisu/base.py | 1 - .../01fill_autofreeze/tiramisu/base.py | 1 - .../01fill_autosave/tiramisu/base.py | 1 - .../dictionaries/01fill_base/tiramisu/base.py | 1 - .../01fill_baseaccent/tiramisu/base.py | 1 - .../01fill_mandatory/tiramisu/base.py | 1 - .../01fill_number/tiramisu/base.py | 1 - .../01fill_only_optional/tiramisu/base.py | 1 - .../01fill_optional/tiramisu/base.py | 1 - .../01fill_quote/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - tests/dictionaries/01test/tiramisu/base.py | 1 - .../01test_multi/tiramisu/base.py | 1 - .../01test_multi_none/tiramisu/base.py | 1 - .../01test_redefine/tiramisu/base.py | 1 - .../01test_redefine_remove/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10autosave_hidden/tiramisu/base.py | 1 - .../10check_base/tiramisu/base.py | 1 - .../10check_no_param/tiramisu/base.py | 1 - .../10check_option/tiramisu/base.py | 1 - .../10check_optional/tiramisu/base.py | 1 - .../10check_valid_differ/tiramisu/base.py | 1 - .../10check_valid_differ_add/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10check_valid_in_network/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10check_valid_ipnetmask/tiramisu/base.py | 1 - .../10fill_information/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10leadership_append/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10leadership_append_name/tiramisu/base.py | 1 - .../10leadership_auto/tiramisu/base.py | 1 - .../10leadership_autoleader/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10leadership_mandatory/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10leadership_multi/tiramisu/base.py | 1 - .../10load_disabled_if_in/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10load_emptyvalue/tiramisu/base.py | 1 - .../10load_frozenifin/tiramisu/base.py | 1 - .../10load_frozenifin_auto/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10load_frozenifnotin/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10load_hidden_if_family/tiramisu/base.py | 1 - .../10load_leadership/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10load_leadership_name/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10load_mandatoryifin/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10load_multivalue/tiramisu/base.py | 1 - .../10valid_enum_accent/tiramisu/base.py | 1 - .../10valid_enum_base/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10valid_enum_leader/tiramisu/base.py | 1 - .../10valid_enum_mandatory/tiramisu/base.py | 1 - .../10valid_enum_multi/tiramisu/base.py | 1 - .../10valid_enum_none/tiramisu/base.py | 1 - .../10valid_enum_number/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10valid_enum_param_empty/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../10valid_enum_quote/tiramisu/base.py | 1 - .../10valid_enum_value/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../11valid_enum_variable/tiramisu/base.py | 1 - .../20family_append/tiramisu/base.py | 1 - .../20family_appendaccent/tiramisu/base.py | 1 - .../20family_empty/tiramisu/base.py | 1 - .../20family_hidden/tiramisu/base.py | 1 - .../20family_mode/tiramisu/base.py | 1 - .../20family_modeleadership/tiramisu/base.py | 1 - .../20notemplating/tiramisu/base.py | 1 - .../dictionaries/20override/tiramisu/base.py | 1 - .../20override_no_templating/tiramisu/base.py | 1 - .../20override_source/tiramisu/base.py | 1 - .../21family_empty/tiramisu/base.py | 1 - .../30mandatory_withoutvalue/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../30mandatory_withvalue/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../40condition_base/tiramisu/base.py | 1 - .../40condition_base_add/tiramisu/base.py | 1 - .../40condition_fallback/tiramisu/base.py | 1 - .../40condition_optional/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../40empty_param/tiramisu/base.py | 1 - .../40empty_param2/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../40ifin_leadership/tiramisu/base.py | 1 - .../40ifin_leadershipauto/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../40ifin_multi/tiramisu/base.py | 1 - .../40ifin_validenum/tiramisu/base.py | 1 - .../45extra_without_family/00-base.xml | 15 ++ .../__init__.py} | 0 .../extra_dirs/extra/00-base.xml | 13 ++ .../45extra_without_family/makedict/base.json | 1 + .../45extra_without_family/result/etc/file | 2 + .../45extra_without_family/tiramisu/base.py | 29 ++++ .../45extra_without_family/tmpl/file | 2 + .../45multi_family/tiramisu/base.py | 1 - .../45multi_family_order/tiramisu/base.py | 1 - .../45without_family/tiramisu/base.py | 1 - .../50exists_exists/tiramisu/base.py | 1 - .../50redefine_description/tiramisu/base.py | 1 - .../51exists_nonexists/tiramisu/base.py | 1 - .../51exists_redefine/tiramisu/base.py | 1 - .../51redefine_auto/tiramisu/base.py | 1 - .../51redefine_autofill/tiramisu/base.py | 1 - .../51redefine_family/tiramisu/base.py | 1 - .../51redefine_fill/tiramisu/base.py | 1 - .../51redefine_fillauto/tiramisu/base.py | 1 - .../51redefine_help/tiramisu/base.py | 1 - .../51redefine_hidden/tiramisu/base.py | 1 - .../51redefine_remove_check/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../51redefine_validenum/tiramisu/base.py | 1 - .../51redefine_value/tiramisu/base.py | 1 - .../51remove_fill/tiramisu/base.py | 1 - .../52exists_redefine/tiramisu/base.py | 1 - .../60action_external/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../60extra_group/tiramisu/base.py | 1 - .../60extra_help/tiramisu/base.py | 1 - .../60extra_load/tiramisu/base.py | 1 - .../60extra_mandatory/tiramisu/base.py | 1 - .../60extra_name_family/tiramisu/base.py | 1 - .../60extra_no_condition/tiramisu/base.py | 1 - .../60extra_redefine/tiramisu/base.py | 1 - .../60familyaction/tiramisu/base.py | 1 - .../60familyaction_accent/tiramisu/base.py | 1 - .../60familyaction_mandatory/tiramisu/base.py | 1 - .../70container_files/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../70container_files_twice/tiramisu/base.py | 1 - .../70container_filesmulti/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../70container_new/tiramisu/base.py | 1 - .../70container_newnocont/tiramisu/base.py | 1 - .../70container_newwithip/tiramisu/base.py | 1 - .../70container_pathaccess/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../70container_save/tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../tiramisu/base.py | 1 - .../70container_services/tiramisu/base.py | 1 - tests/dictionaries/80auto_family/errno_8 | 0 .../80family_dynamic_with_family/errno_22 | 0 tests/test_1_flattener.py | 18 +- tests/test_3_template.py | 16 +- 241 files changed, 305 insertions(+), 413 deletions(-) rename src/rougail/{rougail.py => convert.py} (57%) create mode 100644 tests/dictionaries/01base_file/00-base.xml rename tests/dictionaries/{80auto_family/errno_2 => 01base_file/__init__.py} (100%) create mode 100644 tests/dictionaries/01base_file/makedict/base.json create mode 100644 tests/dictionaries/01base_file/result/etc/file create mode 100644 tests/dictionaries/01base_file/tiramisu/base.py create mode 100644 tests/dictionaries/01base_file/tmpl/file create mode 100644 tests/dictionaries/45extra_without_family/00-base.xml rename tests/dictionaries/{80family_dynamic_with_family/errno_2 => 45extra_without_family/__init__.py} (100%) create mode 100644 tests/dictionaries/45extra_without_family/extra_dirs/extra/00-base.xml create mode 100644 tests/dictionaries/45extra_without_family/makedict/base.json create mode 100644 tests/dictionaries/45extra_without_family/result/etc/file create mode 100644 tests/dictionaries/45extra_without_family/tiramisu/base.py create mode 100644 tests/dictionaries/45extra_without_family/tmpl/file create mode 100644 tests/dictionaries/80auto_family/errno_8 create mode 100644 tests/dictionaries/80family_dynamic_with_family/errno_22 diff --git a/src/rougail/__init__.py b/src/rougail/__init__.py index 2185dec1..a39d2c34 100644 --- a/src/rougail/__init__.py +++ b/src/rougail/__init__.py @@ -24,7 +24,9 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -from .rougail import Rougail +from .convert import RougailConvert +from .template import RougailTemplate +from .config import RougailConfig from .annotator import modes -__ALL__ = ('RougailObjSpace', 'modes') +__ALL__ = ('RougailConvert', 'RougailTemplate', 'RougailConfig', 'modes') diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 21b1ed19..613026fb 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -29,7 +29,7 @@ from typing import List, Any from ..i18n import _ from ..error import DictConsistencyError -from ..config import Config +from ..config import RougailConfig from .target import TargetAnnotator from .param import ParamAnnotator @@ -82,7 +82,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): ) -> None: if not variable.auto_freeze: return - if variable.namespace != Config['variable_namespace']: + if variable.namespace != RougailConfig['variable_namespace']: msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') raise DictConsistencyError(msg, 49, variable.xmlfiles) new_condition = self.objectspace.condition(variable.xmlfiles) diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 953a396d..cd9cdd02 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -209,7 +209,7 @@ class FamilyAnnotator(Walk): for variable in family.variable.values(): if isinstance(variable, self.objectspace.family): msg = _(f'dynamic family "{family.name}" cannot contains another family') - raise DictConsistencyError(msg, 2, family.xmlfiles) + raise DictConsistencyError(msg, 22, family.xmlfiles) def convert_help(self): """Convert variable help diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index ae76c78d..267fb9c4 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -184,6 +184,7 @@ class ServiceAnnotator: self.objectspace.paths.add_family('services', path, family, + None, ) return family diff --git a/src/rougail/annotator/target.py b/src/rougail/annotator/target.py index 2e68c052..4ab3d0bb 100644 --- a/src/rougail/annotator/target.py +++ b/src/rougail/annotator/target.py @@ -60,7 +60,7 @@ class TargetAnnotator: elif self.only_variable: msg = _(f'target to "{target.name}" with param type "{target.type}" ' f'is not allowed') - raise DictConsistencyError(msg, 2, obj.xmlfiles) + raise DictConsistencyError(msg, 8, obj.xmlfiles) if target.type == 'family': target.name = self.objectspace.paths.get_family(target.name, obj.namespace, diff --git a/src/rougail/config.py b/src/rougail/config.py index 7c33ae23..b153f49e 100644 --- a/src/rougail/config.py +++ b/src/rougail/config.py @@ -28,15 +28,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from os.path import join, abspath, dirname -ROUGAILROOT = '/var/rougail' +ROUGAILROOT = '/srv/rougail' DTDDIR = join(dirname(abspath(__file__)), 'data') -Config = {'rougailroot': ROUGAILROOT, - 'patch_dir': join(ROUGAILROOT, 'patches'), - 'manifests_dir': join(ROUGAILROOT, 'manifests'), - 'templates_dir': join(ROUGAILROOT, 'templates'), - 'dtdfilename': join(DTDDIR, 'rougail.dtd'), - 'dtddir': DTDDIR, - 'variable_namespace': 'rougail', - } +RougailConfig = {'dictionaries_dir': [join(ROUGAILROOT, 'dictionaries')], + 'extra_dictionaries': {}, + 'patches_dir': join(ROUGAILROOT, 'patches'), + 'templates_dir': join(ROUGAILROOT, 'templates'), + 'destinations_dir': join(ROUGAILROOT, 'destinations'), + 'tmp_dir': join(ROUGAILROOT, 'tmp'), + 'dtdfilename': join(DTDDIR, 'rougail.dtd'), + 'variable_namespace': 'rougail', + 'functions_file': join(ROUGAILROOT, 'functions.py'), + } diff --git a/src/rougail/rougail.py b/src/rougail/convert.py similarity index 57% rename from src/rougail/rougail.py rename to src/rougail/convert.py index a4e1b6a1..1c3a83d4 100644 --- a/src/rougail/rougail.py +++ b/src/rougail/convert.py @@ -28,9 +28,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Sample usage:: >>> from rougail import Rougail - >>> rougail = Rougail('/usr/share/rougail/rougail.dtd') - >>> rougail.create_or_populate_from_xml(['/usr/share/rougail/dicos']) - >>> rougail.create_or_populate_from_xml(['/usr/share/rougail/extra1'], 'extra1') + >>> rougail = Rougail() + >>> rougail.load_dictionaries(['/usr/share/rougail/dicos']) + >>> rougail.load_extra_dictionaries('extra1', ['/usr/share/rougail/extra1']) >>> rougail.space_visitor('/usr/share/rougail/funcs.py') >>> tiramisu = rougail.save() @@ -45,50 +45,61 @@ procedures. """ from typing import List + +from .i18n import _ +from .config import RougailConfig from .objspace import RougailObjSpace from .xmlreflector import XMLReflector from .tiramisureflector import TiramisuReflector from .annotator import SpaceAnnotator +from .error import DictConsistencyError -class Rougail: +class RougailConvert: """Rougail object """ - def __init__(self, - dtdfilename: str, - ) -> None: + def __init__(self) -> None: self.xmlreflector = XMLReflector() - self.xmlreflector.parse_dtd(dtdfilename) + self.xmlreflector.parse_dtd() self.rougailobjspace = RougailObjSpace(self.xmlreflector) - self.funcs_path = None + self._load_dictionaries(None, RougailConfig['dictionaries_dir']) + for extra_name, extra_dir in RougailConfig['extra_dictionaries'].items(): + self._load_dictionaries(extra_name, extra_dir) - def create_or_populate_from_xml(self, - xmlfolders: List[str], - namespace: str=None, - ) -> List[str]: - """Parses a bunch of XML files and populates the RougailObjSpace - """ + def _load_dictionaries(self, + namespace: str, + xmlfolders: List[str], + ) -> List[str]: + if namespace in ['services', RougailConfig['variable_namespace']]: + msg = _(f'Namespace name "{namespace}" is not allowed') + raise DictConsistencyError(msg, 21, None) + if hasattr(self.rougailobjspace.space, 'variables') and \ + namespace in self.rougailobjspace.space.variables: + msg = _(f'Namespace "{namespace}" is already loader') + raise DictConsistencyError(msg, 2, None) for xmlfile in self.xmlreflector.load_xml_from_folders(xmlfolders): document = self.xmlreflector.parse_xmlfile(xmlfile) self.rougailobjspace.redefine_variables = [] self.rougailobjspace.xml_parse_document(xmlfile, document, - self.rougailobjspace.space, namespace, ) - def space_visitor(self, - eosfunc_file: str, - ) -> None: - """All XML are loader, now annotate content - """ - self.funcs_path = eosfunc_file - SpaceAnnotator(self.rougailobjspace, eosfunc_file) - - def save(self) -> str: + def save(self, + filename: str, + ) -> str: """Return tiramisu object declaration as a string """ + functions_file = RougailConfig['functions_file'] + SpaceAnnotator(self.rougailobjspace, + functions_file, + ) tiramisu_objects = TiramisuReflector(self.rougailobjspace, - self.funcs_path, + functions_file, ) - return tiramisu_objects.get_text() + '\n' + self.rougailobjspace = None + output = tiramisu_objects.get_text() + '\n' + if filename: + with open(filename, 'w') as tiramisu: + tiramisu.write(output) + return output diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 9cfe6803..6e681486 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -32,7 +32,7 @@ from .xmlreflector import XMLReflector from .utils import normalize_family from .error import SpaceObjShallNotBeUpdated, DictConsistencyError from .path import Path -from .config import Config +from .config import RougailConfig # RougailObjSpace's elements that shall be forced to the Redefinable type FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables') @@ -109,6 +109,7 @@ class RougailObjSpace: self.list_conditions = {} self.valid_enums = {} self.booleans_attributs = [] + self.has_dyn_option = False self.make_object_space_classes(xmlreflector) @@ -164,20 +165,16 @@ class RougailObjSpace: def xml_parse_document(self, xmlfile, document, - space, namespace, ): """Parses a Rougail XML file and populates the RougailObjSpace """ - if namespace in ['services', Config['variable_namespace']]: - msg = _(f'Namespace name "{namespace}" is not allowed') - raise DictConsistencyError(msg, 21, xmlfile) if not namespace: - namespace = Config['variable_namespace'] + namespace = RougailConfig['variable_namespace'] redefine_variables = [] self._xml_parse(xmlfile, document, - space, + self.space, namespace, redefine_variables, ) @@ -224,6 +221,7 @@ class RougailObjSpace: self.set_path(namespace, document, variableobj, + space, ) self.add_to_tree_structure(variableobj, space, @@ -305,7 +303,7 @@ class RougailObjSpace: redefine = convert_boolean(subspace.get('redefine', default_redefine)) if redefine is True: if isinstance(existed_var, self.variable): # pylint: disable=E1101 - if namespace == Config['variable_namespace']: + if namespace == RougailConfig['variable_namespace']: redefine_variables.append(name) else: redefine_variables.append(space.path + '.' + name) @@ -343,8 +341,11 @@ class RougailObjSpace: if child.tag in ['variable', 'family']: name = normalize_family(name) if child.tag == 'variable': # pylint: disable=E1101 - if namespace != Config['variable_namespace']: - name = space.path + '.' + name + if namespace != RougailConfig['variable_namespace']: + if isinstance(space, self.variables): + name = space.name + '.' + name + else: + name = space.path + '.' + name if not self.paths.path_is_defined(name): return None old_family_name = self.paths.get_variable_family_path(name) @@ -459,6 +460,7 @@ class RougailObjSpace: namespace, document, variableobj, + space, ): """Fill self.paths attributes """ @@ -467,19 +469,29 @@ class RougailObjSpace: family_name = normalize_family(document.attrib['name']) else: family_name = namespace + if isinstance(space, self.variables): + subpath = space.name + else: + subpath = space.path + self.paths.add_variable(namespace, normalize_family(variableobj.name), - namespace + '.' + family_name, + subpath, document.attrib.get('dynamic') is not None, variableobj, ) elif isinstance(variableobj, self.family): # pylint: disable=E1101 + if isinstance(space, self.variables): + subpath = space.name + else: + subpath = space.path family_name = normalize_family(variableobj.name) - if namespace != Config['variable_namespace']: + if namespace != RougailConfig['variable_namespace']: family_name = namespace + '.' + family_name self.paths.add_family(namespace, family_name, variableobj, + subpath, ) @staticmethod diff --git a/src/rougail/path.py b/src/rougail/path.py index b0f2f96e..3829efee 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from .i18n import _ from .error import DictConsistencyError -from .config import Config +from .config import RougailConfig from .utils import normalize_family @@ -47,11 +47,12 @@ class Path: namespace: str, name: str, variableobj: str, + subpath: str, ) -> str: # pylint: disable=C0111 """Add a new family """ - if namespace == Config['variable_namespace']: - full_name = '.'.join([namespace, name]) + if namespace == RougailConfig['variable_namespace']: + full_name = '.'.join([subpath, name]) self.full_paths_families[name] = full_name else: if '.' not in name: # pragma: no cover @@ -92,7 +93,7 @@ class Path: if name not in self.families: raise DictConsistencyError(_(f'unknown option {name}'), 42, []) dico = self.families[name] - if current_namespace not in [Config['variable_namespace'], 'services'] and \ + if current_namespace not in [RougailConfig['variable_namespace'], 'services'] and \ current_namespace != dico['namespace']: msg = _(f'A family located in the "{dico["namespace"]}" namespace ' f'shall not be used in the "{current_namespace}" namespace') @@ -116,7 +117,7 @@ class Path: self.variables[new_path]['leader'] = leadership_path self.variables[new_path]['variableobj'].path = new_path self.variables[new_path]['family'] = leadership_path - if namespace == Config['variable_namespace']: + if namespace == RougailConfig['variable_namespace']: self.full_paths_variables[name] = new_path def is_leader(self, path): # pylint: disable=C0111 @@ -140,7 +141,7 @@ class Path: """ if '.' not in name: full_path = '.'.join([family, name]) - if namespace == Config['variable_namespace']: + if namespace == RougailConfig['variable_namespace']: self.full_paths_variables[name] = full_path else: full_path = name @@ -179,7 +180,7 @@ class Path: with_suffix=True, ) namespace = dico['variableobj'].namespace - if namespace not in [Config['variable_namespace'], 'services'] and \ + if namespace not in [RougailConfig['variable_namespace'], 'services'] and \ current_namespace != namespace: msg = _(f'A variable located in the "{namespace}" namespace shall not be used ' f'in the "{current_namespace}" namespace') diff --git a/src/rougail/template.py b/src/rougail/template.py index 8fdbb49b..b710563b 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -30,7 +30,7 @@ import logging from typing import Dict, Any from subprocess import call from os import listdir, makedirs, getcwd, chdir -from os.path import dirname, join, isfile, abspath, normpath, relpath +from os.path import dirname, join, isfile, abspath, normpath, isdir from Cheetah.Template import Template as ChtTemplate from Cheetah.NameMapper import NotFound as CheetahNotFound @@ -42,7 +42,7 @@ except ModuleNotFoundError: # pragma: no cover from tiramisu import Config from tiramisu.error import PropertiesOptionError -from .config import Config +from .config import RougailConfig from .error import FileNotFound, TemplateError from .i18n import _ from .utils import normalize_family, load_modules @@ -104,7 +104,7 @@ class CheetahTemplate(ChtTemplate): # pylint: disable=W0223 return None -class CreoleLeaderIndex: +class RougailLeaderIndex: """This object is create when access to a specified Index of the variable """ def __init__(self, @@ -152,7 +152,7 @@ class CreoleLeaderIndex: return value + self._value -class CreoleLeader: +class RougailLeader: """Implement access to leader and follower variable For examples: %%leader, %%leader[0].follower1 """ @@ -166,7 +166,7 @@ class CreoleLeader: """Get a leader.follower at requested index. """ followers = {key: values[index] for key, values in self._follower.items()} - return CreoleLeaderIndex(self._value[index], + return RougailLeaderIndex(self._value[index], followers, index, ) @@ -201,7 +201,7 @@ class CreoleLeader: self._follower[name].append(value) -class CreoleExtra: +class RougailExtra: """Object that implement access to extra variable For example %%extra1.family.variable """ @@ -218,23 +218,21 @@ class CreoleExtra: return iter(self.suboption.values()) -class CreoleTemplateEngine: +class RougailTemplate: """Engine to process Creole cheetah template """ def __init__(self, # pylint: disable=R0913 config: Config, - eosfunc_file: str, - distrib_dir: str, - tmp_dir: str, - dest_dir: str, ) -> None: self.config = config - self.dest_dir = dest_dir - self.tmp_dir = tmp_dir - self.distrib_dir = distrib_dir + self.destinations_dir = abspath(RougailConfig['destinations_dir']) + self.tmp_dir = abspath(RougailConfig['tmp_dir']) + self.templates_dir = abspath(RougailConfig['templates_dir']) + self.patches_dir = abspath(RougailConfig['patches_dir']) eos = {} - if eosfunc_file is not None: - eosfunc = load_modules(eosfunc_file) + functions_file = RougailConfig['functions_file'] + if isfile(functions_file): + eosfunc = load_modules(functions_file) for func in dir(eosfunc): if not func.startswith('_'): eos[func] = getattr(eosfunc, func) @@ -243,36 +241,33 @@ class CreoleTemplateEngine: def patch_template(self, filename: str, - tmp_dir: str, - patch_dir: str, ) -> None: """Apply patch to a template """ - patch_cmd = ['patch', '-d', tmp_dir, '-N', '-p1'] + patch_cmd = ['patch', '-d', self.tmp_dir, '-N', '-p1', '-f'] patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch'] - patch_file = join(patch_dir, f'{filename}.patch') + patch_file = join(self.patches_dir, f'{filename}.patch') if isfile(patch_file): log.info(_("Patching template '{filename}' with '{patch_file}'")) - rel_patch_file = relpath(patch_file, tmp_dir) - ret = call(patch_cmd + patch_no_debug + ['-i', rel_patch_file]) + ret = call(patch_cmd + patch_no_debug + ['-i', patch_file]) if ret: # pragma: no cover - patch_cmd_err = ' '.join(patch_cmd + ['-i', rel_patch_file]) - msg = _(f"Error applying patch: '{rel_patch_file}'\n" + patch_cmd_err = ' '.join(patch_cmd + ['-i', patch_file]) + msg = _(f"Error applying patch: '{patch_file}'\n" f"To reproduce and fix this error {patch_cmd_err}") log.error(_(msg)) - copy(join(self.distrib_dir, filename), tmp_dir) + copy(join(self.templates_dir, filename), self.tmp_dir) def prepare_template(self, filename: str, - tmp_dir: str, - patch_dir: str, ) -> None: """Prepare template source file """ - log.info(_("Copy template: '{filename}' -> '{tmp_dir}'")) - copy(filename, tmp_dir) - self.patch_template(filename, tmp_dir, patch_dir) + log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'")) + if not isdir(self.tmp_dir): + raise TemplateError(_(f'cannot find tmp_dir {self.tmp_dir}')) + copy(filename, self.tmp_dir) + self.patch_template(filename) def process(self, source: str, @@ -309,8 +304,6 @@ class CreoleTemplateEngine: def instance_file(self, filevar: Dict, - tmp_dir: str, - dest_dir: str, ) -> None: """Run templatisation on one file """ @@ -324,14 +317,16 @@ class CreoleTemplateEngine: filenames = [filenames] if variable: variable = [variable] + if not isdir(self.destinations_dir): + raise TemplateError(_(f'cannot find destinations_dir {self.destinations_dir}')) for idx, filename in enumerate(filenames): - destfilename = join(dest_dir, filename[1:]) + destfilename = join(self.destinations_dir, filename[1:]) makedirs(dirname(destfilename), exist_ok=True) if variable: var = variable[idx] else: var = None - source = join(tmp_dir, filevar['source']) + source = join(self.tmp_dir, filevar['source']) if filevar['templating'] == 'creole': self.process(source, filename, @@ -345,18 +340,15 @@ class CreoleTemplateEngine: """Run templatisation on all files """ ori_dir = getcwd() - tmp_dir = relpath(self.tmp_dir, self.distrib_dir) - dest_dir = relpath(self.dest_dir, self.distrib_dir) - patch_dir = relpath(Config['patch_dir'], self.distrib_dir) - chdir(self.distrib_dir) + chdir(self.templates_dir) for option in await self.config.option.list(type='all'): namespace = await option.option.name() - if namespace == Config['variable_namespace']: - await self.load_variables_namespace(option) - else: - self.rougail_variables_dict[namespace] = await self.load_variables_extra(option) + is_variable_namespace = namespace == RougailConfig['variable_namespace'] + self.rougail_variables_dict[namespace] = await self.load_variables(option, + is_variable_namespace, + ) for template in listdir('.'): - self.prepare_template(template, tmp_dir, patch_dir) + self.prepare_template(template) for service_obj in await self.config.option('services').list('all'): for fills in await service_obj.list('all'): if await fills.option.name() in ['files', 'overrides']: @@ -366,78 +358,40 @@ class CreoleTemplateEngine: if not isfile(filename): # pragma: no cover raise FileNotFound(_(f"File {filename} does not exist.")) if fill['activate']: - self.instance_file(fill, - tmp_dir, - dest_dir, - ) + self.instance_file(fill) else: log.debug(_("Instantiation of file '{filename}' disabled")) chdir(ori_dir) - async def load_variables_namespace (self, - optiondescription, - ): - """load variables from the "variable namespace + async def load_variables(self, + optiondescription, + is_variable_namespace, + ) -> RougailExtra: + """Load all variables and set it in RougailExtra objects """ + variables = {} for option in await optiondescription.list('all'): if await option.option.isoptiondescription(): if await option.option.isleadership(): for idx, suboption in enumerate(await option.list('all')): if idx == 0: - leader = CreoleLeader(await suboption.value.get()) - self.rougail_variables_dict[await suboption.option.name()] = leader + leader = RougailLeader(await suboption.value.get()) + leader_name = await suboption.option.name() + if is_variable_namespace: + self.rougail_variables_dict[await suboption.option.name()] = leader else: await leader.add_follower(self.config, await suboption.option.name(), await suboption.option.path(), ) + variables[leader_name] = leader else: - await self.load_variables_namespace(option) + subfamilies = await self.load_variables(option, + is_variable_namespace, + ) + variables[await option.option.name()] = subfamilies else: - self.rougail_variables_dict[await option.option.name()] = await option.value.get() - - async def load_variables_extra(self, - optiondescription, - ) -> CreoleExtra: - """Load all variables and set it in CreoleExtra objects - """ - families = {} - for family in await optiondescription.list('all'): - variables = {} - for variable in await family.list('all'): - if await variable.option.isoptiondescription(): - if await variable.option.isleadership(): - for idx, suboption in enumerate(await variable.list('all')): - if idx == 0: - leader = CreoleLeader(await suboption.value.get()) - leader_name = await suboption.option.name() - else: - await leader.add_follower(self.config, - await suboption.option.name(), - await suboption.option.path(), - ) - variables[leader_name] = leader - else: - subfamilies = await self.load_variables_extra(variable) - variables[await variable.option.name()] = subfamilies - else: - variables[await variable.option.name()] = await variable.value.get() - families[await family.option.name()] = CreoleExtra(variables) - return CreoleExtra(families) - - -async def generate(config: Config, - eosfunc_file: str, - distrib_dir: str, - tmp_dir: str, - dest_dir: str, - ) -> None: - """Generate all files - """ - engine = CreoleTemplateEngine(config, - eosfunc_file, - distrib_dir, - tmp_dir, - dest_dir, - ) - await engine.instance_files() + if is_variable_namespace: + self.rougail_variables_dict[await option.option.name()] = await option.value.get() + variables[await option.option.name()] = await option.value.get() + return RougailExtra(variables) diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 87361531..9198b99a 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -26,8 +26,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from json import dumps +from os.path import isfile -from .config import Config +from .config import RougailConfig from .annotator import CONVERT_OPTION from .objspace import RootRougailObject @@ -54,23 +55,26 @@ class TiramisuReflector: funcs_path, ): self.index = 0 - self.text = ["from importlib.machinery import SourceFileLoader", - "from importlib.util import spec_from_loader, module_from_spec", - f"loader = SourceFileLoader('func', '{funcs_path}')", - "spec = spec_from_loader(loader.name, loader)", - "func = module_from_spec(spec)", - "loader.exec_module(func)", - "for key, value in dict(locals()).items():", - " if key != ['SourceFileLoader', 'func']:", - " setattr(func, key, value)", - "try:", - " from tiramisu3 import *", - "except:", - " from tiramisu import *", - "from rougail.tiramisu import ConvertDynOptionDescription", - ] + self.text = [] + if isfile(funcs_path): + self.text.extend(["from importlib.machinery import SourceFileLoader", + "from importlib.util import spec_from_loader, module_from_spec", + f"loader = SourceFileLoader('func', '{funcs_path}')", + "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)"]) + self.text.extend(["try:", + " from tiramisu3 import *", + "except:", + " from tiramisu import *", + ]) self.objectspace = objectspace self.make_tiramisu_objects() + if self.objectspace.has_dyn_option == True: + self.text.append("from rougail.tiramisu import ConvertDynOptionDescription") def make_tiramisu_objects(self) -> None: """make tiramisu objects @@ -85,18 +89,17 @@ class TiramisuReflector: self.populate_family(basefamily, elt, ) - # parse object - baseelt.reflector_object.get() # pylint: disable=E1101 + self.baseelt = baseelt def reorder_family(self): """variable_namespace family has to be loaded before any other family because `extra` family could use `variable_namespace` variables. """ if hasattr(self.objectspace.space, 'variables'): - if Config['variable_namespace'] in self.objectspace.space.variables: - yield self.objectspace.space.variables[Config['variable_namespace']] + if RougailConfig['variable_namespace'] in self.objectspace.space.variables: + yield self.objectspace.space.variables[RougailConfig['variable_namespace']] for elt, value in self.objectspace.space.variables.items(): - if elt != Config['variable_namespace']: + if elt != RougailConfig['variable_namespace']: yield value if hasattr(self.objectspace.space, 'services'): yield self.objectspace.space.services @@ -148,6 +151,7 @@ class TiramisuReflector: def get_text(self): """Get text """ + self.baseelt.reflector_object.get() # pylint: disable=E1101 return '\n'.join(self.text) @@ -348,6 +352,7 @@ class Family(Common): ): super().__init__(elt, text, objectspace) if hasattr(self.elt, 'suffixes'): + self.objectspace.has_dyn_option = True self.object_type = 'ConvertDynOptionDescription' elif isinstance(self.elt, self.objectspace.leadership): self.object_type = 'Leadership' diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index be06e9e7..68fd4e12 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -32,6 +32,7 @@ from lxml.etree import DTD, parse, XMLSyntaxError # pylint: disable=E0611 from .i18n import _ from .error import DictConsistencyError +from .config import RougailConfig class XMLReflector: @@ -42,13 +43,14 @@ class XMLReflector: def __init__(self): self.dtd = None - def parse_dtd(self, dtdfilename): + def parse_dtd(self) -> None: """Loads the Creole DTD :raises IOError: if the DTD is not found :param dtdfilename: the full filename of the Creole DTD """ + dtdfilename = RougailConfig['dtdfilename'] if not isfile(dtdfilename): raise IOError(_("no such DTD file: {}").format(dtdfilename)) with open(dtdfilename, 'r') as dtdfd: diff --git a/tests/dictionaries/00empty/tiramisu/base.py b/tests/dictionaries/00empty/tiramisu/base.py index f0778708..616d4586 100644 --- a/tests/dictionaries/00empty/tiramisu/base.py +++ b/tests/dictionaries/00empty/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_2 = OptionDescription(name="tata", doc="tata", children=[]) option_1 = OptionDescription(name="services", doc="services", children=[option_2], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/00load_autofreeze/tiramisu/base.py b/tests/dictionaries/00load_autofreeze/tiramisu/base.py index 057d06c1..2c0d31ee 100644 --- a/tests/dictionaries/00load_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreeze/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"})) diff --git a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py index 561b0707..380afdaf 100644 --- a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/00load_autosave/tiramisu/base.py b/tests/dictionaries/00load_autosave/tiramisu/base.py index 1fee71f3..e5f8b1dc 100644 --- a/tests/dictionaries/00load_autosave/tiramisu/base.py +++ b/tests/dictionaries/00load_autosave/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "force_store_value", "mandatory"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py index e2e5450c..7e90b49c 100644 --- a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "force_store_value", "mandatory"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"expert"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/00load_comment/tiramisu/base.py b/tests/dictionaries/00load_comment/tiramisu/base.py index cd6c52e0..5ffec0a0 100644 --- a/tests/dictionaries/00load_comment/tiramisu/base.py +++ b/tests/dictionaries/00load_comment/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/00load_notype/tiramisu/base.py b/tests/dictionaries/00load_notype/tiramisu/base.py index 5fbc2c37..c80e9cf9 100644 --- a/tests/dictionaries/00load_notype/tiramisu/base.py +++ b/tests/dictionaries/00load_notype/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="without_type", doc="without_type", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/00load_save/tiramisu/base.py b/tests/dictionaries/00load_save/tiramisu/base.py index cd6c52e0..5ffec0a0 100644 --- a/tests/dictionaries/00load_save/tiramisu/base.py +++ b/tests/dictionaries/00load_save/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/00load_subfolder/tiramisu/base.py b/tests/dictionaries/00load_subfolder/tiramisu/base.py index d00f8e4c..0f0768ec 100644 --- a/tests/dictionaries/00load_subfolder/tiramisu/base.py +++ b/tests/dictionaries/00load_subfolder/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", 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], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py index b53d674f..1ba7e160 100644 --- a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", "frozen", "hidden", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) diff --git a/tests/dictionaries/01auto_base/tiramisu/base.py b/tests/dictionaries/01auto_base/tiramisu/base.py index bcd4de43..a4fb076c 100644 --- a/tests/dictionaries/01auto_base/tiramisu/base.py +++ b/tests/dictionaries/01auto_base/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01auto_withoutparam/tiramisu/base.py b/tests/dictionaries/01auto_withoutparam/tiramisu/base.py index 091aeb76..548f1929 100644 --- a/tests/dictionaries/01auto_withoutparam/tiramisu/base.py +++ b/tests/dictionaries/01auto_withoutparam/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params(())), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01base_domainname/tiramisu/base.py b/tests/dictionaries/01base_domainname/tiramisu/base.py index 3db95f5b..94cabcdf 100644 --- a/tests/dictionaries/01base_domainname/tiramisu/base.py +++ b/tests/dictionaries/01base_domainname/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = DomainnameOption(name="domain", doc="Description", default="my.domain.name", type='domainname', allow_ip=False, properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_file/00-base.xml b/tests/dictionaries/01base_file/00-base.xml new file mode 100644 index 00000000..fdc87d2d --- /dev/null +++ b/tests/dictionaries/01base_file/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + non + + + + + diff --git a/tests/dictionaries/80auto_family/errno_2 b/tests/dictionaries/01base_file/__init__.py similarity index 100% rename from tests/dictionaries/80auto_family/errno_2 rename to tests/dictionaries/01base_file/__init__.py diff --git a/tests/dictionaries/01base_file/makedict/base.json b/tests/dictionaries/01base_file/makedict/base.json new file mode 100644 index 00000000..145ff249 --- /dev/null +++ b/tests/dictionaries/01base_file/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "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": "creole", "services.test.files.file.activate": true} diff --git a/tests/dictionaries/01base_file/result/etc/file b/tests/dictionaries/01base_file/result/etc/file new file mode 100644 index 00000000..4089fbcc --- /dev/null +++ b/tests/dictionaries/01base_file/result/etc/file @@ -0,0 +1,2 @@ +non +non diff --git a/tests/dictionaries/01base_file/tiramisu/base.py b/tests/dictionaries/01base_file/tiramisu/base.py new file mode 100644 index 00000000..297f5366 --- /dev/null +++ b/tests/dictionaries/01base_file/tiramisu/base.py @@ -0,0 +1,28 @@ +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="Description", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="group", doc="group", default="root") +option_9 = StrOption(name="mode", doc="mode", default="0644") +option_10 = StrOption(name="name", doc="name", default="/etc/file") +option_11 = StrOption(name="owner", doc="owner", default="root") +option_12 = StrOption(name="source", doc="source", default="file") +option_13 = StrOption(name="templating", doc="templating", default="creole") +option_14 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file/tmpl/file b/tests/dictionaries/01base_file/tmpl/file new file mode 100644 index 00000000..27ff6834 --- /dev/null +++ b/tests/dictionaries/01base_file/tmpl/file @@ -0,0 +1,2 @@ +%%mode_conteneur_actif +%%rougail.general.mode_conteneur_actif diff --git a/tests/dictionaries/01base_file_include/tiramisu/base.py b/tests/dictionaries/01base_file_include/tiramisu/base.py index 79179b1a..297f5366 100644 --- a/tests/dictionaries/01base_file_include/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_file_patch/tiramisu/base.py b/tests/dictionaries/01base_file_patch/tiramisu/base.py index 79179b1a..297f5366 100644 --- a/tests/dictionaries/01base_file_patch/tiramisu/base.py +++ b/tests/dictionaries/01base_file_patch/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py index edf414c9..40c381f2 100644 --- a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py +++ b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_float/tiramisu/base.py b/tests/dictionaries/01base_float/tiramisu/base.py index b0c36e15..d84ccb50 100644 --- a/tests/dictionaries/01base_float/tiramisu/base.py +++ b/tests/dictionaries/01base_float/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = FloatOption(name="float", doc="Description", default=0.527, properties=frozenset({"mandatory", "normal"})) option_4 = FloatOption(name="float_multi", doc="Description", multi=True, default=[0.527], default_multi=0.527, properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01base_help_quote/tiramisu/base.py b/tests/dictionaries/01base_help_quote/tiramisu/base.py index 05be9e60..c5c475d4 100644 --- a/tests/dictionaries/01base_help_quote/tiramisu/base.py +++ b/tests/dictionaries/01base_help_quote/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", properties=frozenset({"normal"})) option_3.impl_set_information('help', "message with '") option_4 = StrOption(name="mode_conteneur_actif1", doc="Redefine description", properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01base_multi/tiramisu/base.py b/tests/dictionaries/01base_multi/tiramisu/base.py index a55e3c51..7892c6a3 100644 --- a/tests/dictionaries/01base_multi/tiramisu/base.py +++ b/tests/dictionaries/01base_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", multi=True, default=['non'], default_multi="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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_value_doublequote/tiramisu/base.py b/tests/dictionaries/01base_value_doublequote/tiramisu/base.py index e6f61cd3..3355bea9 100644 --- a/tests/dictionaries/01base_value_doublequote/tiramisu/base.py +++ b/tests/dictionaries/01base_value_doublequote/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", default="quote\"", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_value_doublequote2/tiramisu/base.py b/tests/dictionaries/01base_value_doublequote2/tiramisu/base.py index 3cc02caf..bf1497e3 100644 --- a/tests/dictionaries/01base_value_doublequote2/tiramisu/base.py +++ b/tests/dictionaries/01base_value_doublequote2/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", default="quote'\"", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_value_doublequote3/tiramisu/base.py b/tests/dictionaries/01base_value_doublequote3/tiramisu/base.py index 34faafcb..4c36e5c7 100644 --- a/tests/dictionaries/01base_value_doublequote3/tiramisu/base.py +++ b/tests/dictionaries/01base_value_doublequote3/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", default="quote\\\"\\'", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_value_multi_doublequote/tiramisu/base.py b/tests/dictionaries/01base_value_multi_doublequote/tiramisu/base.py index f446c1d3..7c7568d8 100644 --- a/tests/dictionaries/01base_value_multi_doublequote/tiramisu/base.py +++ b/tests/dictionaries/01base_value_multi_doublequote/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", multi=True, default=['quote"'], default_multi="quote\"", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_value_multi_doublequote2/tiramisu/base.py b/tests/dictionaries/01base_value_multi_doublequote2/tiramisu/base.py index 34cd2d08..d8aee933 100644 --- a/tests/dictionaries/01base_value_multi_doublequote2/tiramisu/base.py +++ b/tests/dictionaries/01base_value_multi_doublequote2/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", multi=True, default=['quote\'"'], default_multi="quote'\"", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_value_multi_quote/tiramisu/base.py b/tests/dictionaries/01base_value_multi_quote/tiramisu/base.py index f819fce4..0c165862 100644 --- a/tests/dictionaries/01base_value_multi_quote/tiramisu/base.py +++ b/tests/dictionaries/01base_value_multi_quote/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", multi=True, default=["quote'"], default_multi="quote'", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_value_quote/tiramisu/base.py b/tests/dictionaries/01base_value_quote/tiramisu/base.py index 66bbfad8..da9bf3c1 100644 --- a/tests/dictionaries/01base_value_quote/tiramisu/base.py +++ b/tests/dictionaries/01base_value_quote/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine description", default="quote'", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py b/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py index 51f12075..77dac068 100644 --- a/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py +++ b/tests/dictionaries/01base_var_name_same_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="general", doc="description", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01family_description/tiramisu/base.py b/tests/dictionaries/01family_description/tiramisu/base.py index f9507609..15ee3eed 100644 --- a/tests/dictionaries/01family_description/tiramisu/base.py +++ b/tests/dictionaries/01family_description/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="mode_conteneur_actif", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="Other description", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py index 1f388973..e90e85b4 100644 --- a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) diff --git a/tests/dictionaries/01fill_autosave/tiramisu/base.py b/tests/dictionaries/01fill_autosave/tiramisu/base.py index 1b5a7b1c..c862d7ed 100644 --- a/tests/dictionaries/01fill_autosave/tiramisu/base.py +++ b/tests/dictionaries/01fill_autosave/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"basic", "force_store_value"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) diff --git a/tests/dictionaries/01fill_base/tiramisu/base.py b/tests/dictionaries/01fill_base/tiramisu/base.py index 13dff30b..3f1f65b9 100644 --- a/tests/dictionaries/01fill_base/tiramisu/base.py +++ b/tests/dictionaries/01fill_base/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01fill_baseaccent/tiramisu/base.py b/tests/dictionaries/01fill_baseaccent/tiramisu/base.py index d7efa078..9747fc00 100644 --- a/tests/dictionaries/01fill_baseaccent/tiramisu/base.py +++ b/tests/dictionaries/01fill_baseaccent/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01fill_mandatory/tiramisu/base.py b/tests/dictionaries/01fill_mandatory/tiramisu/base.py index bbbc3ac8..23d2d55e 100644 --- a/tests/dictionaries/01fill_mandatory/tiramisu/base.py +++ b/tests/dictionaries/01fill_mandatory/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01fill_number/tiramisu/base.py b/tests/dictionaries/01fill_number/tiramisu/base.py index 6c16a801..9f58ad60 100644 --- a/tests/dictionaries/01fill_number/tiramisu/base.py +++ b/tests/dictionaries/01fill_number/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = IntOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue(3)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01fill_only_optional/tiramisu/base.py b/tests/dictionaries/01fill_only_optional/tiramisu/base.py index 091aeb76..548f1929 100644 --- a/tests/dictionaries/01fill_only_optional/tiramisu/base.py +++ b/tests/dictionaries/01fill_only_optional/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params(())), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01fill_optional/tiramisu/base.py b/tests/dictionaries/01fill_optional/tiramisu/base.py index bcd4de43..a4fb076c 100644 --- a/tests/dictionaries/01fill_optional/tiramisu/base.py +++ b/tests/dictionaries/01fill_optional/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01fill_quote/tiramisu/base.py b/tests/dictionaries/01fill_quote/tiramisu/base.py index bdd32da7..4f39148f 100644 --- a/tests/dictionaries/01fill_quote/tiramisu/base.py +++ b/tests/dictionaries/01fill_quote/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("quote'")))), properties=frozenset({"normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("quote\"")))), properties=frozenset({"normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("quote\"'")))), properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py index 0efa3a90..b351fd5b 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) diff --git a/tests/dictionaries/01test/tiramisu/base.py b/tests/dictionaries/01test/tiramisu/base.py index cf208666..85a77cad 100644 --- a/tests/dictionaries/01test/tiramisu/base.py +++ b/tests/dictionaries/01test/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="mode_conteneur_actif", default="non", properties=frozenset({"mandatory", "normal"})) option_3.impl_set_information('test', ('test',)) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01test_multi/tiramisu/base.py b/tests/dictionaries/01test_multi/tiramisu/base.py index f035dff3..6df6797c 100644 --- a/tests/dictionaries/01test_multi/tiramisu/base.py +++ b/tests/dictionaries/01test_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="mode_conteneur_actif", default="non", properties=frozenset({"mandatory", "normal"})) option_3.impl_set_information('test', ('test1', 'test2')) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01test_multi_none/tiramisu/base.py b/tests/dictionaries/01test_multi_none/tiramisu/base.py index 06605b8e..2e260b40 100644 --- a/tests/dictionaries/01test_multi_none/tiramisu/base.py +++ b/tests/dictionaries/01test_multi_none/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="mode_conteneur_actif", default="non", properties=frozenset({"mandatory", "normal"})) option_3.impl_set_information('test', (None, 'test1', 'test2')) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01test_redefine/tiramisu/base.py b/tests/dictionaries/01test_redefine/tiramisu/base.py index ffd9716b..62b88448 100644 --- a/tests/dictionaries/01test_redefine/tiramisu/base.py +++ b/tests/dictionaries/01test_redefine/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="mode_conteneur_actif", default="non", properties=frozenset({"mandatory", "normal"})) option_3.impl_set_information('test', ('test1',)) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/01test_redefine_remove/tiramisu/base.py b/tests/dictionaries/01test_redefine_remove/tiramisu/base.py index af38f235..e5d6f0c2 100644 --- a/tests/dictionaries/01test_redefine_remove/tiramisu/base.py +++ b/tests/dictionaries/01test_redefine_remove/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="mode_conteneur_actif", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py b/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py index 419b2527..f862c33b 100644 --- a/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py +++ b/tests/dictionaries/02autosave_hidden_frozenifin/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"})) diff --git a/tests/dictionaries/10autosave_hidden/tiramisu/base.py b/tests/dictionaries/10autosave_hidden/tiramisu/base.py index 34e02600..1e0bc3f3 100644 --- a/tests/dictionaries/10autosave_hidden/tiramisu/base.py +++ b/tests/dictionaries/10autosave_hidden/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", "frozen", "hidden"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"})) diff --git a/tests/dictionaries/10check_base/tiramisu/base.py b/tests/dictionaries/10check_base/tiramisu/base.py index d03c088b..6b96bfc4 100644 --- a/tests/dictionaries/10check_base/tiramisu/base.py +++ b/tests/dictionaries/10check_base/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"})) option_4 = IntOption(name="int", doc="No change", min_number=0, max_number=100, properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10check_no_param/tiramisu/base.py b/tests/dictionaries/10check_no_param/tiramisu/base.py index a35b842b..7f9a91e7 100644 --- a/tests/dictionaries/10check_no_param/tiramisu/base.py +++ b/tests/dictionaries/10check_no_param/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10check_option/tiramisu/base.py b/tests/dictionaries/10check_option/tiramisu/base.py index b6ac74dc..0a98381e 100644 --- a/tests/dictionaries/10check_option/tiramisu/base.py +++ b/tests/dictionaries/10check_option/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"})) option_4 = IntOption(name="int2", doc="No change", default=100, properties=frozenset({"mandatory", "normal"})) option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption()), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10check_optional/tiramisu/base.py b/tests/dictionaries/10check_optional/tiramisu/base.py index 252cce39..a57c0530 100644 --- a/tests/dictionaries/10check_optional/tiramisu/base.py +++ b/tests/dictionaries/10check_optional/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"})) option_5 = IntOption(name="int2", doc="No change", properties=frozenset({"normal"})) option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10check_valid_differ/tiramisu/base.py b/tests/dictionaries/10check_valid_differ/tiramisu/base.py index eb6067a8..4adb6a71 100644 --- a/tests/dictionaries/10check_valid_differ/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py index b6743731..9b178bd4 100644 --- a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py index 39abfcf6..15666891 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/10check_valid_in_network/tiramisu/base.py b/tests/dictionaries/10check_valid_in_network/tiramisu/base.py index 1c65a89e..b52f3d18 100644 --- a/tests/dictionaries/10check_valid_in_network/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_in_network/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", properties=frozenset({"basic", "mandatory"})) diff --git a/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py b/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py index 08a7c6a1..cbffa263 100644 --- a/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", cidr=True, properties=frozenset({"basic", "mandatory"})) option_5 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) diff --git a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py index 80137b7e..94fb4430 100644 --- a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], properties=frozenset({"basic", "mandatory"})) diff --git a/tests/dictionaries/10fill_information/tiramisu/base.py b/tests/dictionaries/10fill_information/tiramisu/base.py index 2585a5f7..1c0d2c51 100644 --- a/tests/dictionaries/10fill_information/tiramisu/base.py +++ b/tests/dictionaries/10fill_information/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None)))), properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/10frozenifin_unknown_valid_enum_number/tiramisu/base.py b/tests/dictionaries/10frozenifin_unknown_valid_enum_number/tiramisu/base.py index 811e1b2a..466244f9 100644 --- a/tests/dictionaries/10frozenifin_unknown_valid_enum_number/tiramisu/base.py +++ b/tests/dictionaries/10frozenifin_unknown_valid_enum_number/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="enumvar", values=(1, 2, 3), default=1, properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10leadership_append/tiramisu/base.py b/tests/dictionaries/10leadership_append/tiramisu/base.py index 3087b0e5..ca5b56b2 100644 --- a/tests/dictionaries/10leadership_append/tiramisu/base.py +++ b/tests/dictionaries/10leadership_append/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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) diff --git a/tests/dictionaries/10leadership_append_hidden/tiramisu/base.py b/tests/dictionaries/10leadership_append_hidden/tiramisu/base.py index 25495dcd..4bb89fbd 100644 --- a/tests/dictionaries/10leadership_append_hidden/tiramisu/base.py +++ b/tests/dictionaries/10leadership_append_hidden/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"force_default_on_freeze", "frozen"})) diff --git a/tests/dictionaries/10leadership_append_name/tiramisu/base.py b/tests/dictionaries/10leadership_append_name/tiramisu/base.py index 06f36f42..ceadc27f 100644 --- a/tests/dictionaries/10leadership_append_name/tiramisu/base.py +++ b/tests/dictionaries/10leadership_append_name/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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) diff --git a/tests/dictionaries/10leadership_auto/tiramisu/base.py b/tests/dictionaries/10leadership_auto/tiramisu/base.py index c6c2f938..e4603ed1 100644 --- a/tests/dictionaries/10leadership_auto/tiramisu/base.py +++ b/tests/dictionaries/10leadership_auto/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"force_default_on_freeze", "frozen", "hidden", "normal"})) diff --git a/tests/dictionaries/10leadership_autoleader/tiramisu/base.py b/tests/dictionaries/10leadership_autoleader/tiramisu/base.py index 721d4a51..275327c8 100644 --- a/tests/dictionaries/10leadership_autoleader/tiramisu/base.py +++ b/tests/dictionaries/10leadership_autoleader/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"force_default_on_freeze", "frozen", "hidden", "normal"})) diff --git a/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py b/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py index 9842ffe2..3315b7bc 100644 --- a/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py +++ b/tests/dictionaries/10leadership_autoleader_expert/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=Calculation(func.calc_list, Params((), kwargs={'valeur': ParamValue("valfill")}))) diff --git a/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py b/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py index 07e964b0..a5ac66b3 100644 --- a/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py +++ b/tests/dictionaries/10leadership_autosaveexpert/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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"})) diff --git a/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py b/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py index 2e751c6c..d17d4a9f 100644 --- a/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py +++ b/tests/dictionaries/10leadership_familyaccent/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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"})) diff --git a/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py b/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py index 4a637cbf..4faab53d 100644 --- a/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py +++ b/tests/dictionaries/10leadership_leader_hidden/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=Calculation(func.calc_list, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"force_default_on_freeze", "frozen"})) diff --git a/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py b/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py index fb0ac91a..c1d6a592 100644 --- a/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py +++ b/tests/dictionaries/10leadership_leader_hidden_if_in/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))})) diff --git a/tests/dictionaries/10leadership_leader_hidden_if_in_name/tiramisu/base.py b/tests/dictionaries/10leadership_leader_hidden_if_in_name/tiramisu/base.py index c61ef97e..c8d6a29b 100644 --- a/tests/dictionaries/10leadership_leader_hidden_if_in_name/tiramisu/base.py +++ b/tests/dictionaries/10leadership_leader_hidden_if_in_name/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))})) diff --git a/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py b/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py index 3a18c286..673a952b 100644 --- a/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py +++ b/tests/dictionaries/10leadership_leadermandatory/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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, properties=frozenset({"mandatory"})) option_6 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10leadership_mandatory/tiramisu/base.py b/tests/dictionaries/10leadership_mandatory/tiramisu/base.py index 3726a1d3..72421be5 100644 --- a/tests/dictionaries/10leadership_mandatory/tiramisu/base.py +++ b/tests/dictionaries/10leadership_mandatory/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"mandatory", "normal"})) diff --git a/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py b/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py index 19182ef7..7ab3f6e5 100644 --- a/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py +++ b/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_5 = NetmaskOption(name="nut_monitor_netmask", doc="Masque de l'IP du réseau de l'esclave", multi=True) option_6 = NetworkOption(name="nut_monitor_host", doc="Adresse IP du réseau de l'esclave", multi=True, properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/10leadership_multi/tiramisu/base.py b/tests/dictionaries/10leadership_multi/tiramisu/base.py index 20281d0f..62b3dd1b 100644 --- a/tests/dictionaries/10leadership_multi/tiramisu/base.py +++ b/tests/dictionaries/10leadership_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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) diff --git a/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py index 2db16e6e..cb391664 100644 --- a/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py index 45fd6d09..53244114 100644 --- a/tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("no")}))})) option_5 = StrOption(name="variable2", doc="variable2", default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=True)))), properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py index 3be43a0d..2653972a 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py index 63bf2ed8..83a34e72 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py index 62867e53..f3a106a8 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py index b0dd1131..dc751ea4 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py index 99a45f26..0a82c0d2 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py index 1e84dc49..1585798d 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py index b8e43b80..b3b6e12f 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py index 3c82b9b1..cb0f6aac 100644 --- a/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_none/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(None)}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(None)}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py index d4e091e9..5d2a297a 100644 --- a/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="tous", properties=frozenset({"mandatory", "normal"})) 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), 'expected': ParamOption(option_4)}))})) diff --git a/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py index 8c174a44..13e16a9e 100644 --- a/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="aucun", properties=frozenset({"mandatory", "normal"})) 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), 'expected': ParamOption(option_4)}))})) diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py index 358d96f8..10e93750 100644 --- a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py index 8abde318..5fe77eb1 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="disable_variable", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py index 9641b213..f3e3b36c 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"disabled", "mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) diff --git a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py index 0ce154b0..656cab58 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"disabled", "mandatory", "normal"})) 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), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py index 72702194..8d8d5df5 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py index 72702194..8d8d5df5 100644 --- a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_emptyvalue/tiramisu/base.py b/tests/dictionaries/10load_emptyvalue/tiramisu/base.py index a0879bc5..87b4d9e0 100644 --- a/tests/dictionaries/10load_emptyvalue/tiramisu/base.py +++ b/tests/dictionaries/10load_emptyvalue/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", properties=frozenset({"normal"})) option_4 = StrOption(name="mode_conteneur_actif2", doc="No change", properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10load_frozenifin/tiramisu/base.py b/tests/dictionaries/10load_frozenifin/tiramisu/base.py index 54513960..2dd35738 100644 --- a/tests/dictionaries/10load_frozenifin/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py index 2d9d359f..90bf1c7c 100644 --- a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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=Calculation(func.calc_val, Params((ParamValue("non")))), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py index 6ce4c30f..b0166485 100644 --- a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")}))})) diff --git a/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py index 02d0b5dd..969a0b76 100644 --- a/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_noexist/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", 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"})) diff --git a/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py index 40d7ae20..d2d5ec72 100644 --- a/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="tous", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)}))})) diff --git a/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py index 07ded3ca..1e993f2d 100644 --- a/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) diff --git a/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py b/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py index 02d0b5dd..969a0b76 100644 --- a/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifnotin_noexist/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", 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"})) diff --git a/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py b/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py index 4cdd465d..5ca6ff4f 100644 --- a/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py +++ b/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py index 77e4029e..b2a2e853 100644 --- a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py +++ b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_leadership/tiramisu/base.py b/tests/dictionaries/10load_leadership/tiramisu/base.py index aae5430d..6649c56d 100644 --- a/tests/dictionaries/10load_leadership/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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) diff --git a/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py b/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py index 1204e326..b0b3366c 100644 --- a/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_default_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="leader", multi=True, default=['non'], default_multi="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="leader", doc="leader", multi=True) option_6 = StrOption(name="follower1", doc="follower1", multi=True, default_multi="value", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py b/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py index 35363512..2107608e 100644 --- a/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_default_submulti/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="leader", multi=True, default=['non'], default_multi="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="leader", doc="leader", multi=True, default=['leader'], properties=frozenset({"mandatory"})) option_6 = StrOption(name="follower1", doc="follower1", multi=submulti, default_multi=['value'], properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py b/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py index b797a270..24a3f26b 100644 --- a/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="leader", multi=True, default=['non'], default_multi="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="leader", doc="leader", multi=True, default=['value'], properties=frozenset({"mandatory"})) option_6 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10load_leadership_description/tiramisu/base.py b/tests/dictionaries/10load_leadership_description/tiramisu/base.py index 4146cfce..89bb47ae 100644 --- a/tests/dictionaries/10load_leadership_description/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_description/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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) diff --git a/tests/dictionaries/10load_leadership_name/tiramisu/base.py b/tests/dictionaries/10load_leadership_name/tiramisu/base.py index 80915361..91b5dd2c 100644 --- a/tests/dictionaries/10load_leadership_name/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_name/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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) diff --git a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py b/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py index 7d574c90..8a959c5f 100644 --- a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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"})) diff --git a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py index 1199865f..f7c85630 100644 --- a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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) diff --git a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py index f5aa4a72..363b44b0 100644 --- a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py +++ b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py index 02d0b5dd..969a0b76 100644 --- a/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", 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"})) diff --git a/tests/dictionaries/10load_multivalue/tiramisu/base.py b/tests/dictionaries/10load_multivalue/tiramisu/base.py index 98330f60..f9956563 100644 --- a/tests/dictionaries/10load_multivalue/tiramisu/base.py +++ b/tests/dictionaries/10load_multivalue/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", multi=True, default=['non', 'oui'], default_multi="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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/10valid_enum_accent/tiramisu/base.py b/tests/dictionaries/10valid_enum_accent/tiramisu/base.py index 456b01e3..f0792cdb 100644 --- a/tests/dictionaries/10valid_enum_accent/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_accent/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', 'c', 'é'), default="c", properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_base/tiramisu/base.py b/tests/dictionaries/10valid_enum_base/tiramisu/base.py index 500b343f..0f349e81 100644 --- a/tests/dictionaries/10valid_enum_base/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_base/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', 'c'), default="c", properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py b/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py index 9bf043fd..b0bd34df 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar2", doc="multi", values=('a', 'b', 'c'), default="c", properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_leader/tiramisu/base.py b/tests/dictionaries/10valid_enum_leader/tiramisu/base.py index 5a9bf4b1..a7089875 100644 --- a/tests/dictionaries/10valid_enum_leader/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_leader/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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 = ChoiceOption(name="follower1", doc="follower1", values=('a', 'b', 'c'), multi=True, default_multi="a", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py b/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py index a3879571..344356ff 100644 --- a/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', 'c'), default="a", properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_multi/tiramisu/base.py b/tests/dictionaries/10valid_enum_multi/tiramisu/base.py index c577ad53..260c17ff 100644 --- a/tests/dictionaries/10valid_enum_multi/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = ChoiceOption(name="multi", doc="multi", values=('a', 'b', 'c'), multi=True, default=['a'], default_multi="a", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/10valid_enum_none/tiramisu/base.py b/tests/dictionaries/10valid_enum_none/tiramisu/base.py index 7ba02f34..5c1623cc 100644 --- a/tests/dictionaries/10valid_enum_none/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_none/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', None), default="b", properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_number/tiramisu/base.py b/tests/dictionaries/10valid_enum_number/tiramisu/base.py index 3a21354c..1454d749 100644 --- a/tests/dictionaries/10valid_enum_number/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_number/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="enumvar", values=(1, 2, 3), default=1, properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py b/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py index deb1f8d3..a33048cd 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="enumvar", values=(1, 2, 3), default=3, properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py b/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py index 6a4e7b05..7e75cbdf 100644 --- a/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="multi", values=(None,), properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py b/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py index 6a4e7b05..7e75cbdf 100644 --- a/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="multi", values=(None,), properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_quote/tiramisu/base.py b/tests/dictionaries/10valid_enum_quote/tiramisu/base.py index 5d0f32b6..ff69f9e1 100644 --- a/tests/dictionaries/10valid_enum_quote/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_quote/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_5 = ChoiceOption(name="enumvar", doc="multi", values=("quote'", 'quote"', 'quote"\''), default="quote'", properties=frozenset({"expert", "mandatory"})) diff --git a/tests/dictionaries/10valid_enum_value/tiramisu/base.py b/tests/dictionaries/10valid_enum_value/tiramisu/base.py index cd0d336c..0d7ed6a5 100644 --- a/tests/dictionaries/10valid_enum_value/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_value/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="mode_conteneur_actif", doc="No change", values=('a', 'b', 'c'), default="b", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 674c85e0..04871ea3 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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), 'expected': ParamValue("oui")}))})) option_5 = BoolOption(name="mode_conteneur_actif2", doc="No change", default=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py index 3f0768e1..4c480964 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py index f95f1117..ca3e94e5 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = BoolOption(name="condition", doc="condition", default=False, properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) 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 d74947f9..6828bd6c 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="condition", doc="No change", default="oui", 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), '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), 'expected': ParamValue("oui")}))})) 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 e2efec20..58d7afea 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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), '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), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 81e6c903..299e1d37 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"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"})) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 81e6c903..299e1d37 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"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"})) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index 5f38ff7f..875068e7 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"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"})) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index 62a1afa9..365d0e6d 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="condition", doc="No change", values=('non', 'statique'), default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", 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"})) 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 83e1a28e..d6ef9410 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/11valid_enum_variable/tiramisu/base.py b/tests/dictionaries/11valid_enum_variable/tiramisu/base.py index 8d10dc0d..e4907cf9 100644 --- a/tests/dictionaries/11valid_enum_variable/tiramisu/base.py +++ b/tests/dictionaries/11valid_enum_variable/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="var", doc="New variable", multi=True, default=['a', 'b', 'c'], default_multi="a", properties=frozenset({"mandatory", "normal"})) option_3 = ChoiceOption(name="mode_conteneur_actif", doc="No change", values=Calculation(func.calc_value, Params((ParamOption(option_4)))), default="a", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/20family_append/tiramisu/base.py b/tests/dictionaries/20family_append/tiramisu/base.py index 4dd75664..9ad04363 100644 --- a/tests/dictionaries/20family_append/tiramisu/base.py +++ b/tests/dictionaries/20family_append/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", 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, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/20family_appendaccent/tiramisu/base.py b/tests/dictionaries/20family_appendaccent/tiramisu/base.py index 1258876e..cd378b9d 100644 --- a/tests/dictionaries/20family_appendaccent/tiramisu/base.py +++ b/tests/dictionaries/20family_appendaccent/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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), '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"})) diff --git a/tests/dictionaries/20family_empty/tiramisu/base.py b/tests/dictionaries/20family_empty/tiramisu/base.py index 0411ce41..bcff5670 100644 --- a/tests/dictionaries/20family_empty/tiramisu/base.py +++ b/tests/dictionaries/20family_empty/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/20family_hidden/tiramisu/base.py b/tests/dictionaries/20family_hidden/tiramisu/base.py index 199f34f4..3660de89 100644 --- a/tests/dictionaries/20family_hidden/tiramisu/base.py +++ b/tests/dictionaries/20family_hidden/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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({"hidden", "normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/20family_mode/tiramisu/base.py b/tests/dictionaries/20family_mode/tiramisu/base.py index 0411ce41..bcff5670 100644 --- a/tests/dictionaries/20family_mode/tiramisu/base.py +++ b/tests/dictionaries/20family_mode/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/20family_modeleadership/tiramisu/base.py b/tests/dictionaries/20family_modeleadership/tiramisu/base.py index 59ce6209..c44c4518 100644 --- a/tests/dictionaries/20family_modeleadership/tiramisu/base.py +++ b/tests/dictionaries/20family_modeleadership/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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, properties=frozenset({"normal"})) diff --git a/tests/dictionaries/20notemplating/tiramisu/base.py b/tests/dictionaries/20notemplating/tiramisu/base.py index e9c74948..a6e0a5ac 100644 --- a/tests/dictionaries/20notemplating/tiramisu/base.py +++ b/tests/dictionaries/20notemplating/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/20override/tiramisu/base.py b/tests/dictionaries/20override/tiramisu/base.py index a6a85d74..310440f5 100644 --- a/tests/dictionaries/20override/tiramisu/base.py +++ b/tests/dictionaries/20override/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/20override_no_templating/tiramisu/base.py b/tests/dictionaries/20override_no_templating/tiramisu/base.py index f32fc665..3bdc9e28 100644 --- a/tests/dictionaries/20override_no_templating/tiramisu/base.py +++ b/tests/dictionaries/20override_no_templating/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/20override_source/tiramisu/base.py b/tests/dictionaries/20override_source/tiramisu/base.py index 5eacc5b1..d9a14cba 100644 --- a/tests/dictionaries/20override_source/tiramisu/base.py +++ b/tests/dictionaries/20override_source/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/21family_empty/tiramisu/base.py b/tests/dictionaries/21family_empty/tiramisu/base.py index c4fff0b1..9bdad808 100644 --- a/tests/dictionaries/21family_empty/tiramisu/base.py +++ b/tests/dictionaries/21family_empty/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py b/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py index 35f6c402..8e5568f1 100644 --- a/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", properties=frozenset({"basic", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py index af5d621b..71762e7c 100644 --- a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("value")))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py b/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py index 3fd19671..abe968b4 100644 --- a/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="value", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py index fdebf37a..746f4317 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("value")))), properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/40condition_base/tiramisu/base.py b/tests/dictionaries/40condition_base/tiramisu/base.py index 7a977d97..a7fba4b2 100644 --- a/tests/dictionaries/40condition_base/tiramisu/base.py +++ b/tests/dictionaries/40condition_base/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/40condition_base_add/tiramisu/base.py b/tests/dictionaries/40condition_base_add/tiramisu/base.py index 7a977d97..a7fba4b2 100644 --- a/tests/dictionaries/40condition_base_add/tiramisu/base.py +++ b/tests/dictionaries/40condition_base_add/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/40condition_fallback/tiramisu/base.py b/tests/dictionaries/40condition_fallback/tiramisu/base.py index 7fa9261a..5f0ec474 100644 --- a/tests/dictionaries/40condition_fallback/tiramisu/base.py +++ b/tests/dictionaries/40condition_fallback/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) diff --git a/tests/dictionaries/40condition_optional/tiramisu/base.py b/tests/dictionaries/40condition_optional/tiramisu/base.py index cc646169..ecf65c60 100644 --- a/tests/dictionaries/40condition_optional/tiramisu/base.py +++ b/tests/dictionaries/40condition_optional/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) diff --git a/tests/dictionaries/40condition_optional_empty/tiramisu/base.py b/tests/dictionaries/40condition_optional_empty/tiramisu/base.py index f451bc41..0232a4ac 100644 --- a/tests/dictionaries/40condition_optional_empty/tiramisu/base.py +++ b/tests/dictionaries/40condition_optional_empty/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/40empty_param/tiramisu/base.py b/tests/dictionaries/40empty_param/tiramisu/base.py index 57c64ed0..1aaecb16 100644 --- a/tests/dictionaries/40empty_param/tiramisu/base.py +++ b/tests/dictionaries/40empty_param/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = PortOption(name="toto1", doc="Port d'écoute du proxy", default=Calculation(func.calc_multi_condition, Params((ParamValue(None)))), allow_private=True, properties=frozenset({"expert"})) option_4 = PortOption(name="toto2", doc="Port d'écoute du proxy NTLM", default="3127", allow_private=True, properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="proxy_authentifie", doc="proxy authentifié", children=[option_3, option_4], properties=frozenset({"expert"})) diff --git a/tests/dictionaries/40empty_param2/tiramisu/base.py b/tests/dictionaries/40empty_param2/tiramisu/base.py index d9aeea23..212d7262 100644 --- a/tests/dictionaries/40empty_param2/tiramisu/base.py +++ b/tests/dictionaries/40empty_param2/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = PortOption(name="toto1", doc="Port d'écoute du proxy", default=Calculation(func.calc_multi_condition, Params((), kwargs={'value': ParamValue(None)})), allow_private=True, properties=frozenset({"expert"})) option_4 = PortOption(name="toto2", doc="Port d'écoute du proxy NTLM", default="3127", allow_private=True, properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="proxy_authentifie", doc="proxy authentifié", children=[option_3, option_4], properties=frozenset({"expert"})) diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py b/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py index 35a49bb6..f2fba470 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py +++ b/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", multi=True, default=['non'], properties=frozenset({"force_default_on_freeze", "frozen", "mandatory"})) option_6 = StrOption(name="mode_conteneur_actif2", doc="No change", multi=True, default_multi="non", properties=frozenset({"force_default_on_freeze", "frozen", "mandatory", "normal"})) diff --git a/tests/dictionaries/40ifin_leadership/tiramisu/base.py b/tests/dictionaries/40ifin_leadership/tiramisu/base.py index 259523c8..f9167dde 100644 --- a/tests/dictionaries/40ifin_leadership/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadership/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True) diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index 239b6749..b9d6e460 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a'], properties=frozenset({"mandatory"})) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py index 46993ff9..0a0c35e7 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a', 'b'], properties=frozenset({"mandatory"})) diff --git a/tests/dictionaries/40ifin_multi/tiramisu/base.py b/tests/dictionaries/40ifin_multi/tiramisu/base.py index 45e840c3..c56c018f 100644 --- a/tests/dictionaries/40ifin_multi/tiramisu/base.py +++ b/tests/dictionaries/40ifin_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) diff --git a/tests/dictionaries/40ifin_validenum/tiramisu/base.py b/tests/dictionaries/40ifin_validenum/tiramisu/base.py index d4d80591..dcc8ddd9 100644 --- a/tests/dictionaries/40ifin_validenum/tiramisu/base.py +++ b/tests/dictionaries/40ifin_validenum/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) diff --git a/tests/dictionaries/45extra_without_family/00-base.xml b/tests/dictionaries/45extra_without_family/00-base.xml new file mode 100644 index 00000000..1a1a2d77 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + + + + rougail + + + + diff --git a/tests/dictionaries/80family_dynamic_with_family/errno_2 b/tests/dictionaries/45extra_without_family/__init__.py similarity index 100% rename from tests/dictionaries/80family_dynamic_with_family/errno_2 rename to tests/dictionaries/45extra_without_family/__init__.py diff --git a/tests/dictionaries/45extra_without_family/extra_dirs/extra/00-base.xml b/tests/dictionaries/45extra_without_family/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..2e5f4742 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/extra_dirs/extra/00-base.xml @@ -0,0 +1,13 @@ + + + + + + + + + non + extra.my_var + + + diff --git a/tests/dictionaries/45extra_without_family/makedict/base.json b/tests/dictionaries/45extra_without_family/makedict/base.json new file mode 100644 index 00000000..f78601d2 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/makedict/base.json @@ -0,0 +1 @@ +{"rougail.my_var": "rougail", "extra.my_var": null, "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": "creole", "services.test.files.file.activate": true} diff --git a/tests/dictionaries/45extra_without_family/result/etc/file b/tests/dictionaries/45extra_without_family/result/etc/file new file mode 100644 index 00000000..7ef82175 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/result/etc/file @@ -0,0 +1,2 @@ +rougail + diff --git a/tests/dictionaries/45extra_without_family/tiramisu/base.py b/tests/dictionaries/45extra_without_family/tiramisu/base.py new file mode 100644 index 00000000..00324be9 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/tiramisu/base.py @@ -0,0 +1,29 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_2 = StrOption(name="my_var", doc="my_var", default="rougail", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_4 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_multi_condition, Params((ParamValue("non")))), properties=frozenset({"normal"})) +option_3 = OptionDescription(name="extra", doc="extra", children=[option_4]) +option_9 = StrOption(name="group", doc="group", default="root") +option_10 = StrOption(name="mode", doc="mode", default="0644") +option_11 = StrOption(name="name", doc="name", default="/etc/file") +option_12 = StrOption(name="owner", doc="owner", default="root") +option_13 = StrOption(name="source", doc="source", default="file") +option_14 = StrOption(name="templating", doc="templating", default="creole") +option_15 = BoolOption(name="activate", doc="activate", default=True) +option_8 = OptionDescription(name="file", doc="file", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) +option_7 = OptionDescription(name="files", doc="files", children=[option_8]) +option_6 = OptionDescription(name="test", doc="test", children=[option_7]) +option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3, option_5]) diff --git a/tests/dictionaries/45extra_without_family/tmpl/file b/tests/dictionaries/45extra_without_family/tmpl/file new file mode 100644 index 00000000..2277a384 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/tmpl/file @@ -0,0 +1,2 @@ +%%my_var +%%extra.my_var diff --git a/tests/dictionaries/45multi_family/tiramisu/base.py b/tests/dictionaries/45multi_family/tiramisu/base.py index 9d00f696..7e556a1c 100644 --- a/tests/dictionaries/45multi_family/tiramisu/base.py +++ b/tests/dictionaries/45multi_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_4 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"})) option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"normal"})) option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/45multi_family_order/tiramisu/base.py b/tests/dictionaries/45multi_family_order/tiramisu/base.py index ee00f16d..a5c092cd 100644 --- a/tests/dictionaries/45multi_family_order/tiramisu/base.py +++ b/tests/dictionaries/45multi_family_order/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_2 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal"})) option_4 = StrOption(name="variable2", doc="variable2", properties=frozenset({"normal"})) option_6 = StrOption(name="variable3", doc="variable3", properties=frozenset({"normal"})) diff --git a/tests/dictionaries/45without_family/tiramisu/base.py b/tests/dictionaries/45without_family/tiramisu/base.py index 8adb1991..678c2bed 100644 --- a/tests/dictionaries/45without_family/tiramisu/base.py +++ b/tests/dictionaries/45without_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_2 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/50exists_exists/tiramisu/base.py b/tests/dictionaries/50exists_exists/tiramisu/base.py index fa37da6f..deb9cbf1 100644 --- a/tests/dictionaries/50exists_exists/tiramisu/base.py +++ b/tests/dictionaries/50exists_exists/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Description", 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/50redefine_description/tiramisu/base.py b/tests/dictionaries/50redefine_description/tiramisu/base.py index db07684c..792e2176 100644 --- a/tests/dictionaries/50redefine_description/tiramisu/base.py +++ b/tests/dictionaries/50redefine_description/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefined", 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51exists_nonexists/tiramisu/base.py b/tests/dictionaries/51exists_nonexists/tiramisu/base.py index 30fc22fb..f5df0733 100644 --- a/tests/dictionaries/51exists_nonexists/tiramisu/base.py +++ b/tests/dictionaries/51exists_nonexists/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="Description", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="New description", default="oui", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/51exists_redefine/tiramisu/base.py b/tests/dictionaries/51exists_redefine/tiramisu/base.py index caaa90a9..de4748b5 100644 --- a/tests/dictionaries/51exists_redefine/tiramisu/base.py +++ b/tests/dictionaries/51exists_redefine/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_auto/tiramisu/base.py b/tests/dictionaries/51redefine_auto/tiramisu/base.py index 1cc14a64..213df46a 100644 --- a/tests/dictionaries/51redefine_auto/tiramisu/base.py +++ b/tests/dictionaries/51redefine_auto/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_autofill/tiramisu/base.py b/tests/dictionaries/51redefine_autofill/tiramisu/base.py index 97a82fa6..09b30dd5 100644 --- a/tests/dictionaries/51redefine_autofill/tiramisu/base.py +++ b/tests/dictionaries/51redefine_autofill/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_family/tiramisu/base.py b/tests/dictionaries/51redefine_family/tiramisu/base.py index 030c7c00..60c05013 100644 --- a/tests/dictionaries/51redefine_family/tiramisu/base.py +++ b/tests/dictionaries/51redefine_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) diff --git a/tests/dictionaries/51redefine_fill/tiramisu/base.py b/tests/dictionaries/51redefine_fill/tiramisu/base.py index 1cc14a64..213df46a 100644 --- a/tests/dictionaries/51redefine_fill/tiramisu/base.py +++ b/tests/dictionaries/51redefine_fill/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_fillauto/tiramisu/base.py b/tests/dictionaries/51redefine_fillauto/tiramisu/base.py index 1cc14a64..213df46a 100644 --- a/tests/dictionaries/51redefine_fillauto/tiramisu/base.py +++ b/tests/dictionaries/51redefine_fillauto/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_help/tiramisu/base.py b/tests/dictionaries/51redefine_help/tiramisu/base.py index dd0f5c93..d7a3b246 100644 --- a/tests/dictionaries/51redefine_help/tiramisu/base.py +++ b/tests/dictionaries/51redefine_help/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="redefine help", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_3.impl_set_information('help', "redefine help ok") option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/51redefine_hidden/tiramisu/base.py b/tests/dictionaries/51redefine_hidden/tiramisu/base.py index 198f1ac8..e05e7be1 100644 --- a/tests/dictionaries/51redefine_hidden/tiramisu/base.py +++ b/tests/dictionaries/51redefine_hidden/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine hidden", 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_remove_check/tiramisu/base.py b/tests/dictionaries/51redefine_remove_check/tiramisu/base.py index 2100e7e7..9d70847b 100644 --- a/tests/dictionaries/51redefine_remove_check/tiramisu/base.py +++ b/tests/dictionaries/51redefine_remove_check/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py index 3966f712..411b40d7 100644 --- a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py +++ b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py index 86daaadf..c8f3bdf7 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_7 = StrOption(name="module_instancie", 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({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/51redefine_validenum/tiramisu/base.py b/tests/dictionaries/51redefine_validenum/tiramisu/base.py index d22f83e7..34de05c3 100644 --- a/tests/dictionaries/51redefine_validenum/tiramisu/base.py +++ b/tests/dictionaries/51redefine_validenum/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = ChoiceOption(name="mode_conteneur_actif", doc="Redefine description", values=('a', 'b'), default="a", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/51redefine_value/tiramisu/base.py b/tests/dictionaries/51redefine_value/tiramisu/base.py index 8d4fea83..e4b863be 100644 --- a/tests/dictionaries/51redefine_value/tiramisu/base.py +++ b/tests/dictionaries/51redefine_value/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine value", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="Redefine value", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/51remove_fill/tiramisu/base.py b/tests/dictionaries/51remove_fill/tiramisu/base.py index 2e8c218b..78ccdb56 100644 --- a/tests/dictionaries/51remove_fill/tiramisu/base.py +++ b/tests/dictionaries/51remove_fill/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/52exists_redefine/tiramisu/base.py b/tests/dictionaries/52exists_redefine/tiramisu/base.py index 1c0944f6..47ed77cd 100644 --- a/tests/dictionaries/52exists_redefine/tiramisu/base.py +++ b/tests/dictionaries/52exists_redefine/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="New description", 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/60action_external/tiramisu/base.py b/tests/dictionaries/60action_external/tiramisu/base.py index 2ff964ef..60131d82 100644 --- a/tests/dictionaries/60action_external/tiramisu/base.py +++ b/tests/dictionaries/60action_external/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py index 113bc42d..e9805eb4 100644 --- a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py +++ b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_5 = StrOption(name="module_instancie", 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({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) diff --git a/tests/dictionaries/60extra_group/tiramisu/base.py b/tests/dictionaries/60extra_group/tiramisu/base.py index 0b56385e..2dfb82fa 100644 --- a/tests/dictionaries/60extra_group/tiramisu/base.py +++ b/tests/dictionaries/60extra_group/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="activer_ejabberd", 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], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/60extra_help/tiramisu/base.py b/tests/dictionaries/60extra_help/tiramisu/base.py index 859b5465..de4eb536 100644 --- a/tests/dictionaries/60extra_help/tiramisu/base.py +++ b/tests/dictionaries/60extra_help/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="activer_ejabberd", 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], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/60extra_load/tiramisu/base.py b/tests/dictionaries/60extra_load/tiramisu/base.py index fd22284c..d47bb6a3 100644 --- a/tests/dictionaries/60extra_load/tiramisu/base.py +++ b/tests/dictionaries/60extra_load/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="activer_ejabberd", 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], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/60extra_mandatory/tiramisu/base.py b/tests/dictionaries/60extra_mandatory/tiramisu/base.py index 8c329a03..d9d56446 100644 --- a/tests/dictionaries/60extra_mandatory/tiramisu/base.py +++ b/tests/dictionaries/60extra_mandatory/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="activer_ejabberd", 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], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/60extra_name_family/tiramisu/base.py b/tests/dictionaries/60extra_name_family/tiramisu/base.py index fd0b508e..706f671e 100644 --- a/tests/dictionaries/60extra_name_family/tiramisu/base.py +++ b/tests/dictionaries/60extra_name_family/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="extra", doc="extra", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/60extra_no_condition/tiramisu/base.py b/tests/dictionaries/60extra_no_condition/tiramisu/base.py index a8d37abd..912d77c1 100644 --- a/tests/dictionaries/60extra_no_condition/tiramisu/base.py +++ b/tests/dictionaries/60extra_no_condition/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_5 = StrOption(name="module_instancie", 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({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) diff --git a/tests/dictionaries/60extra_redefine/tiramisu/base.py b/tests/dictionaries/60extra_redefine/tiramisu/base.py index deb751cd..6ddcd90e 100644 --- a/tests/dictionaries/60extra_redefine/tiramisu/base.py +++ b/tests/dictionaries/60extra_redefine/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="activer_ejabberd", 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], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/60familyaction/tiramisu/base.py b/tests/dictionaries/60familyaction/tiramisu/base.py index 10257ff0..6f61d69e 100644 --- a/tests/dictionaries/60familyaction/tiramisu/base.py +++ b/tests/dictionaries/60familyaction/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/60familyaction_accent/tiramisu/base.py b/tests/dictionaries/60familyaction_accent/tiramisu/base.py index 10257ff0..6f61d69e 100644 --- a/tests/dictionaries/60familyaction_accent/tiramisu/base.py +++ b/tests/dictionaries/60familyaction_accent/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py b/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py index 594b9b61..43d104bb 100644 --- a/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py +++ b/tests/dictionaries/60familyaction_mandatory/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_files/tiramisu/base.py b/tests/dictionaries/70container_files/tiramisu/base.py index 35f26d55..c939a358 100644 --- a/tests/dictionaries/70container_files/tiramisu/base.py +++ b/tests/dictionaries/70container_files/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py index 192ff297..1d3e2c34 100644 --- a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="file_name", doc="file_name", multi=True, default=['/etc/mailname', '/etc/mailname2'], default_multi="/etc/mailname", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py index 1700afe8..3f8dcd23 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="file_name", doc="file_name", multi=True, default=['/etc/mailname', '/etc/mailname2'], default_multi="/etc/mailname", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="var", doc="var", multi=True, default=['mailname', 'mailname2'], default_multi="mailname", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py index 2c8b0aee..6c29194e 100644 --- a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="file_name", doc="file_name", default="/etc/mailname", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="var", doc="var", default="mailname", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/70container_files_twice/tiramisu/base.py b/tests/dictionaries/70container_files_twice/tiramisu/base.py index 70e58bb8..be8d98d2 100644 --- a/tests/dictionaries/70container_files_twice/tiramisu/base.py +++ b/tests/dictionaries/70container_files_twice/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_filesmulti/tiramisu/base.py b/tests/dictionaries/70container_filesmulti/tiramisu/base.py index 1daadaa5..6406494f 100644 --- a/tests/dictionaries/70container_filesmulti/tiramisu/base.py +++ b/tests/dictionaries/70container_filesmulti/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_filesredefine/tiramisu/base.py b/tests/dictionaries/70container_filesredefine/tiramisu/base.py index 4ea6bace..31ec80f8 100644 --- a/tests/dictionaries/70container_filesredefine/tiramisu/base.py +++ b/tests/dictionaries/70container_filesredefine/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_new/tiramisu/base.py b/tests/dictionaries/70container_new/tiramisu/base.py index f899d6b9..9b97268a 100644 --- a/tests/dictionaries/70container_new/tiramisu/base.py +++ b/tests/dictionaries/70container_new/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_newnocont/tiramisu/base.py b/tests/dictionaries/70container_newnocont/tiramisu/base.py index 38e64569..621b70cf 100644 --- a/tests/dictionaries/70container_newnocont/tiramisu/base.py +++ b/tests/dictionaries/70container_newnocont/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_newwithip/tiramisu/base.py b/tests/dictionaries/70container_newwithip/tiramisu/base.py index 6f246395..e5b8fb5d 100644 --- a/tests/dictionaries/70container_newwithip/tiramisu/base.py +++ b/tests/dictionaries/70container_newwithip/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = IPOption(name="adresse_ip_test", doc="No change", allow_reserved=True, properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/70container_pathaccess/tiramisu/base.py b/tests/dictionaries/70container_pathaccess/tiramisu/base.py index 25c12451..436088a9 100644 --- a/tests/dictionaries/70container_pathaccess/tiramisu/base.py +++ b/tests/dictionaries/70container_pathaccess/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = NetmaskOption(name="nut_monitor_netmask", doc="Masque de l'IP du réseau de l'esclave", properties=frozenset({"basic", "mandatory"})) option_5 = NetworkOption(name="nut_monitor_host", doc="Adresse IP du réseau de l'esclave", properties=frozenset({"basic", "mandatory"})) diff --git a/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py b/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py index 1eb86e33..bc79dc40 100644 --- a/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py +++ b/tests/dictionaries/70container_pathaccess_leadership/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_5 = NetmaskOption(name="nut_monitor_netmask", doc="Masque de l'IP du réseau de l'esclave", multi=True, properties=frozenset({"mandatory"})) option_6 = NetworkOption(name="nut_monitor_host", doc="Adresse IP du réseau de l'esclave", multi=True, properties=frozenset({"basic", "mandatory"})) diff --git a/tests/dictionaries/70container_save/tiramisu/base.py b/tests/dictionaries/70container_save/tiramisu/base.py index 4027c7a2..96d39ae0 100644 --- a/tests/dictionaries/70container_save/tiramisu/base.py +++ b/tests/dictionaries/70container_save/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_serviceaccess/tiramisu/base.py b/tests/dictionaries/70container_serviceaccess/tiramisu/base.py index a4583417..88990725 100644 --- a/tests/dictionaries/70container_serviceaccess/tiramisu/base.py +++ b/tests/dictionaries/70container_serviceaccess/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_servicerestriction/tiramisu/base.py b/tests/dictionaries/70container_servicerestriction/tiramisu/base.py index 015197f3..65924846 100644 --- a/tests/dictionaries/70container_servicerestriction/tiramisu/base.py +++ b/tests/dictionaries/70container_servicerestriction/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/70container_services/tiramisu/base.py b/tests/dictionaries/70container_services/tiramisu/base.py index 20fd844f..6683d20a 100644 --- a/tests/dictionaries/70container_services/tiramisu/base.py +++ b/tests/dictionaries/70container_services/tiramisu/base.py @@ -11,7 +11,6 @@ try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/80auto_family/errno_8 b/tests/dictionaries/80auto_family/errno_8 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_dynamic_with_family/errno_22 b/tests/dictionaries/80family_dynamic_with_family/errno_22 new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 96f6e64f..68d78d59 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -5,9 +5,8 @@ from pytest import fixture, raises from os import listdir from json import load -from rougail import Rougail +from rougail import RougailConvert, RougailConfig from rougail.error import DictConsistencyError -from rougail.config import Config @@ -55,23 +54,23 @@ def test_dir_error(request): def launch_flattener(test_dir, test_ok=False): - eolobj = Rougail(Config['dtdfilename']) dirs = [test_dir] subfolder = join(test_dir, 'subfolder') if isdir(subfolder): dirs.append(subfolder) - eolobj.create_or_populate_from_xml(dirs) + RougailConfig['dictionaries_dir'] = dirs + RougailConfig['extra_dictionaries'] = {} if isdir(join(test_dir, 'extra_dirs')): extras = listdir(join(test_dir, 'extra_dirs')) extras.sort() for extra in extras: subfolder = join(test_dir, 'extra_dirs', extra) if isdir(subfolder): - eolobj.create_or_populate_from_xml([subfolder], extra) + RougailConfig['extra_dictionaries'][extra] = [subfolder] eosfunc = join(dico_dirs, '../eosfunc/test.py') - Config['patch_dir'] = join(test_dir, 'patches') - eolobj.space_visitor(eosfunc) - tiramisu_objects = eolobj.save() + RougailConfig['functions_file'] = eosfunc + eolobj = RougailConvert() + tiramisu_objects = eolobj.save(None) if 'children=[]' in tiramisu_objects.split('\n')[-2]: raise Exception('empty tiramisu object?') tiramisu_dir = join(test_dir, 'tiramisu') @@ -110,5 +109,6 @@ def test_error_dictionary(test_dir_error): def test_no_dtd(): + RougailConfig['dtdfilename'] = 'notexists.dtd' with raises(IOError): - eolobj = Rougail('notexists.dtd') + eolobj = RougailConvert() diff --git a/tests/test_3_template.py b/tests/test_3_template.py index 549071d5..a9cacbd0 100644 --- a/tests/test_3_template.py +++ b/tests/test_3_template.py @@ -5,7 +5,7 @@ from pytest import fixture, mark from lxml.etree import parse from tiramisu import Config -from rougail import template +from rougail import RougailConfig, RougailTemplate template_dirs = 'tests/dictionaries' @@ -58,13 +58,13 @@ async def test_dictionary(test_dir): if isdir(dest_dir): rmtree(dest_dir) mkdir(dest_dir) - template.Config['patch_dir'] = join(test_dir, 'patches') - await template.generate(config, - funcs_file, - distrib_dir, - tmp_dir, - dest_dir, - ) + RougailConfig['patches_dir'] = join(test_dir, 'patches') + RougailConfig['templates_dir'] = distrib_dir + RougailConfig['tmp_dir'] = tmp_dir + RougailConfig['functions_file'] = funcs_file + RougailConfig['destinations_dir'] = dest_dir + engine = RougailTemplate(config) + await engine.instance_files() list_templates = set() if isdir(dest_dir): find_files(dest_dir, From c24ef61bff3735a7a8402a1808cfd6818ffc8a73 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 14 Feb 2021 10:12:42 +0100 Subject: [PATCH 105/168] update french documentation --- doc/README.md | 28 ++++-- doc/dev/README.md | 187 ++++++++++++++++++++++++++++++++++++++++ doc/dev/config.md | 67 ++++++++++++++ doc/service/ip.md | 6 +- doc/service/override.md | 2 + doc/service/port.md | 4 +- 6 files changed, 287 insertions(+), 7 deletions(-) create mode 100644 doc/dev/README.md create mode 100644 doc/dev/config.md diff --git a/doc/README.md b/doc/README.md index 7289514c..293f91b9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,24 +1,42 @@ # Rougail +Rougail est un bibliothèque python3 qui permet de charger des dictionnaires (fichiers au format XML), de charger les variables dans Tiramisu et de générer des templates. + +## La bibliothèque + + - [Utiliser la bibliothèque](dev/README.md) + - [Personnaliser la configration de la bibliothèque](dev/config.md) + ## Les dictionnaires -FIXME : explications -FIXME : extra +Un dictionnaire est un fichier XML donc la structure est expliqué ci-dessous. -## Les variables +Un dictionnaire contient en ensemble de variable, utilisable à tout moment, notamment dans des templates. + +Il est possible d'avoir plusieurs espace de nom pour classer les variables (appeler aussi "extra") mais il est aussi possible, à l'interieur de ce espace de nom de mettre des familles pour classer les variables. + +Les familles et les variables peuvent être défini dans plusieurs dictionnaires. Ces dictionnaires s'aggrège alors. Il est possible de rajouter des familles des variables, des services, des éléments à un service et des contraintes. + +Il est également possible de redéfinir des éléments pour changer les comportement d'une variable ou d'un service. + +### Les variables - [Les familles](family/README.md) - [Les variables](variable/README.md) -## Les services +### Les services - [La gestion d'un fichier](service/file.md) - [La gestion d'un fichier de service systemd](service/override.md) - [La gestion d'un port](service/port.md) - [La gestion d'une ip](service/ip.md) -## Les contraintes +### Les contraintes - [Les calcules automatiques](fill/README.md) - [Les vérifications des valeurs](check/README.md) - [Les conditions](condition/README.md) + +## Les templates + + - Type creole diff --git a/doc/dev/README.md b/doc/dev/README.md new file mode 100644 index 00000000..b6fbcbd5 --- /dev/null +++ b/doc/dev/README.md @@ -0,0 +1,187 @@ +# La bibliothèque rougail + +Rougail est une bibliothèque simple a utiliser. + +Dans les exemples suivant, nous utilisons la configuration par défaut de Rougail. Vous pouvez [personnaliser les répertoires utilisés](config.md). + +## Convertisons un dictionnaire en objet tiramisu + +Commençons par créer un dictionnaire simple. + +Voici un premier dictionnaire /srv/rougail/dictionaries/00-base.xml : + +``` + + + + + my_value + + + +``` + +Construisons les objets tiramisu : + +``` +from rougail import RougailConvert + +rougail = RougailConvert() +rougail.save('example1.py') +``` + +Un nouveau fichier 'example1.py' va être créé dans le répertoire local + +## Convertisons un dictionnaire et un dictionnaire extra en objet tiramisu + +En plus du dictionnaire précédent, créons un dictionnaire extra /srv/rougail/extra_dictionaries/00-base.xml + +``` + + + + + my_value_extra + + + +``` + +Construisons les objets tiramisu : + +``` +from rougail import RougailConvert, RougailConfig + +RougailConfig['extra_dictionaries']['example'] = ['/srv/rougail/extra_dictionaries/'] + +rougail = RougailConvert() +rougail.save('example2.py') +``` + +## Templatisons un template + +Nous créons un dictionnaire complémentaire pour ajouter notre template /srv/rougail/dictionaries/00-template.xml : + +``` + + + + + + + + +``` + +Et un template /srv/rougail/templates/example.conf : + +``` +The value: %%my_variable + +The extra value: %%example.my_variable_extra +``` + +Générons le fichier tiramisu : + +``` +from rougail import RougailConvert, RougailConfig + +RougailConfig['extra_dictionaries']['example'] = ['/srv/rougail/extra_dictionaries/'] + +rougail = RougailConvert() +rougail.save('example3.py') +``` + +Créer les répertoires utils pour la templatisation : mkdir /srv/rougail/destinations /srv/rougail/tmp + +Générons le template : + +``` +import asyncio +from tiramisu import Config +from rougail import RougailTemplate +from example3 import option_0 + +async def template(): + config = await Config(option_0) + engine = RougailTemplate(config) + await engine.instance_files() + +loop = asyncio.get_event_loop() +loop.run_until_complete(template()) +loop.close() +``` + +Le fichier /srv/rougail/destinations/etc/example.conf est maintenant créé avec le contenu attendu suivant : + +``` +The value: my_value + +The extra value: my_value_extra +``` + +## Appliquons un patch au template + +Il peut être intéressant de réaliser un patch à un template pour corriger un problème spécifique à notre environnement, sans attendre que le mainteneur du template n'est fait la correction. + +Testons en créant le patch /srv/rougail/patches/example.conf.patch : + +``` +--- /srv/rougail/templates/example.conf 2021-02-13 19:41:38.677491087 +0100 ++++ tmp/example.conf 2021-02-13 20:12:55.525089820 +0100 +@@ -1,3 +1,5 @@ + The value: %%my_variable + + The extra value: %%example.my_variable_extra ++ ++Add by a patch +``` + +Le patch est bien appliquer sur notre fichier /srv/rougail/destinations/etc/example.conf : + +``` +The value: my_value + +The extra value: my_value_extra + +Add by a patch +``` + +Deux choses importantes à savoir sur les patchs : + +- le nom du patch est obligatoire le nom du template source + ".patch" +- la deuxième ligne toujours commencer par "+++ tmp/" + le nom du template source + +## Créons une fonction personnalisé + +Nous créons un dictionnaire complémentaire pour ajouter un calcul à la variable my_variable_extra dans /srv/rougail/dictionaries/00-fill.xml : + +``` + + + + + my_variable + + + +``` + +Puis créons la fonction "return_no" dans /srv/rougail/functions.py : + +``` +def return_no(): + return 'no' +``` + +Après avoir reconverti les dictionnaires et regénérer le template nous avons donc le contenu du fichier /srv/rougail/destinations/etc/example.conf : + +``` +The value: no + +The extra value: my_value_extra + +Add by a patch +``` + +La valeur de la variable my_variable est bien calculé à partir de la fonction "return_no". diff --git a/doc/dev/config.md b/doc/dev/config.md new file mode 100644 index 00000000..1143c82b --- /dev/null +++ b/doc/dev/config.md @@ -0,0 +1,67 @@ +# Personnalisons la configuration de Rougail + +La configuration de rougail se trouve dans l'objet RougailConfig : + +``` +from rougail import RougailConfig +``` + +C'est un simple dictionnaire python avec différentes clefs. + +Pour modifier il suffit de faire : + +``` +RougailConfig[key] = value +``` + +## Les répertoires des dictionnaires + +Il existe deux types de répertoires de dictionnaires : + +- les dictionnaires principaux avec la clef "dictionaries_dir". La valeur par défaut est ['/srv/rougail/dictionaries']. Cette variable doit contenir la liste des répertoires contenants des dictionnaires. + +Les dictionnaires sont chargés dans l'ordre des répertoires. Chaque répertoire est chargé les uns après les autres. A l'intérieur de ces répertoires les fichiers XML seront classés par ordre alphabétique. + +Il n'y a pas de classement par ordre alphabétique de l'ensemble des fichiers XML de tous les répertoires. + +Les familles et variable de ces dictionnaires sont classés, par défaut, dans l'espace de nom "rougail". Il est possible de changer le nom de cet espace de nom avec la clef "variable_namespace". + +- les dictionnaires extra avec la clef "extra_dictionaries". La valeur est un dictionnaire avec l'ensemble des espaces de nom de extra. La clef étant l'espace de nom et la valeur étant une liste de répertoire. + +Par exemple pour ajouter l'extra "example" il faut faire : + +``` +RougailConfig['extra_dictionaries']['example'] = ['/dir1', '/dir2'] +``` + +Les dictionnaires sont chargés dans le même ordre que les dictionnaires principaux. + +## La DTD + +Rougail a besoin du fichier de DTD pour lire les fichiers dictionnaire. + +Par défaut le fichier de la DTD est dans le sous répertoire "data" du répertoire de code. Le nom du fichier est rougail.dtd. + +Pour pouvez changer le répertoire de destination de la DTD et le nom du fichier avec la clef "dtdfilename". + +## Le fichier de fonction + +Le fichier qui contient les fonctions personnalisés est géré dans la clef "functions_file" et a comme valeur par défaut "/srv/rougail/functions.py". + +## Le répertoire des templates + +Le répertoire des templates est géré dans la clef "templates_dir" et a comme valeur par défaut : "/srv/rougail/templates". + +## Le répertoire des patchs + +Le répertoire des patches est géré dans la clef "patches_dir" et a comme valeur par défaut : "/srv/rougail/patches". + +## Le répertoire temporaire + +Le répertoire temporaire est utile lors de la génération de template. Il contient une copie des templates avec, éventuellement, les patches appliqués sur les templates. + +Le répertoire de temporaire est géré dans la clef "tmp_dir" et a comme valeur par défaut : "/srv/rougail/tmp". + +## Le répertoire de destination des fichiers générés + +Le répertoire de destination des fichiers générés est géré dans la clef "destinations_dir" et a comme valeur par défaut : "/srv/rougail/destinations". diff --git a/doc/service/ip.md b/doc/service/ip.md index c0bb61f1..e78cd14b 100644 --- a/doc/service/ip.md +++ b/doc/service/ip.md @@ -1,4 +1,8 @@ -# IP +# La gestion d'une IP + +## La balise ip + +La gestion des IP se fait dans un conteneur de [service](service.md). FIXME diff --git a/doc/service/override.md b/doc/service/override.md index d071982a..9705714d 100644 --- a/doc/service/override.md +++ b/doc/service/override.md @@ -2,6 +2,8 @@ ## La balise override +La gestion des overrides se fait dans un conteneur de [service](service.md). + La balise override permet de redéfinir facilement un service systemd. Il suffit d'avoir un template dont le nom est par défaut le nom du service avec l'extension "service" et de déclarer la balise : diff --git a/doc/service/port.md b/doc/service/port.md index 0dc7f840..1b02d388 100644 --- a/doc/service/port.md +++ b/doc/service/port.md @@ -1,7 +1,9 @@ -# Port +# La gestion d'un port ## La balise port +La gestion des ports se fait dans un conteneur de [service](service.md). + La balise port permet d'associer un port à service : ``` From b0588768af35f7d9a70f67e3e711494e45fd16ac Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 14 Feb 2021 17:48:50 +0100 Subject: [PATCH 106/168] some correction --- src/rougail/annotator/check.py | 2 - src/rougail/annotator/family.py | 4 -- src/rougail/annotator/param.py | 5 +- src/rougail/convert.py | 63 ++++++++++--------- src/rougail/objspace.py | 24 +++---- src/rougail/xmlreflector.py | 33 ++++------ .../00-base.xml | 18 ++++++ .../__init__.py | 0 .../88valid_enum_not_number_variable/errno_26 | 0 9 files changed, 72 insertions(+), 77 deletions(-) create mode 100644 tests/dictionaries/88valid_enum_not_number_variable/00-base.xml create mode 100644 tests/dictionaries/88valid_enum_not_number_variable/__init__.py create mode 100644 tests/dictionaries/88valid_enum_not_number_variable/errno_26 diff --git a/src/rougail/annotator/check.py b/src/rougail/annotator/check.py index 2cc5e220..8d497a14 100644 --- a/src/rougail/annotator/check.py +++ b/src/rougail/annotator/check.py @@ -66,8 +66,6 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): variable_type = None if obj.name == 'valid_enum': for target in obj.target: - if variable_type and target.name.type != variable_type: - raise Exception('pfff') variable_type = target.name.type return variable_type diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index cd9cdd02..d4a54799 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -78,8 +78,6 @@ class FamilyAnnotator(Walk): return True else: return True - else: - return False return False def remove_empty_families(self) -> None: @@ -99,8 +97,6 @@ class FamilyAnnotator(Walk): for family in self.get_families(): if not hasattr(family, 'description'): family.description = family.name - if not hasattr(family, 'path'): - family.path = family.name family.doc = family.description del family.description family.name = normalize_family(family.name) diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index aa7545d0..c12ab364 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -69,7 +69,8 @@ class ParamAnnotator: ) param.text = self.objectspace.paths.get_variable(path) if variable_type and param.text.type != variable_type: - raise Exception('pfff', variable_type, param.text.type) + msg = _(f'"{obj.name}" has type "{variable_type}" but param has type "{param.text.type}"') + raise DictConsistencyError(msg, 26, param.xmlfiles) if suffix: param.suffix = suffix family_path = self.objectspace.paths.get_variable_family_path(path) @@ -83,7 +84,7 @@ class ParamAnnotator: elif variable_type: if 'type' in vars(param) and variable_type != param.type: msg = _(f'parameter has incompatible type "{param.type}" ' - f'with type "{variable_type}")') + f'with type "{variable_type}"') raise DictConsistencyError(msg, 7, param.xmlfiles) try: param.text = CONVERT_OPTION[variable_type].get('func', str)(param.text) diff --git a/src/rougail/convert.py b/src/rougail/convert.py index 1c3a83d4..143bbf82 100644 --- a/src/rougail/convert.py +++ b/src/rougail/convert.py @@ -59,47 +59,48 @@ class RougailConvert: """Rougail object """ def __init__(self) -> None: - self.xmlreflector = XMLReflector() - self.xmlreflector.parse_dtd() - self.rougailobjspace = RougailObjSpace(self.xmlreflector) - self._load_dictionaries(None, RougailConfig['dictionaries_dir']) - for extra_name, extra_dir in RougailConfig['extra_dictionaries'].items(): - self._load_dictionaries(extra_name, extra_dir) + xmlreflector = XMLReflector() + rougailobjspace = RougailObjSpace(xmlreflector) + self._load_dictionaries(xmlreflector, + rougailobjspace, + RougailConfig['variable_namespace'], + RougailConfig['dictionaries_dir'], + ) + for namespace, extra_dir in RougailConfig['extra_dictionaries'].items(): + if namespace in ['services', RougailConfig['variable_namespace']]: + msg = _(f'Namespace name "{namespace}" is not allowed') + raise DictConsistencyError(msg, 21, None) + self._load_dictionaries(xmlreflector, + rougailobjspace, + namespace, + extra_dir, + ) + functions_file = RougailConfig['functions_file'] + SpaceAnnotator(rougailobjspace, + functions_file, + ) + self.output = TiramisuReflector(rougailobjspace, + functions_file, + ).get_text() + '\n' def _load_dictionaries(self, + xmlreflector: XMLReflector, + rougailobjspace: RougailObjSpace, namespace: str, xmlfolders: List[str], ) -> List[str]: - if namespace in ['services', RougailConfig['variable_namespace']]: - msg = _(f'Namespace name "{namespace}" is not allowed') - raise DictConsistencyError(msg, 21, None) - if hasattr(self.rougailobjspace.space, 'variables') and \ - namespace in self.rougailobjspace.space.variables: - msg = _(f'Namespace "{namespace}" is already loader') - raise DictConsistencyError(msg, 2, None) - for xmlfile in self.xmlreflector.load_xml_from_folders(xmlfolders): - document = self.xmlreflector.parse_xmlfile(xmlfile) - self.rougailobjspace.redefine_variables = [] - self.rougailobjspace.xml_parse_document(xmlfile, - document, - namespace, - ) + for xmlfile, document in xmlreflector.load_xml_from_folders(xmlfolders): + rougailobjspace.xml_parse_document(xmlfile, + document, + namespace, + ) def save(self, filename: str, ) -> str: """Return tiramisu object declaration as a string """ - functions_file = RougailConfig['functions_file'] - SpaceAnnotator(self.rougailobjspace, - functions_file, - ) - tiramisu_objects = TiramisuReflector(self.rougailobjspace, - functions_file, - ) - self.rougailobjspace = None - output = tiramisu_objects.get_text() + '\n' if filename: with open(filename, 'w') as tiramisu: - tiramisu.write(output) - return output + tiramisu.write(self.output) + return self.output diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 6e681486..b32ba34e 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -169,8 +169,6 @@ class RougailObjSpace: ): """Parses a Rougail XML file and populates the RougailObjSpace """ - if not namespace: - namespace = RougailConfig['variable_namespace'] redefine_variables = [] self._xml_parse(xmlfile, document, @@ -328,7 +326,8 @@ class RougailObjSpace: tag = FORCE_TAG.get(child.tag, child.tag) if tag not in vars(space): setattr(space, tag, {}) - return getattr(self, child.tag)(xmlfile, name) + obj = getattr(self, child.tag)(xmlfile, name) + return obj def get_existed_obj(self, name: str, @@ -342,10 +341,7 @@ class RougailObjSpace: name = normalize_family(name) if child.tag == 'variable': # pylint: disable=E1101 if namespace != RougailConfig['variable_namespace']: - if isinstance(space, self.variables): - name = space.name + '.' + name - else: - name = space.path + '.' + name + name = space.path + '.' + name if not self.paths.path_is_defined(name): return None old_family_name = self.paths.get_variable_family_path(name) @@ -469,30 +465,24 @@ class RougailObjSpace: family_name = normalize_family(document.attrib['name']) else: family_name = namespace - if isinstance(space, self.variables): - subpath = space.name - else: - subpath = space.path self.paths.add_variable(namespace, normalize_family(variableobj.name), - subpath, + space.path, document.attrib.get('dynamic') is not None, variableobj, ) elif isinstance(variableobj, self.family): # pylint: disable=E1101 - if isinstance(space, self.variables): - subpath = space.name - else: - subpath = space.path family_name = normalize_family(variableobj.name) if namespace != RougailConfig['variable_namespace']: family_name = namespace + '.' + family_name self.paths.add_family(namespace, family_name, variableobj, - subpath, + space.path, ) + elif isinstance(variableobj, self.variables): + variableobj.path = variableobj.name @staticmethod def add_to_tree_structure(variableobj, diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index 68fd4e12..e59408b2 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -41,9 +41,6 @@ class XMLReflector: writing the xml result on the disk """ def __init__(self): - self.dtd = None - - def parse_dtd(self) -> None: """Loads the Creole DTD :raises IOError: if the DTD is not found @@ -56,23 +53,9 @@ class XMLReflector: with open(dtdfilename, 'r') as dtdfd: self.dtd = DTD(dtdfd) - def parse_xmlfile(self, xmlfile): - """Parses and validates some Creole XML against the Creole DTD - - :returns: the root element tree object - """ - try: - document = parse(xmlfile) - except XMLSyntaxError as err: - raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err - if not self.dtd.validate(document): - dtd_error = self.dtd.error_log.filter_from_errors()[0] - msg = _(f'not a valid XML file: {dtd_error}') - raise DictConsistencyError(msg, 43, [xmlfile]) - return document.getroot() - - @staticmethod - def load_xml_from_folders(xmlfolders: List[str]): + def load_xml_from_folders(self, + xmlfolders: List[str], + ): """Loads all the XML files located in the xmlfolders' list :param xmlfolders: list of full folder's name @@ -82,4 +65,12 @@ class XMLReflector: filename.endswith('.xml')] filenames.sort() for xmlfile in filenames: - yield xmlfile + try: + document = parse(xmlfile) + except XMLSyntaxError as err: + raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err + if not self.dtd.validate(document): + dtd_error = self.dtd.error_log.filter_from_errors()[0] + msg = _(f'not a valid XML file: {dtd_error}') + raise DictConsistencyError(msg, 43, [xmlfile]) + yield xmlfile, document.getroot() diff --git a/tests/dictionaries/88valid_enum_not_number_variable/00-base.xml b/tests/dictionaries/88valid_enum_not_number_variable/00-base.xml new file mode 100644 index 00000000..84dc6823 --- /dev/null +++ b/tests/dictionaries/88valid_enum_not_number_variable/00-base.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + str + enumvar + + + + diff --git a/tests/dictionaries/88valid_enum_not_number_variable/__init__.py b/tests/dictionaries/88valid_enum_not_number_variable/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/88valid_enum_not_number_variable/errno_26 b/tests/dictionaries/88valid_enum_not_number_variable/errno_26 new file mode 100644 index 00000000..e69de29b From ab3713383f5ac6658d45c58cb1634fa83af3e35a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 14 Feb 2021 18:03:15 +0100 Subject: [PATCH 107/168] documentation --- doc/dev/README.md | 34 +++++++++++++++++++--------------- doc/dev/config.md | 8 ++++---- doc/family/simple.md | 3 ++- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/doc/dev/README.md b/doc/dev/README.md index b6fbcbd5..d15000d3 100644 --- a/doc/dev/README.md +++ b/doc/dev/README.md @@ -23,16 +23,16 @@ Voici un premier dictionnaire /srv/rougail/dictionaries/00-base.xml : Construisons les objets tiramisu : -``` +```python from rougail import RougailConvert rougail = RougailConvert() -rougail.save('example1.py') +rougail.save('example.py') ``` -Un nouveau fichier 'example1.py' va être créé dans le répertoire local +Un nouveau fichier 'example.py' va être créé dans le répertoire local -## Convertisons un dictionnaire et un dictionnaire extra en objet tiramisu +## Convertisons un dictionnaire extra en objet tiramisu En plus du dictionnaire précédent, créons un dictionnaire extra /srv/rougail/extra_dictionaries/00-base.xml @@ -49,13 +49,13 @@ En plus du dictionnaire précédent, créons un dictionnaire extra /srv/rougail/ Construisons les objets tiramisu : -``` +```python from rougail import RougailConvert, RougailConfig RougailConfig['extra_dictionaries']['example'] = ['/srv/rougail/extra_dictionaries/'] rougail = RougailConvert() -rougail.save('example2.py') +rougail.save('example.py') ``` ## Templatisons un template @@ -83,24 +83,28 @@ The extra value: %%example.my_variable_extra Générons le fichier tiramisu : -``` +```python from rougail import RougailConvert, RougailConfig RougailConfig['extra_dictionaries']['example'] = ['/srv/rougail/extra_dictionaries/'] rougail = RougailConvert() -rougail.save('example3.py') +rougail.save('example.py') ``` -Créer les répertoires utils pour la templatisation : mkdir /srv/rougail/destinations /srv/rougail/tmp +Créer les répertoires utils pour la templatisation : + +```bash +mkdir /srv/rougail/destinations /srv/rougail/tmp +``` Générons le template : -``` +```python import asyncio +from example import option_0 from tiramisu import Config from rougail import RougailTemplate -from example3 import option_0 async def template(): config = await Config(option_0) @@ -150,11 +154,11 @@ Add by a patch Deux choses importantes à savoir sur les patchs : - le nom du patch est obligatoire le nom du template source + ".patch" -- la deuxième ligne toujours commencer par "+++ tmp/" + le nom du template source +- la deuxième ligne doit toujours commencer par "+++ tmp/" + le nom du template source ## Créons une fonction personnalisé -Nous créons un dictionnaire complémentaire pour ajouter un calcul à la variable my_variable_extra dans /srv/rougail/dictionaries/00-fill.xml : +Nous créons un dictionnaire complémentaire pour ajouter un calcul à la variable "my_variable" dans /srv/rougail/dictionaries/00-fill.xml : ``` @@ -169,7 +173,7 @@ Nous créons un dictionnaire complémentaire pour ajouter un calcul à la variab Puis créons la fonction "return_no" dans /srv/rougail/functions.py : -``` +```python def return_no(): return 'no' ``` @@ -184,4 +188,4 @@ The extra value: my_value_extra Add by a patch ``` -La valeur de la variable my_variable est bien calculé à partir de la fonction "return_no". +La valeur de la variable "my_variable" est bien calculé à partir de la fonction "return_no". diff --git a/doc/dev/config.md b/doc/dev/config.md index 1143c82b..9f2592c7 100644 --- a/doc/dev/config.md +++ b/doc/dev/config.md @@ -2,7 +2,7 @@ La configuration de rougail se trouve dans l'objet RougailConfig : -``` +```python from rougail import RougailConfig ``` @@ -10,7 +10,7 @@ C'est un simple dictionnaire python avec différentes clefs. Pour modifier il suffit de faire : -``` +```python RougailConfig[key] = value ``` @@ -24,9 +24,9 @@ Les dictionnaires sont chargés dans l'ordre des répertoires. Chaque répertoir Il n'y a pas de classement par ordre alphabétique de l'ensemble des fichiers XML de tous les répertoires. -Les familles et variable de ces dictionnaires sont classés, par défaut, dans l'espace de nom "rougail". Il est possible de changer le nom de cet espace de nom avec la clef "variable_namespace". +Les familles et variables de ces dictionnaires sont classés, par défaut, dans l'espace de nom "rougail". Il est possible de changer le nom de cet espace de nom avec la clef "variable_namespace". -- les dictionnaires extra avec la clef "extra_dictionaries". La valeur est un dictionnaire avec l'ensemble des espaces de nom de extra. La clef étant l'espace de nom et la valeur étant une liste de répertoire. +- les dictionnaires extra avec la clef "extra_dictionaries". La valeur est un dictionnaire avec l'ensemble des espaces de nom. La clef étant l'espace de nom et la valeur étant une liste de répertoire. Par exemple pour ajouter l'extra "example" il faut faire : diff --git a/doc/family/simple.md b/doc/family/simple.md index c786aaf9..eb3da32e 100644 --- a/doc/family/simple.md +++ b/doc/family/simple.md @@ -24,8 +24,9 @@ Ou dans une autre famille : +``` -Attention, il famille vide sera automatiquement supprimée. +Attention, une famille vide sera automatiquement supprimée. ## Description et aide de la famille From d1a39e5183df1ad75cb5547ead40f4a63577a03e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 14 Feb 2021 18:42:16 +0100 Subject: [PATCH 108/168] add in RougailConfig auto_freeze_variable --- doc/dev/config.md | 4 ++ doc/family/auto.md | 17 +++---- doc/family/simple.md | 2 +- doc/variable/README.md | 2 - doc/variable/simple.md | 8 +-- src/rougail/annotator/condition.py | 51 ++++++++----------- src/rougail/annotator/variable.py | 3 -- src/rougail/config.py | 3 +- .../00load_autofreeze/00-base.xml | 14 +++-- .../00load_autofreeze/makedict/base.json | 2 +- .../00load_autofreeze/tiramisu/base.py | 7 ++- .../00load_autofreezeexpert/00-base.xml | 14 +++-- .../makedict/base.json | 2 +- .../00load_autofreezeexpert/tiramisu/base.py | 7 ++- .../01auto_autofreeze/00-base.xml | 18 +++---- .../01auto_autofreeze/makedict/base.json | 2 +- .../01auto_autofreeze/tiramisu/base.py | 7 ++- .../01fill_autofreeze/00-base.xml | 24 ++++----- .../01fill_autofreeze/makedict/base.json | 2 +- .../01fill_autofreeze/tiramisu/base.py | 9 ++-- .../01hidden_if_in_autofreeze/00-base.xml | 24 ++++----- .../makedict/base.json | 2 +- .../tiramisu/base.py | 7 ++- .../00-base.xml | 38 +++++++------- .../01-base.xml | 4 +- .../makedict/base.json | 2 +- .../tiramisu/base.py | 13 +++-- .../00-base.xml | 12 ++--- .../makedict/base.json | 2 +- .../tiramisu/base.py | 6 +-- .../60extra_no_condition/00-base.xml | 2 +- .../60extra_no_condition/tiramisu/base.py | 6 +-- .../80leadership_autofreeze/00-base.xml | 8 +-- 33 files changed, 148 insertions(+), 176 deletions(-) diff --git a/doc/dev/config.md b/doc/dev/config.md index 9f2592c7..5b7f92b5 100644 --- a/doc/dev/config.md +++ b/doc/dev/config.md @@ -65,3 +65,7 @@ Le répertoire de temporaire est géré dans la clef "tmp_dir" et a comme valeur ## Le répertoire de destination des fichiers générés Le répertoire de destination des fichiers générés est géré dans la clef "destinations_dir" et a comme valeur par défaut : "/srv/rougail/destinations". + +## La variable auto_freeze + +La propriété auto_freeze n'est appliqué que une variable spécifique passe à True. Par défaut le nom de la variable est "instancied_module", mais il est possible de changer le nom de cette variable via la clef "auto_freeze_variable". diff --git a/doc/family/auto.md b/doc/family/auto.md index a5dc7819..1209dd30 100644 --- a/doc/family/auto.md +++ b/doc/family/auto.md @@ -6,20 +6,17 @@ Le nom et la description de la famille et des variables qu'elle contient sera en Par exemple : ``` - - - val1 - val2 - - - - + + val1 + val2 + + + ``` -Créera trois familles : +Créera deux familles : -- la famille : "my_family" - la famille dynamique : "my_dyn_family_val1" avec la description "Describe val1" - la famille dynamique : "my_dyn_family_val2" avec la description "Describe val2" diff --git a/doc/family/simple.md b/doc/family/simple.md index eb3da32e..c0ce2d33 100644 --- a/doc/family/simple.md +++ b/doc/family/simple.md @@ -56,7 +56,7 @@ Pour définir le [mode](../mode.md) : ## Famille invisible -Il est possible de cacher une famille, ainsi toutes les variables et des familles inclusent dans cette famille. +Il est possible de cacher une famille, ainsi que toutes les variables et des familles inclusent dans cette famille. Cacher une famille signifie qu'elle ne sera pas visible lorsqu'on modifie la configuration du service. Par contre ces variables sont accessibles lorsqu'on va utiliser ces variables. diff --git a/doc/variable/README.md b/doc/variable/README.md index db84b9ed..af87388f 100644 --- a/doc/variable/README.md +++ b/doc/variable/README.md @@ -2,5 +2,3 @@ - [Une variable](simple.md) - [Variable meneuse ou suiveuse](leadership.md) - -FIXME diff --git a/doc/variable/simple.md b/doc/variable/simple.md index 4ac5a286..98df5cf2 100644 --- a/doc/variable/simple.md +++ b/doc/variable/simple.md @@ -36,10 +36,10 @@ Une variable a un type. Ce type permet de définir les valeurs acceptées par ce - string : chaine de caractère (type par défaut) - number : un nombre - float : un chiffre flottant -- boolean : True ou False si aucune valeur n'est défini la valeur par défaut cette variable sera True +- boolean : "True" ou "False", si aucune valeur n'est défini la valeur par défaut de cette variable sera "True" - password : un mot de passe - mail : une adresse mail -- filename : nom de fichier au sens Unix (exemple : '/etc/passwd') +- filename : nom de fichier au sens Unix (exemple : "/etc/passwd") - date : une date au format "%Y-%m-%d" (exemple : "2021-01-30") - unix_user : nom d'utilisateur au sens Unix - ip : n'importe quelle adresse IPv4 @@ -91,7 +91,7 @@ Pour définir le [mode](../mode.md) : Il est possible de cacher une variable. Cacher une variable signifie qu'elle ne sera pas visible lorsqu'on modifie la configuration du service. -Par contre cette variable sont accessibles lorsqu'on va l'utiliser. +Par contre cette variable sera accessibles lorsqu'on va l'utiliser. Pour cacher une variable : @@ -215,3 +215,5 @@ Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne Ces variables sont généralement des variables obligatoires. En effet ces variable ne sont en lecteur seul que si elles sont une valeurs. Une [variable meneuse ou suiveuse](leadership.md) ne peut pas avoir la propriété auto_freeze. + +FIXME diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 613026fb..4286872c 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -35,8 +35,6 @@ from .target import TargetAnnotator from .param import ParamAnnotator from .variable import Walk -FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' - class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): """Annotate condition @@ -72,35 +70,30 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): def convert_auto_freeze(self): """convert auto_freeze - only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen + only if auto_freeze_variable is True this variable is frozen """ for variable in self.get_variables(): - self._convert_auto_freeze(variable) - - def _convert_auto_freeze(self, - variable: 'self.objectspace.variable', - ) -> None: - if not variable.auto_freeze: - return - if variable.namespace != RougailConfig['variable_namespace']: - msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') - raise DictConsistencyError(msg, 49, variable.xmlfiles) - new_condition = self.objectspace.condition(variable.xmlfiles) - new_condition.name = 'auto_frozen_if_not_in' - new_condition.namespace = variable.namespace - new_condition.source = FREEZE_AUTOFREEZE_VARIABLE - new_param = self.objectspace.param(variable.xmlfiles) - new_param.text = 'oui' - new_condition.param = [new_param] - new_target = self.objectspace.target(variable.xmlfiles) - new_target.type = 'variable' - new_target.name = variable.name - new_condition.target = [new_target] - if not hasattr(self.objectspace.space, 'constraints'): - self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) - if not hasattr(self.objectspace.space.constraints, 'condition'): - self.objectspace.space.constraints.condition = [] - self.objectspace.space.constraints.condition.append(new_condition) + if not variable.auto_freeze: + continue + if variable.namespace != RougailConfig['variable_namespace']: + msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') + raise DictConsistencyError(msg, 49, variable.xmlfiles) + new_condition = self.objectspace.condition(variable.xmlfiles) + new_condition.name = 'auto_frozen_if_not_in' + new_condition.namespace = variable.namespace + new_condition.source = RougailConfig['auto_freeze_variable'] + new_param = self.objectspace.param(variable.xmlfiles) + new_param.text = True + new_condition.param = [new_param] + new_target = self.objectspace.target(variable.xmlfiles) + new_target.type = 'variable' + new_target.name = variable.name + new_condition.target = [new_target] + if not hasattr(self.objectspace.space, 'constraints'): + self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) + if not hasattr(self.objectspace.space.constraints, 'condition'): + self.objectspace.space.constraints.condition = [] + self.objectspace.space.constraints.condition.append(new_condition) def check_source_target(self): """verify that source != target in condition diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 379d5001..b56edb7c 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -90,9 +90,6 @@ class Walk: yield follower continue yield variable -# if hasattr(family, 'family'): -# for fam in family.family.values(): -# yield from self._get_variables(fam, with_leadership) def get_families(self): """Iter all families from the objectspace diff --git a/src/rougail/config.py b/src/rougail/config.py index b153f49e..20c79f87 100644 --- a/src/rougail/config.py +++ b/src/rougail/config.py @@ -39,6 +39,7 @@ RougailConfig = {'dictionaries_dir': [join(ROUGAILROOT, 'dictionaries')], 'destinations_dir': join(ROUGAILROOT, 'destinations'), 'tmp_dir': join(ROUGAILROOT, 'tmp'), 'dtdfilename': join(DTDDIR, 'rougail.dtd'), - 'variable_namespace': 'rougail', 'functions_file': join(ROUGAILROOT, 'functions.py'), + 'variable_namespace': 'rougail', + 'auto_freeze_variable': 'instanciated_module', } diff --git a/tests/dictionaries/00load_autofreeze/00-base.xml b/tests/dictionaries/00load_autofreeze/00-base.xml index fd503179..592d52e8 100644 --- a/tests/dictionaries/00load_autofreeze/00-base.xml +++ b/tests/dictionaries/00load_autofreeze/00-base.xml @@ -1,14 +1,12 @@ - - - non - - - non - - + + no + + + False + diff --git a/tests/dictionaries/10load_disabled_if_in_list_optional/__init__.py b/tests/dictionaries/10load_disabled_if_in_list_optional/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10load_disabled_if_in_list_optional/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_list_optional/makedict/base.json new file mode 100644 index 00000000..9da78c4c --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_list_optional/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": true} diff --git a/tests/dictionaries/10load_disabled_if_in_list_optional/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_list_optional/tiramisu/base.py new file mode 100644 index 00000000..b73e0e6f --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_list_optional/tiramisu/base.py @@ -0,0 +1,16 @@ +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 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabled_if_in_none/00-base.xml b/tests/dictionaries/10load_disabled_if_in_none/00-base.xml index fc5fa443..7a59f9e0 100644 --- a/tests/dictionaries/10load_disabled_if_in_none/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_in_none/00-base.xml @@ -19,7 +19,6 @@ mode_conteneur_actif mode_conteneur_actif2 - afilllist diff --git a/tests/dictionaries/10load_disabledifin_fallback/00-base.xml b/tests/dictionaries/10load_disabledifin_fallback/00-base.xml index d9441910..c00f0ca0 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_fallback/00-base.xml @@ -19,7 +19,6 @@ oui mode_conteneur_actif mode_conteneur_actif2 - afilllist non diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml b/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml index 92ae75cb..3fbfe19c 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml @@ -19,7 +19,6 @@ oui mode_conteneur_actif mode_conteneur_actif2 - afilllist non diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml b/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml index 2208cca2..bad3f6cd 100644 --- a/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml @@ -19,7 +19,6 @@ oui mode_conteneur_actif mode_conteneur_actif2 - afilllist diff --git a/tests/dictionaries/40condition_optional_family/00-base.xml b/tests/dictionaries/40condition_optional_family/00-base.xml new file mode 100644 index 00000000..f93ac940 --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + True + general + general2 + + + + diff --git a/tests/dictionaries/40condition_optional_family/__init__.py b/tests/dictionaries/40condition_optional_family/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/40condition_optional_family/makedict/base.json b/tests/dictionaries/40condition_optional_family/makedict/base.json new file mode 100644 index 00000000..9da78c4c --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": true} diff --git a/tests/dictionaries/40condition_optional_family/tiramisu/base.py b/tests/dictionaries/40condition_optional_family/tiramisu/base.py new file mode 100644 index 00000000..c6650f5b --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/tiramisu/base.py @@ -0,0 +1,18 @@ +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 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="my_variable", doc="my_variable", properties=frozenset({"normal"})) +option_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True)}))})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/80target_list_unknown/00-base.xml b/tests/dictionaries/80target_list_unknown/00-base.xml new file mode 100644 index 00000000..dde2b553 --- /dev/null +++ b/tests/dictionaries/80target_list_unknown/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + + + True + unknown + + + + diff --git a/tests/dictionaries/80target_list_unknown/__init__.py b/tests/dictionaries/80target_list_unknown/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80target_list_unknown/errno_2 b/tests/dictionaries/80target_list_unknown/errno_2 new file mode 100644 index 00000000..e69de29b From 6d571d8cac3e3e263ba70f9674780b2f4b1a0082 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 15 Feb 2021 18:52:12 +0100 Subject: [PATCH 111/168] mandatory_if_in only for variables --- src/rougail/annotator/target.py | 5 ++++- src/rougail/data/rougail.dtd | 2 +- .../80load_mandatoryifin_family/00-base.xml | 20 +++++++++++++++++++ .../80load_mandatoryifin_family/__init__.py | 0 .../80load_mandatoryifin_family/errno_51 | 0 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/dictionaries/80load_mandatoryifin_family/00-base.xml create mode 100644 tests/dictionaries/80load_mandatoryifin_family/__init__.py create mode 100644 tests/dictionaries/80load_mandatoryifin_family/errno_51 diff --git a/src/rougail/annotator/target.py b/src/rougail/annotator/target.py index 2efb24ad..e75a19d0 100644 --- a/src/rougail/annotator/target.py +++ b/src/rougail/annotator/target.py @@ -62,12 +62,15 @@ class TargetAnnotator: f'is not allowed') raise DictConsistencyError(msg, 8, obj.xmlfiles) if target.type == 'family': + if obj.name not in ['disabled_if_in', 'disabled_if_not_in', "hidden_if_in", "hidden_if_not_in"]: + msg = _(f'target "{target.type}" not allow with "{obj.name}"') + raise DictConsistencyError(msg, 51, target.xmlfiles) target.name = self.objectspace.paths.get_family(target.name, obj.namespace, ) elif target.type.endswith('list') and \ obj.name not in ['disabled_if_in', 'disabled_if_not_in']: - msg = _(f'target "{target.type}" not allow') + msg = _(f'target "{target.type}" not allow with "{obj.name}"') raise DictConsistencyError(msg, 10, target.xmlfiles) except DictConsistencyError as err: if err.errno != 42: diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index d5f6fc39..787d3b3c 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -132,7 +132,7 @@ - + diff --git a/tests/dictionaries/80load_mandatoryifin_family/00-base.xml b/tests/dictionaries/80load_mandatoryifin_family/00-base.xml new file mode 100644 index 00000000..1a6182fb --- /dev/null +++ b/tests/dictionaries/80load_mandatoryifin_family/00-base.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + oui + general2 + + + + diff --git a/tests/dictionaries/80load_mandatoryifin_family/__init__.py b/tests/dictionaries/80load_mandatoryifin_family/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80load_mandatoryifin_family/errno_51 b/tests/dictionaries/80load_mandatoryifin_family/errno_51 new file mode 100644 index 00000000..e69de29b From 0585ab0b11b02123a09f922e59d7f2981eaaa703 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 15 Feb 2021 18:52:41 +0100 Subject: [PATCH 112/168] update condition's doc --- doc/condition/README.md | 5 ++++ doc/condition/condition.md | 50 +++++++++++++++++++++++++++++++++++++ doc/condition/conditions.md | 29 +++++++++++++++++++++ doc/condition/redefine.md | 29 +++++++++++++++++++++ doc/target/README.md | 5 ++++ doc/target/family.md | 13 ++++++++++ doc/target/list.md | 35 ++++++++++++++++++++++++++ 7 files changed, 166 insertions(+) create mode 100644 doc/condition/README.md create mode 100644 doc/condition/condition.md create mode 100644 doc/condition/conditions.md create mode 100644 doc/condition/redefine.md create mode 100644 doc/target/README.md create mode 100644 doc/target/family.md create mode 100644 doc/target/list.md diff --git a/doc/condition/README.md b/doc/condition/README.md new file mode 100644 index 00000000..6808380f --- /dev/null +++ b/doc/condition/README.md @@ -0,0 +1,5 @@ +# Les conditions + + - [Déclaration d'une condition](condition.md) + - [Les différentes conditions](conditions.md) + - [Réfinition](redefine.md) diff --git a/doc/condition/condition.md b/doc/condition/condition.md new file mode 100644 index 00000000..45e977f7 --- /dev/null +++ b/doc/condition/condition.md @@ -0,0 +1,50 @@ +# Les conditions + +Les conditions permettent d'ajouter ou de supprimer des propriétés à une [variable](../variable/README.md), une [famille](../family/README.md), un [fichier](../service/file.md), un [port](../service/port.md) ou une [ip](../service/ip.md) suivant le contexte. + +Nous allons nous concentrer ici sur la condition hidden_if_in, mais [il existe d'autre conditions](conditions.md). + +La condition hidden_if_in permet de cacher une variable où une famille à l'utilisateur, mais cette variable est toujours accessible dans un calcul, un vérification ou dans un template. + +``` + + + + + + + + True + my_variable + + +``` + +Le [paramètres](../param/README.md) de la condition permet de définir les valeurs que doit avoir la source pour appliquer l'action. + +La [cible](../target/README.md) de la condition est ici "my_variable". + +Donc ici la variable est caché à l'utilisateur si la variable "condition" est à True (le paramètre). + +Il est également possible de mettre plusieurs paramètre : + +``` + + + + + + + + yes + maybe + my_variable + + +``` + +FIXME + + + + diff --git a/doc/condition/conditions.md b/doc/condition/conditions.md new file mode 100644 index 00000000..f8f84a56 --- /dev/null +++ b/doc/condition/conditions.md @@ -0,0 +1,29 @@ +# Les conditions + +## Les conditions \_if_in et \_if_not_in + +Il existe deux types de conditions : + +- les conditions dont le nom fini par \_if_in : dans ce cas si la variable source est égal à un des paramètres, l'action est effective +- les conditions dont le nom fini par \_if_not_in : dans ce cas si la variable source est différents de tous les paramètres, l'action est effective + +## Désactivation + +Il est possible de désactiver une [variable](../variable/README.md) ou une [famille](../family/README.md) avec les conditions : + +- disabled_if_in +- disabled_if_not_in + +## Caché + +Il est possible de cacher une [variable](../variable/README.md), une [famille](../family/README.md), un [fichier](../service/file.md), un [port](../service/port.md) ou une [ip](../service/ip.md) avec les conditions : + +- hidden_if_in +- hidden_if_not_in + +## Obligatoire + +Il est possible de rendre obligatoire une [variable](../variable/README.md) avec les conditions : + +- mandatory_if_in +- mandatory_if_not_in diff --git a/doc/condition/redefine.md b/doc/condition/redefine.md new file mode 100644 index 00000000..b076205c --- /dev/null +++ b/doc/condition/redefine.md @@ -0,0 +1,29 @@ +# Rédéfinition + +Il se peut que dans un dictionnaire on décide de définir une condition. + +Dans un second dictionnaire il est possible de supprimer cette condition. + +Dans un premier dictionnaire déclarons notre variable et notre calcule : + +``` + + + + + + + + True + my_variable + + +``` + +Dans un second dictionnaire supprimer ce calcul : + +``` + + + +``` diff --git a/doc/target/README.md b/doc/target/README.md new file mode 100644 index 00000000..978b61eb --- /dev/null +++ b/doc/target/README.md @@ -0,0 +1,5 @@ +# La cible + + - [De type variable)](../target/variable.md) + - [De type famille)](../target/family.md) + - [De type \*list](../target/list.md) diff --git a/doc/target/family.md b/doc/target/family.md new file mode 100644 index 00000000..bdefc72e --- /dev/null +++ b/doc/target/family.md @@ -0,0 +1,13 @@ +# Cible de type "variable" + +Une cible peut être de type famille : + +``` +my_family +``` + +Mais une target peut être optionnelle. C'est à dire que si la famille n'existe pas, l'action ne sera pas associé à cette famille. + +``` +my_family +``` diff --git a/doc/target/list.md b/doc/target/list.md new file mode 100644 index 00000000..eefb327d --- /dev/null +++ b/doc/target/list.md @@ -0,0 +1,35 @@ +# Cible de type \*list + +## Les différences cible de type \*.list + +### filelist + +Une cible peut être de type [fichier](../service/file.md) : + +``` +example +``` + +### portlist + +Une cible peut être de type [port](../service/port.md) : + +``` +example +``` + +### iplist + +Une cible peut être de type [ip](../service/ip.md) : + +``` +example +``` + +## La cible optionnelle + +Mais une target peut être optionnelle. C'est à dire que si la \*list n'existe pas, l'action ne sera pas associé. + +``` +unknown +``` From bd299e3d2b64fa1c5eb1814f35ca042fe9dcbf7b Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 16 Feb 2021 10:22:29 +0100 Subject: [PATCH 113/168] documentation + fallback on condition --- doc/README.md | 17 +---- doc/check/function.md | 4 +- doc/condition/condition.md | 36 +++++++-- doc/dictionary/extra.md | 12 +++ doc/dictionary/rougail.md | 22 ++++++ doc/service/file.md | 4 +- doc/service/ip.md | 75 ++++++++++++++++--- doc/target/README.md | 4 +- doc/variable/leadership.md | 24 ++++++ doc/variable/simple.md | 18 ++++- src/rougail/annotator/condition.py | 15 ++-- src/rougail/annotator/service.py | 2 +- src/rougail/annotator/variable.py | 14 ++-- src/rougail/data/rougail.dtd | 5 +- .../00-base.xml | 2 +- .../00-base.xml | 4 +- .../10load_disabledifin_fallback/00-base.xml | 2 +- .../00-base.xml | 2 +- .../00-base.xml | 2 +- .../dictionaries/40condition_base/00-base.xml | 2 +- .../40condition_base_add/00-base.xml | 2 +- .../40condition_base_add/01-base.xml | 2 +- .../40condition_fallback/00-base.xml | 2 +- .../40condition_optional/00-base.xml | 2 +- .../40condition_optional_empty/00-base.xml | 2 +- .../40hidden_if_in_group_fallback/00-base.xml | 2 +- .../80condition_without_target/00-base.xml | 2 +- .../80hidden_if_in_filelist/00-base.xml | 2 +- 28 files changed, 210 insertions(+), 72 deletions(-) create mode 100644 doc/dictionary/extra.md create mode 100644 doc/dictionary/rougail.md diff --git a/doc/README.md b/doc/README.md index b96b0edc..ff8a82f4 100644 --- a/doc/README.md +++ b/doc/README.md @@ -9,17 +9,8 @@ Rougail est un bibliothèque python3 qui permet de charger des dictionnaires (fi ## Les dictionnaires -Un dictionnaire est un fichier XML donc la structure est expliqué ci-dessous. - -Un dictionnaire contient en ensemble de variable, utilisable à tout moment, notamment dans des templates. - -Il est possible d'avoir plusieurs espace de nom pour classer les variables (appeler aussi "extra") mais il est aussi possible, à l'interieur de ce espace de nom de mettre des familles pour classer les variables. - -Les familles et les variables peuvent être défini dans plusieurs dictionnaires. Ces dictionnaires s'aggrège alors. Il est possible de rajouter des familles des variables, des services, des éléments à un service et des contraintes. - -Il est également possible de redéfinir des éléments pour changer les comportement d'une variable ou d'un service. - -FIXME expliquer les noms des variables dans les extras + - [Les dictionnaires](dictionary/rougail.md) + - [Les dictionnaires extra](dictionary/extra.md) ### Les variables @@ -43,7 +34,3 @@ FIXME expliquer les noms des variables dans les extras ## Les templates - Type creole - - -FIXME : -- une variable avec nom unique sauf pour extra diff --git a/doc/check/function.md b/doc/check/function.md index f293f633..016164c2 100644 --- a/doc/check/function.md +++ b/doc/check/function.md @@ -38,6 +38,8 @@ Une fonction de vérification doit prendre en compte 2 aspects important : À partir de maintenant seule None et des valeurs en minuscule seront autorisés. +Il est possible de définir des [paramètres](../param/README.md) à cette fonction. + ## Vérification des valeurs avec avertissement Dans la contrainte, il est possible de spécifier le niveau d'erreur et le mettre en avertissement : @@ -49,5 +51,3 @@ Dans la contrainte, il est possible de spécifier le niveau d'erreur et le mettr ``` Dans ce cas une valeur avec une majuscule sera accepté, mais un message d'avertissement apparaitra. - -Il est possible de définir des [paramètres](../param/README.md) à cette fonction. diff --git a/doc/condition/condition.md b/doc/condition/condition.md index 45e977f7..f667072e 100644 --- a/doc/condition/condition.md +++ b/doc/condition/condition.md @@ -1,5 +1,7 @@ # Les conditions +## Un condition + Les conditions permettent d'ajouter ou de supprimer des propriétés à une [variable](../variable/README.md), une [famille](../family/README.md), un [fichier](../service/file.md), un [port](../service/port.md) ou une [ip](../service/ip.md) suivant le contexte. Nous allons nous concentrer ici sur la condition hidden_if_in, mais [il existe d'autre conditions](conditions.md). @@ -26,6 +28,8 @@ La [cible](../target/README.md) de la condition est ici "my_variable". Donc ici la variable est caché à l'utilisateur si la variable "condition" est à True (le paramètre). +## Un condition avec plusieurs paramètres + Il est également possible de mettre plusieurs paramètre : ``` @@ -43,8 +47,30 @@ Il est également possible de mettre plusieurs paramètre : ``` -FIXME - - - - +## Une condition optionnelle + +Il est possible de définir une condition avec une variable source qui n'existe pas dans toutes les contextes. + +Dans ce cas, on met la condition en "optionnelle". + +Si la variable source existe, la condition s'applique. + +Si la variable source n'existe pas : + +- si le nom fini en _if_in (par exemple hidden_if_in), l'action est forcée sans condition (les cibles sont hidden) +- si le nom fini en _if_not_in (par exemple hidden_if_not_in), la condition est totalement ignorée + +Ces deux comportements peuvent être changé à tout moment avec l'attribut "apply_on_fallback". Dans ce cas : + +- si la valeur de "apply_on_fallback" est "True", l'action est forcée sans condition +- si la valeur de "apply_on_fallback" est "False", la condition est totalement ignorée + +Exemple : + +``` + + yes + maybe + my_variable + +``` diff --git a/doc/dictionary/extra.md b/doc/dictionary/extra.md new file mode 100644 index 00000000..4fea90c9 --- /dev/null +++ b/doc/dictionary/extra.md @@ -0,0 +1,12 @@ +# Les dictionnaires extra + +Un extra est un espace de nom différent. L'idée et de pouvoir classer les variables par thématique. + +Les espaces de nom extra doivent être déclaré au moment [de la configuration de Rougail](../dev/config.md). + +Dans cet espace de nom : + +- des variables et des familles peuvent avoir le même nom dans différentes familles +- la valeur d'un cible, source, leader ou follower des contraintes doivent être avec un chemin complet +- on ne peut pas déclarer des services dans cet espace de nom +- dans un template il faut utiliser des chemins complet (%%my_extra.my_family.my_variable ou %%my_extra.my_family.leader.follower pour une variable suiveuse) diff --git a/doc/dictionary/rougail.md b/doc/dictionary/rougail.md new file mode 100644 index 00000000..1fa0c4f4 --- /dev/null +++ b/doc/dictionary/rougail.md @@ -0,0 +1,22 @@ +# Les dictionnaires + +## Un dictionnaire ? + +Un dictionnaire est un fichier XML donc la structure est décrite dans cette documentation. + +Un dictionnaire contient en ensemble de variable chargé dans Tiramisu, utilisable à tout moment, notamment dans des templates. + +Les familles, les variables et les contraintes peuvent être défini dans plusieurs dictionnaires. Ces dictionnaires s'aggrège alors. + +Il est également possible de redéfinir des éléments pour changer les comportement d'une variable ou d'un service. + +## L'espace de nom par défaut + +L'espace de nom par défaut s'appelle "rougail" ([ce nom est personnalisable](../dev/config.md)). + +Cet espace de nom est un peu particulier : + +- le nom des variables et des familles doivent être unique pour l'ensemble de cet espace (même si ces variables ou familles sont dans des familles différentes) +- la valeur d'un cible, source, leader ou follower des contraintes peuvent être avec nom de la variable ou de la famille ou leurs chemins complet +- on peut déclarer des services dans cet espace de nom +- dans un template on peut utiliser cette variable sans le chemin complet (%%my_variable) ou avec (%%rougail.my_family.my_variable) diff --git a/doc/service/file.md b/doc/service/file.md index 7ee4072e..5c3f8a1c 100644 --- a/doc/service/file.md +++ b/doc/service/file.md @@ -112,9 +112,7 @@ Il est possible de définir une [condition](../condition/README.md) de type "dis - - - + diff --git a/doc/service/ip.md b/doc/service/ip.md index e78cd14b..e81e2686 100644 --- a/doc/service/ip.md +++ b/doc/service/ip.md @@ -1,15 +1,72 @@ # La gestion d'une IP -## La balise ip +## La balise IP La gestion des IP se fait dans un conteneur de [service](service.md). -FIXME +La déclaration de l'attribut permet d'associer une IP autorisé à accéder au service. - - - - - - - +Il est nécessaire, au minimum, de spécifier son adresse IP et l'interface : + +``` +192.168.0.1 +``` + +L'IP peut être un variable : + +``` +variable_ip +``` + +## La gestion d'un réseau + +L'adresse IP peut être un réseau : + +``` +192.168.0.0 +``` + +Le masque de réseau peut être un variable : + +``` +variable_ip +``` + +## L'interface + +Il est possible de spécifier le nom de l'interface si on la connait : + +``` +192.168.0.1 +``` + +Mais il est possible de calculer automatiquement cette valeur : + +``` +192.168.0.1 +``` + +Dans ce cas l'interface est déduite à partir de la table de routage. + +## Désactiver la génération d'une IP + +Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise IP : + +``` + + + 192.168.0.1 + + + + + + + + False + test_ip + + +``` + +Dans ce cas, tous les IP avec un attribut iplist à "test_ip" seront désactivé si la variable "condition" est False. diff --git a/doc/target/README.md b/doc/target/README.md index 978b61eb..bd9b6a9f 100644 --- a/doc/target/README.md +++ b/doc/target/README.md @@ -1,5 +1,5 @@ # La cible - - [De type variable)](../target/variable.md) - - [De type famille)](../target/family.md) + - [De type variable](../target/variable.md) + - [De type famille](../target/family.md) - [De type \*list](../target/list.md) diff --git a/doc/variable/leadership.md b/doc/variable/leadership.md index f8a98c2b..90033c67 100644 --- a/doc/variable/leadership.md +++ b/doc/variable/leadership.md @@ -58,6 +58,30 @@ Il est possible d'en définit d'autres : ``` +## Définition des variables meneuse et suiveuse dans un dictionnaire extra + +Voici un exemple de définition d'une variable meneuse et de deux variables meneuses dans un espace de nom "example" : + +``` + + + + + + + + + + example.family.follower1 + example.family.follower2 + + +``` + +Le chemin de la variable meneuse est traditionnel, par contre le chemin des variables suiveuses n'est pas le chemin définitif de la variable. + +Le chemin d'une variable suiveuse est normalement "example.family.leader.follower1" mais la variable n'est pas encore une variable suiveuse à ce moment là du traitement. C'est pour cela qu'il ne faut, uniquement dans les groupes, mettre le nom de la variable meneuse dans le chemin. + ## Ajout d'une nouvelle variable suiveuse Pour ajouter, dans un nouveau dictionnaire, une variable suiveuse à notre groupe, rien de plus simple, il suffit de redéfinir un groupe avec cette (ou ces) nouvelle variable : diff --git a/doc/variable/simple.md b/doc/variable/simple.md index d74eaf15..c539e422 100644 --- a/doc/variable/simple.md +++ b/doc/variable/simple.md @@ -219,4 +219,20 @@ Ces variables sont généralement des variables obligatoires. En effet ces varia Une [variable meneuse ou suiveuse](leadership.md) ne peut pas avoir la propriété auto_freeze. -FIXME +## Information "test" + +L'attribut "test" est un attribut spécial qui permet aux concepteurs d'un dictionnaire d'influancer le robot de test en précisant de valeurs utile à tester. + +Concrêtement, le contenu de cet attribut est enregister dans une "information" de l'option Tiramisu correspondante. + +Exemple : + +``` + +``` + +Il est possible de préciser plusieurs valeurs avec le séparateur "|" : + +``` + +``` diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 382cf0bc..c3f48826 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -52,7 +52,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): self.target_is_uniq = False self.only_variable = False self.convert_target(self.objectspace.space.constraints.condition) - self.check_condition_fallback() + self.check_condition_optional() self.convert_condition_source() self.convert_param(self.objectspace.space.constraints.condition) self.check_source_target() @@ -106,19 +106,18 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): f'{condition.source.path}') raise DictConsistencyError(msg, 11, condition.xmlfiles) - def check_condition_fallback(self): - """a condition with a fallback **and** the source variable doesn't exist + def check_condition_optional(self): + """a condition with a optional **and** the source variable doesn't exist """ remove_conditions = [] for idx, condition in enumerate(self.objectspace.space.constraints.condition): - # fallback - if condition.fallback is False or \ + if condition.optional is False or \ self.objectspace.paths.path_is_defined(condition.source): continue - if condition.name in ['disabled_if_in', 'mandatory_if_in', 'hidden_if_in']: - apply_action = not condition.force_condition_on_fallback + if hasattr(condition, 'apply_on_fallback'): + apply_action = condition.apply_on_fallback else: - apply_action = condition.force_inverse_condition_on_fallback + apply_on_fallback = condition.name.endswith('_if_in'): remove_conditions.append(idx) if apply_action: self.force_actions_to_variable(condition) diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index 267fb9c4..4cf20e99 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -32,7 +32,7 @@ from ..utils import normalize_family from ..error import DictConsistencyError # a CreoleObjSpace's attribute has some annotations # that shall not be present in the exported (flatened) XML -ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace', +ERASED_ATTRIBUTES = ('redefine', 'exists', 'optional', 'remove_check', 'namespace', 'remove_condition', 'path', 'instance_mode', 'index', 'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name', 'reflector_object',) diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index b56edb7c..a6b07c67 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -197,15 +197,11 @@ class VariableAnnotator(Walk): # pylint: disable=R0903 """Convert variable tests value """ for variable in self.get_variables(): - self._convert_test(variable) - - def _convert_test(self, - variable, - ) -> None: - if not hasattr(variable, 'information'): - variable.information = self.objectspace.information(variable.xmlfiles) - if hasattr(variable, 'test'): + if not hasattr(variable, 'test'): + continue if variable.test: + if not hasattr(variable, 'information'): + variable.information = self.objectspace.information(variable.xmlfiles) values = variable.test.split('|') new_values = [] for value in values: @@ -221,6 +217,8 @@ class VariableAnnotator(Walk): # pylint: disable=R0903 """Convert variable help """ for variable in self.get_variables(): + if not hasattr(variable, 'information'): + variable.information = self.objectspace.information(variable.xmlfiles) self._convert_help(variable) @staticmethod diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 787d3b3c..08aceeb9 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -121,9 +121,8 @@ - - - + + diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml b/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml index 86bba15b..9ce69f57 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/00-base.xml @@ -16,7 +16,7 @@ - + no disable_variable afilllist diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml index 19e5a39b..749d64d3 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/00-base.xml @@ -15,13 +15,13 @@ - + oui mode_conteneur_actif mode_conteneur_actif2 afilllist - + non mode_conteneur_actif diff --git a/tests/dictionaries/10load_disabledifin_fallback/00-base.xml b/tests/dictionaries/10load_disabledifin_fallback/00-base.xml index c00f0ca0..592ba86e 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_fallback/00-base.xml @@ -20,7 +20,7 @@ mode_conteneur_actif mode_conteneur_actif2 - + non mode_conteneur_actif diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml b/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml index 3fbfe19c..40b8b2fa 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml +++ b/tests/dictionaries/10load_disabledifin_fallback_force/00-base.xml @@ -20,7 +20,7 @@ mode_conteneur_actif mode_conteneur_actif2 - + non mode_conteneur_actif diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml b/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml index eb372de0..e858dd47 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml @@ -19,7 +19,7 @@ - + non afilllist diff --git a/tests/dictionaries/40condition_base/00-base.xml b/tests/dictionaries/40condition_base/00-base.xml index 8ebe8866..89b2bf09 100644 --- a/tests/dictionaries/40condition_base/00-base.xml +++ b/tests/dictionaries/40condition_base/00-base.xml @@ -18,7 +18,7 @@ - + oui mode_conteneur_actif1 mode_conteneur_actif2 diff --git a/tests/dictionaries/40condition_base_add/00-base.xml b/tests/dictionaries/40condition_base_add/00-base.xml index 8ebe8866..89b2bf09 100644 --- a/tests/dictionaries/40condition_base_add/00-base.xml +++ b/tests/dictionaries/40condition_base_add/00-base.xml @@ -18,7 +18,7 @@ - + oui mode_conteneur_actif1 mode_conteneur_actif2 diff --git a/tests/dictionaries/40condition_base_add/01-base.xml b/tests/dictionaries/40condition_base_add/01-base.xml index a87dc7e6..87c374e9 100644 --- a/tests/dictionaries/40condition_base_add/01-base.xml +++ b/tests/dictionaries/40condition_base_add/01-base.xml @@ -7,7 +7,7 @@ - + oui mode_conteneur_actif1 mode_conteneur_actif2 diff --git a/tests/dictionaries/40condition_fallback/00-base.xml b/tests/dictionaries/40condition_fallback/00-base.xml index 347a0f49..fe044f84 100644 --- a/tests/dictionaries/40condition_fallback/00-base.xml +++ b/tests/dictionaries/40condition_fallback/00-base.xml @@ -20,7 +20,7 @@ - + oui mode_conteneur_actif1 mode_conteneur_actif2 diff --git a/tests/dictionaries/40condition_optional/00-base.xml b/tests/dictionaries/40condition_optional/00-base.xml index 7ed14637..d8cab151 100644 --- a/tests/dictionaries/40condition_optional/00-base.xml +++ b/tests/dictionaries/40condition_optional/00-base.xml @@ -15,7 +15,7 @@ - + oui mode_conteneur_actif1 mode_conteneur_actif2 diff --git a/tests/dictionaries/40condition_optional_empty/00-base.xml b/tests/dictionaries/40condition_optional_empty/00-base.xml index 734dc45f..30dfb031 100644 --- a/tests/dictionaries/40condition_optional_empty/00-base.xml +++ b/tests/dictionaries/40condition_optional_empty/00-base.xml @@ -15,7 +15,7 @@ - + oui mode_conteneur_actif2 diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml b/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml index bc55708a..f55b64f6 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml +++ b/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml @@ -15,7 +15,7 @@ - + oui mode_conteneur_actif1 diff --git a/tests/dictionaries/80condition_without_target/00-base.xml b/tests/dictionaries/80condition_without_target/00-base.xml index 5a75fe4a..a8938849 100644 --- a/tests/dictionaries/80condition_without_target/00-base.xml +++ b/tests/dictionaries/80condition_without_target/00-base.xml @@ -18,7 +18,7 @@ - + oui diff --git a/tests/dictionaries/80hidden_if_in_filelist/00-base.xml b/tests/dictionaries/80hidden_if_in_filelist/00-base.xml index 1b452337..14afbd68 100644 --- a/tests/dictionaries/80hidden_if_in_filelist/00-base.xml +++ b/tests/dictionaries/80hidden_if_in_filelist/00-base.xml @@ -16,7 +16,7 @@ - + non afilllist From e60fd4adbc8911819bb41d6f40e20a6ece7d1f70 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 16 Feb 2021 12:08:45 +0100 Subject: [PATCH 114/168] check variable and family name --- doc/README.md | 1 + src/rougail/annotator/condition.py | 12 ++--- src/rougail/annotator/variable.py | 9 ++++ src/rougail/convert.py | 22 +++++---- src/rougail/objspace.py | 45 ++++++++++--------- src/rougail/path.py | 18 +++++--- src/rougail/template.py | 16 ++++--- src/rougail/tiramisureflector.py | 7 ++- src/rougail/xmlreflector.py | 7 +-- .../60extra_variable_name_extra/00-base.xml | 15 +++++++ .../60extra_variable_name_extra/__init__.py | 0 .../extra_dirs/extra/00-base.xml | 7 +++ .../makedict/base.json | 1 + .../tiramisu/base.py | 20 +++++++++ .../dictionaries/80family_unique/00-base.xml | 12 +++++ .../dictionaries/80family_unique/__init__.py | 0 tests/dictionaries/80family_unique/errno_55 | 0 .../dictionaries/80variable_extra/00-base.xml | 8 ++++ .../dictionaries/80variable_extra/__init__.py | 0 tests/dictionaries/80variable_extra/errno_54 | 0 .../extra_dirs/extra/00-base.xml | 7 +++ .../80variable_rougail/00-base.xml | 8 ++++ .../80variable_rougail/__init__.py | 0 .../dictionaries/80variable_rougail/errno_54 | 0 24 files changed, 158 insertions(+), 57 deletions(-) create mode 100644 tests/dictionaries/60extra_variable_name_extra/00-base.xml create mode 100644 tests/dictionaries/60extra_variable_name_extra/__init__.py create mode 100644 tests/dictionaries/60extra_variable_name_extra/extra_dirs/extra/00-base.xml create mode 100644 tests/dictionaries/60extra_variable_name_extra/makedict/base.json create mode 100644 tests/dictionaries/60extra_variable_name_extra/tiramisu/base.py create mode 100644 tests/dictionaries/80family_unique/00-base.xml create mode 100644 tests/dictionaries/80family_unique/__init__.py create mode 100644 tests/dictionaries/80family_unique/errno_55 create mode 100644 tests/dictionaries/80variable_extra/00-base.xml create mode 100644 tests/dictionaries/80variable_extra/__init__.py create mode 100644 tests/dictionaries/80variable_extra/errno_54 create mode 100644 tests/dictionaries/80variable_extra/extra_dirs/extra/00-base.xml create mode 100644 tests/dictionaries/80variable_rougail/00-base.xml create mode 100644 tests/dictionaries/80variable_rougail/__init__.py create mode 100644 tests/dictionaries/80variable_rougail/errno_54 diff --git a/doc/README.md b/doc/README.md index ff8a82f4..e4b748a5 100644 --- a/doc/README.md +++ b/doc/README.md @@ -34,3 +34,4 @@ Rougail est un bibliothèque python3 qui permet de charger des dictionnaires (fi ## Les templates - Type creole +FIXME ^^ diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index c3f48826..89ebb2ea 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -29,7 +29,6 @@ from typing import List, Any from ..i18n import _ from ..error import DictConsistencyError -from ..config import RougailConfig from .target import TargetAnnotator from .param import ParamAnnotator @@ -75,13 +74,13 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): for variable in self.get_variables(): if not variable.auto_freeze: continue - if variable.namespace != RougailConfig['variable_namespace']: + if variable.namespace != self.objectspace.rougailconfig['variable_namespace']: msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') raise DictConsistencyError(msg, 49, variable.xmlfiles) new_condition = self.objectspace.condition(variable.xmlfiles) new_condition.name = 'auto_frozen_if_not_in' new_condition.namespace = variable.namespace - new_condition.source = RougailConfig['auto_freeze_variable'] + new_condition.source = self.objectspace.rougailconfig['auto_freeze_variable'] new_param = self.objectspace.param(variable.xmlfiles) new_param.text = True new_condition.param = [new_param] @@ -114,12 +113,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): if condition.optional is False or \ self.objectspace.paths.path_is_defined(condition.source): continue - if hasattr(condition, 'apply_on_fallback'): - apply_action = condition.apply_on_fallback - else: - apply_on_fallback = condition.name.endswith('_if_in'): remove_conditions.append(idx) - if apply_action: + if (hasattr(condition, 'apply_on_fallback') and condition.apply_on_fallback) or \ + (not hasattr(condition, 'apply_on_fallback') and condition.name.endswith('_if_in')): self.force_actions_to_variable(condition) remove_conditions.sort(reverse=True) for idx in remove_conditions: diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index a6b07c67..db432fda 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -25,6 +25,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +from ..i18n import _ +from ..error import DictConsistencyError from ..objspace import convert_boolean @@ -116,6 +118,9 @@ class VariableAnnotator(Walk): # pylint: disable=R0903 if not hasattr(objectspace.space, 'variables'): return self.objectspace = objectspace + self.forbidden_name = ['services', self.objectspace.rougailconfig['variable_namespace']] + for extra in self.objectspace.rougailconfig['extra_dictionaries']: + self.forbidden_name.append(extra) self.convert_variable() self.convert_test() self.convert_help() @@ -141,6 +146,10 @@ class VariableAnnotator(Walk): # pylint: disable=R0903 variable, variable_type: str, ) -> None: + if variable.namespace == self.objectspace.rougailconfig['variable_namespace'] and \ + variable.name in self.forbidden_name: + msg = _(f'the name of the variable "{variable.name}" cannot be the same as the name of a namespace') + raise DictConsistencyError(msg, 54, variable.xmlfiles) if variable.type != 'symlink' and not hasattr(variable, 'description'): variable.description = variable.name if hasattr(variable, 'value'): diff --git a/src/rougail/convert.py b/src/rougail/convert.py index 143bbf82..ad4f0b0d 100644 --- a/src/rougail/convert.py +++ b/src/rougail/convert.py @@ -58,16 +58,22 @@ from .error import DictConsistencyError class RougailConvert: """Rougail object """ - def __init__(self) -> None: - xmlreflector = XMLReflector() - rougailobjspace = RougailObjSpace(xmlreflector) + def __init__(self, + rougailconfig: RougailConfig=None, + ) -> None: + if rougailconfig is None: + rougailconfig = RougailConfig + xmlreflector = XMLReflector(rougailconfig) + rougailobjspace = RougailObjSpace(xmlreflector, + rougailconfig, + ) self._load_dictionaries(xmlreflector, rougailobjspace, - RougailConfig['variable_namespace'], - RougailConfig['dictionaries_dir'], + rougailconfig['variable_namespace'], + rougailconfig['dictionaries_dir'], ) - for namespace, extra_dir in RougailConfig['extra_dictionaries'].items(): - if namespace in ['services', RougailConfig['variable_namespace']]: + for namespace, extra_dir in rougailconfig['extra_dictionaries'].items(): + if namespace in ['services', rougailconfig['variable_namespace']]: msg = _(f'Namespace name "{namespace}" is not allowed') raise DictConsistencyError(msg, 21, None) self._load_dictionaries(xmlreflector, @@ -75,7 +81,7 @@ class RougailConvert: namespace, extra_dir, ) - functions_file = RougailConfig['functions_file'] + functions_file = rougailconfig['functions_file'] SpaceAnnotator(rougailobjspace, functions_file, ) diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index b32ba34e..127bc2c5 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -32,7 +32,6 @@ from .xmlreflector import XMLReflector from .utils import normalize_family from .error import SpaceObjShallNotBeUpdated, DictConsistencyError from .path import Path -from .config import RougailConfig # RougailObjSpace's elements that shall be forced to the Redefinable type FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables') @@ -101,9 +100,10 @@ class RougailObjSpace: def __init__(self, xmlreflector: XMLReflector, + rougailconfig: 'RougailConfig', ) -> None: self.space = ObjSpace() - self.paths = Path() + self.paths = Path(rougailconfig) self.forced_text_elts_as_name = set(FORCED_TEXT_ELTS_AS_NAME) self.list_conditions = {} @@ -112,6 +112,7 @@ class RougailObjSpace: self.has_dyn_option = False self.make_object_space_classes(xmlreflector) + self.rougailconfig = rougailconfig def make_object_space_classes(self, xmlreflector: XMLReflector, @@ -197,12 +198,12 @@ class RougailObjSpace: family_names.append(child.attrib['name']) try: # variable objects creation - variableobj = self.get_variableobj(xmlfile, - child, - space, - namespace, - redefine_variables, - ) + exists, variableobj = self.get_variableobj(xmlfile, + child, + space, + namespace, + redefine_variables, + ) except SpaceObjShallNotBeUpdated: continue self.set_text(child, @@ -216,11 +217,12 @@ class RougailObjSpace: variableobj, redefine_variables, ) - self.set_path(namespace, - document, - variableobj, - space, - ) + if not exists: + self.set_path(namespace, + document, + variableobj, + space, + ) self.add_to_tree_structure(variableobj, space, child, @@ -260,11 +262,12 @@ class RougailObjSpace: if child.tag in vars(space): # Atom instance has to be a singleton here # we do not re-create it, we reuse it - return getattr(space, child.tag) - return obj(xmlfile, name) + return False, getattr(space, child.tag) + return False, obj(xmlfile, name) + # UnRedefinable object if child.tag not in vars(space): setattr(space, child.tag, []) - return obj(xmlfile, name) + return False, obj(xmlfile, name) def _get_name(self, child, @@ -301,12 +304,12 @@ class RougailObjSpace: redefine = convert_boolean(subspace.get('redefine', default_redefine)) if redefine is True: if isinstance(existed_var, self.variable): # pylint: disable=E1101 - if namespace == RougailConfig['variable_namespace']: + if namespace == self.rougailconfig['variable_namespace']: redefine_variables.append(name) else: redefine_variables.append(space.path + '.' + name) existed_var.xmlfiles.append(xmlfile) - return existed_var + return True, existed_var exists = convert_boolean(subspace.get('exists', True)) if exists is False: raise SpaceObjShallNotBeUpdated() @@ -327,7 +330,7 @@ class RougailObjSpace: if tag not in vars(space): setattr(space, tag, {}) obj = getattr(self, child.tag)(xmlfile, name) - return obj + return False, obj def get_existed_obj(self, name: str, @@ -340,7 +343,7 @@ class RougailObjSpace: if child.tag in ['variable', 'family']: name = normalize_family(name) if child.tag == 'variable': # pylint: disable=E1101 - if namespace != RougailConfig['variable_namespace']: + if namespace != self.rougailconfig['variable_namespace']: name = space.path + '.' + name if not self.paths.path_is_defined(name): return None @@ -474,7 +477,7 @@ class RougailObjSpace: ) elif isinstance(variableobj, self.family): # pylint: disable=E1101 family_name = normalize_family(variableobj.name) - if namespace != RougailConfig['variable_namespace']: + if namespace != self.rougailconfig['variable_namespace']: family_name = namespace + '.' + family_name self.paths.add_family(namespace, family_name, diff --git a/src/rougail/path.py b/src/rougail/path.py index 3829efee..ff1a2b78 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from .i18n import _ from .error import DictConsistencyError -from .config import RougailConfig from .utils import normalize_family @@ -36,11 +35,14 @@ class Path: sample: path="creole.general.condition" """ - def __init__(self): + def __init__(self, + rougailconfig: 'RougailConfig', + ) -> None: self.variables = {} self.families = {} self.full_paths_families = {} self.full_paths_variables = {} + self.variable_namespace = rougailconfig['variable_namespace'] # Family def add_family(self, @@ -51,8 +53,10 @@ class Path: ) -> str: # pylint: disable=C0111 """Add a new family """ - if namespace == RougailConfig['variable_namespace']: + if namespace == self.variable_namespace: full_name = '.'.join([subpath, name]) + if name in self.full_paths_families: + raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 55, variableobj.xmlfiles) self.full_paths_families[name] = full_name else: if '.' not in name: # pragma: no cover @@ -93,7 +97,7 @@ class Path: if name not in self.families: raise DictConsistencyError(_(f'unknown option {name}'), 42, []) dico = self.families[name] - if current_namespace not in [RougailConfig['variable_namespace'], 'services'] and \ + if current_namespace not in [self.variable_namespace, 'services'] and \ current_namespace != dico['namespace']: msg = _(f'A family located in the "{dico["namespace"]}" namespace ' f'shall not be used in the "{current_namespace}" namespace') @@ -117,7 +121,7 @@ class Path: self.variables[new_path]['leader'] = leadership_path self.variables[new_path]['variableobj'].path = new_path self.variables[new_path]['family'] = leadership_path - if namespace == RougailConfig['variable_namespace']: + if namespace == self.variable_namespace: self.full_paths_variables[name] = new_path def is_leader(self, path): # pylint: disable=C0111 @@ -141,7 +145,7 @@ class Path: """ if '.' not in name: full_path = '.'.join([family, name]) - if namespace == RougailConfig['variable_namespace']: + if namespace == self.variable_namespace: self.full_paths_variables[name] = full_path else: full_path = name @@ -180,7 +184,7 @@ class Path: with_suffix=True, ) namespace = dico['variableobj'].namespace - if namespace not in [RougailConfig['variable_namespace'], 'services'] and \ + if namespace not in [self.variable_namespace, 'services'] and \ current_namespace != namespace: msg = _(f'A variable located in the "{namespace}" namespace shall not be used ' f'in the "{current_namespace}" namespace') diff --git a/src/rougail/template.py b/src/rougail/template.py index b710563b..2cf63dcb 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -223,14 +223,17 @@ class RougailTemplate: """ def __init__(self, # pylint: disable=R0913 config: Config, + rougailconfig: RougailConfig=None, ) -> None: + if rougailconfig is None: + rougailconfig = RougailConfig self.config = config - self.destinations_dir = abspath(RougailConfig['destinations_dir']) - self.tmp_dir = abspath(RougailConfig['tmp_dir']) - self.templates_dir = abspath(RougailConfig['templates_dir']) - self.patches_dir = abspath(RougailConfig['patches_dir']) + self.destinations_dir = abspath(rougailconfig['destinations_dir']) + self.tmp_dir = abspath(rougailconfig['tmp_dir']) + self.templates_dir = abspath(rougailconfig['templates_dir']) + self.patches_dir = abspath(rougailconfig['patches_dir']) eos = {} - functions_file = RougailConfig['functions_file'] + functions_file = rougailconfig['functions_file'] if isfile(functions_file): eosfunc = load_modules(functions_file) for func in dir(eosfunc): @@ -238,6 +241,7 @@ class RougailTemplate: eos[func] = getattr(eosfunc, func) self.eosfunc = eos self.rougail_variables_dict = {} + self.rougailconfig = rougailconfig def patch_template(self, filename: str, @@ -343,7 +347,7 @@ class RougailTemplate: chdir(self.templates_dir) for option in await self.config.option.list(type='all'): namespace = await option.option.name() - is_variable_namespace = namespace == RougailConfig['variable_namespace'] + is_variable_namespace = namespace == self.rougailconfig['variable_namespace'] self.rougail_variables_dict[namespace] = await self.load_variables(option, is_variable_namespace, ) diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 9198b99a..0d78bb38 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from json import dumps from os.path import isfile -from .config import RougailConfig from .annotator import CONVERT_OPTION from .objspace import RootRougailObject @@ -96,10 +95,10 @@ class TiramisuReflector: because `extra` family could use `variable_namespace` variables. """ if hasattr(self.objectspace.space, 'variables'): - if RougailConfig['variable_namespace'] in self.objectspace.space.variables: - yield self.objectspace.space.variables[RougailConfig['variable_namespace']] + if self.objectspace.rougailconfig['variable_namespace'] in self.objectspace.space.variables: + yield self.objectspace.space.variables[self.objectspace.rougailconfig['variable_namespace']] for elt, value in self.objectspace.space.variables.items(): - if elt != RougailConfig['variable_namespace']: + if elt != self.objectspace.rougailconfig['variable_namespace']: yield value if hasattr(self.objectspace.space, 'services'): yield self.objectspace.space.services diff --git a/src/rougail/xmlreflector.py b/src/rougail/xmlreflector.py index e59408b2..48bf50bb 100644 --- a/src/rougail/xmlreflector.py +++ b/src/rougail/xmlreflector.py @@ -32,7 +32,6 @@ from lxml.etree import DTD, parse, XMLSyntaxError # pylint: disable=E0611 from .i18n import _ from .error import DictConsistencyError -from .config import RougailConfig class XMLReflector: @@ -40,14 +39,16 @@ class XMLReflector: parsing it, validating against the Creole DTD, writing the xml result on the disk """ - def __init__(self): + def __init__(self, + rougailconfig: 'RougailConfig', + ) -> None: """Loads the Creole DTD :raises IOError: if the DTD is not found :param dtdfilename: the full filename of the Creole DTD """ - dtdfilename = RougailConfig['dtdfilename'] + dtdfilename = rougailconfig['dtdfilename'] if not isfile(dtdfilename): raise IOError(_("no such DTD file: {}").format(dtdfilename)) with open(dtdfilename, 'r') as dtdfd: diff --git a/tests/dictionaries/60extra_variable_name_extra/00-base.xml b/tests/dictionaries/60extra_variable_name_extra/00-base.xml new file mode 100644 index 00000000..4eb9d373 --- /dev/null +++ b/tests/dictionaries/60extra_variable_name_extra/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/tests/dictionaries/60extra_variable_name_extra/__init__.py b/tests/dictionaries/60extra_variable_name_extra/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/60extra_variable_name_extra/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_variable_name_extra/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..76a450e6 --- /dev/null +++ b/tests/dictionaries/60extra_variable_name_extra/extra_dirs/extra/00-base.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/dictionaries/60extra_variable_name_extra/makedict/base.json b/tests/dictionaries/60extra_variable_name_extra/makedict/base.json new file mode 100644 index 00000000..60d4d218 --- /dev/null +++ b/tests/dictionaries/60extra_variable_name_extra/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.extra": null} diff --git a/tests/dictionaries/60extra_variable_name_extra/tiramisu/base.py b/tests/dictionaries/60extra_variable_name_extra/tiramisu/base.py new file mode 100644 index 00000000..dda96b9b --- /dev/null +++ b/tests/dictionaries/60extra_variable_name_extra/tiramisu/base.py @@ -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_4 = StrOption(name="activer_ejabberd", 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], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_6 = StrOption(name="extra", doc="extra", properties=frozenset({"normal"})) +option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/80family_unique/00-base.xml b/tests/dictionaries/80family_unique/00-base.xml new file mode 100644 index 00000000..da71a435 --- /dev/null +++ b/tests/dictionaries/80family_unique/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/80family_unique/__init__.py b/tests/dictionaries/80family_unique/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_unique/errno_55 b/tests/dictionaries/80family_unique/errno_55 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_extra/00-base.xml b/tests/dictionaries/80variable_extra/00-base.xml new file mode 100644 index 00000000..4f429ec0 --- /dev/null +++ b/tests/dictionaries/80variable_extra/00-base.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/dictionaries/80variable_extra/__init__.py b/tests/dictionaries/80variable_extra/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_extra/errno_54 b/tests/dictionaries/80variable_extra/errno_54 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_extra/extra_dirs/extra/00-base.xml b/tests/dictionaries/80variable_extra/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..dd1a7ba3 --- /dev/null +++ b/tests/dictionaries/80variable_extra/extra_dirs/extra/00-base.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/dictionaries/80variable_rougail/00-base.xml b/tests/dictionaries/80variable_rougail/00-base.xml new file mode 100644 index 00000000..2d569b61 --- /dev/null +++ b/tests/dictionaries/80variable_rougail/00-base.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/dictionaries/80variable_rougail/__init__.py b/tests/dictionaries/80variable_rougail/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_rougail/errno_54 b/tests/dictionaries/80variable_rougail/errno_54 new file mode 100644 index 00000000..e69de29b From 85151da58de6aa61a0638d950d22ea3a7c6b7ba6 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 16 Feb 2021 13:45:43 +0100 Subject: [PATCH 115/168] a family and a variable cannot have the same path --- src/rougail/objspace.py | 2 +- src/rougail/path.py | 6 ++++++ .../80family_variable_not_same_name/00-base.xml | 11 +++++++++++ .../80family_variable_not_same_name/__init__.py | 0 .../80family_variable_not_same_name/errno_57 | 0 .../80variable_family_not_same_name/00-base.xml | 11 +++++++++++ .../80variable_family_not_same_name/__init__.py | 0 .../80variable_family_not_same_name/errno_56 | 0 8 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/dictionaries/80family_variable_not_same_name/00-base.xml create mode 100644 tests/dictionaries/80family_variable_not_same_name/__init__.py create mode 100644 tests/dictionaries/80family_variable_not_same_name/errno_57 create mode 100644 tests/dictionaries/80variable_family_not_same_name/00-base.xml create mode 100644 tests/dictionaries/80variable_family_not_same_name/__init__.py create mode 100644 tests/dictionaries/80variable_family_not_same_name/errno_56 diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 127bc2c5..7c97b0a0 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -356,7 +356,7 @@ class RougailObjSpace: # it's not a family tag = FORCE_TAG.get(child.tag, child.tag) children = getattr(space, tag, {}) - if name in children: + if name in children and isinstance(children[name], getattr(self, child.tag)): return children[name] return None diff --git a/src/rougail/path.py b/src/rougail/path.py index ff1a2b78..b2b45eb8 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -66,6 +66,9 @@ class Path: if full_name in self.families and \ self.families[full_name]['variableobj'] != variableobj: # pragma: no cover raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 37, variableobj.xmlfiles) + if full_name in self.variables: + msg = _(f'A variable and a family has the same path "{full_name}"') + raise DictConsistencyError(msg, 56, variableobj.xmlfiles) self.families[full_name] = dict(name=name, namespace=namespace, variableobj=variableobj, @@ -150,6 +153,9 @@ class Path: else: full_path = name variableobj.path = full_path + if full_path in self.families: + msg = _(f'A family and a variable has the same path "{full_path}"') + raise DictConsistencyError(msg, 57, variableobj.xmlfiles) self.variables[full_path] = dict(name=name, family=family, leader=None, diff --git a/tests/dictionaries/80family_variable_not_same_name/00-base.xml b/tests/dictionaries/80family_variable_not_same_name/00-base.xml new file mode 100644 index 00000000..b95506cc --- /dev/null +++ b/tests/dictionaries/80family_variable_not_same_name/00-base.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/tests/dictionaries/80family_variable_not_same_name/__init__.py b/tests/dictionaries/80family_variable_not_same_name/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80family_variable_not_same_name/errno_57 b/tests/dictionaries/80family_variable_not_same_name/errno_57 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_family_not_same_name/00-base.xml b/tests/dictionaries/80variable_family_not_same_name/00-base.xml new file mode 100644 index 00000000..3ca4e3da --- /dev/null +++ b/tests/dictionaries/80variable_family_not_same_name/00-base.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/tests/dictionaries/80variable_family_not_same_name/__init__.py b/tests/dictionaries/80variable_family_not_same_name/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_family_not_same_name/errno_56 b/tests/dictionaries/80variable_family_not_same_name/errno_56 new file mode 100644 index 00000000..e69de29b From 1272524cc8ecbf047e32a07ef583561f3c572e7f Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 16 Feb 2021 13:50:58 +0100 Subject: [PATCH 116/168] test redefine without family --- .../01test_redefine_base/00-base.xml | 8 ++++++++ .../01test_redefine_base/10-base.xml | 8 ++++++++ .../01test_redefine_base/__init__.py | 0 .../01test_redefine_base/makedict/base.json | 1 + .../01test_redefine_base/tiramisu/base.py | 17 +++++++++++++++++ 5 files changed, 34 insertions(+) create mode 100644 tests/dictionaries/01test_redefine_base/00-base.xml create mode 100644 tests/dictionaries/01test_redefine_base/10-base.xml create mode 100644 tests/dictionaries/01test_redefine_base/__init__.py create mode 100644 tests/dictionaries/01test_redefine_base/makedict/base.json create mode 100644 tests/dictionaries/01test_redefine_base/tiramisu/base.py diff --git a/tests/dictionaries/01test_redefine_base/00-base.xml b/tests/dictionaries/01test_redefine_base/00-base.xml new file mode 100644 index 00000000..99149e60 --- /dev/null +++ b/tests/dictionaries/01test_redefine_base/00-base.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/dictionaries/01test_redefine_base/10-base.xml b/tests/dictionaries/01test_redefine_base/10-base.xml new file mode 100644 index 00000000..cc13a576 --- /dev/null +++ b/tests/dictionaries/01test_redefine_base/10-base.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/dictionaries/01test_redefine_base/__init__.py b/tests/dictionaries/01test_redefine_base/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/01test_redefine_base/makedict/base.json b/tests/dictionaries/01test_redefine_base/makedict/base.json new file mode 100644 index 00000000..d3a9c907 --- /dev/null +++ b/tests/dictionaries/01test_redefine_base/makedict/base.json @@ -0,0 +1 @@ +{"rougail.my_variable": null} diff --git a/tests/dictionaries/01test_redefine_base/tiramisu/base.py b/tests/dictionaries/01test_redefine_base/tiramisu/base.py new file mode 100644 index 00000000..3240ec23 --- /dev/null +++ b/tests/dictionaries/01test_redefine_base/tiramisu/base.py @@ -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="my_variable", doc="my_variable", properties=frozenset({"normal"})) +option_2.impl_set_information('test', ('test1',)) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) From c7ea03b411152d078bacc027efb36d707d894440 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 17 Feb 2021 07:48:19 +0100 Subject: [PATCH 117/168] check symlink type for _type in service --- src/rougail/annotator/service.py | 59 ++++++++----------- src/rougail/data/rougail.dtd | 10 ++-- src/rougail/objspace.py | 3 + .../00-base.xml | 0 .../__init__.py | 0 .../makedict/base.json | 0 .../tiramisu/base.py | 0 .../dictionaries/70port_variable/00-base.xml | 19 ++++++ .../dictionaries/70port_variable/__init__.py | 0 .../70port_variable/makedict/base.json | 1 + .../70port_variable/tiramisu/base.py | 27 +++++++++ 11 files changed, 80 insertions(+), 39 deletions(-) rename tests/dictionaries/{70container_serviceaccess => 70port}/00-base.xml (100%) rename tests/dictionaries/{70container_serviceaccess => 70port}/__init__.py (100%) rename tests/dictionaries/{70container_serviceaccess => 70port}/makedict/base.json (100%) rename tests/dictionaries/{70container_serviceaccess => 70port}/tiramisu/base.py (100%) create mode 100644 tests/dictionaries/70port_variable/00-base.xml create mode 100644 tests/dictionaries/70port_variable/__init__.py create mode 100644 tests/dictionaries/70port_variable/makedict/base.json create mode 100644 tests/dictionaries/70port_variable/tiramisu/base.py diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index 4cf20e99..6d8ab88b 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -38,16 +38,6 @@ ERASED_ATTRIBUTES = ('redefine', 'exists', 'optional', 'remove_check', 'namespac 'reflector_object',) -KEY_TYPE = {'variable': 'symlink', - 'PortOption': 'port', - 'UnicodeOption': 'string', - 'NetworkOption': 'network', - 'NetmaskOption': 'netmask', - 'URLOption': 'web_address', - 'FilenameOption': 'filename', - } - - class ServiceAnnotator: """Manage service's object for example:: @@ -122,9 +112,11 @@ class ServiceAnnotator: ) family.variable = [] activate_obj = self._generate_element('boolean', + None, + None, 'activate', True, - elt.xmlfiles, + elt, '.'.join([subpath, 'activate']), ) for key in dir(elt): @@ -137,13 +129,19 @@ class ServiceAnnotator: value, []).append(activate_obj) continue - family.variable.append(self._generate_element(self._get_type(key, - elttype, - elt, - ), + if key == 'name': + dtd_key_type = elttype + '_type' + else: + dtd_key_type = key + '_type' + elt_type = getattr(elt, dtd_key_type, 'string') + if elt_type == 'variable': + elt_type = 'symlink' + family.variable.append(self._generate_element(elt_type, + dtd_key_type, + elttype, key, value, - elt.xmlfiles, + elt, f'{subpath}.{key}' )) family.variable.append(activate_obj) @@ -190,18 +188,26 @@ class ServiceAnnotator: def _generate_element(self, type_, + dtd_key_type, + elttype, key, value, - xmlfiles, + elt, path, ): # pylint: disable=R0913 - variable = self.objectspace.variable(xmlfiles) + variable = self.objectspace.variable(elt.xmlfiles) variable.name = normalize_family(key) variable.mode = None variable.type = type_ if type_ == 'symlink': variable.opt = self.objectspace.paths.get_variable(value) variable.multi = None + if self.objectspace.types[dtd_key_type] != 'variable' and \ + variable.opt.type != self.objectspace.types[dtd_key_type]: + msg = _(f'"{key}" in "{elttype}" must be a variable with type ' + f'"{self.objectspace.types[dtd_key_type]}" not "{variable.opt.type}"') + raise DictConsistencyError(msg, 58, elt.xmlfiles) + else: variable.doc = key variable.default = value @@ -214,21 +220,6 @@ class ServiceAnnotator: ) return variable - def _get_type(self, - key: str, - elt_name: str, - elt, - ) -> str: - if key == 'name': - dtd_key_type = elt_name + '_type' - else: - dtd_key_type = key + '_type' - if key in self.objectspace.booleans_attributs: - return 'boolean' - if hasattr(elt, dtd_key_type): - return KEY_TYPE[getattr(elt, dtd_key_type)] - return 'string' - def _update_override(self, file_, service_name, @@ -247,7 +238,7 @@ class ServiceAnnotator: file_, service_name, ): - if not hasattr(file_, 'file_type') or file_.file_type == "UnicodeOption": + if not hasattr(file_, 'file_type') or file_.file_type == "string": if not hasattr(file_, 'source'): file_.source = basename(file_.name) elif not hasattr(file_, 'source'): diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 08aceeb9..b2c0e59d 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -49,21 +49,21 @@ - + - - + + - + - + diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index 7c97b0a0..48d56a8b 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -110,6 +110,7 @@ class RougailObjSpace: self.valid_enums = {} self.booleans_attributs = [] self.has_dyn_option = False + self.types = {} self.make_object_space_classes(xmlreflector) self.rougailconfig = rougailconfig @@ -141,6 +142,8 @@ class RougailObjSpace: if dtd_attr.name in self.booleans_attributs: default_value = convert_boolean(default_value) attrs[dtd_attr.name] = default_value + if dtd_attr.name.endswith('_type'): + self.types[dtd_attr.name] = default_value if dtd_attr.name == 'redefine': # has a redefine attribute, so it's a Redefinable object clstype = Redefinable diff --git a/tests/dictionaries/70container_serviceaccess/00-base.xml b/tests/dictionaries/70port/00-base.xml similarity index 100% rename from tests/dictionaries/70container_serviceaccess/00-base.xml rename to tests/dictionaries/70port/00-base.xml diff --git a/tests/dictionaries/70container_serviceaccess/__init__.py b/tests/dictionaries/70port/__init__.py similarity index 100% rename from tests/dictionaries/70container_serviceaccess/__init__.py rename to tests/dictionaries/70port/__init__.py diff --git a/tests/dictionaries/70container_serviceaccess/makedict/base.json b/tests/dictionaries/70port/makedict/base.json similarity index 100% rename from tests/dictionaries/70container_serviceaccess/makedict/base.json rename to tests/dictionaries/70port/makedict/base.json diff --git a/tests/dictionaries/70container_serviceaccess/tiramisu/base.py b/tests/dictionaries/70port/tiramisu/base.py similarity index 100% rename from tests/dictionaries/70container_serviceaccess/tiramisu/base.py rename to tests/dictionaries/70port/tiramisu/base.py diff --git a/tests/dictionaries/70port_variable/00-base.xml b/tests/dictionaries/70port_variable/00-base.xml new file mode 100644 index 00000000..f6388f1a --- /dev/null +++ b/tests/dictionaries/70port_variable/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + my_variable + my_variable + + + + + + 123 + + + + diff --git a/tests/dictionaries/70port_variable/__init__.py b/tests/dictionaries/70port_variable/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70port_variable/makedict/base.json b/tests/dictionaries/70port_variable/makedict/base.json new file mode 100644 index 00000000..8445ec19 --- /dev/null +++ b/tests/dictionaries/70port_variable/makedict/base.json @@ -0,0 +1 @@ +{"rougail.my_variable": "123", "services.ntp.ports.my_variable.name": "123", "services.ntp.ports.my_variable.protocol": "udp", "services.ntp.ports.my_variable.activate": true, "services.ntp.ports.my_variable_1.name": "123", "services.ntp.ports.my_variable_1.protocol": "tcp", "services.ntp.ports.my_variable_1.activate": true} diff --git a/tests/dictionaries/70port_variable/tiramisu/base.py b/tests/dictionaries/70port_variable/tiramisu/base.py new file mode 100644 index 00000000..c0ac2625 --- /dev/null +++ b/tests/dictionaries/70port_variable/tiramisu/base.py @@ -0,0 +1,27 @@ +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 = PortOption(name="my_variable", doc="my_variable", default="123", allow_private=True, properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = SymLinkOption(name="name", opt=option_2) +option_8 = StrOption(name="protocol", doc="protocol", default="udp") +option_9 = BoolOption(name="activate", doc="activate", default=True) +option_6 = OptionDescription(name="my_variable", doc="my_variable", children=[option_7, option_8, option_9]) +option_11 = SymLinkOption(name="name", opt=option_2) +option_12 = StrOption(name="protocol", doc="protocol", default="tcp") +option_13 = BoolOption(name="activate", doc="activate", default=True) +option_10 = OptionDescription(name="my_variable_1", doc="my_variable_1", children=[option_11, option_12, option_13]) +option_5 = OptionDescription(name="ports", doc="ports", children=[option_6, option_10]) +option_4 = OptionDescription(name="ntp", doc="ntp", children=[option_5]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) From 0c4deb10166a6717d24425dc514d3092ba63b932 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 17 Feb 2021 09:52:17 +0100 Subject: [PATCH 118/168] name of file is a filename --- doc/service/file.md | 2 ++ doc/service/ip.md | 12 +++++++ doc/service/port.md | 2 ++ src/rougail/annotator/service.py | 2 +- src/rougail/data/rougail.dtd | 2 +- .../dictionaries/01base_file/tiramisu/base.py | 2 +- .../01base_file_include/tiramisu/base.py | 2 +- .../01base_file_patch/tiramisu/base.py | 2 +- .../01base_file_utfchar/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 4 +-- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../20notemplating/tiramisu/base.py | 2 +- .../40ifin_leadershipauto/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../45extra_without_family/tiramisu/base.py | 2 +- .../60extra_group/tiramisu/base.py | 2 +- .../60extra_help/tiramisu/base.py | 2 +- .../70container_files/tiramisu/base.py | 4 +-- .../00-base.xml | 13 +++---- .../makedict/base.json | 2 +- .../tiramisu/base.py | 28 +++++++-------- .../00-base.xml | 21 +++++------- .../makedict/base.json | 2 +- .../tiramisu/base.py | 34 +++++++++---------- .../00-base.xml | 17 ++++------ .../makedict/base.json | 2 +- .../tiramisu/base.py | 34 +++++++++---------- .../70container_files_twice/tiramisu/base.py | 6 ++-- .../70container_filesmulti/tiramisu/base.py | 4 +-- .../tiramisu/base.py | 2 +- tests/dictionaries/80port_string/00-base.xml | 19 +++++++++++ tests/dictionaries/80port_string/__init__.py | 0 tests/dictionaries/80port_string/errno_58 | 0 49 files changed, 140 insertions(+), 126 deletions(-) create mode 100644 tests/dictionaries/80port_string/00-base.xml create mode 100644 tests/dictionaries/80port_string/__init__.py create mode 100644 tests/dictionaries/80port_string/errno_58 diff --git a/doc/service/file.md b/doc/service/file.md index 5c3f8a1c..f14435ca 100644 --- a/doc/service/file.md +++ b/doc/service/file.md @@ -41,6 +41,8 @@ Il est possible également de définir le nom du fichier dans une variable : ``` +Attention, la variable doit être de type "filename". + Dans le cas des fichiers dynamique, la source est obligatoire. Il est même possible de définir une variable de type multiple, ce qui génèrera plusiers fichiers : diff --git a/doc/service/ip.md b/doc/service/ip.md index e81e2686..bc39c1c7 100644 --- a/doc/service/ip.md +++ b/doc/service/ip.md @@ -18,6 +18,8 @@ L'IP peut être un variable : variable_ip ``` +Attention, la variable doit être de type "network". + ## La gestion d'un réseau L'adresse IP peut être un réseau : @@ -32,6 +34,8 @@ Le masque de réseau peut être un variable : variable_ip ``` +Attention, la variable doit être de type "netmask". + ## L'interface Il est possible de spécifier le nom de l'interface si on la connait : @@ -48,6 +52,14 @@ Mais il est possible de calculer automatiquement cette valeur : Dans ce cas l'interface est déduite à partir de la table de routage. +L'interface peut être un variable : + +``` +192.168.0.1 +``` + +Attention, la variable doit être de type "string". + ## Désactiver la génération d'une IP Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise IP : diff --git a/doc/service/port.md b/doc/service/port.md index 1b02d388..7a5b6f1d 100644 --- a/doc/service/port.md +++ b/doc/service/port.md @@ -37,6 +37,8 @@ Il est possible également de définir le port dans une variable : ``` +Attention, la variable doit être de type "port". + ## Désactiver le port Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise port : diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index 6d8ab88b..04ec6107 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -238,7 +238,7 @@ class ServiceAnnotator: file_, service_name, ): - if not hasattr(file_, 'file_type') or file_.file_type == "string": + if not hasattr(file_, 'file_type') or file_.file_type == "filename": if not hasattr(file_, 'source'): file_.source = basename(file_.name) elif not hasattr(file_, 'source'): diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index b2c0e59d..ef773057 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -63,7 +63,7 @@ - + diff --git a/tests/dictionaries/01base_file/tiramisu/base.py b/tests/dictionaries/01base_file/tiramisu/base.py index 297f5366..a9f008e6 100644 --- a/tests/dictionaries/01base_file/tiramisu/base.py +++ b/tests/dictionaries/01base_file/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3], option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/file") +option_10 = FilenameOption(name="name", doc="name", default="/etc/file") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file") option_13 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/01base_file_include/tiramisu/base.py b/tests/dictionaries/01base_file_include/tiramisu/base.py index 297f5366..a9f008e6 100644 --- a/tests/dictionaries/01base_file_include/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3], option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/file") +option_10 = FilenameOption(name="name", doc="name", default="/etc/file") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file") option_13 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/01base_file_patch/tiramisu/base.py b/tests/dictionaries/01base_file_patch/tiramisu/base.py index 297f5366..a9f008e6 100644 --- a/tests/dictionaries/01base_file_patch/tiramisu/base.py +++ b/tests/dictionaries/01base_file_patch/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3], option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/file") +option_10 = FilenameOption(name="name", doc="name", default="/etc/file") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file") option_13 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py index 40c381f2..b68ce93c 100644 --- a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py +++ b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3], option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/systemd-makefs@dev-disk-by\\x2dpartlabel") +option_10 = FilenameOption(name="name", doc="name", default="/etc/systemd-makefs@dev-disk-by\\x2dpartlabel") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="systemd-makefs@dev-disk-by\\x2dpartlabel") option_13 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py index 2653972a..2c7794e1 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py index 83a34e72..9b745caf 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py index f3a106a8..024a3198 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py index dc751ea4..1d4938cf 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py index 0a82c0d2..85db20ff 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py index 1585798d..3bc1c751 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py index b3b6e12f..9e84a801 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py index 5fe77eb1..32d0b092 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py @@ -17,7 +17,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_9 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="mode", doc="mode", default="0644") -option_11 = StrOption(name="name", doc="name", default="/tmp/file1") +option_11 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 04871ea3..203f3b50 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/etc/file") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py index 4c480964..eaeb5f1a 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3], option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/tmp/file1") +option_10 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file1") option_13 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py index ca3e94e5..20bfffa1 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3], option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/tmp/file1") +option_10 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file1") option_13 = StrOption(name="templating", doc="templating", default="creole") 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 6828bd6c..c4f42074 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/etc/file") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") 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 58d7afea..8072af9b 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file1") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") @@ -26,7 +26,7 @@ option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_18 = StrOption(name="group", doc="group", default="root") option_19 = StrOption(name="mode", doc="mode", default="0644") -option_20 = StrOption(name="name", doc="name", default="/tmp/file2") +option_20 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 299e1d37..75adf3f4 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 299e1d37..75adf3f4 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index 875068e7..a0f22bc1 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index 365d0e6d..7759aa66 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -18,7 +18,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="group", doc="group", default="root") option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = StrOption(name="name", doc="name", default="/tmp/file") +option_12 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") 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 d6ef9410..4408179d 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -17,7 +17,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_9 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="mode", doc="mode", default="0644") -option_11 = StrOption(name="name", doc="name", default="/tmp/file1") +option_11 = FilenameOption(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 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/20notemplating/tiramisu/base.py b/tests/dictionaries/20notemplating/tiramisu/base.py index a6e0a5ac..25608104 100644 --- a/tests/dictionaries/20notemplating/tiramisu/base.py +++ b/tests/dictionaries/20notemplating/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3], option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/file") +option_10 = FilenameOption(name="name", doc="name", default="/etc/file") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="file") option_13 = StrOption(name="templating", doc="templating", default="none") diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index b9d6e460..59c5b4e0 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -21,7 +21,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_13 = StrOption(name="group", doc="group", default="root") option_14 = StrOption(name="mode", doc="mode", default="0644") -option_15 = StrOption(name="name", doc="name", default="/etc/mailname") +option_15 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_16 = StrOption(name="owner", doc="owner", default="root") option_17 = StrOption(name="source", doc="source", default="mailname") option_18 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py index 0a0c35e7..0034ae99 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -21,7 +21,7 @@ option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_13 = StrOption(name="group", doc="group", default="root") option_14 = StrOption(name="mode", doc="mode", default="0644") -option_15 = StrOption(name="name", doc="name", default="/etc/mailname") +option_15 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_16 = StrOption(name="owner", doc="owner", default="root") option_17 = StrOption(name="source", doc="source", default="mailname") option_18 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/45extra_without_family/tiramisu/base.py b/tests/dictionaries/45extra_without_family/tiramisu/base.py index 00324be9..6ad149f3 100644 --- a/tests/dictionaries/45extra_without_family/tiramisu/base.py +++ b/tests/dictionaries/45extra_without_family/tiramisu/base.py @@ -17,7 +17,7 @@ option_4 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_ option_3 = OptionDescription(name="extra", doc="extra", children=[option_4]) option_9 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="mode", doc="mode", default="0644") -option_11 = StrOption(name="name", doc="name", default="/etc/file") +option_11 = FilenameOption(name="name", doc="name", default="/etc/file") option_12 = StrOption(name="owner", doc="owner", default="root") option_13 = StrOption(name="source", doc="source", default="file") option_14 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/60extra_group/tiramisu/base.py b/tests/dictionaries/60extra_group/tiramisu/base.py index 2dfb82fa..eee42aa7 100644 --- a/tests/dictionaries/60extra_group/tiramisu/base.py +++ b/tests/dictionaries/60extra_group/tiramisu/base.py @@ -22,7 +22,7 @@ option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7 option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) option_14 = StrOption(name="group", doc="group", default="root") option_15 = StrOption(name="mode", doc="mode", default="0644") -option_16 = StrOption(name="name", doc="name", default="/etc/mailname") +option_16 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_17 = StrOption(name="owner", doc="owner", default="root") option_18 = StrOption(name="source", doc="source", default="mailname") option_19 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/60extra_help/tiramisu/base.py b/tests/dictionaries/60extra_help/tiramisu/base.py index de4eb536..7e2d6c7b 100644 --- a/tests/dictionaries/60extra_help/tiramisu/base.py +++ b/tests/dictionaries/60extra_help/tiramisu/base.py @@ -23,7 +23,7 @@ option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7 option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) option_14 = StrOption(name="group", doc="group", default="root") option_15 = StrOption(name="mode", doc="mode", default="0644") -option_16 = StrOption(name="name", doc="name", default="/etc/mailname") +option_16 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_17 = StrOption(name="owner", doc="owner", default="root") option_18 = StrOption(name="source", doc="source", default="mailname") option_19 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/70container_files/tiramisu/base.py b/tests/dictionaries/70container_files/tiramisu/base.py index c939a358..94d6c4f3 100644 --- a/tests/dictionaries/70container_files/tiramisu/base.py +++ b/tests/dictionaries/70container_files/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="général", children=[option_3 option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/mailname") +option_10 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname") option_13 = StrOption(name="templating", doc="templating", default="creole") @@ -24,7 +24,7 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_16 = StrOption(name="group", doc="group", default="root") option_17 = StrOption(name="mode", doc="mode", default="0644") -option_18 = StrOption(name="name", doc="name", default="/rougail.conf") +option_18 = FilenameOption(name="name", doc="name", default="/rougail.conf") option_19 = StrOption(name="owner", doc="owner", default="root") option_20 = StrOption(name="source", doc="source", default="rougail.conf") option_21 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/70container_files_symlink_multi/00-base.xml b/tests/dictionaries/70container_files_symlink_multi/00-base.xml index afb2b6fc..a85ac593 100644 --- a/tests/dictionaries/70container_files_symlink_multi/00-base.xml +++ b/tests/dictionaries/70container_files_symlink_multi/00-base.xml @@ -6,14 +6,9 @@ - - - - /etc/mailname - /etc/mailname2 - - + + /etc/mailname + /etc/mailname2 + diff --git a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json index 84fd8e1c..32ba56d2 100644 --- a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true} +{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py index 1d3e2c34..4d1b0897 100644 --- a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py @@ -11,19 +11,17 @@ try: from tiramisu3 import * except: from tiramisu import * -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_4 = StrOption(name="file_name", doc="file_name", multi=True, default=['/etc/mailname', '/etc/mailname2'], default_multi="/etc/mailname", properties=frozenset({"mandatory", "normal"})) -option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) +option_2 = FilenameOption(name="file_name", doc="file_name", multi=True, default=['/etc/mailname', '/etc/mailname2'], default_multi="/etc/mailname", properties=frozenset({"mandatory", "normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_9 = StrOption(name="group", doc="group", default="root") -option_10 = StrOption(name="mode", doc="mode", default="0644") -option_11 = SymLinkOption(name="name", opt=option_4) -option_12 = StrOption(name="owner", doc="owner", default="root") -option_13 = StrOption(name="source", doc="source", default="mailname") -option_14 = StrOption(name="templating", doc="templating", default="creole") -option_15 = BoolOption(name="activate", doc="activate", default=True) -option_8 = OptionDescription(name="mailname", doc="mailname", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) -option_7 = OptionDescription(name="files", doc="files", children=[option_8]) -option_6 = OptionDescription(name="test", doc="test", children=[option_7]) -option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) -option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) +option_7 = StrOption(name="group", doc="group", default="root") +option_8 = StrOption(name="mode", doc="mode", default="0644") +option_9 = SymLinkOption(name="name", opt=option_2) +option_10 = StrOption(name="owner", doc="owner", default="root") +option_11 = StrOption(name="source", doc="source", default="mailname") +option_12 = StrOption(name="templating", doc="templating", default="creole") +option_13 = BoolOption(name="activate", doc="activate", default=True) +option_6 = OptionDescription(name="mailname", doc="mailname", children=[option_7, option_8, option_9, option_10, option_11, option_12, option_13]) +option_5 = OptionDescription(name="files", doc="files", children=[option_6]) +option_4 = OptionDescription(name="test", doc="test", children=[option_5]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/00-base.xml b/tests/dictionaries/70container_files_symlink_multi_variable/00-base.xml index 056b4c22..90e7ad3b 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/00-base.xml +++ b/tests/dictionaries/70container_files_symlink_multi_variable/00-base.xml @@ -6,18 +6,13 @@ - - - - /etc/mailname - /etc/mailname2 - - - mailname - mailname2 - - + + /etc/mailname + /etc/mailname2 + + + mailname + mailname2 + diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json index 470a20ea..84d239ff 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.general.var": ["mailname", "mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.variable": ["mailname", "mailname2"], "services.test.files.mailname.activate": true} +{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.var": ["mailname", "mailname2"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.variable": ["mailname", "mailname2"], "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py index 3f8dcd23..dc6fda84 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py @@ -11,21 +11,19 @@ try: from tiramisu3 import * except: from tiramisu import * -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_4 = StrOption(name="file_name", doc="file_name", multi=True, default=['/etc/mailname', '/etc/mailname2'], default_multi="/etc/mailname", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="var", doc="var", multi=True, default=['mailname', 'mailname2'], default_multi="mailname", properties=frozenset({"mandatory", "normal"})) -option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) -option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_10 = StrOption(name="group", doc="group", default="root") -option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = SymLinkOption(name="name", opt=option_4) -option_13 = StrOption(name="owner", doc="owner", default="root") -option_14 = StrOption(name="source", doc="source", default="mailname") -option_15 = StrOption(name="templating", doc="templating", default="creole") -option_16 = SymLinkOption(name="variable", opt=option_5) -option_17 = BoolOption(name="activate", doc="activate", default=True) -option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) -option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) -option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) +option_2 = FilenameOption(name="file_name", doc="file_name", multi=True, default=['/etc/mailname', '/etc/mailname2'], default_multi="/etc/mailname", properties=frozenset({"mandatory", "normal"})) +option_3 = StrOption(name="var", doc="var", multi=True, default=['mailname', 'mailname2'], default_multi="mailname", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_8 = StrOption(name="group", doc="group", default="root") +option_9 = StrOption(name="mode", doc="mode", default="0644") +option_10 = SymLinkOption(name="name", opt=option_2) +option_11 = StrOption(name="owner", doc="owner", default="root") +option_12 = StrOption(name="source", doc="source", default="mailname") +option_13 = StrOption(name="templating", doc="templating", default="creole") +option_14 = SymLinkOption(name="variable", opt=option_3) +option_15 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_files_symlink_variable/00-base.xml b/tests/dictionaries/70container_files_symlink_variable/00-base.xml index bb6103a4..c77ea562 100644 --- a/tests/dictionaries/70container_files_symlink_variable/00-base.xml +++ b/tests/dictionaries/70container_files_symlink_variable/00-base.xml @@ -6,16 +6,11 @@ - - - - /etc/mailname - - - mailname - - + + /etc/mailname + + + mailname + diff --git a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json index 18ba2f42..8543cb74 100644 --- a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.file_name": "/etc/mailname", "rougail.general.var": "mailname", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true} +{"rougail.file_name": "/etc/mailname", "rougail.var": "mailname", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": "creole", "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true} diff --git a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py index 6c29194e..de24603e 100644 --- a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py @@ -11,21 +11,19 @@ try: from tiramisu3 import * except: from tiramisu import * -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_4 = StrOption(name="file_name", doc="file_name", default="/etc/mailname", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="var", doc="var", default="mailname", properties=frozenset({"mandatory", "normal"})) -option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) -option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_10 = StrOption(name="group", doc="group", default="root") -option_11 = StrOption(name="mode", doc="mode", default="0644") -option_12 = SymLinkOption(name="name", opt=option_4) -option_13 = StrOption(name="owner", doc="owner", default="root") -option_14 = StrOption(name="source", doc="source", default="mailname") -option_15 = StrOption(name="templating", doc="templating", default="creole") -option_16 = SymLinkOption(name="variable", opt=option_5) -option_17 = BoolOption(name="activate", doc="activate", default=True) -option_9 = OptionDescription(name="mailname", doc="mailname", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) -option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) -option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) -option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) +option_2 = FilenameOption(name="file_name", doc="file_name", default="/etc/mailname", properties=frozenset({"mandatory", "normal"})) +option_3 = StrOption(name="var", doc="var", default="mailname", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_8 = StrOption(name="group", doc="group", default="root") +option_9 = StrOption(name="mode", doc="mode", default="0644") +option_10 = SymLinkOption(name="name", opt=option_2) +option_11 = StrOption(name="owner", doc="owner", default="root") +option_12 = StrOption(name="source", doc="source", default="mailname") +option_13 = StrOption(name="templating", doc="templating", default="creole") +option_14 = SymLinkOption(name="variable", opt=option_3) +option_15 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_files_twice/tiramisu/base.py b/tests/dictionaries/70container_files_twice/tiramisu/base.py index be8d98d2..1cf7e15f 100644 --- a/tests/dictionaries/70container_files_twice/tiramisu/base.py +++ b/tests/dictionaries/70container_files_twice/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="général", children=[option_3 option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/mailname") +option_10 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname") option_13 = StrOption(name="templating", doc="templating", default="creole") @@ -24,7 +24,7 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_16 = StrOption(name="group", doc="group", default="root") option_17 = StrOption(name="mode", doc="mode", default="0644") -option_18 = StrOption(name="name", doc="name", default="/etc/eole/mailname") +option_18 = FilenameOption(name="name", doc="name", default="/etc/eole/mailname") option_19 = StrOption(name="owner", doc="owner", default="root") option_20 = StrOption(name="source", doc="source", default="mailname") option_21 = StrOption(name="templating", doc="templating", default="creole") @@ -32,7 +32,7 @@ option_22 = BoolOption(name="activate", doc="activate", default=True) option_15 = OptionDescription(name="mailname_1", doc="mailname_1", children=[option_16, option_17, option_18, option_19, option_20, option_21, option_22]) option_24 = StrOption(name="group", doc="group", default="root") option_25 = StrOption(name="mode", doc="mode", default="0644") -option_26 = StrOption(name="name", doc="name", default="/rougail.conf") +option_26 = FilenameOption(name="name", doc="name", default="/rougail.conf") option_27 = StrOption(name="owner", doc="owner", default="root") option_28 = StrOption(name="source", doc="source", default="rougail.conf") option_29 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/70container_filesmulti/tiramisu/base.py b/tests/dictionaries/70container_filesmulti/tiramisu/base.py index 6406494f..b1716b53 100644 --- a/tests/dictionaries/70container_filesmulti/tiramisu/base.py +++ b/tests/dictionaries/70container_filesmulti/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="général", children=[option_3 option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/mailname") +option_10 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname") option_13 = StrOption(name="templating", doc="templating", default="creole") @@ -24,7 +24,7 @@ option_14 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_16 = StrOption(name="group", doc="group", default="root") option_17 = StrOption(name="mode", doc="mode", default="0644") -option_18 = StrOption(name="name", doc="name", default="/etc/mailname2") +option_18 = FilenameOption(name="name", doc="name", default="/etc/mailname2") option_19 = StrOption(name="owner", doc="owner", default="root") option_20 = StrOption(name="source", doc="source", default="mailname2") option_21 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/70container_filesredefine/tiramisu/base.py b/tests/dictionaries/70container_filesredefine/tiramisu/base.py index 31ec80f8..ee2f63d0 100644 --- a/tests/dictionaries/70container_filesredefine/tiramisu/base.py +++ b/tests/dictionaries/70container_filesredefine/tiramisu/base.py @@ -16,7 +16,7 @@ option_2 = OptionDescription(name="general", doc="général", children=[option_3 option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_8 = StrOption(name="group", doc="group", default="root") option_9 = StrOption(name="mode", doc="mode", default="0644") -option_10 = StrOption(name="name", doc="name", default="/etc/mailname") +option_10 = FilenameOption(name="name", doc="name", default="/etc/mailname") option_11 = StrOption(name="owner", doc="owner", default="root") option_12 = StrOption(name="source", doc="source", default="mailname.new") option_13 = StrOption(name="templating", doc="templating", default="creole") diff --git a/tests/dictionaries/80port_string/00-base.xml b/tests/dictionaries/80port_string/00-base.xml new file mode 100644 index 00000000..7c7ae605 --- /dev/null +++ b/tests/dictionaries/80port_string/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + my_variable + my_variable + + + + + + 123 + + + + diff --git a/tests/dictionaries/80port_string/__init__.py b/tests/dictionaries/80port_string/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80port_string/errno_58 b/tests/dictionaries/80port_string/errno_58 new file mode 100644 index 00000000..e69de29b From 236dda2e3ef0c89fc0b64718e92409f367838d6f Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 17 Feb 2021 10:04:57 +0100 Subject: [PATCH 119/168] add test for iplist --- .../00-base.xml | 0 .../__init__.py | 0 .../makedict/base.json | 0 .../tiramisu/base.py | 0 .../70services_pathaccess_iplist/00-base.xml | 23 ++++++++++++++++++ .../70services_pathaccess_iplist/__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 24 +++++++++++++++++++ .../70services_pathaccess_iplist2/00-base.xml | 23 ++++++++++++++++++ .../70services_pathaccess_iplist2/__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 24 +++++++++++++++++++ 12 files changed, 96 insertions(+) rename tests/dictionaries/{70container_pathaccess => 70services_pathaccess}/00-base.xml (100%) rename tests/dictionaries/{70container_pathaccess => 70services_pathaccess}/__init__.py (100%) rename tests/dictionaries/{70container_pathaccess => 70services_pathaccess}/makedict/base.json (100%) rename tests/dictionaries/{70container_pathaccess => 70services_pathaccess}/tiramisu/base.py (100%) create mode 100644 tests/dictionaries/70services_pathaccess_iplist/00-base.xml create mode 100644 tests/dictionaries/70services_pathaccess_iplist/__init__.py create mode 100644 tests/dictionaries/70services_pathaccess_iplist/makedict/base.json create mode 100644 tests/dictionaries/70services_pathaccess_iplist/tiramisu/base.py create mode 100644 tests/dictionaries/70services_pathaccess_iplist2/00-base.xml create mode 100644 tests/dictionaries/70services_pathaccess_iplist2/__init__.py create mode 100644 tests/dictionaries/70services_pathaccess_iplist2/makedict/base.json create mode 100644 tests/dictionaries/70services_pathaccess_iplist2/tiramisu/base.py diff --git a/tests/dictionaries/70container_pathaccess/00-base.xml b/tests/dictionaries/70services_pathaccess/00-base.xml similarity index 100% rename from tests/dictionaries/70container_pathaccess/00-base.xml rename to tests/dictionaries/70services_pathaccess/00-base.xml diff --git a/tests/dictionaries/70container_pathaccess/__init__.py b/tests/dictionaries/70services_pathaccess/__init__.py similarity index 100% rename from tests/dictionaries/70container_pathaccess/__init__.py rename to tests/dictionaries/70services_pathaccess/__init__.py diff --git a/tests/dictionaries/70container_pathaccess/makedict/base.json b/tests/dictionaries/70services_pathaccess/makedict/base.json similarity index 100% rename from tests/dictionaries/70container_pathaccess/makedict/base.json rename to tests/dictionaries/70services_pathaccess/makedict/base.json diff --git a/tests/dictionaries/70container_pathaccess/tiramisu/base.py b/tests/dictionaries/70services_pathaccess/tiramisu/base.py similarity index 100% rename from tests/dictionaries/70container_pathaccess/tiramisu/base.py rename to tests/dictionaries/70services_pathaccess/tiramisu/base.py diff --git a/tests/dictionaries/70services_pathaccess_iplist/00-base.xml b/tests/dictionaries/70services_pathaccess_iplist/00-base.xml new file mode 100644 index 00000000..1f0be8f6 --- /dev/null +++ b/tests/dictionaries/70services_pathaccess_iplist/00-base.xml @@ -0,0 +1,23 @@ + + + + + + 192.168.0.1 + + + + + no + + + + + + yes + example + + + + diff --git a/tests/dictionaries/70services_pathaccess_iplist/__init__.py b/tests/dictionaries/70services_pathaccess_iplist/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70services_pathaccess_iplist/makedict/base.json b/tests/dictionaries/70services_pathaccess_iplist/makedict/base.json new file mode 100644 index 00000000..5b00283a --- /dev/null +++ b/tests/dictionaries/70services_pathaccess_iplist/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": "no", "services.nut.ips.192_168_0_1.interface": "auto", "services.nut.ips.192_168_0_1.name": "192.168.0.1", "services.nut.ips.192_168_0_1.netmask": "255.255.255.255", "services.nut.ips.192_168_0_1.activate": true} diff --git a/tests/dictionaries/70services_pathaccess_iplist/tiramisu/base.py b/tests/dictionaries/70services_pathaccess_iplist/tiramisu/base.py new file mode 100644 index 00000000..33279fa5 --- /dev/null +++ b/tests/dictionaries/70services_pathaccess_iplist/tiramisu/base.py @@ -0,0 +1,24 @@ +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="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = StrOption(name="interface", doc="interface", default="auto") +option_8 = NetworkOption(name="name", doc="name", default="192.168.0.1") +option_9 = NetmaskOption(name="netmask", doc="netmask", default="255.255.255.255") +option_10 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_6 = OptionDescription(name="192_168_0_1", doc="192.168.0.1", children=[option_7, option_8, option_9, option_10]) +option_5 = OptionDescription(name="ips", doc="ips", children=[option_6]) +option_4 = OptionDescription(name="nut", doc="nut", children=[option_5]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70services_pathaccess_iplist2/00-base.xml b/tests/dictionaries/70services_pathaccess_iplist2/00-base.xml new file mode 100644 index 00000000..fe90af1b --- /dev/null +++ b/tests/dictionaries/70services_pathaccess_iplist2/00-base.xml @@ -0,0 +1,23 @@ + + + + + + 192.168.0.1 + + + + + yes + + + + + + yes + example + + + + diff --git a/tests/dictionaries/70services_pathaccess_iplist2/__init__.py b/tests/dictionaries/70services_pathaccess_iplist2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70services_pathaccess_iplist2/makedict/base.json b/tests/dictionaries/70services_pathaccess_iplist2/makedict/base.json new file mode 100644 index 00000000..ebec540a --- /dev/null +++ b/tests/dictionaries/70services_pathaccess_iplist2/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": "yes", "services.nut.ips.192_168_0_1.interface": "auto", "services.nut.ips.192_168_0_1.name": "192.168.0.1", "services.nut.ips.192_168_0_1.netmask": "255.255.255.255", "services.nut.ips.192_168_0_1.activate": false} diff --git a/tests/dictionaries/70services_pathaccess_iplist2/tiramisu/base.py b/tests/dictionaries/70services_pathaccess_iplist2/tiramisu/base.py new file mode 100644 index 00000000..7fa0f814 --- /dev/null +++ b/tests/dictionaries/70services_pathaccess_iplist2/tiramisu/base.py @@ -0,0 +1,24 @@ +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="condition", doc="condition", default="yes", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = StrOption(name="interface", doc="interface", default="auto") +option_8 = NetworkOption(name="name", doc="name", default="192.168.0.1") +option_9 = NetmaskOption(name="netmask", doc="netmask", default="255.255.255.255") +option_10 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_6 = OptionDescription(name="192_168_0_1", doc="192.168.0.1", children=[option_7, option_8, option_9, option_10]) +option_5 = OptionDescription(name="ips", doc="ips", children=[option_6]) +option_4 = OptionDescription(name="nut", doc="nut", children=[option_5]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) From c11ae16ea0754f2ee60b5d8087080b224f084178 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 17 Feb 2021 12:17:53 +0100 Subject: [PATCH 120/168] add port_type example --- src/rougail/annotator/condition.py | 10 +- src/rougail/annotator/param.py | 94 +++++++++++-------- src/rougail/tiramisureflector.py | 2 +- .../dictionaries/70port_portlist/00-base.xml | 26 +++++ .../dictionaries/70port_portlist/__init__.py | 0 .../70port_portlist/makedict/base.json | 1 + .../70port_portlist/tiramisu/base.py | 27 ++++++ 7 files changed, 118 insertions(+), 42 deletions(-) create mode 100644 tests/dictionaries/70port_portlist/00-base.xml create mode 100644 tests/dictionaries/70port_portlist/__init__.py create mode 100644 tests/dictionaries/70port_portlist/makedict/base.json create mode 100644 tests/dictionaries/70port_portlist/tiramisu/base.py diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 89ebb2ea..09fce084 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -235,8 +235,16 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): or_needed = len(condition.param) != 1 if len(condition.param) == 1: values = getattr(condition.param[0], 'text', None) + param_type = condition.param[0].type else: values = tuple([getattr(param, 'text', None) for param in condition.param]) + param_type = None + for param in condition.param: + if param_type is None or param_type == 'nil': + param_type = param.type + if param_type != param.type: + msg = _(f'param with type "{target.type}" has multi param types') + raise DictConsistencyError(msg, 59, condition.xmlfiles) param3 = self.objectspace.param(target.xmlfiles) param3.name = f'condition_{fill.index}' param3.type = 'variable' @@ -245,7 +253,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): param4 = self.objectspace.param(target.xmlfiles) param4.name = f'expected_{fill.index}' param4.text = values - param4.type = condition.param[0].type + param4.type = param_type fill.param.append(param4) if condition.name != 'disabled_if_in': param5 = self.objectspace.param(target.xmlfiles) diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index c12ab364..a6e763b1 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -45,54 +45,68 @@ class ParamAnnotator: param_to_delete = [] variable_type = self.valid_type_validation(obj) for param_idx, param in enumerate(obj.param): - if param.type == 'suffix': - if hasattr(param, 'text'): + if hasattr(param, 'text'): + if param.type == 'suffix': msg = _(f'"{param.type}" parameter must not have a value') raise DictConsistencyError(msg, 28, obj.xmlfiles) + elif param.type == 'nil': + if param.text is not None: + msg = _(f'"{param.type}" parameter must not have a value') + raise DictConsistencyError(msg, 40, obj.xmlfiles) + elif param.type == 'variable': + try: + path, suffix = self.objectspace.paths.get_variable_path(param.text, + obj.namespace, + ) + param.text = self.objectspace.paths.get_variable(path) + if variable_type and param.text.type != variable_type: + msg = _(f'"{obj.name}" has type "{variable_type}" but param has type "{param.text.type}"') + raise DictConsistencyError(msg, 26, param.xmlfiles) + if suffix: + param.suffix = suffix + family_path = self.objectspace.paths.get_variable_family_path(path) + param.family = self.objectspace.paths.get_family(family_path, + param.text.namespace, + ) + except DictConsistencyError as err: + if err.errno != 42 or not param.optional: + raise err + param_to_delete.append(param_idx) + elif variable_type: + self._convert_with_variable_type(variable_type, param) + continue + # no param.text + if param.type == 'suffix': for target in obj.target: if not self.objectspace.paths.variable_is_dynamic(target.name.path): msg = _(f'"suffix" parameter cannot be set with target "{target.name}"' f' which is not a dynamic variable') raise DictConsistencyError(msg, 53, obj.xmlfiles) - elif not hasattr(param, 'text'): - if not param.type == 'nil': - msg = _(f'"{param.type}" parameter must have a value') - raise DictConsistencyError(msg, 27, obj.xmlfiles) - param.text = None elif param.type == 'nil': - msg = _(f'"{param.type}" parameter must not have a value') - raise DictConsistencyError(msg, 40, obj.xmlfiles) - elif param.type == 'variable': - try: - path, suffix = self.objectspace.paths.get_variable_path(param.text, - obj.namespace, - ) - param.text = self.objectspace.paths.get_variable(path) - if variable_type and param.text.type != variable_type: - msg = _(f'"{obj.name}" has type "{variable_type}" but param has type "{param.text.type}"') - raise DictConsistencyError(msg, 26, param.xmlfiles) - if suffix: - param.suffix = suffix - family_path = self.objectspace.paths.get_variable_family_path(path) - param.family = self.objectspace.paths.get_family(family_path, - param.text.namespace, - ) - except DictConsistencyError as err: - if err.errno != 42 or not param.optional: - raise err - param_to_delete.append(param_idx) - elif variable_type: - if 'type' in vars(param) and variable_type != param.type: - msg = _(f'parameter has incompatible type "{param.type}" ' - f'with type "{variable_type}"') - raise DictConsistencyError(msg, 7, param.xmlfiles) - try: - param.text = CONVERT_OPTION[variable_type].get('func', str)(param.text) - except ValueError as err: - msg = _(f'unable to change type of "{param.text}" ' - f'is not a valid "{variable_type}"') - raise DictConsistencyError(msg, 13, param.xmlfiles) from err - param.type = variable_type + param.text = None + elif param.type == 'string': + param.text = '' + if variable_type: + self._convert_with_variable_type(variable_type, param) + else: + msg = _(f'"{param.type}" parameter must have a value') + raise DictConsistencyError(msg, 27, obj.xmlfiles) param_to_delete.sort(reverse=True) for param_idx in param_to_delete: obj.param.pop(param_idx) + + def _convert_with_variable_type(self, + variable_type: str, + param: 'self.objectspace.param', + ) -> None: + if 'type' in vars(param) and variable_type != param.type: + msg = _(f'parameter has incompatible type "{param.type}" ' + f'with type "{variable_type}"') + raise DictConsistencyError(msg, 7, param.xmlfiles) + try: + param.text = CONVERT_OPTION[variable_type].get('func', str)(param.text) + except ValueError as err: + msg = _(f'unable to change type of "{param.text}" ' + f'is not a valid "{variable_type}"') + raise DictConsistencyError(msg, 13, param.xmlfiles) from err + param.type = variable_type diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 0d78bb38..295ab0f5 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -242,7 +242,7 @@ class Common: ): """Populate variable parameters """ - if param.type in ['number', 'boolean', 'nil', 'string']: + if param.type in ['number', 'boolean', 'nil', 'string', 'port']: value = param.text if param.type == 'string' and value is not None: value = self.convert_str(value) diff --git a/tests/dictionaries/70port_portlist/00-base.xml b/tests/dictionaries/70port_portlist/00-base.xml new file mode 100644 index 00000000..1a7bf309 --- /dev/null +++ b/tests/dictionaries/70port_portlist/00-base.xml @@ -0,0 +1,26 @@ + + + + + + + my_variable + my_variable + + + + + + 123 + + + + + + + example + + + + diff --git a/tests/dictionaries/70port_portlist/__init__.py b/tests/dictionaries/70port_portlist/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70port_portlist/makedict/base.json b/tests/dictionaries/70port_portlist/makedict/base.json new file mode 100644 index 00000000..8445ec19 --- /dev/null +++ b/tests/dictionaries/70port_portlist/makedict/base.json @@ -0,0 +1 @@ +{"rougail.my_variable": "123", "services.ntp.ports.my_variable.name": "123", "services.ntp.ports.my_variable.protocol": "udp", "services.ntp.ports.my_variable.activate": true, "services.ntp.ports.my_variable_1.name": "123", "services.ntp.ports.my_variable_1.protocol": "tcp", "services.ntp.ports.my_variable_1.activate": true} diff --git a/tests/dictionaries/70port_portlist/tiramisu/base.py b/tests/dictionaries/70port_portlist/tiramisu/base.py new file mode 100644 index 00000000..e568c1f3 --- /dev/null +++ b/tests/dictionaries/70port_portlist/tiramisu/base.py @@ -0,0 +1,27 @@ +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 = PortOption(name="my_variable", doc="my_variable", default="123", allow_private=True, properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = SymLinkOption(name="name", opt=option_2) +option_8 = StrOption(name="protocol", doc="protocol", default="udp") +option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue((None, '')), 'condition_operator': ParamValue("OR")}))) +option_6 = OptionDescription(name="my_variable", doc="my_variable", children=[option_7, option_8, option_9]) +option_11 = SymLinkOption(name="name", opt=option_2) +option_12 = StrOption(name="protocol", doc="protocol", default="tcp") +option_13 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue((None, '')), 'condition_operator': ParamValue("OR")}))) +option_10 = OptionDescription(name="my_variable_1", doc="my_variable_1", children=[option_11, option_12, option_13]) +option_5 = OptionDescription(name="ports", doc="ports", children=[option_6, option_10]) +option_4 = OptionDescription(name="ntp", doc="ntp", children=[option_5]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) From 3b2d96566b5c53b002b8fccb529dc6d850380c2e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 17 Feb 2021 17:30:06 +0100 Subject: [PATCH 121/168] valid value in param --- src/rougail/annotator/param.py | 8 ++++-- .../dictionaries/70port_portlist/00-base.xml | 1 - .../70port_portlist/tiramisu/base.py | 4 +-- .../70port_portlist_optional/00-base.xml | 17 ++++++++++++ .../70port_portlist_optional/__init__.py | 0 .../makedict/base.json | 1 + .../70port_portlist_optional/tiramisu/base.py | 16 ++++++++++++ tests/dictionaries/80invalid_port/00-base.xml | 26 +++++++++++++++++++ tests/dictionaries/80invalid_port/__init__.py | 0 tests/dictionaries/80invalid_port/errno_13 | 0 10 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 tests/dictionaries/70port_portlist_optional/00-base.xml create mode 100644 tests/dictionaries/70port_portlist_optional/__init__.py create mode 100644 tests/dictionaries/70port_portlist_optional/makedict/base.json create mode 100644 tests/dictionaries/70port_portlist_optional/tiramisu/base.py create mode 100644 tests/dictionaries/80invalid_port/00-base.xml create mode 100644 tests/dictionaries/80invalid_port/__init__.py create mode 100644 tests/dictionaries/80invalid_port/errno_13 diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index a6e763b1..0b684e84 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -24,6 +24,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +import tiramisu + from .variable import CONVERT_OPTION from ..i18n import _ @@ -104,9 +106,11 @@ class ParamAnnotator: f'with type "{variable_type}"') raise DictConsistencyError(msg, 7, param.xmlfiles) try: - param.text = CONVERT_OPTION[variable_type].get('func', str)(param.text) + option = CONVERT_OPTION[variable_type] + param.text = option.get('func', str)(param.text) + getattr(tiramisu, option['opttype'])('test', 'Object to valid value', param.text, **option.get('initkwargs', {})) except ValueError as err: - msg = _(f'unable to change type of "{param.text}" ' + msg = _(f'unable to change type of value "{param.text}" ' f'is not a valid "{variable_type}"') raise DictConsistencyError(msg, 13, param.xmlfiles) from err param.type = variable_type diff --git a/tests/dictionaries/70port_portlist/00-base.xml b/tests/dictionaries/70port_portlist/00-base.xml index 1a7bf309..288580f3 100644 --- a/tests/dictionaries/70port_portlist/00-base.xml +++ b/tests/dictionaries/70port_portlist/00-base.xml @@ -17,7 +17,6 @@ - example diff --git a/tests/dictionaries/70port_portlist/tiramisu/base.py b/tests/dictionaries/70port_portlist/tiramisu/base.py index e568c1f3..a0d70a1b 100644 --- a/tests/dictionaries/70port_portlist/tiramisu/base.py +++ b/tests/dictionaries/70port_portlist/tiramisu/base.py @@ -15,11 +15,11 @@ option_2 = PortOption(name="my_variable", doc="my_variable", default="123", allo option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_7 = SymLinkOption(name="name", opt=option_2) option_8 = StrOption(name="protocol", doc="protocol", default="udp") -option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue((None, '')), 'condition_operator': ParamValue("OR")}))) +option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue(None)}))) option_6 = OptionDescription(name="my_variable", doc="my_variable", children=[option_7, option_8, option_9]) option_11 = SymLinkOption(name="name", opt=option_2) option_12 = StrOption(name="protocol", doc="protocol", default="tcp") -option_13 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue((None, '')), 'condition_operator': ParamValue("OR")}))) +option_13 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue(None)}))) option_10 = OptionDescription(name="my_variable_1", doc="my_variable_1", children=[option_11, option_12, option_13]) option_5 = OptionDescription(name="ports", doc="ports", children=[option_6, option_10]) option_4 = OptionDescription(name="ntp", doc="ntp", children=[option_5]) diff --git a/tests/dictionaries/70port_portlist_optional/00-base.xml b/tests/dictionaries/70port_portlist_optional/00-base.xml new file mode 100644 index 00000000..f885f1d9 --- /dev/null +++ b/tests/dictionaries/70port_portlist_optional/00-base.xml @@ -0,0 +1,17 @@ + + + + + + 123 + + + + + + example + + + + diff --git a/tests/dictionaries/70port_portlist_optional/__init__.py b/tests/dictionaries/70port_portlist_optional/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70port_portlist_optional/makedict/base.json b/tests/dictionaries/70port_portlist_optional/makedict/base.json new file mode 100644 index 00000000..0ca5d8e4 --- /dev/null +++ b/tests/dictionaries/70port_portlist_optional/makedict/base.json @@ -0,0 +1 @@ +{"rougail.my_variable": "123"} diff --git a/tests/dictionaries/70port_portlist_optional/tiramisu/base.py b/tests/dictionaries/70port_portlist_optional/tiramisu/base.py new file mode 100644 index 00000000..a3699558 --- /dev/null +++ b/tests/dictionaries/70port_portlist_optional/tiramisu/base.py @@ -0,0 +1,16 @@ +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 = PortOption(name="my_variable", doc="my_variable", default="123", allow_private=True, properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/80invalid_port/00-base.xml b/tests/dictionaries/80invalid_port/00-base.xml new file mode 100644 index 00000000..5baa3e01 --- /dev/null +++ b/tests/dictionaries/80invalid_port/00-base.xml @@ -0,0 +1,26 @@ + + + + + + + my_variable + my_variable + + + + + + 123 + + + + + + aaa + example + + + + diff --git a/tests/dictionaries/80invalid_port/__init__.py b/tests/dictionaries/80invalid_port/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80invalid_port/errno_13 b/tests/dictionaries/80invalid_port/errno_13 new file mode 100644 index 00000000..e69de29b From e35a3cb19d7879dc943e238be3bbb04d9c334c54 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 17 Feb 2021 22:32:28 +0100 Subject: [PATCH 122/168] add ParamIndex --- src/rougail/annotator/family.py | 137 ++++++++++-------- src/rougail/annotator/group.py | 16 +- src/rougail/annotator/param.py | 11 +- src/rougail/data/rougail.dtd | 4 +- src/rougail/path.py | 9 ++ src/rougail/tiramisureflector.py | 2 + .../01fill_target_optional/00-base.xml | 19 +++ .../01fill_target_optional/__init__.py | 0 .../01fill_target_optional/makedict/base.json | 1 + .../01fill_target_optional/tiramisu/base.py | 17 +++ .../10check_base_target_optional/00-base.xml | 15 ++ .../10check_base_target_optional/__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 16 ++ .../10leadership_auto_index/00-base.xml | 21 +++ .../10leadership_auto_index/__init__.py | 0 .../makedict/base.json | 1 + .../10leadership_auto_index/tiramisu/base.py | 18 +++ .../45multi_family_expert/00-base.xml | 12 ++ .../45multi_family_expert/__init__.py | 0 .../45multi_family_expert/makedict/base.json | 1 + .../45multi_family_expert/tiramisu/base.py | 18 +++ tests/eosfunc/test.py | 4 + 23 files changed, 254 insertions(+), 69 deletions(-) create mode 100644 tests/dictionaries/01fill_target_optional/00-base.xml create mode 100644 tests/dictionaries/01fill_target_optional/__init__.py create mode 100644 tests/dictionaries/01fill_target_optional/makedict/base.json create mode 100644 tests/dictionaries/01fill_target_optional/tiramisu/base.py create mode 100644 tests/dictionaries/10check_base_target_optional/00-base.xml create mode 100644 tests/dictionaries/10check_base_target_optional/__init__.py create mode 100644 tests/dictionaries/10check_base_target_optional/makedict/base.json create mode 100644 tests/dictionaries/10check_base_target_optional/tiramisu/base.py create mode 100644 tests/dictionaries/10leadership_auto_index/00-base.xml create mode 100644 tests/dictionaries/10leadership_auto_index/__init__.py create mode 100644 tests/dictionaries/10leadership_auto_index/makedict/base.json create mode 100644 tests/dictionaries/10leadership_auto_index/tiramisu/base.py create mode 100644 tests/dictionaries/45multi_family_expert/00-base.xml create mode 100644 tests/dictionaries/45multi_family_expert/__init__.py create mode 100644 tests/dictionaries/45multi_family_expert/makedict/base.json create mode 100644 tests/dictionaries/45multi_family_expert/tiramisu/base.py diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index d4a54799..6ba7a456 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -104,52 +104,36 @@ class FamilyAnnotator(Walk): def change_modes(self): """change the mode of variables """ - # default is high level - new_family_mode = modes_level[-1] - for family in self.objectspace.space.variables.values(): - self.change_family_mode(family, - new_family_mode, - first=True, - ) + families = list(self.get_families()) + for family in families: + self._set_default_mode(family) + families.reverse() + for family in families: + self._change_family_mode(family) - def change_family_mode(self, - family: 'self.objectspace.family', - new_family_mode: str, - first: bool=False, - ) -> str: - if hasattr(family, 'mode'): + def _set_default_mode(self, + family: 'self.objectspace.family', + ) -> None: + if hasattr(family, 'mode') and 'mode' in vars(family): family_mode = family.mode else: - family_mode = new_family_mode - if hasattr(family, 'variable'): - # change variable mode, but not if variables are not in a family - for variable in family.variable.values(): - if isinstance(variable, self.objectspace.family): - new_family_mode = self.change_family_mode(variable, - new_family_mode, - ) - continue - if first: - continue - if isinstance(variable, self.objectspace.leadership): - func = self._change_variable_mode_leader - else: - func = self._change_variabe_mode - func(variable, - family_mode, - ) - if modes[new_family_mode] > modes[variable.mode]: - new_family_mode = variable.mode - if not first: - # set the lower variable mode to family - family.mode = new_family_mode - return new_family_mode + family_mode = None + if not hasattr(family, 'variable'): + return + for variable in family.variable.values(): + if isinstance(variable, self.objectspace.family): + if family_mode and 'mode' not in vars(variable): + variable.mode = family_mode + continue + if isinstance(variable, self.objectspace.leadership): + func = self._set_default_mode_leader + else: + func = self._set_default_mode_variable + func(variable) - def _change_variabe_mode(self, - variable, - family_mode: str, - is_follower=False, - ) -> None: + @staticmethod + def _set_default_mode_variable(variable: 'self.objectspace.variable', + ) -> None: # auto_save or auto_freeze variable is set to 'basic' mode # if its mode is not defined by the user if 'mode' not in vars(variable) and \ @@ -158,6 +142,57 @@ class FamilyAnnotator(Walk): # mandatory variable without value is a basic variable if variable.mandatory is True and not hasattr(variable, 'default'): variable.mode = modes_level[0] + + def _set_default_mode_leader(self, + leadership, + ) -> None: + leader_mode = None + for follower in leadership.variable: + if follower.auto_save is True: + msg = _(f'leader/followers "{follower.name}" could not be auto_save') + raise DictConsistencyError(msg, 29, leadership.xmlfiles) + if follower.auto_freeze is True: + msg = f'leader/followers "{follower.name}" could not be auto_freeze' + raise DictConsistencyError(_(msg), 30, leadership.xmlfiles) + self._set_default_mode_variable(follower) + if leader_mode is None: + leader_mode = leadership.variable[0].mode + else: + # leader's mode is minimum level + if modes[leader_mode] > modes[follower.mode]: + follower.mode = leader_mode + leadership.mode = leader_mode + + def _change_family_mode(self, + family: 'self.objectspace.family', + ) -> None: + if hasattr(family, 'mode'): + family_mode = family.mode + else: + family_mode = modes_level[1] + min_variable_mode = modes_level[-1] + # change variable mode, but not if variables are not in a family + if hasattr(family, 'variable'): + for variable in family.variable.values(): + if not isinstance(variable, self.objectspace.family): + if isinstance(variable, self.objectspace.leadership): + func = self._change_variable_mode_leader + else: + func = self._change_variable_mode + func(variable, + family_mode, + ) + if modes[min_variable_mode] > modes[variable.mode]: + min_variable_mode = variable.mode + if hasattr(family, 'mode'): + # set the lower variable mode to family + family.mode = min_variable_mode + + def _change_variable_mode(self, + variable, + family_mode: str, + is_follower=False, + ) -> None: # none basic variable in high level family has to be in high level if modes[variable.mode] < modes[family_mode] and \ (not is_follower or variable.mode != modes_level[0]): @@ -168,27 +203,13 @@ class FamilyAnnotator(Walk): family_mode: str, ) -> None: is_follower = False - leader_mode = None for follower in leadership.variable: - if follower.auto_save is True: - msg = _(f'leader/followers "{follower.name}" could not be auto_save') - raise DictConsistencyError(msg, 29, leadership.xmlfiles) - if follower.auto_freeze is True: - msg = f'leader/followers "{follower.name}" could not be auto_freeze' - raise DictConsistencyError(_(msg), 30, leadership.xmlfiles) - self._change_variabe_mode(follower, + self._change_variable_mode(follower, family_mode, is_follower, ) - if leader_mode is None: - leader_mode = leadership.variable[0].mode - leadership.variable[0].mode = None - else: - # leader's mode is minimum level - if modes[leader_mode] > modes[follower.mode]: - follower.mode = leader_mode is_follower = True - leadership.mode = leader_mode + leadership.variable[0].mode = None def dynamic_families(self): """link dynamic families to object diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py index 84833c62..d6d13618 100644 --- a/src/rougail/annotator/group.py +++ b/src/rougail/annotator/group.py @@ -53,9 +53,14 @@ class GroupAnnotator: cache_paths[group.leader] = leader_fam_path follower_names = list(group.follower.keys()) leader = self.objectspace.paths.get_variable(group.leader) - ori_leader_family = self.objectspace.paths.get_family(leader_fam_path, - leader.namespace, - ) + if '.' not in leader_fam_path: + # it's a namespace + ori_leader_family = self.objectspace.space.variables[leader_fam_path] + else: + # it's a sub family + ori_leader_family = self.objectspace.paths.get_family(leader_fam_path, + leader.namespace, + ) has_a_leader = False for variable in list(ori_leader_family.variable.values()): if isinstance(variable, self.objectspace.leadership) and \ @@ -121,10 +126,7 @@ class GroupAnnotator: leadership_path, leader_space, ) - leader_family = self.objectspace.paths.get_family(ori_leader_family.path, - ori_leader_family.namespace, - ) - leader_family.variable[variable.name] = leader_space + ori_leader_family.variable[variable.name] = leader_space leader_space.variable.append(variable) self.objectspace.paths.set_leader(variable.namespace, ori_leader_family.path, diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index 0b684e84..9fa5404b 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -48,7 +48,7 @@ class ParamAnnotator: variable_type = self.valid_type_validation(obj) for param_idx, param in enumerate(obj.param): if hasattr(param, 'text'): - if param.type == 'suffix': + if param.type in ['suffix', 'index']: msg = _(f'"{param.type}" parameter must not have a value') raise DictConsistencyError(msg, 28, obj.xmlfiles) elif param.type == 'nil': @@ -81,9 +81,16 @@ class ParamAnnotator: if param.type == 'suffix': for target in obj.target: if not self.objectspace.paths.variable_is_dynamic(target.name.path): - msg = _(f'"suffix" parameter cannot be set with target "{target.name}"' + msg = _(f'"{param.type}" parameter cannot be set with target "{target.name}"' f' which is not a dynamic variable') raise DictConsistencyError(msg, 53, obj.xmlfiles) + elif param.type == 'index': + for target in obj.target: + if not self.objectspace.paths.is_follower(target.name.path): + msg = _(f'"{param.type}" parameter cannot be set with target "{target.name}"' + f' which is not a follower variable') + raise DictConsistencyError(msg, 60, obj.xmlfiles) + pass elif param.type == 'nil': param.text = None elif param.type == 'string': diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index ef773057..30de5621 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -72,7 +72,7 @@ - + @@ -125,7 +125,7 @@ - + diff --git a/src/rougail/path.py b/src/rougail/path.py index b2b45eb8..2055fba1 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -136,6 +136,15 @@ class Path: leadership = self.get_family(variable['leader'], variable['variableobj'].namespace) return leadership.variable[0].path == path + def is_follower(self, path): + """Is the variable is a follower + """ + variable = self._get_variable(path) + if not variable['leader']: + return False + leadership = self.get_family(variable['leader'], variable['variableobj'].namespace) + return leadership.variable[0].path != path + # Variable def add_variable(self, # pylint: disable=R0913 namespace: str, diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 295ab0f5..caa33c6e 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -253,6 +253,8 @@ class Common: return f'ParamInformation("{param.text}", None)' if param.type == 'suffix': return 'ParamSuffix()' + if param.type == 'index': + return 'ParamIndex()' raise Exception(f'unknown type {param.type}') # pragma: no cover @staticmethod diff --git a/tests/dictionaries/01fill_target_optional/00-base.xml b/tests/dictionaries/01fill_target_optional/00-base.xml new file mode 100644 index 00000000..476aa8ec --- /dev/null +++ b/tests/dictionaries/01fill_target_optional/00-base.xml @@ -0,0 +1,19 @@ + + + + + + non + + + + + + + mode_conteneur_actif1 + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/01fill_target_optional/__init__.py b/tests/dictionaries/01fill_target_optional/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/01fill_target_optional/makedict/base.json b/tests/dictionaries/01fill_target_optional/makedict/base.json new file mode 100644 index 00000000..aa4ad28e --- /dev/null +++ b/tests/dictionaries/01fill_target_optional/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif1": "non"} diff --git a/tests/dictionaries/01fill_target_optional/tiramisu/base.py b/tests/dictionaries/01fill_target_optional/tiramisu/base.py new file mode 100644 index 00000000..204d9cb6 --- /dev/null +++ b/tests/dictionaries/01fill_target_optional/tiramisu/base.py @@ -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_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_base_target_optional/00-base.xml b/tests/dictionaries/10check_base_target_optional/00-base.xml new file mode 100644 index 00000000..b065fc3d --- /dev/null +++ b/tests/dictionaries/10check_base_target_optional/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + + 0 + 100 + int + + + + diff --git a/tests/dictionaries/10check_base_target_optional/__init__.py b/tests/dictionaries/10check_base_target_optional/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10check_base_target_optional/makedict/base.json b/tests/dictionaries/10check_base_target_optional/makedict/base.json new file mode 100644 index 00000000..d3a9c907 --- /dev/null +++ b/tests/dictionaries/10check_base_target_optional/makedict/base.json @@ -0,0 +1 @@ +{"rougail.my_variable": null} diff --git a/tests/dictionaries/10check_base_target_optional/tiramisu/base.py b/tests/dictionaries/10check_base_target_optional/tiramisu/base.py new file mode 100644 index 00000000..0da19d84 --- /dev/null +++ b/tests/dictionaries/10check_base_target_optional/tiramisu/base.py @@ -0,0 +1,16 @@ +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="my_variable", doc="my_variable", properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10leadership_auto_index/00-base.xml b/tests/dictionaries/10leadership_auto_index/00-base.xml new file mode 100644 index 00000000..ed6d0676 --- /dev/null +++ b/tests/dictionaries/10leadership_auto_index/00-base.xml @@ -0,0 +1,21 @@ + + + + + a + b + c + + + + + + + + follower1 + + + follower1 + + + diff --git a/tests/dictionaries/10leadership_auto_index/__init__.py b/tests/dictionaries/10leadership_auto_index/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10leadership_auto_index/makedict/base.json b/tests/dictionaries/10leadership_auto_index/makedict/base.json new file mode 100644 index 00000000..010ea979 --- /dev/null +++ b/tests/dictionaries/10leadership_auto_index/makedict/base.json @@ -0,0 +1 @@ +{"rougail.leader.leader": [{"rougail.leader.leader": "a", "rougail.leader.follower1": 0}, {"rougail.leader.leader": "b", "rougail.leader.follower1": 1}, {"rougail.leader.leader": "c", "rougail.leader.follower1": 2}]} diff --git a/tests/dictionaries/10leadership_auto_index/tiramisu/base.py b/tests/dictionaries/10leadership_auto_index/tiramisu/base.py new file mode 100644 index 00000000..24c130f3 --- /dev/null +++ b/tests/dictionaries/10leadership_auto_index/tiramisu/base.py @@ -0,0 +1,18 @@ +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="leader", doc="leader", multi=True, default=['a', 'b', 'c'], properties=frozenset({"mandatory"})) +option_4 = IntOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((ParamIndex()))), properties=frozenset({"normal"})) +option_2 = Leadership(name="leader", doc="leader", 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]) diff --git a/tests/dictionaries/45multi_family_expert/00-base.xml b/tests/dictionaries/45multi_family_expert/00-base.xml new file mode 100644 index 00000000..d79e58e4 --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/45multi_family_expert/__init__.py b/tests/dictionaries/45multi_family_expert/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/45multi_family_expert/makedict/base.json b/tests/dictionaries/45multi_family_expert/makedict/base.json new file mode 100644 index 00000000..536366a7 --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/makedict/base.json @@ -0,0 +1 @@ +{"rougail.base.subfamily.variable": null} diff --git a/tests/dictionaries/45multi_family_expert/tiramisu/base.py b/tests/dictionaries/45multi_family_expert/tiramisu/base.py new file mode 100644 index 00000000..94d393d7 --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/tiramisu/base.py @@ -0,0 +1,18 @@ +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_4 = StrOption(name="variable", doc="variable", properties=frozenset({"expert"})) +option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"expert"})) +option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/eosfunc/test.py b/tests/eosfunc/test.py index ec3de625..13bd0452 100644 --- a/tests/eosfunc/test.py +++ b/tests/eosfunc/test.py @@ -60,3 +60,7 @@ def device_type(*args, **kwargs): def calc_list(*args, **kwargs): return list(args) + + +def test_index(index): + return index From 2e16bc2b903b760e4aa2d115057fc6d9a76157c2 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 18 Feb 2021 14:02:07 +0100 Subject: [PATCH 123/168] update mode --- src/rougail/annotator/family.py | 73 +++++++++++++------ .../01fill_mandatory/tiramisu/base.py | 4 +- .../tiramisu/base.py | 2 +- .../00-base.xml | 16 ++-- .../00-base.xml | 26 +++---- .../20family_modeleadership/tiramisu/base.py | 6 +- .../45multi_family_basic/00-base.xml | 12 +++ .../45multi_family_basic/__init__.py | 0 .../45multi_family_basic/makedict/base.json | 1 + .../45multi_family_basic/tiramisu/base.py | 18 +++++ .../dictionaries/80mode_conflict/00-base.xml | 12 +++ .../dictionaries/80mode_conflict/__init__.py | 0 tests/dictionaries/80mode_conflict/errno_62 | 0 .../80mode_leadership_conflict/00-base.xml | 26 +++++++ .../80mode_leadership_conflict/__init__.py | 0 .../80mode_leadership_conflict/errno_63 | 0 .../80multi_family_mode_conflict/00-base.xml | 12 +++ .../80multi_family_mode_conflict/__init__.py | 0 .../80multi_family_mode_conflict/errno_61 | 0 19 files changed, 160 insertions(+), 48 deletions(-) create mode 100644 tests/dictionaries/45multi_family_basic/00-base.xml create mode 100644 tests/dictionaries/45multi_family_basic/__init__.py create mode 100644 tests/dictionaries/45multi_family_basic/makedict/base.json create mode 100644 tests/dictionaries/45multi_family_basic/tiramisu/base.py create mode 100644 tests/dictionaries/80mode_conflict/00-base.xml create mode 100644 tests/dictionaries/80mode_conflict/__init__.py create mode 100644 tests/dictionaries/80mode_conflict/errno_62 create mode 100644 tests/dictionaries/80mode_leadership_conflict/00-base.xml create mode 100644 tests/dictionaries/80mode_leadership_conflict/__init__.py create mode 100644 tests/dictionaries/80mode_leadership_conflict/errno_63 create mode 100644 tests/dictionaries/80multi_family_mode_conflict/00-base.xml create mode 100644 tests/dictionaries/80multi_family_mode_conflict/__init__.py create mode 100644 tests/dictionaries/80multi_family_mode_conflict/errno_61 diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 6ba7a456..adfbc26f 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -122,29 +122,44 @@ class FamilyAnnotator(Walk): return for variable in family.variable.values(): if isinstance(variable, self.objectspace.family): - if family_mode and 'mode' not in vars(variable): - variable.mode = family_mode + if family_mode and not self._has_mode(variable): + self._set_auto_mode(variable, family_mode) continue if isinstance(variable, self.objectspace.leadership): func = self._set_default_mode_leader else: func = self._set_default_mode_variable - func(variable) + func(variable, family_mode) @staticmethod - def _set_default_mode_variable(variable: 'self.objectspace.variable', - ) -> None: + def _has_mode(obj) -> bool: + return 'mode' in vars(obj) and not hasattr(obj, 'mode_auto') + + def _set_default_mode_variable(self, + variable: 'self.objectspace.variable', + family_mode: str, + ) -> None: # auto_save or auto_freeze variable is set to 'basic' mode # if its mode is not defined by the user - if 'mode' not in vars(variable) and \ + if not self._has_mode(variable) and \ (variable.auto_save is True or variable.auto_freeze is True): - variable.mode = modes_level[0] + self._set_auto_mode(variable, modes_level[0]) # mandatory variable without value is a basic variable - if variable.mandatory is True and not hasattr(variable, 'default'): - variable.mode = modes_level[0] + elif variable.mandatory is True and \ + not hasattr(variable, 'default') and \ + not hasattr(variable, 'default_multi'): + self._set_auto_mode(variable, modes_level[0]) + elif family_mode and not self._has_mode(variable): + self._set_auto_mode(variable, family_mode) + + @staticmethod + def _set_auto_mode(obj, mode: str) -> None: + obj.mode = mode + obj.mode_auto = True def _set_default_mode_leader(self, - leadership, + leadership: 'self.objectspace.leadership', + family_mode: str, ) -> None: leader_mode = None for follower in leadership.variable: @@ -154,14 +169,23 @@ class FamilyAnnotator(Walk): if follower.auto_freeze is True: msg = f'leader/followers "{follower.name}" could not be auto_freeze' raise DictConsistencyError(_(msg), 30, leadership.xmlfiles) - self._set_default_mode_variable(follower) - if leader_mode is None: - leader_mode = leadership.variable[0].mode - else: + if leader_mode is not None: # leader's mode is minimum level if modes[leader_mode] > modes[follower.mode]: - follower.mode = leader_mode - leadership.mode = leader_mode + if self._has_mode(follower) and not self._has_mode(leadership.variable[0]): + self._set_auto_mode(leadership.variable[0], follower.mode) + else: + if self._has_mode(follower): + msg = _(f'the follower "{follower.name}" is in "{follower.mode}" mode ' + f'but leader have the higher mode "{leader_mode}"') + raise DictConsistencyError(msg, 63, follower.xmlfiles) + self._set_auto_mode(follower, leader_mode) + self._set_default_mode_variable(follower, + family_mode, + ) + if leader_mode is None: + leader_mode = leadership.variable[0].mode + self._set_auto_mode(leadership, leadership.variable[0].mode) def _change_family_mode(self, family: 'self.objectspace.family', @@ -184,9 +208,13 @@ class FamilyAnnotator(Walk): ) if modes[min_variable_mode] > modes[variable.mode]: min_variable_mode = variable.mode - if hasattr(family, 'mode'): + if hasattr(family, 'mode') and family.mode != min_variable_mode: # set the lower variable mode to family - family.mode = min_variable_mode + if self._has_mode(family): + msg = _(f'the family "{family.name}" is in "{family.mode}" mode but variables and ' + f'families inside have the higher modes "{min_variable_mode}"') + raise DictConsistencyError(msg, 62, variable.xmlfiles) + self._set_auto_mode(family, min_variable_mode) def _change_variable_mode(self, variable, @@ -194,9 +222,12 @@ class FamilyAnnotator(Walk): is_follower=False, ) -> None: # none basic variable in high level family has to be in high level - if modes[variable.mode] < modes[family_mode] and \ - (not is_follower or variable.mode != modes_level[0]): - variable.mode = family_mode + if modes[variable.mode] < modes[family_mode]: + if self._has_mode(variable): + msg = _(f'the variable "{variable.name}" is in "{variable.mode}" mode ' + f'but family has the higher family mode "{family_mode}"') + raise DictConsistencyError(msg, 61, variable.xmlfiles) + self._set_auto_mode(variable, family_mode) def _change_variable_mode_leader(self, leadership, diff --git a/tests/dictionaries/01fill_mandatory/tiramisu/base.py b/tests/dictionaries/01fill_mandatory/tiramisu/base.py index 23d2d55e..d8abb72b 100644 --- a/tests/dictionaries/01fill_mandatory/tiramisu/base.py +++ b/tests/dictionaries/01fill_mandatory/tiramisu/base.py @@ -11,8 +11,8 @@ try: from tiramisu3 import * except: from tiramisu import * -option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"basic", "mandatory"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"expert", "mandatory"})) -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({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py b/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py index 7ab3f6e5..f7ddf727 100644 --- a/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py +++ b/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_5 = NetmaskOption(name="nut_monitor_netmask", doc="Masque de l'IP du réseau de l'esclave", multi=True) -option_6 = NetworkOption(name="nut_monitor_host", doc="Adresse IP du réseau de l'esclave", multi=True, properties=frozenset({"mandatory", "normal"})) +option_6 = NetworkOption(name="nut_monitor_host", doc="Adresse IP du réseau de l'esclave", multi=True, properties=frozenset({"basic", "mandatory"})) option_4 = Leadership(name="nut_monitor_netmask", doc="Masque de l'IP du réseau de l'esclave", children=[option_5, option_6], 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]) diff --git a/tests/dictionaries/10load_leadership_default_multi/00-base.xml b/tests/dictionaries/10load_leadership_default_multi/00-base.xml index 50298362..dc7f6d35 100644 --- a/tests/dictionaries/10load_leadership_default_multi/00-base.xml +++ b/tests/dictionaries/10load_leadership_default_multi/00-base.xml @@ -2,14 +2,14 @@ - - non - - - - value - - + + non + + + + value + + diff --git a/tests/dictionaries/10load_leadership_default_submulti/00-base.xml b/tests/dictionaries/10load_leadership_default_submulti/00-base.xml index d1cf8272..89c74adf 100644 --- a/tests/dictionaries/10load_leadership_default_submulti/00-base.xml +++ b/tests/dictionaries/10load_leadership_default_submulti/00-base.xml @@ -2,19 +2,19 @@ - - non - - - leader - - - value - - - value1 - value2 - + + non + + + leader + + + value + + + value1 + value2 + diff --git a/tests/dictionaries/20family_modeleadership/tiramisu/base.py b/tests/dictionaries/20family_modeleadership/tiramisu/base.py index c44c4518..28e3a12f 100644 --- a/tests/dictionaries/20family_modeleadership/tiramisu/base.py +++ b/tests/dictionaries/20family_modeleadership/tiramisu/base.py @@ -14,8 +14,8 @@ except: 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, properties=frozenset({"normal"})) -option_7 = StrOption(name="follower2", doc="follower2", multi=True, 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="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_7 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"basic"})) +option_4 = Leadership(name="leader", doc="leader", children=[option_5, option_6, option_7], properties=frozenset({"basic"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45multi_family_basic/00-base.xml b/tests/dictionaries/45multi_family_basic/00-base.xml new file mode 100644 index 00000000..e62828fd --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/45multi_family_basic/__init__.py b/tests/dictionaries/45multi_family_basic/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/45multi_family_basic/makedict/base.json b/tests/dictionaries/45multi_family_basic/makedict/base.json new file mode 100644 index 00000000..536366a7 --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/makedict/base.json @@ -0,0 +1 @@ +{"rougail.base.subfamily.variable": null} diff --git a/tests/dictionaries/45multi_family_basic/tiramisu/base.py b/tests/dictionaries/45multi_family_basic/tiramisu/base.py new file mode 100644 index 00000000..3f1787a3 --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/tiramisu/base.py @@ -0,0 +1,18 @@ +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_4 = StrOption(name="variable", doc="variable", properties=frozenset({"basic"})) +option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"basic"})) +option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/80mode_conflict/00-base.xml b/tests/dictionaries/80mode_conflict/00-base.xml new file mode 100644 index 00000000..6b666c60 --- /dev/null +++ b/tests/dictionaries/80mode_conflict/00-base.xml @@ -0,0 +1,12 @@ + + + + + + non + + + + + diff --git a/tests/dictionaries/80mode_conflict/__init__.py b/tests/dictionaries/80mode_conflict/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80mode_conflict/errno_62 b/tests/dictionaries/80mode_conflict/errno_62 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80mode_leadership_conflict/00-base.xml b/tests/dictionaries/80mode_leadership_conflict/00-base.xml new file mode 100644 index 00000000..c8e748e8 --- /dev/null +++ b/tests/dictionaries/80mode_leadership_conflict/00-base.xml @@ -0,0 +1,26 @@ + + + + + + non + + + + + + + + + + + + valfill + leader + + + follower1 + follower2 + + + diff --git a/tests/dictionaries/80mode_leadership_conflict/__init__.py b/tests/dictionaries/80mode_leadership_conflict/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80mode_leadership_conflict/errno_63 b/tests/dictionaries/80mode_leadership_conflict/errno_63 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80multi_family_mode_conflict/00-base.xml b/tests/dictionaries/80multi_family_mode_conflict/00-base.xml new file mode 100644 index 00000000..f738fd48 --- /dev/null +++ b/tests/dictionaries/80multi_family_mode_conflict/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/80multi_family_mode_conflict/__init__.py b/tests/dictionaries/80multi_family_mode_conflict/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80multi_family_mode_conflict/errno_61 b/tests/dictionaries/80multi_family_mode_conflict/errno_61 new file mode 100644 index 00000000..e69de29b From 88f5b20aa90d501088afe24feb59804c6faf6e58 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 18 Feb 2021 14:08:57 +0100 Subject: [PATCH 124/168] test index param --- src/rougail/annotator/param.py | 2 +- .../dictionaries/80no_leadership_index/00-base.xml | 13 +++++++++++++ .../dictionaries/80no_leadership_index/__init__.py | 0 tests/dictionaries/80no_leadership_index/errno_60 | 0 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/dictionaries/80no_leadership_index/00-base.xml create mode 100644 tests/dictionaries/80no_leadership_index/__init__.py create mode 100644 tests/dictionaries/80no_leadership_index/errno_60 diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index 9fa5404b..adc82747 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -87,7 +87,7 @@ class ParamAnnotator: elif param.type == 'index': for target in obj.target: if not self.objectspace.paths.is_follower(target.name.path): - msg = _(f'"{param.type}" parameter cannot be set with target "{target.name}"' + msg = _(f'"{param.type}" parameter cannot be set with target "{target.name.name}"' f' which is not a follower variable') raise DictConsistencyError(msg, 60, obj.xmlfiles) pass diff --git a/tests/dictionaries/80no_leadership_index/00-base.xml b/tests/dictionaries/80no_leadership_index/00-base.xml new file mode 100644 index 00000000..dcfb3023 --- /dev/null +++ b/tests/dictionaries/80no_leadership_index/00-base.xml @@ -0,0 +1,13 @@ + + + + + + + + + + my_variable + + + diff --git a/tests/dictionaries/80no_leadership_index/__init__.py b/tests/dictionaries/80no_leadership_index/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80no_leadership_index/errno_60 b/tests/dictionaries/80no_leadership_index/errno_60 new file mode 100644 index 00000000..e69de29b From 493aeff04e2cf345d9b857a0620b29ce6f2d5238 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 18 Feb 2021 17:00:12 +0100 Subject: [PATCH 125/168] pylint --- src/rougail/annotator/condition.py | 8 ++-- src/rougail/annotator/family.py | 2 +- src/rougail/annotator/param.py | 38 ++++++++++++------- src/rougail/annotator/property.py | 4 +- src/rougail/annotator/service.py | 4 +- src/rougail/annotator/target.py | 8 +++- src/rougail/annotator/value.py | 5 +-- src/rougail/annotator/variable.py | 5 ++- src/rougail/convert.py | 4 +- src/rougail/path.py | 6 ++- src/rougail/template.py | 7 ++-- src/rougail/tiramisureflector.py | 7 ++-- .../10valid_enum_none/00-base.xml | 1 + .../10valid_enum_none/tiramisu/base.py | 2 +- 14 files changed, 62 insertions(+), 39 deletions(-) diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 09fce084..4c7ba92c 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -24,7 +24,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -from typing import List, Any +from typing import List from ..i18n import _ @@ -115,7 +115,8 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): continue remove_conditions.append(idx) if (hasattr(condition, 'apply_on_fallback') and condition.apply_on_fallback) or \ - (not hasattr(condition, 'apply_on_fallback') and condition.name.endswith('_if_in')): + (not hasattr(condition, 'apply_on_fallback') and \ + condition.name.endswith('_if_in')): self.force_actions_to_variable(condition) remove_conditions.sort(reverse=True) for idx in remove_conditions: @@ -242,9 +243,6 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): for param in condition.param: if param_type is None or param_type == 'nil': param_type = param.type - if param_type != param.type: - msg = _(f'param with type "{target.type}" has multi param types') - raise DictConsistencyError(msg, 59, condition.xmlfiles) param3 = self.objectspace.param(target.xmlfiles) param3.name = f'condition_{fill.index}' param3.type = 'variable' diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index adfbc26f..856d7a1e 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -213,7 +213,7 @@ class FamilyAnnotator(Walk): if self._has_mode(family): msg = _(f'the family "{family.name}" is in "{family.mode}" mode but variables and ' f'families inside have the higher modes "{min_variable_mode}"') - raise DictConsistencyError(msg, 62, variable.xmlfiles) + raise DictConsistencyError(msg, 62, family.xmlfiles) self._set_auto_mode(family, min_variable_mode) def _change_variable_mode(self, diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index adc82747..b1b71c38 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -33,9 +33,14 @@ from ..error import DictConsistencyError class ParamAnnotator: - def valid_type_validation(self, - obj, - ) -> None: + """Param annotator + """ + objectspace = None + + @staticmethod + def valid_type_validation(obj) -> None: + """Function to valid type (redefine in fill/condition/check classes) + """ return None def convert_param(self, objects) -> None: @@ -51,7 +56,7 @@ class ParamAnnotator: if param.type in ['suffix', 'index']: msg = _(f'"{param.type}" parameter must not have a value') raise DictConsistencyError(msg, 28, obj.xmlfiles) - elif param.type == 'nil': + if param.type == 'nil': if param.text is not None: msg = _(f'"{param.type}" parameter must not have a value') raise DictConsistencyError(msg, 40, obj.xmlfiles) @@ -62,13 +67,15 @@ class ParamAnnotator: ) param.text = self.objectspace.paths.get_variable(path) if variable_type and param.text.type != variable_type: - msg = _(f'"{obj.name}" has type "{variable_type}" but param has type "{param.text.type}"') + msg = _(f'"{obj.name}" has type "{variable_type}" but param ' + f'has type "{param.text.type}"') raise DictConsistencyError(msg, 26, param.xmlfiles) if suffix: param.suffix = suffix family_path = self.objectspace.paths.get_variable_family_path(path) + namespace = param.text.namespace param.family = self.objectspace.paths.get_family(family_path, - param.text.namespace, + namespace, ) except DictConsistencyError as err: if err.errno != 42 or not param.optional: @@ -81,16 +88,15 @@ class ParamAnnotator: if param.type == 'suffix': for target in obj.target: if not self.objectspace.paths.variable_is_dynamic(target.name.path): - msg = _(f'"{param.type}" parameter cannot be set with target "{target.name}"' - f' which is not a dynamic variable') + msg = _(f'"{param.type}" parameter cannot be set with target ' + f'"{target.name}" which is not a dynamic variable') raise DictConsistencyError(msg, 53, obj.xmlfiles) elif param.type == 'index': for target in obj.target: if not self.objectspace.paths.is_follower(target.name.path): - msg = _(f'"{param.type}" parameter cannot be set with target "{target.name.name}"' - f' which is not a follower variable') + msg = _(f'"{param.type}" parameter cannot be set with target ' + f'"{target.name.name}" which is not a follower variable') raise DictConsistencyError(msg, 60, obj.xmlfiles) - pass elif param.type == 'nil': param.text = None elif param.type == 'string': @@ -104,8 +110,8 @@ class ParamAnnotator: for param_idx in param_to_delete: obj.param.pop(param_idx) - def _convert_with_variable_type(self, - variable_type: str, + @staticmethod + def _convert_with_variable_type(variable_type: str, param: 'self.objectspace.param', ) -> None: if 'type' in vars(param) and variable_type != param.type: @@ -115,7 +121,11 @@ class ParamAnnotator: try: option = CONVERT_OPTION[variable_type] param.text = option.get('func', str)(param.text) - getattr(tiramisu, option['opttype'])('test', 'Object to valid value', param.text, **option.get('initkwargs', {})) + getattr(tiramisu, option['opttype'])('test', + 'Object to valid value', + param.text, + **option.get('initkwargs', {}), + ) except ValueError as err: msg = _(f'unable to change type of value "{param.text}" ' f'is not a valid "{variable_type}"') diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py index 8c6ede7f..848320ba 100644 --- a/src/rougail/annotator/property.py +++ b/src/rougail/annotator/property.py @@ -95,12 +95,14 @@ class PropertyAnnotator(Walk): self.convert_property(variable) def convert_family(self) -> None: - """convert variables + """convert families """ for family in self.get_families(): self.convert_property(family) def convert_variable(self) -> None: + """convert variables + """ for variable in self.get_variables(with_leadership=True): if isinstance(variable, self.objectspace.leadership): for follower in variable.variable: diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index 04ec6107..5edce2d6 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -234,8 +234,8 @@ class ServiceAnnotator: service_name, ) - def _update_file(self, - file_, + @staticmethod + def _update_file(file_, service_name, ): if not hasattr(file_, 'file_type') or file_.file_type == "filename": diff --git a/src/rougail/annotator/target.py b/src/rougail/annotator/target.py index e75a19d0..b3ed69dc 100644 --- a/src/rougail/annotator/target.py +++ b/src/rougail/annotator/target.py @@ -29,6 +29,8 @@ from ..error import DictConsistencyError class TargetAnnotator: + """Target annotator + """ def convert_target(self, objects, ) -> None: @@ -62,7 +64,11 @@ class TargetAnnotator: f'is not allowed') raise DictConsistencyError(msg, 8, obj.xmlfiles) if target.type == 'family': - if obj.name not in ['disabled_if_in', 'disabled_if_not_in', "hidden_if_in", "hidden_if_not_in"]: + if obj.name not in ['disabled_if_in', + 'disabled_if_not_in', + 'hidden_if_in', + 'hidden_if_not_in', + ]: msg = _(f'target "{target.type}" not allow with "{obj.name}"') raise DictConsistencyError(msg, 51, target.xmlfiles) target.name = self.objectspace.paths.get_family(target.name, diff --git a/src/rougail/annotator/value.py b/src/rougail/annotator/value.py index 7b6148eb..3519508e 100644 --- a/src/rougail/annotator/value.py +++ b/src/rougail/annotator/value.py @@ -61,9 +61,8 @@ class ValueAnnotator(Walk): # pylint: disable=R0903 new_value.name = True new_value.type = 'boolean' variable.value = [new_value] - """if the variable is mandatory and doesn't have any value - then the variable's mode is set to 'basic' - """ + # if the variable is mandatory and doesn't have any value + # then the variable's mode is set to 'basic' # variable with default value is mandatory if hasattr(variable, 'value') and variable.value: has_value = True diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index db432fda..46ffabe5 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -70,6 +70,8 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'], class Walk: """Walk to objectspace to find variable or family """ + objectspace = None + def get_variables(self, with_leadership: bool=False, ): @@ -148,7 +150,8 @@ class VariableAnnotator(Walk): # pylint: disable=R0903 ) -> None: if variable.namespace == self.objectspace.rougailconfig['variable_namespace'] and \ variable.name in self.forbidden_name: - msg = _(f'the name of the variable "{variable.name}" cannot be the same as the name of a namespace') + msg = _(f'the name of the variable "{variable.name}" cannot be the same as the name' + ' of a namespace') raise DictConsistencyError(msg, 54, variable.xmlfiles) if variable.type != 'symlink' and not hasattr(variable, 'description'): variable.description = variable.name diff --git a/src/rougail/convert.py b/src/rougail/convert.py index ad4f0b0d..2e746a6b 100644 --- a/src/rougail/convert.py +++ b/src/rougail/convert.py @@ -89,8 +89,8 @@ class RougailConvert: functions_file, ).get_text() + '\n' - def _load_dictionaries(self, - xmlreflector: XMLReflector, + @staticmethod + def _load_dictionaries(xmlreflector: XMLReflector, rougailobjspace: RougailObjSpace, namespace: str, xmlfolders: List[str], diff --git a/src/rougail/path.py b/src/rougail/path.py index 2055fba1..f18d055d 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -56,7 +56,8 @@ class Path: if namespace == self.variable_namespace: full_name = '.'.join([subpath, name]) if name in self.full_paths_families: - raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 55, variableobj.xmlfiles) + msg = _(f'Duplicate family name "{name}"') + raise DictConsistencyError(msg, 55, variableobj.xmlfiles) self.full_paths_families[name] = full_name else: if '.' not in name: # pragma: no cover @@ -65,7 +66,8 @@ class Path: full_name = name if full_name in self.families and \ self.families[full_name]['variableobj'] != variableobj: # pragma: no cover - raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 37, variableobj.xmlfiles) + msg = _(f'Duplicate family name "{name}"') + raise DictConsistencyError(msg, 37, variableobj.xmlfiles) if full_name in self.variables: msg = _(f'A variable and a family has the same path "{full_name}"') raise DictConsistencyError(msg, 56, variableobj.xmlfiles) diff --git a/src/rougail/template.py b/src/rougail/template.py index 2cf63dcb..551b0489 100644 --- a/src/rougail/template.py +++ b/src/rougail/template.py @@ -347,9 +347,9 @@ class RougailTemplate: chdir(self.templates_dir) for option in await self.config.option.list(type='all'): namespace = await option.option.name() - is_variable_namespace = namespace == self.rougailconfig['variable_namespace'] + is_var_namespace = namespace == self.rougailconfig['variable_namespace'] self.rougail_variables_dict[namespace] = await self.load_variables(option, - is_variable_namespace, + is_var_namespace, ) for template in listdir('.'): self.prepare_template(template) @@ -396,6 +396,7 @@ class RougailTemplate: variables[await option.option.name()] = subfamilies else: if is_variable_namespace: - self.rougail_variables_dict[await option.option.name()] = await option.value.get() + value = await option.value.get() + self.rougail_variables_dict[await option.option.name()] = value variables[await option.option.name()] = await option.value.get() return RougailExtra(variables) diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index caa33c6e..3fff6b2a 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -72,7 +72,7 @@ class TiramisuReflector: ]) self.objectspace = objectspace self.make_tiramisu_objects() - if self.objectspace.has_dyn_option == True: + if self.objectspace.has_dyn_option is True: self.text.append("from rougail.tiramisu import ConvertDynOptionDescription") def make_tiramisu_objects(self) -> None: @@ -95,8 +95,9 @@ class TiramisuReflector: because `extra` family could use `variable_namespace` variables. """ if hasattr(self.objectspace.space, 'variables'): - if self.objectspace.rougailconfig['variable_namespace'] in self.objectspace.space.variables: - yield self.objectspace.space.variables[self.objectspace.rougailconfig['variable_namespace']] + variable_namespace = self.objectspace.rougailconfig['variable_namespace'] + if variable_namespace in self.objectspace.space.variables: + yield self.objectspace.space.variables[variable_namespace] for elt, value in self.objectspace.space.variables.items(): if elt != self.objectspace.rougailconfig['variable_namespace']: yield value diff --git a/tests/dictionaries/10valid_enum_none/00-base.xml b/tests/dictionaries/10valid_enum_none/00-base.xml index 1e9d5272..85aeb34a 100644 --- a/tests/dictionaries/10valid_enum_none/00-base.xml +++ b/tests/dictionaries/10valid_enum_none/00-base.xml @@ -18,6 +18,7 @@ a b + enumvar diff --git a/tests/dictionaries/10valid_enum_none/tiramisu/base.py b/tests/dictionaries/10valid_enum_none/tiramisu/base.py index 5c1623cc..6fcb84e5 100644 --- a/tests/dictionaries/10valid_enum_none/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_none/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) -option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', None), default="b", properties=frozenset({"expert", "mandatory"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', None, ''), default="b", properties=frozenset({"expert", "mandatory"})) option_5.impl_set_information('help', "bla bla bla") option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) From 0ccd3405dbc7e977d3a63fd5111f6a037fe9b159 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 18 Feb 2021 18:57:50 +0100 Subject: [PATCH 126/168] add 'version' to rougail attribut --- src/rougail/data/rougail.dtd | 1 + tests/dictionaries/00empty/00_base.xml | 2 +- tests/dictionaries/00load_autofreeze/00-base.xml | 2 +- tests/dictionaries/00load_autofreezeexpert/00-base.xml | 2 +- tests/dictionaries/00load_autosave/00-base.xml | 2 +- tests/dictionaries/00load_autosaveexpert/00-base.xml | 2 +- tests/dictionaries/00load_comment/00-base.xml | 2 +- tests/dictionaries/00load_notype/00-base.xml | 2 +- tests/dictionaries/00load_save/00-base.xml | 2 +- tests/dictionaries/00load_subfolder/99-base.xml | 2 +- tests/dictionaries/00load_subfolder/subfolder/00-base.xml | 2 +- tests/dictionaries/01auto_autofreeze/00-base.xml | 2 +- tests/dictionaries/01auto_base/00-base.xml | 2 +- tests/dictionaries/01auto_withoutparam/00-base.xml | 2 +- tests/dictionaries/01base_domainname/00-base.xml | 2 +- tests/dictionaries/01base_file/00-base.xml | 2 +- tests/dictionaries/01base_file_include/00-base.xml | 2 +- tests/dictionaries/01base_file_patch/00-base.xml | 2 +- tests/dictionaries/01base_file_utfchar/00-base.xml | 2 +- tests/dictionaries/01base_float/00-base.xml | 2 +- tests/dictionaries/01base_help_quote/00-base.xml | 2 +- tests/dictionaries/01base_multi/00-base.xml | 2 +- tests/dictionaries/01base_value_doublequote/00-base.xml | 2 +- tests/dictionaries/01base_value_doublequote2/00-base.xml | 2 +- tests/dictionaries/01base_value_doublequote3/00-base.xml | 2 +- tests/dictionaries/01base_value_multi_doublequote/00-base.xml | 2 +- tests/dictionaries/01base_value_multi_doublequote2/00-base.xml | 2 +- tests/dictionaries/01base_value_multi_quote/00-base.xml | 2 +- tests/dictionaries/01base_value_quote/00-base.xml | 2 +- tests/dictionaries/01base_var_name_same_family/00-base.xml | 2 +- tests/dictionaries/01family_description/00-base.xml | 2 +- tests/dictionaries/01fill_autofreeze/00-base.xml | 2 +- tests/dictionaries/01fill_autosave/00-base.xml | 2 +- tests/dictionaries/01fill_base/00-base.xml | 2 +- tests/dictionaries/01fill_baseaccent/00-base.xml | 2 +- tests/dictionaries/01fill_mandatory/00-base.xml | 2 +- tests/dictionaries/01fill_number/00-base.xml | 2 +- tests/dictionaries/01fill_only_optional/00-base.xml | 2 +- tests/dictionaries/01fill_optional/00-base.xml | 2 +- tests/dictionaries/01fill_quote/00-base.xml | 2 +- tests/dictionaries/01fill_target_optional/00-base.xml | 2 +- tests/dictionaries/01hidden_if_in_autofreeze/00-base.xml | 2 +- tests/dictionaries/01test/00-base.xml | 2 +- tests/dictionaries/01test_multi/00-base.xml | 2 +- tests/dictionaries/01test_multi_none/00-base.xml | 2 +- tests/dictionaries/01test_redefine/00-base.xml | 2 +- tests/dictionaries/01test_redefine/10-base.xml | 2 +- tests/dictionaries/01test_redefine_base/00-base.xml | 2 +- tests/dictionaries/01test_redefine_base/10-base.xml | 2 +- tests/dictionaries/01test_redefine_remove/00-base.xml | 2 +- tests/dictionaries/01test_redefine_remove/10-base.xml | 2 +- tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml | 2 +- tests/dictionaries/10autosave_hidden/00-base.xml | 2 +- tests/dictionaries/10check_base/00-base.xml | 2 +- tests/dictionaries/10check_base_target_optional/00-base.xml | 2 +- tests/dictionaries/10check_no_param/00-base.xml | 2 +- tests/dictionaries/10check_option/00-base.xml | 2 +- tests/dictionaries/10check_optional/00-base.xml | 2 +- tests/dictionaries/10check_valid_differ/00-base.xml | 2 +- tests/dictionaries/10check_valid_differ_add/00-base.xml | 2 +- tests/dictionaries/10check_valid_differ_add/01-base.xml | 2 +- tests/dictionaries/10check_valid_differ_removecheck/00-base.xml | 2 +- tests/dictionaries/10check_valid_differ_removecheck/01-base.xml | 2 +- tests/dictionaries/10check_valid_in_network/00-base.xml | 2 +- tests/dictionaries/10check_valid_in_network_cidr/00-base.xml | 2 +- tests/dictionaries/10check_valid_ipnetmask/00-base.xml | 2 +- tests/dictionaries/10fill_information/00-base.xml | 2 +- .../10frozenifin_unknown_valid_enum_number/00-base.xml | 2 +- tests/dictionaries/10leadership_append/00-base.xml | 2 +- tests/dictionaries/10leadership_append/01-base.xml | 2 +- tests/dictionaries/10leadership_append_hidden/00-base.xml | 2 +- tests/dictionaries/10leadership_append_hidden/01-base.xml | 2 +- tests/dictionaries/10leadership_append_name/00-base.xml | 2 +- tests/dictionaries/10leadership_append_name/01-base.xml | 2 +- tests/dictionaries/10leadership_auto/00-base.xml | 2 +- tests/dictionaries/10leadership_auto_index/00-base.xml | 2 +- tests/dictionaries/10leadership_autoleader/00-base.xml | 2 +- tests/dictionaries/10leadership_autoleader_expert/00-base.xml | 2 +- tests/dictionaries/10leadership_autosaveexpert/00-base.xml | 2 +- tests/dictionaries/10leadership_familyaccent/00-base.xml | 2 +- tests/dictionaries/10leadership_leader_hidden/00-base.xml | 2 +- tests/dictionaries/10leadership_leader_hidden_if_in/00-base.xml | 2 +- .../10leadership_leader_hidden_if_in_name/00-base.xml | 2 +- tests/dictionaries/10leadership_leadermandatory/00-base.xml | 2 +- tests/dictionaries/10leadership_mandatory/00-base.xml | 2 +- tests/dictionaries/10leadership_mandatoryfollower/00-base.xml | 2 +- tests/dictionaries/10leadership_multi/00-base.xml | 2 +- tests/dictionaries/10load_disabled_if_in/00-base.xml | 2 +- tests/dictionaries/10load_disabled_if_in_fill/00-base.xml | 2 +- .../10load_disabled_if_in_list_optional/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_in_multi_param/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_in_multi_param2/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_in_multi_param3/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_in_multi_param4/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_in_multi_param5/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_in_multi_param6/00-base.xml | 2 +- .../10load_disabled_if_in_multi_param_disabled/00-base.xml | 2 +- tests/dictionaries/10load_disabled_if_in_none/00-base.xml | 2 +- tests/dictionaries/10load_disabled_if_in_variable/00-base.xml | 2 +- tests/dictionaries/10load_disabled_if_in_variable2/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_inaccent_family/00-base.xml | 2 +- .../dictionaries/10load_disabled_if_not_in_fallback/00-base.xml | 2 +- .../10load_disabled_if_not_in_fallback_force/00-base.xml | 2 +- tests/dictionaries/10load_disabledifin_fallback/00-base.xml | 2 +- .../dictionaries/10load_disabledifin_fallback_force/00-base.xml | 2 +- tests/dictionaries/10load_disabledifin_whithouttype/00-base.xml | 2 +- tests/dictionaries/10load_emptyvalue/00-base.xml | 2 +- tests/dictionaries/10load_frozenifin/00-base.xml | 2 +- tests/dictionaries/10load_frozenifin_auto/00-base.xml | 2 +- tests/dictionaries/10load_frozenifin_multiparam/00-base.xml | 2 +- tests/dictionaries/10load_frozenifin_noexist/00-base.xml | 2 +- tests/dictionaries/10load_frozenifin_variable/00-base.xml | 2 +- tests/dictionaries/10load_frozenifnotin/00-base.xml | 2 +- tests/dictionaries/10load_frozenifnotin_noexist/00-base.xml | 2 +- tests/dictionaries/10load_hidden_if_empty_family/00-base.xml | 2 +- tests/dictionaries/10load_hidden_if_family/00-base.xml | 2 +- tests/dictionaries/10load_leadership/00-base.xml | 2 +- tests/dictionaries/10load_leadership_default_multi/00-base.xml | 2 +- .../dictionaries/10load_leadership_default_submulti/00-base.xml | 2 +- .../10load_leadership_defaultmulti_leader/00-base.xml | 2 +- tests/dictionaries/10load_leadership_description/00-base.xml | 2 +- tests/dictionaries/10load_leadership_name/00-base.xml | 2 +- .../dictionaries/10load_leadership_normalize_family/00-base.xml | 2 +- .../dictionaries/10load_leadership_normalize_family/01-base.xml | 2 +- tests/dictionaries/10load_leadership_submulti/00-base.xml | 2 +- tests/dictionaries/10load_mandatoryifin/00-base.xml | 2 +- tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml | 2 +- tests/dictionaries/10load_multivalue/00-base.xml | 2 +- tests/dictionaries/10valid_enum_accent/00-base.xml | 2 +- tests/dictionaries/10valid_enum_base/00-base.xml | 2 +- tests/dictionaries/10valid_enum_base_redefine/00-base.xml | 2 +- tests/dictionaries/10valid_enum_base_redefine/01-base.xml | 2 +- tests/dictionaries/10valid_enum_leader/00-base.xml | 2 +- tests/dictionaries/10valid_enum_mandatory/00-base.xml | 2 +- tests/dictionaries/10valid_enum_multi/00-base.xml | 2 +- tests/dictionaries/10valid_enum_none/00-base.xml | 2 +- tests/dictionaries/10valid_enum_number/00-base.xml | 2 +- tests/dictionaries/10valid_enum_numberdefault/00-base.xml | 2 +- tests/dictionaries/10valid_enum_param_empty/00-base.xml | 2 +- tests/dictionaries/10valid_enum_param_empty2/00-base.xml | 2 +- tests/dictionaries/10valid_enum_quote/00-base.xml | 2 +- tests/dictionaries/10valid_enum_value/00-base.xml | 2 +- tests/dictionaries/11disabled_if_in_filelist/00-base.xml | 2 +- .../dictionaries/11disabled_if_in_filelist_boolean/00-base.xml | 2 +- .../dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml | 2 +- .../dictionaries/11disabled_if_in_filelist_disabled/00-base.xml | 2 +- tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml | 2 +- tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml | 2 +- .../11disabledifnotin_filelist_notexist/00-base.xml | 2 +- .../11disabledifnotin_filelist_notexist_multi/00-base.xml | 2 +- .../11disabledifnotin_filelist_notexist_validenum/00-base.xml | 2 +- tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml | 2 +- tests/dictionaries/11valid_enum_variable/00-base.xml | 2 +- tests/dictionaries/20family_append/00-base.xml | 2 +- tests/dictionaries/20family_append/01-base.xml | 2 +- tests/dictionaries/20family_appendaccent/00-base.xml | 2 +- tests/dictionaries/20family_appendaccent/01-base.xml | 2 +- tests/dictionaries/20family_appendaccent/02-base.xml | 2 +- tests/dictionaries/20family_dynamic/00-base.xml | 2 +- tests/dictionaries/20family_dynamic_calc/00-base.xml | 2 +- tests/dictionaries/20family_dynamic_calc2/00-base.xml | 2 +- tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml | 2 +- tests/dictionaries/20family_dynamic_description/00-base.xml | 2 +- tests/dictionaries/20family_dynamic_number/00-base.xml | 2 +- tests/dictionaries/20family_empty/00-base.xml | 2 +- tests/dictionaries/20family_hidden/00-base.xml | 2 +- tests/dictionaries/20family_hidden/01-base.xml | 2 +- tests/dictionaries/20family_mode/00-base.xml | 2 +- tests/dictionaries/20family_modeleadership/00-base.xml | 2 +- tests/dictionaries/20notemplating/00-base.xml | 2 +- tests/dictionaries/20override/00-base.xml | 2 +- tests/dictionaries/20override_no_templating/00-base.xml | 2 +- tests/dictionaries/20override_source/00-base.xml | 2 +- tests/dictionaries/21family_empty/00-base.xml | 2 +- tests/dictionaries/30mandatory_withoutvalue/00-base.xml | 2 +- tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml | 2 +- tests/dictionaries/30mandatory_withvalue/00-base.xml | 2 +- tests/dictionaries/30mandatory_withvaluecalc/00-base.xml | 2 +- tests/dictionaries/40condition_base/00-base.xml | 2 +- tests/dictionaries/40condition_base_add/00-base.xml | 2 +- tests/dictionaries/40condition_base_add/01-base.xml | 2 +- tests/dictionaries/40condition_fallback/00-base.xml | 2 +- tests/dictionaries/40condition_optional/00-base.xml | 2 +- tests/dictionaries/40condition_optional_empty/00-base.xml | 2 +- tests/dictionaries/40condition_optional_family/00-base.xml | 2 +- tests/dictionaries/40empty_param/00_base.xml | 2 +- tests/dictionaries/40empty_param2/00_base.xml | 2 +- tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml | 2 +- tests/dictionaries/40ifin_leadership/00-base.xml | 2 +- tests/dictionaries/40ifin_leadershipauto/00-base.xml | 2 +- tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml | 2 +- tests/dictionaries/40ifin_multi/00-base.xml | 2 +- tests/dictionaries/40ifin_validenum/00-base.xml | 2 +- tests/dictionaries/45extra_without_family/00-base.xml | 2 +- .../45extra_without_family/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/45multi_family/00-base.xml | 2 +- tests/dictionaries/45multi_family_basic/00-base.xml | 2 +- tests/dictionaries/45multi_family_expert/00-base.xml | 2 +- tests/dictionaries/45multi_family_order/00-base.xml | 2 +- tests/dictionaries/45without_family/00-base.xml | 2 +- tests/dictionaries/50exists_exists/00-base.xml | 2 +- tests/dictionaries/50exists_exists/01-base.xml | 2 +- tests/dictionaries/50redefine_description/00-base.xml | 2 +- tests/dictionaries/50redefine_description/01-redefine.xml | 2 +- tests/dictionaries/51exists_nonexists/00-base.xml | 2 +- tests/dictionaries/51exists_nonexists/01-base.xml | 2 +- tests/dictionaries/51exists_redefine/00-base.xml | 2 +- tests/dictionaries/51exists_redefine/01-base.xml | 2 +- tests/dictionaries/51redefine_auto/00-base.xml | 2 +- tests/dictionaries/51redefine_auto/01-base.xml | 2 +- tests/dictionaries/51redefine_autofill/00-base.xml | 2 +- tests/dictionaries/51redefine_autofill/01-base.xml | 2 +- tests/dictionaries/51redefine_family/00-base.xml | 2 +- tests/dictionaries/51redefine_family/01-base.xml | 2 +- tests/dictionaries/51redefine_fill/00-base.xml | 2 +- tests/dictionaries/51redefine_fill/01-base.xml | 2 +- tests/dictionaries/51redefine_fillauto/00-base.xml | 2 +- tests/dictionaries/51redefine_fillauto/01-base.xml | 2 +- tests/dictionaries/51redefine_help/00-base.xml | 2 +- tests/dictionaries/51redefine_help/01-base.xml | 2 +- tests/dictionaries/51redefine_hidden/00-base.xml | 2 +- tests/dictionaries/51redefine_hidden/01-redefine.xml | 2 +- tests/dictionaries/51redefine_multi/00-base.xml | 2 +- tests/dictionaries/51redefine_multi/01-redefine.xml | 2 +- tests/dictionaries/51redefine_remove_check/00-base.xml | 2 +- tests/dictionaries/51redefine_remove_check/01-base.xml | 2 +- tests/dictionaries/51redefine_remove_condition/00-base.xml | 2 +- tests/dictionaries/51redefine_remove_condition/01-base.xml | 2 +- .../51redefine_removecondition_nonautofreeze/00-base.xml | 2 +- .../51redefine_removecondition_nonautofreeze/01-base.xml | 2 +- tests/dictionaries/51redefine_type/00-base.xml | 2 +- tests/dictionaries/51redefine_type/01-redefine.xml | 2 +- tests/dictionaries/51redefine_validenum/00-base.xml | 2 +- tests/dictionaries/51redefine_validenum/01-redefine.xml | 2 +- tests/dictionaries/51redefine_value/00-base.xml | 2 +- tests/dictionaries/51redefine_value/01-redefine.xml | 2 +- tests/dictionaries/51remove_fill/00-base.xml | 2 +- tests/dictionaries/51remove_fill/01-base.xml | 2 +- tests/dictionaries/52exists_redefine/00-base.xml | 2 +- tests/dictionaries/52exists_redefine/01-base.xml | 2 +- tests/dictionaries/60action_external/00-base.xml | 2 +- .../dictionaries/60action_external/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_externalspaceauto/00-base.xml | 2 +- .../60extra_externalspaceauto/extra_dirs/extra/00-base.xml | 2 +- .../60extra_externalspaceauto/extra_dirs/extra1/00-base.xml | 2 +- tests/dictionaries/60extra_externalspacecondition/00-base.xml | 2 +- .../60extra_externalspacecondition/extra_dirs/extra/00-base.xml | 2 +- .../extra_dirs/extra1/00-base.xml | 2 +- tests/dictionaries/60extra_externalspacecondition2/00-base.xml | 2 +- .../extra_dirs/extra/00-base.xml | 2 +- .../extra_dirs/extra1/00-base.xml | 2 +- tests/dictionaries/60extra_externalspacecondition3/00-base.xml | 2 +- .../extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_group/00-base.xml | 2 +- tests/dictionaries/60extra_group/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_help/00-base.xml | 2 +- tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_load/00-base.xml | 2 +- tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_mandatory/00-base.xml | 2 +- .../dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_name_family/00-base.xml | 2 +- .../60extra_name_family/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_no_condition/00-base.xml | 2 +- .../60extra_no_condition/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60extra_redefine/00-base.xml | 2 +- .../dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml | 2 +- .../60extra_redefine/extra_dirs/extra/01-redefine.xml | 2 +- tests/dictionaries/60extra_variable_name_extra/00-base.xml | 2 +- .../60extra_variable_name_extra/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60familyaction/00-base.xml | 2 +- tests/dictionaries/60familyaction/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60familyaction_accent/00-base.xml | 2 +- .../60familyaction_accent/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/60familyaction_mandatory/00-base.xml | 2 +- .../60familyaction_mandatory/60familyaction/00-base.xml | 2 +- .../60familyaction_mandatory/60familyaction/result/00-base.xml | 2 +- .../60familyaction_mandatory/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/61extra_dyn/00-base.xml | 2 +- tests/dictionaries/61extra_dyn/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/61extra_dyn_extra/00-base.xml | 2 +- .../dictionaries/61extra_dyn_extra/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/70container_files/00-base.xml | 2 +- tests/dictionaries/70container_files_symlink_multi/00-base.xml | 2 +- .../70container_files_symlink_multi_variable/00-base.xml | 2 +- .../dictionaries/70container_files_symlink_variable/00-base.xml | 2 +- tests/dictionaries/70container_files_twice/00-base.xml | 2 +- tests/dictionaries/70container_filesmulti/00-base.xml | 2 +- tests/dictionaries/70container_filesredefine/00-base.xml | 2 +- tests/dictionaries/70container_filesredefine/01-base.xml | 2 +- tests/dictionaries/70container_new/00-base.xml | 2 +- tests/dictionaries/70container_newnocont/00-base.xml | 2 +- tests/dictionaries/70container_newwithip/00-base.xml | 2 +- .../dictionaries/70container_pathaccess_leadership/00-base.xml | 2 +- tests/dictionaries/70container_save/00-base.xml | 2 +- tests/dictionaries/70container_servicerestriction/00-base.xml | 2 +- tests/dictionaries/70container_services/00-base.xml | 2 +- tests/dictionaries/70port/00-base.xml | 2 +- tests/dictionaries/70port_portlist/00-base.xml | 2 +- tests/dictionaries/70port_portlist_optional/00-base.xml | 2 +- tests/dictionaries/70port_variable/00-base.xml | 2 +- tests/dictionaries/70services_pathaccess/00-base.xml | 2 +- tests/dictionaries/70services_pathaccess_iplist/00-base.xml | 2 +- tests/dictionaries/70services_pathaccess_iplist2/00-base.xml | 2 +- tests/dictionaries/80auto_family/00-base.xml | 2 +- tests/dictionaries/80check_unknown/00-base.xml | 2 +- tests/dictionaries/80check_unknown_var/00-base.xml | 2 +- tests/dictionaries/80check_without_target/00-base.xml | 2 +- tests/dictionaries/80condition_itself/00-base.xml | 2 +- tests/dictionaries/80condition_not_exists_error/00-base.xml | 2 +- tests/dictionaries/80condition_not_exists_error_var/00-base.xml | 2 +- tests/dictionaries/80condition_without_target/00-base.xml | 2 +- .../80container_files_symlink_without_source/00-base.xml | 2 +- tests/dictionaries/80container_filesredefine_error/00-base.xml | 2 +- tests/dictionaries/80container_filesredefine_error/01-base.xml | 2 +- tests/dictionaries/80empty_param_number/00_base.xml | 2 +- tests/dictionaries/80empty_typeeole_eole/00_base.xml | 2 +- tests/dictionaries/80empty_typeeole_number/00_base.xml | 2 +- tests/dictionaries/80extra_auto_freeze/00-base.xml | 2 +- .../80extra_auto_freeze/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/80extra_rougail/00-base.xml | 2 +- .../dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml | 2 +- tests/dictionaries/80extra_services/00-base.xml | 2 +- .../80extra_services/extra_dirs/services/00-base.xml | 2 +- tests/dictionaries/80family_change/00-base.xml | 2 +- tests/dictionaries/80family_change/01-base.xml | 2 +- tests/dictionaries/80family_changeaccent/00-base.xml | 2 +- tests/dictionaries/80family_changeaccent/01-base.xml | 2 +- .../80family_dynamic_calc_invalid_suffix/00-base.xml | 2 +- tests/dictionaries/80family_dynamic_check/00-base.xml | 2 +- tests/dictionaries/80family_dynamic_not_multi/00-base.xml | 2 +- tests/dictionaries/80family_dynamic_with_family/00-base.xml | 2 +- tests/dictionaries/80family_not_dynamic_calc_suffix/00-base.xml | 2 +- tests/dictionaries/80family_only_on_suffix/00-base.xml | 2 +- tests/dictionaries/80family_several/00-base.xml | 2 +- tests/dictionaries/80family_unique/00-base.xml | 2 +- tests/dictionaries/80family_variable_not_same_name/00-base.xml | 2 +- tests/dictionaries/80fill_error/00-base.xml | 2 +- tests/dictionaries/80fill_multi/00-base.xml | 2 +- tests/dictionaries/80fill_not_exists/00-base.xml | 2 +- tests/dictionaries/80fill_unknown_function/00-base.xml | 2 +- tests/dictionaries/80frozenifin_unknown/00-base.xml | 2 +- tests/dictionaries/80hidden_if_in_dynamic/00-base.xml | 2 +- tests/dictionaries/80hidden_if_in_filelist/00-base.xml | 2 +- tests/dictionaries/80invalid_dtd/00_base.xml | 2 +- tests/dictionaries/80invalid_port/00-base.xml | 2 +- tests/dictionaries/80invalid_xml/00_base.xml | 2 +- tests/dictionaries/80leadership_auto_save/00-base.xml | 2 +- tests/dictionaries/80leadership_autofreeze/00-base.xml | 2 +- tests/dictionaries/80leadership_leader_not_multi/00-base.xml | 2 +- .../80leadership_none_follower_between_follower/00-base.xml | 2 +- tests/dictionaries/80leadership_not_ordered/00-base.xml | 2 +- tests/dictionaries/80leadership_not_same_family/00-base.xml | 2 +- tests/dictionaries/80leadership_notexists/00-base.xml | 2 +- tests/dictionaries/80load_mandatoryifin_family/00-base.xml | 2 +- tests/dictionaries/80mode_conflict/00-base.xml | 2 +- tests/dictionaries/80mode_leadership_conflict/00-base.xml | 2 +- tests/dictionaries/80multi_family_mode_conflict/00-base.xml | 2 +- tests/dictionaries/80nil_with_value/00-base.xml | 2 +- tests/dictionaries/80no_leadership_index/00-base.xml | 2 +- tests/dictionaries/80port_string/00-base.xml | 2 +- tests/dictionaries/80redefine_double_error/00-base.xml | 2 +- tests/dictionaries/80redefine_double_error/01-base.xml | 2 +- tests/dictionaries/80redefine_double_error/02-base.xml | 2 +- tests/dictionaries/80redefine_error/00-base.xml | 2 +- tests/dictionaries/80redefine_error/01-redefine.xml | 2 +- tests/dictionaries/80redefine_fillerror/00-base.xml | 2 +- tests/dictionaries/80redefine_fillerror/01-base.xml | 2 +- tests/dictionaries/80redefine_notexists/00-base.xml | 2 +- tests/dictionaries/80redefine_notexists/01-redefine.xml | 2 +- tests/dictionaries/80target_list_unknown/00-base.xml | 2 +- tests/dictionaries/80unknown_type/00-base.xml | 2 +- tests/dictionaries/80valid_entier_invalid_param/00-base.xml | 2 +- tests/dictionaries/80valid_entier_not_number/00-base.xml | 2 +- tests/dictionaries/80valid_entier_without_param/00-base.xml | 2 +- tests/dictionaries/80valid_enum_base_redefine/00-base.xml | 2 +- tests/dictionaries/80valid_enum_base_redefine/01-base.xml | 2 +- tests/dictionaries/80valid_enum_multi_param/00-base.xml | 2 +- tests/dictionaries/80valid_enum_multi_variable/00-base.xml | 2 +- tests/dictionaries/80valid_enum_no_param/00-base.xml | 2 +- tests/dictionaries/80valid_enum_none_multi_variable/00-base.xml | 2 +- .../dictionaries/80valid_enum_number_without_value/00-base.xml | 2 +- tests/dictionaries/80variable_extra/00-base.xml | 2 +- .../dictionaries/80variable_extra/extra_dirs/extra/00-base.xml | 2 +- tests/dictionaries/80variable_family_not_same_name/00-base.xml | 2 +- tests/dictionaries/80variable_rougail/00-base.xml | 2 +- tests/dictionaries/81extra_externalspace/00-base.xml | 2 +- .../81extra_externalspace/extra_dirs/extra/00-base.xml | 2 +- .../81extra_externalspace/extra_dirs/extra1/00-base.xml | 2 +- tests/dictionaries/88valid_enum_not_number/00-base.xml | 2 +- tests/dictionaries/88valid_enum_not_number2/00-base.xml | 2 +- tests/dictionaries/88valid_enum_not_number_variable/00-base.xml | 2 +- tests/dictionaries/88valid_enum_numberdefaultstring/00-base.xml | 2 +- tests/dictionaries/88valid_enum_variable_optional/00-base.xml | 2 +- 394 files changed, 394 insertions(+), 393 deletions(-) diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 30de5621..39004cc3 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -38,6 +38,7 @@ + diff --git a/tests/dictionaries/00empty/00_base.xml b/tests/dictionaries/00empty/00_base.xml index 5bc54563..ea43804d 100644 --- a/tests/dictionaries/00empty/00_base.xml +++ b/tests/dictionaries/00empty/00_base.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/dictionaries/00load_autofreeze/00-base.xml b/tests/dictionaries/00load_autofreeze/00-base.xml index 592d52e8..21cfd3c2 100644 --- a/tests/dictionaries/00load_autofreeze/00-base.xml +++ b/tests/dictionaries/00load_autofreeze/00-base.xml @@ -1,5 +1,5 @@ - + no diff --git a/tests/dictionaries/00load_autofreezeexpert/00-base.xml b/tests/dictionaries/00load_autofreezeexpert/00-base.xml index 362981aa..4441553d 100644 --- a/tests/dictionaries/00load_autofreezeexpert/00-base.xml +++ b/tests/dictionaries/00load_autofreezeexpert/00-base.xml @@ -1,5 +1,5 @@ - + no diff --git a/tests/dictionaries/00load_autosave/00-base.xml b/tests/dictionaries/00load_autosave/00-base.xml index 8be2a32d..7a44967a 100644 --- a/tests/dictionaries/00load_autosave/00-base.xml +++ b/tests/dictionaries/00load_autosave/00-base.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/dictionaries/00load_autosaveexpert/00-base.xml b/tests/dictionaries/00load_autosaveexpert/00-base.xml index 0ed16b71..a9cd293b 100644 --- a/tests/dictionaries/00load_autosaveexpert/00-base.xml +++ b/tests/dictionaries/00load_autosaveexpert/00-base.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/dictionaries/00load_comment/00-base.xml b/tests/dictionaries/00load_comment/00-base.xml index 3b468b1f..97015669 100644 --- a/tests/dictionaries/00load_comment/00-base.xml +++ b/tests/dictionaries/00load_comment/00-base.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/dictionaries/00load_notype/00-base.xml b/tests/dictionaries/00load_notype/00-base.xml index 05d4be90..e1d93361 100644 --- a/tests/dictionaries/00load_notype/00-base.xml +++ b/tests/dictionaries/00load_notype/00-base.xml @@ -1,5 +1,5 @@ - + ``` -Dans ce cas, tous les fichiers avec un attribut filelist à "squid" seront désactivé si la variable "condition" est False. +Dans ce cas, tous les fichiers avec un attribut filelist à "squid" seront désactivés si la variable "condition" est False. ## Redéfinir une fichier diff --git a/doc/service/port.md b/doc/service/port.md deleted file mode 100644 index 7a5b6f1d..00000000 --- a/doc/service/port.md +++ /dev/null @@ -1,65 +0,0 @@ -# La gestion d'un port - -## La balise port - -La gestion des ports se fait dans un conteneur de [service](service.md). - -La balise port permet d'associer un port à service : - -``` - - - 3128 - - -``` - -Il est possible de choisir le protocole TCP ou UDP (TCP par défaut) : - -``` -123 -``` - -## Les numéros de port dynamique - -Il est possible également de définir le port dans une variable : - -``` - - - my_variable - - - - - 123 - - -``` - -Attention, la variable doit être de type "port". - -## Désactiver le port - -Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise port : - -``` - - - 3128 - - - - - - - - - - False - squid - - -``` - -Dans ce cas, tous les ports avec un attribut portlist à "squid" seront désactivé si la variable "condition" est False. diff --git a/doc/service/service.md b/doc/service/service.md index d79e2b22..06473ea8 100644 --- a/doc/service/service.md +++ b/doc/service/service.md @@ -1,8 +1,10 @@ # La gestion d'un service +## La base service + Un service est inclut dans un conteneur [services](../services.md). -Cette balise permet de définir tous les éléments (fichier, port, IP, ...) lié à un service ou à démon. +Cette balise permet de définir tous les éléments ([fichier](file.md), [IP](ip.md), ...) liés à un service ou à démon. Il faut, à la création du service, préciser son nom : @@ -24,3 +26,25 @@ Un service peut ne pas être géré : Un service non géré est généralement une service qui n'existe pas réellement (par exemple si on configure un client). Un service non géré ne peut conteneur que des fichiers. + +## Désactiver la génération d'un service + +Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise service : + +``` + + + + + + + + + + False + test + + +``` + +Dans ce cas, tous les services et les éléments qu'il compose ([fichier](file.md), ...) avec un attribut servicelist à "test" seront désactivés si la variable "condition" est False. diff --git a/doc/target/list.md b/doc/target/list.md index eefb327d..bff8305f 100644 --- a/doc/target/list.md +++ b/doc/target/list.md @@ -2,6 +2,14 @@ ## Les différences cible de type \*.list +### servicelist + +Une cible peut être de type [service](../service/service.md) : + +``` +example +``` + ### filelist Une cible peut être de type [fichier](../service/file.md) : @@ -10,14 +18,6 @@ Une cible peut être de type [fichier](../service/file.md) : example ``` -### portlist - -Une cible peut être de type [port](../service/port.md) : - -``` -example -``` - ### iplist Une cible peut être de type [ip](../service/ip.md) : diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index 2639972b..e75c3170 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -70,10 +70,21 @@ class ServiceAnnotator: self.objectspace.space.services.doc = 'services' self.objectspace.space.services.path = 'services' for service_name, service in self.objectspace.space.services.service.items(): - if not service.manage: - service.information = self.objectspace.information(service.xmlfiles) - service.information.manage = service.manage + activate_obj = self._generate_element('boolean', + None, + None, + 'activate', + True, + service, + '.'.join(['services', normalize_family(service_name), 'activate']), + ) for elttype, values in dict(vars(service)).items(): + if elttype == 'servicelist': + self.objectspace.list_conditions.setdefault('servicelist', + {}).setdefault( + values, + []).append(activate_obj) + continue if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES: continue if not service.manage and elttype not in ALLOW_ATTRIBUT_NOT_MANAGE: @@ -96,6 +107,15 @@ class ServiceAnnotator: path, ) setattr(service, elttype, family) + manage = self._generate_element('boolean', + None, + None, + 'manage', + service.manage, + service, + '.'.join(['services', normalize_family(service_name), 'manage']), + ) + service.variable = [activate_obj, manage] service.doc = service.name def make_group_from_elts(self, diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 1a9d0421..8fbb6c05 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -49,6 +49,7 @@ + @@ -126,7 +127,7 @@ - + diff --git a/src/rougail/template/base.py b/src/rougail/template/base.py index 7623daf5..35fe8232 100644 --- a/src/rougail/template/base.py +++ b/src/rougail/template/base.py @@ -289,7 +289,11 @@ class RougailBaseTemplate: for included in (True, False): for service_obj in await self.config.option('services').list('all'): service_name = await service_obj.option.name() - for fills in await service_obj.list('all'): + if await service_obj.option('activate').value.get() is False: + if included is False: + self.desactive_service(service_name) + continue + for fills in await service_obj.list('optiondescription'): type_ = await fills.option.name() for fill_obj in await fills.list('all'): fill = await fill_obj.value.dict() @@ -306,6 +310,11 @@ class RougailBaseTemplate: self.post_instance() chdir(ori_dir) + def desactive_service(self, + service_name: str, + ): + raise NotImplementedError(_('cannot desactivate a service')) + def post_instance(self): # pragma: no cover pass diff --git a/src/rougail/template/systemd.py b/src/rougail/template/systemd.py index 1693a90a..e5ec065e 100644 --- a/src/rougail/template/systemd.py +++ b/src/rougail/template/systemd.py @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from typing import Dict -from os import makedirs +from os import makedirs, symlink from os.path import dirname, isfile, join from ipaddress import ip_network @@ -45,9 +45,9 @@ z %%filename - - - - - %end if %end def %for %%service in %%services - %if %%hasattr(%%service, 'files') + %if %%service.activate is True and %%hasattr(%%service, 'files') %for %%file in %%service.files - %if %%file.activate == True and %%file.included != 'content' + %if %%file.activate is True and %%file.included != 'content' %if %%isinstance(%%file.name, list) %for %%filename in %%file.name %%display(%%file, %%filename)%slurp @@ -93,7 +93,6 @@ class RougailSystemdTemplate(RougailBaseTemplate): service_name = filevar['name'] return tmp_file, None, f'/systemd/system/{service_name}.service.d/rougail.conf', None - def _instance_ip(self, filevar: Dict, destfile, @@ -116,6 +115,13 @@ class RougailSystemdTemplate(RougailBaseTemplate): filevar['engine'] = 'creole' return None, ROUGAIL_IP_TEMPLATE, f'/systemd/system/{service_name}.service.d/rougail_ip.conf', variable + def desactive_service(self, + service_name: str, + ): + filename = f'{self.destinations_dir}/systemd/system/{service_name}.service' + makedirs(dirname(filename), exist_ok=True) + symlink('/dev/null', filename) + def post_instance(self): destfile = '/tmpfiles.d/rougail.conf' destfilename = join(self.destinations_dir, destfile[1:]) diff --git a/tests/dictionaries/00empty/makedict/base.json b/tests/dictionaries/00empty/makedict/base.json new file mode 100644 index 00000000..17c919d6 --- /dev/null +++ b/tests/dictionaries/00empty/makedict/base.json @@ -0,0 +1 @@ +{"services.tata.activate": true, "services.tata.manage": true} diff --git a/tests/dictionaries/00empty/tiramisu/base.py b/tests/dictionaries/00empty/tiramisu/base.py index 616d4586..fbf5613a 100644 --- a/tests/dictionaries/00empty/tiramisu/base.py +++ b/tests/dictionaries/00empty/tiramisu/base.py @@ -11,6 +11,8 @@ try: from tiramisu3 import * except: from tiramisu import * -option_2 = OptionDescription(name="tata", doc="tata", children=[]) +option_3 = BoolOption(name="activate", doc="activate", default=True) +option_4 = BoolOption(name="manage", doc="manage", default=True) +option_2 = OptionDescription(name="tata", doc="tata", children=[option_3, option_4]) option_1 = OptionDescription(name="services", doc="services", children=[option_2], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01base_file/makedict/base.json b/tests/dictionaries/01base_file/makedict/base.json index 1d1bb389..65b06eec 100644 --- a/tests/dictionaries/01base_file/makedict/base.json +++ b/tests/dictionaries/01base_file/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/01base_file/tiramisu/base.py b/tests/dictionaries/01base_file/tiramisu/base.py index 4efa80ee..340e122d 100644 --- a/tests/dictionaries/01base_file/tiramisu/base.py +++ b/tests/dictionaries/01base_file/tiramisu/base.py @@ -33,6 +33,8 @@ option_23 = StrOption(name="source", doc="source", default="file2") option_24 = BoolOption(name="activate", doc="activate", default=True) option_16 = OptionDescription(name="file2", doc="file2", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_25 = BoolOption(name="activate", doc="activate", default=True) +option_26 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_25, option_26]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_include/makedict/base.json b/tests/dictionaries/01base_file_include/makedict/base.json index 1d1bb389..65b06eec 100644 --- a/tests/dictionaries/01base_file_include/makedict/base.json +++ b/tests/dictionaries/01base_file_include/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/01base_file_include/tiramisu/base.py b/tests/dictionaries/01base_file_include/tiramisu/base.py index 4efa80ee..340e122d 100644 --- a/tests/dictionaries/01base_file_include/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include/tiramisu/base.py @@ -33,6 +33,8 @@ option_23 = StrOption(name="source", doc="source", default="file2") option_24 = BoolOption(name="activate", doc="activate", default=True) option_16 = OptionDescription(name="file2", doc="file2", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_25 = BoolOption(name="activate", doc="activate", default=True) +option_26 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_25, option_26]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_include_content/makedict/base.json b/tests/dictionaries/01base_file_include_content/makedict/base.json index 8d2c63ad..dfd8cb67 100644 --- a/tests/dictionaries/01base_file_include_content/makedict/base.json +++ b/tests/dictionaries/01base_file_include_content/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.files.incfile.engine": "creole", "services.test.files.incfile.group": "root", "services.test.files.incfile.included": "content", "services.test.files.incfile.mode": "0644", "services.test.files.incfile.name": "/etc/dir/incfile", "services.test.files.incfile.owner": "root", "services.test.files.incfile.source": "incfile", "services.test.files.incfile.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.files.incfile.engine": "creole", "services.test.files.incfile.group": "root", "services.test.files.incfile.included": "content", "services.test.files.incfile.mode": "0644", "services.test.files.incfile.name": "/etc/dir/incfile", "services.test.files.incfile.owner": "root", "services.test.files.incfile.source": "incfile", "services.test.files.incfile.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/01base_file_include_content/tiramisu/base.py b/tests/dictionaries/01base_file_include_content/tiramisu/base.py index a6da8128..9eb2c680 100644 --- a/tests/dictionaries/01base_file_include_content/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include_content/tiramisu/base.py @@ -42,6 +42,8 @@ option_32 = StrOption(name="source", doc="source", default="incfile") option_33 = BoolOption(name="activate", doc="activate", default=True) option_25 = OptionDescription(name="incfile", doc="incfile", children=[option_26, option_27, option_28, option_29, option_30, option_31, option_32, option_33]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16, option_25]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_34 = BoolOption(name="activate", doc="activate", default=True) +option_35 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_34, option_35]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_include_name/makedict/base.json b/tests/dictionaries/01base_file_include_name/makedict/base.json index 9d5a544f..7eee37db 100644 --- a/tests/dictionaries/01base_file_include_name/makedict/base.json +++ b/tests/dictionaries/01base_file_include_name/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.files.incfile.engine": "creole", "services.test.files.incfile.group": "root", "services.test.files.incfile.included": "name", "services.test.files.incfile.mode": "0644", "services.test.files.incfile.name": "/etc/dir/incfile", "services.test.files.incfile.owner": "root", "services.test.files.incfile.source": "incfile", "services.test.files.incfile.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.files.incfile.engine": "creole", "services.test.files.incfile.group": "root", "services.test.files.incfile.included": "name", "services.test.files.incfile.mode": "0644", "services.test.files.incfile.name": "/etc/dir/incfile", "services.test.files.incfile.owner": "root", "services.test.files.incfile.source": "incfile", "services.test.files.incfile.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/01base_file_include_name/tiramisu/base.py b/tests/dictionaries/01base_file_include_name/tiramisu/base.py index 7d5dc786..4fe855ae 100644 --- a/tests/dictionaries/01base_file_include_name/tiramisu/base.py +++ b/tests/dictionaries/01base_file_include_name/tiramisu/base.py @@ -42,6 +42,8 @@ option_32 = StrOption(name="source", doc="source", default="incfile") option_33 = BoolOption(name="activate", doc="activate", default=True) option_25 = OptionDescription(name="incfile", doc="incfile", children=[option_26, option_27, option_28, option_29, option_30, option_31, option_32, option_33]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16, option_25]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_34 = BoolOption(name="activate", doc="activate", default=True) +option_35 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_34, option_35]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_patch/makedict/base.json b/tests/dictionaries/01base_file_patch/makedict/base.json index 1d1bb389..65b06eec 100644 --- a/tests/dictionaries/01base_file_patch/makedict/base.json +++ b/tests/dictionaries/01base_file_patch/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/01base_file_patch/tiramisu/base.py b/tests/dictionaries/01base_file_patch/tiramisu/base.py index 4efa80ee..340e122d 100644 --- a/tests/dictionaries/01base_file_patch/tiramisu/base.py +++ b/tests/dictionaries/01base_file_patch/tiramisu/base.py @@ -33,6 +33,8 @@ option_23 = StrOption(name="source", doc="source", default="file2") option_24 = BoolOption(name="activate", doc="activate", default=True) option_16 = OptionDescription(name="file2", doc="file2", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_25 = BoolOption(name="activate", doc="activate", default=True) +option_26 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_25, option_26]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_utfchar/makedict/base.json b/tests/dictionaries/01base_file_utfchar/makedict/base.json index 1b143810..caa2f4dc 100644 --- a/tests/dictionaries/01base_file_utfchar/makedict/base.json +++ b/tests/dictionaries/01base_file_utfchar/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.engine": "creole", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.included": "no", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true, "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.engine": "jinja2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.included": "no", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.source": "systemd-makefs@dev-disk-by\\x2dpartlabel2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.engine": "creole", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.included": "no", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true, "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.engine": "jinja2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.included": "no", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.source": "systemd-makefs@dev-disk-by\\x2dpartlabel2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py index 708125b7..9544822b 100644 --- a/tests/dictionaries/01base_file_utfchar/tiramisu/base.py +++ b/tests/dictionaries/01base_file_utfchar/tiramisu/base.py @@ -33,6 +33,8 @@ option_23 = StrOption(name="source", doc="source", default="systemd-makefs@dev-d option_24 = BoolOption(name="activate", doc="activate", default=True) option_16 = OptionDescription(name="systemd_makefs@dev_disk_by\\x2dpartlabel2", doc="systemd-makefs@dev-disk-by\\x2dpartlabel2", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_25 = BoolOption(name="activate", doc="activate", default=True) +option_26 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_25, option_26]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json index 9fa6fc6d..d9ca2c8e 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py index 9e7ed8ec..ee02d03d 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file1") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json index e912a36b..c1d375e0 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "no", "rougail.general.test_variable": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true} +{"rougail.general.condition": "no", "rougail.general.condition2": "no", "rougail.general.test_variable": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py index 844af3b4..aa7b6a80 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file1") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json index a8df4ffd..981ea298 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false} +{"rougail.general.condition": "no", "rougail.general.condition2": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py index 923ebc48..ce3ae23b 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file1") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json index f805d38b..cc8a3018 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "yes", "rougail.general.condition2": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true} +{"rougail.general.condition": "yes", "rougail.general.condition2": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py index cb643fe2..09e2262f 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file1") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json index 506580d8..ff296f1b 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "yes", "rougail.general.condition2": "yes", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false} +{"rougail.general.condition": "yes", "rougail.general.condition2": "yes", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py index e23830dc..29027a3a 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file1") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json index 1f4000b3..e8f83ea3 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "yes", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false} +{"rougail.general.condition": "no", "rougail.general.condition2": "yes", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py index b1240522..2669168b 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file1") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json index 09ba67b0..15068ac2 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "oui", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false} +{"rougail.general.condition": "oui", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py index b5b0fbfe..4f8ba148 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file1") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json b/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json index 7078b1f0..c654c2d0 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "no", "rougail.general.disable_variable": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true} +{"rougail.general.condition": "no", "rougail.general.disable_variable": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py index cb884345..170302ea 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/base.py @@ -25,6 +25,8 @@ option_15 = StrOption(name="source", doc="source", default="file1") option_16 = BoolOption(name="activate", doc="activate", default=True) option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) -option_6 = OptionDescription(name="test", doc="test", children=[option_7]) +option_17 = BoolOption(name="activate", doc="activate", default=True) +option_18 = BoolOption(name="manage", doc="manage", default=True) +option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_17, option_18]) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json index 0f87ab35..35415a54 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": true, "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": true, "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 1b5a5b19..e18a413c 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("oui")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json index bde10991..80ae7c66 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": true, "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false} +{"rougail.general.condition": true, "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py index 98a12f2b..886e0b0e 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py @@ -24,6 +24,8 @@ option_14 = StrOption(name="source", doc="source", default="file1") option_15 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)}))) option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_16 = BoolOption(name="activate", doc="activate", default=True) +option_17 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json index 7f404fa4..39dc850f 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json @@ -1 +1 @@ -{"rougail.general.condition": false, "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true} +{"rougail.general.condition": false, "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py index e941deae..85c4017b 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py @@ -24,6 +24,8 @@ option_14 = StrOption(name="source", doc="source", default="file1") option_15 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)}))) option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_16 = BoolOption(name="activate", doc="activate", default=True) +option_17 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) 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 5963379a..e3e0a34f 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.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false} +{"rougail.general.condition": "oui", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} 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 50c0fd55..8162b1f3 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("oui")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json index d37411d7..6eee3998 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_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.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.files.file2.engine": "creole", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/tmp/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.files.file2.engine": "creole", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/tmp/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} 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 620f03f4..1834cf14 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -35,6 +35,8 @@ option_25 = StrOption(name="source", doc="source", default="file2") option_26 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("oui")}))) option_18 = OptionDescription(name="file2", doc="file2", children=[option_19, option_20, option_21, option_22, option_23, option_24, option_25, option_26]) option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_18]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_27 = BoolOption(name="activate", doc="activate", default=True) +option_28 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_27, option_28]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json index 6fc66b82..60576b02 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.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 79a9d754..60c349da 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json index 6fc66b82..60576b02 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.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 79a9d754..60c349da 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json index 6fc66b82..60576b02 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.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index 0d119ec0..41408f0f 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True), 'condition_1': ParamOption(option_5), 'expected_1': ParamValue("oui"), 'reverse_condition_1': ParamValue(True), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json index 6fc66b82..60576b02 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.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false} +{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index 2664c56a..4c08cfca 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -26,6 +26,8 @@ option_16 = StrOption(name="source", doc="source", default="file") option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("statique"), 'reverse_condition_0': ParamValue(True)}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) -option_7 = OptionDescription(name="test", doc="test", children=[option_8]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) 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 950fa7cf..f6f29e5f 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.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} 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 931431f4..4e1e374d 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -25,6 +25,8 @@ option_15 = StrOption(name="source", doc="source", default="file1") option_16 = 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_16]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) -option_6 = OptionDescription(name="test", doc="test", children=[option_7]) +option_17 = BoolOption(name="activate", doc="activate", default=True) +option_18 = BoolOption(name="manage", doc="manage", default=True) +option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_17, option_18]) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/20notemplating/makedict/base.json b/tests/dictionaries/20notemplating/makedict/base.json index 8d50ae21..118174dc 100644 --- a/tests/dictionaries/20notemplating/makedict/base.json +++ b/tests/dictionaries/20notemplating/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "none", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "none", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/20notemplating/tiramisu/base.py b/tests/dictionaries/20notemplating/tiramisu/base.py index 4bd9d6d4..615ba96a 100644 --- a/tests/dictionaries/20notemplating/tiramisu/base.py +++ b/tests/dictionaries/20notemplating/tiramisu/base.py @@ -24,6 +24,8 @@ option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_16 = BoolOption(name="activate", doc="activate", default=True) +option_17 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override/makedict/base.json b/tests/dictionaries/20override/makedict/base.json index f919d625..9b9f194a 100644 --- a/tests/dictionaries/20override/makedict/base.json +++ b/tests/dictionaries/20override/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "creole", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true, "services.test2.overrides.test2_service.engine": "jinja2", "services.test2.overrides.test2_service.name": "test2", "services.test2.overrides.test2_service.source": "test2.service", "services.test2.overrides.test2_service.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "creole", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true, "services.test.activate": true, "services.test.manage": true, "services.test2.overrides.test2_service.engine": "jinja2", "services.test2.overrides.test2_service.name": "test2", "services.test2.overrides.test2_service.source": "test2.service", "services.test2.overrides.test2_service.activate": true, "services.test2.activate": true, "services.test2.manage": true} diff --git a/tests/dictionaries/20override/tiramisu/base.py b/tests/dictionaries/20override/tiramisu/base.py index cc6b9910..c0bae6a5 100644 --- a/tests/dictionaries/20override/tiramisu/base.py +++ b/tests/dictionaries/20override/tiramisu/base.py @@ -20,13 +20,17 @@ option_10 = StrOption(name="source", doc="source", default="test.service") option_11 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11]) option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) -option_15 = StrOption(name="engine", doc="engine", default="jinja2") -option_16 = StrOption(name="name", doc="name", default="test2") -option_17 = StrOption(name="source", doc="source", default="test2.service") -option_18 = BoolOption(name="activate", doc="activate", default=True) -option_14 = OptionDescription(name="test2_service", doc="test2.service", children=[option_15, option_16, option_17, option_18]) -option_13 = OptionDescription(name="overrides", doc="overrides", children=[option_14]) -option_12 = OptionDescription(name="test2", doc="test2", children=[option_13]) -option_4 = OptionDescription(name="services", doc="services", children=[option_5, option_12], properties=frozenset({"hidden"})) +option_12 = BoolOption(name="activate", doc="activate", default=True) +option_13 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_12, option_13]) +option_17 = StrOption(name="engine", doc="engine", default="jinja2") +option_18 = StrOption(name="name", doc="name", default="test2") +option_19 = StrOption(name="source", doc="source", default="test2.service") +option_20 = BoolOption(name="activate", doc="activate", default=True) +option_16 = OptionDescription(name="test2_service", doc="test2.service", children=[option_17, option_18, option_19, option_20]) +option_15 = OptionDescription(name="overrides", doc="overrides", children=[option_16]) +option_21 = BoolOption(name="activate", doc="activate", default=True) +option_22 = BoolOption(name="manage", doc="manage", default=True) +option_14 = OptionDescription(name="test2", doc="test2", children=[option_15, option_21, option_22]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5, option_14], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override_no_templating/makedict/base.json b/tests/dictionaries/20override_no_templating/makedict/base.json index 84d3ee6f..3283f09c 100644 --- a/tests/dictionaries/20override_no_templating/makedict/base.json +++ b/tests/dictionaries/20override_no_templating/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "none", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "none", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/20override_no_templating/tiramisu/base.py b/tests/dictionaries/20override_no_templating/tiramisu/base.py index 5325ff0e..3de45df9 100644 --- a/tests/dictionaries/20override_no_templating/tiramisu/base.py +++ b/tests/dictionaries/20override_no_templating/tiramisu/base.py @@ -20,6 +20,8 @@ option_10 = StrOption(name="source", doc="source", default="test.service") option_11 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11]) option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_12 = BoolOption(name="activate", doc="activate", default=True) +option_13 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_12, option_13]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override_source/makedict/base.json b/tests/dictionaries/20override_source/makedict/base.json index f177d42d..8672bb97 100644 --- a/tests/dictionaries/20override_source/makedict/base.json +++ b/tests/dictionaries/20override_source/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test2_service.engine": "creole", "services.test.overrides.test2_service.name": "test", "services.test.overrides.test2_service.source": "test2.service", "services.test.overrides.test2_service.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test2_service.engine": "creole", "services.test.overrides.test2_service.name": "test", "services.test.overrides.test2_service.source": "test2.service", "services.test.overrides.test2_service.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/20override_source/tiramisu/base.py b/tests/dictionaries/20override_source/tiramisu/base.py index 991e7eaa..4e7dcc66 100644 --- a/tests/dictionaries/20override_source/tiramisu/base.py +++ b/tests/dictionaries/20override_source/tiramisu/base.py @@ -20,6 +20,8 @@ option_10 = StrOption(name="source", doc="source", default="test2.service") option_11 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="test2_service", doc="test2.service", children=[option_8, option_9, option_10, option_11]) option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_12 = BoolOption(name="activate", doc="activate", default=True) +option_13 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_12, option_13]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json index 19d1d5d6..5e1a706b 100644 --- a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index a82d0919..1e0df8df 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -29,6 +29,8 @@ option_19 = StrOption(name="source", doc="source", default="mailname") option_20 = BoolOption(name="activate", doc="activate", default=True) option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19, option_20]) option_11 = OptionDescription(name="files", doc="files", children=[option_12]) -option_10 = OptionDescription(name="test", doc="test", children=[option_11]) +option_21 = BoolOption(name="activate", doc="activate", default=True) +option_22 = BoolOption(name="manage", doc="manage", default=True) +option_10 = OptionDescription(name="test", doc="test", children=[option_11, option_21, option_22]) option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9]) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json index 38edfa4d..cd209af3 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}, {"rougail.general.leader.leader": "b", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}, {"rougail.general.leader.leader": "b", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py index 1e25e7ce..32ae5f4c 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -38,6 +38,8 @@ option_28 = StrOption(name="source", doc="source", default="mailname2") option_29 = BoolOption(name="activate", doc="activate", default=True) option_21 = OptionDescription(name="mailname2", doc="mailname2", children=[option_22, option_23, option_24, option_25, option_26, option_27, option_28, option_29]) option_11 = OptionDescription(name="files", doc="files", children=[option_12, option_21]) -option_10 = OptionDescription(name="test", doc="test", children=[option_11]) +option_30 = BoolOption(name="activate", doc="activate", default=True) +option_31 = BoolOption(name="manage", doc="manage", default=True) +option_10 = OptionDescription(name="test", doc="test", children=[option_11, option_30, option_31]) option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9]) diff --git a/tests/dictionaries/45extra_without_family/makedict/base.json b/tests/dictionaries/45extra_without_family/makedict/base.json index 1f8b6af6..fd4af5ed 100644 --- a/tests/dictionaries/45extra_without_family/makedict/base.json +++ b/tests/dictionaries/45extra_without_family/makedict/base.json @@ -1 +1 @@ -{"rougail.my_var": "rougail", "extra.my_var": null, "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true} +{"rougail.my_var": "rougail", "extra.my_var": null, "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/45extra_without_family/tiramisu/base.py b/tests/dictionaries/45extra_without_family/tiramisu/base.py index 007e3c22..92eaec88 100644 --- a/tests/dictionaries/45extra_without_family/tiramisu/base.py +++ b/tests/dictionaries/45extra_without_family/tiramisu/base.py @@ -25,6 +25,8 @@ option_15 = StrOption(name="source", doc="source", default="file") option_16 = BoolOption(name="activate", doc="activate", default=True) option_8 = OptionDescription(name="file", doc="file", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_7 = OptionDescription(name="files", doc="files", children=[option_8]) -option_6 = OptionDescription(name="test", doc="test", children=[option_7]) +option_17 = BoolOption(name="activate", doc="activate", default=True) +option_18 = BoolOption(name="manage", doc="manage", default=True) +option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_17, option_18]) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3, option_5]) diff --git a/tests/dictionaries/60extra_group/makedict/base.json b/tests/dictionaries/60extra_group/makedict/base.json index 399599af..54eb0f87 100644 --- a/tests/dictionaries/60extra_group/makedict/base.json +++ b/tests/dictionaries/60extra_group/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": [{"extra.ejabberd.description.description": "test", "extra.ejabberd.description.mode": "pre"}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": [{"extra.ejabberd.description.description": "test", "extra.ejabberd.description.mode": "pre"}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/60extra_group/tiramisu/base.py b/tests/dictionaries/60extra_group/tiramisu/base.py index e4b66544..48bbaf6a 100644 --- a/tests/dictionaries/60extra_group/tiramisu/base.py +++ b/tests/dictionaries/60extra_group/tiramisu/base.py @@ -39,6 +39,8 @@ option_29 = StrOption(name="source", doc="source", default="mailname2") option_30 = BoolOption(name="activate", doc="activate", default=True) option_22 = OptionDescription(name="mailname2", doc="mailname2", children=[option_23, option_24, option_25, option_26, option_27, option_28, option_29, option_30]) option_12 = OptionDescription(name="files", doc="files", children=[option_13, option_22]) -option_11 = OptionDescription(name="test", doc="test", children=[option_12]) +option_31 = BoolOption(name="activate", doc="activate", default=True) +option_32 = BoolOption(name="manage", doc="manage", default=True) +option_11 = OptionDescription(name="test", doc="test", children=[option_12, option_31, option_32]) option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10]) diff --git a/tests/dictionaries/60extra_help/makedict/base.json b/tests/dictionaries/60extra_help/makedict/base.json index b547da3d..e7ce63c0 100644 --- a/tests/dictionaries/60extra_help/makedict/base.json +++ b/tests/dictionaries/60extra_help/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/60extra_help/tiramisu/base.py b/tests/dictionaries/60extra_help/tiramisu/base.py index 957f0cbf..fe6f95c3 100644 --- a/tests/dictionaries/60extra_help/tiramisu/base.py +++ b/tests/dictionaries/60extra_help/tiramisu/base.py @@ -31,6 +31,8 @@ option_20 = StrOption(name="source", doc="source", default="mailname") option_21 = BoolOption(name="activate", doc="activate", default=True) option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20, option_21]) option_12 = OptionDescription(name="files", doc="files", children=[option_13]) -option_11 = OptionDescription(name="test", doc="test", children=[option_12]) +option_22 = BoolOption(name="activate", doc="activate", default=True) +option_23 = BoolOption(name="manage", doc="manage", default=True) +option_11 = OptionDescription(name="test", doc="test", children=[option_12, option_22, option_23]) option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10]) diff --git a/tests/dictionaries/70container_files/makedict/base.json b/tests/dictionaries/70container_files/makedict/base.json index 5c1982e6..a282ce2a 100644 --- a/tests/dictionaries/70container_files/makedict/base.json +++ b/tests/dictionaries/70container_files/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.rougail_conf.engine": "creole", "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.included": "no", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.rougail_conf.engine": "creole", "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.included": "no", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_files/tiramisu/base.py b/tests/dictionaries/70container_files/tiramisu/base.py index 0acabdb4..da69b45c 100644 --- a/tests/dictionaries/70container_files/tiramisu/base.py +++ b/tests/dictionaries/70container_files/tiramisu/base.py @@ -33,6 +33,8 @@ option_23 = StrOption(name="source", doc="source", default="rougail.conf") option_24 = BoolOption(name="activate", doc="activate", default=True) option_16 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_25 = BoolOption(name="activate", doc="activate", default=True) +option_26 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_25, option_26]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json index 8cfd02e9..5a6d32c4 100644 --- a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json @@ -1 +1 @@ -{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.file_name2": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true} +{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.file_name2": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py index c9fcc836..9e7595d9 100644 --- a/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi/tiramisu/base.py @@ -33,6 +33,8 @@ option_23 = StrOption(name="source", doc="source", default="mailname2") option_24 = BoolOption(name="activate", doc="activate", default=True) option_16 = OptionDescription(name="mailname2", doc="mailname2", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_25 = BoolOption(name="activate", doc="activate", default=True) +option_26 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_25, option_26]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json index 033c82ba..3538f49e 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json @@ -1 +1 @@ -{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.file_name2": ["/etc/mailname3", "/etc/mailname4"], "rougail.var": ["mailname", "mailname2"], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.variable": ["mailname", "mailname2"], "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.variable": ["mailname", "mailname2"], "services.test.files.mailname2.activate": true} +{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.file_name2": ["/etc/mailname3", "/etc/mailname4"], "rougail.var": ["mailname", "mailname2"], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.variable": ["mailname", "mailname2"], "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.variable": ["mailname", "mailname2"], "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py index 56484d2b..d5633dff 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_multi_variable/tiramisu/base.py @@ -36,6 +36,8 @@ option_26 = SymLinkOption(name="variable", opt=option_4) option_27 = BoolOption(name="activate", doc="activate", default=True) option_18 = OptionDescription(name="mailname2", doc="mailname2", children=[option_19, option_20, option_21, option_22, option_23, option_24, option_25, option_26, option_27]) option_7 = OptionDescription(name="files", doc="files", children=[option_8, option_18]) -option_6 = OptionDescription(name="test", doc="test", children=[option_7]) +option_28 = BoolOption(name="activate", doc="activate", default=True) +option_29 = BoolOption(name="manage", doc="manage", default=True) +option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_28, option_29]) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json index 76d2eb22..74235a0b 100644 --- a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json @@ -1 +1 @@ -{"rougail.file_name": "/etc/mailname", "rougail.var": "mailname", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true} +{"rougail.file_name": "/etc/mailname", "rougail.var": "mailname", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py index 471af7af..f23e7903 100644 --- a/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py +++ b/tests/dictionaries/70container_files_symlink_variable/tiramisu/base.py @@ -25,6 +25,8 @@ option_15 = SymLinkOption(name="variable", opt=option_3) option_16 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname", doc="mailname", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_17 = BoolOption(name="activate", doc="activate", default=True) +option_18 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_17, option_18]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_files_twice/makedict/base.json b/tests/dictionaries/70container_files_twice/makedict/base.json index e5a25611..bd97710f 100644 --- a/tests/dictionaries/70container_files_twice/makedict/base.json +++ b/tests/dictionaries/70container_files_twice/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname_1.engine": "creole", "services.test.files.mailname_1.group": "root", "services.test.files.mailname_1.included": "no", "services.test.files.mailname_1.mode": "0644", "services.test.files.mailname_1.name": "/etc/eole/mailname", "services.test.files.mailname_1.owner": "root", "services.test.files.mailname_1.source": "mailname", "services.test.files.mailname_1.activate": true, "services.test.files.rougail_conf.engine": "creole", "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.included": "no", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname_1.engine": "creole", "services.test.files.mailname_1.group": "root", "services.test.files.mailname_1.included": "no", "services.test.files.mailname_1.mode": "0644", "services.test.files.mailname_1.name": "/etc/eole/mailname", "services.test.files.mailname_1.owner": "root", "services.test.files.mailname_1.source": "mailname", "services.test.files.mailname_1.activate": true, "services.test.files.rougail_conf.engine": "creole", "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.included": "no", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_files_twice/tiramisu/base.py b/tests/dictionaries/70container_files_twice/tiramisu/base.py index 3ae65529..82a665d0 100644 --- a/tests/dictionaries/70container_files_twice/tiramisu/base.py +++ b/tests/dictionaries/70container_files_twice/tiramisu/base.py @@ -42,6 +42,8 @@ option_32 = StrOption(name="source", doc="source", default="rougail.conf") option_33 = BoolOption(name="activate", doc="activate", default=True) option_25 = OptionDescription(name="rougail_conf", doc="rougail.conf", children=[option_26, option_27, option_28, option_29, option_30, option_31, option_32, option_33]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16, option_25]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_34 = BoolOption(name="activate", doc="activate", default=True) +option_35 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_34, option_35]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_filesmulti/makedict/base.json b/tests/dictionaries/70container_filesmulti/makedict/base.json index b550e233..4ea58299 100644 --- a/tests/dictionaries/70container_filesmulti/makedict/base.json +++ b/tests/dictionaries/70container_filesmulti/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "creole", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "creole", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_filesmulti/tiramisu/base.py b/tests/dictionaries/70container_filesmulti/tiramisu/base.py index 56e85914..27d5b8c6 100644 --- a/tests/dictionaries/70container_filesmulti/tiramisu/base.py +++ b/tests/dictionaries/70container_filesmulti/tiramisu/base.py @@ -33,6 +33,8 @@ option_23 = StrOption(name="source", doc="source", default="mailname2") option_24 = BoolOption(name="activate", doc="activate", default=True) option_16 = OptionDescription(name="mailname2", doc="mailname2", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_25 = BoolOption(name="activate", doc="activate", default=True) +option_26 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_25, option_26]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_filesredefine/makedict/base.json b/tests/dictionaries/70container_filesredefine/makedict/base.json index cf75774e..3ffb0e06 100644 --- a/tests/dictionaries/70container_filesredefine/makedict/base.json +++ b/tests/dictionaries/70container_filesredefine/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname_new.engine": "creole", "services.test.files.mailname_new.group": "root", "services.test.files.mailname_new.included": "no", "services.test.files.mailname_new.mode": "0644", "services.test.files.mailname_new.name": "/etc/mailname", "services.test.files.mailname_new.owner": "root", "services.test.files.mailname_new.source": "mailname.new", "services.test.files.mailname_new.activate": true} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname_new.engine": "creole", "services.test.files.mailname_new.group": "root", "services.test.files.mailname_new.included": "no", "services.test.files.mailname_new.mode": "0644", "services.test.files.mailname_new.name": "/etc/mailname", "services.test.files.mailname_new.owner": "root", "services.test.files.mailname_new.source": "mailname.new", "services.test.files.mailname_new.activate": true, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_filesredefine/tiramisu/base.py b/tests/dictionaries/70container_filesredefine/tiramisu/base.py index 13430e4c..685264a4 100644 --- a/tests/dictionaries/70container_filesredefine/tiramisu/base.py +++ b/tests/dictionaries/70container_filesredefine/tiramisu/base.py @@ -24,6 +24,8 @@ option_14 = StrOption(name="source", doc="source", default="mailname.new") option_15 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="mailname_new", doc="mailname.new", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) -option_5 = OptionDescription(name="test", doc="test", children=[option_6]) +option_16 = BoolOption(name="activate", doc="activate", default=True) +option_17 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_new/makedict/base.json b/tests/dictionaries/70container_new/makedict/base.json index eb10bec4..0ecf390c 100644 --- a/tests/dictionaries/70container_new/makedict/base.json +++ b/tests/dictionaries/70container_new/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui"} +{"rougail.general.mode_conteneur_actif": "oui", "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_new/tiramisu/base.py b/tests/dictionaries/70container_new/tiramisu/base.py index 9b97268a..09c5d721 100644 --- a/tests/dictionaries/70container_new/tiramisu/base.py +++ b/tests/dictionaries/70container_new/tiramisu/base.py @@ -14,6 +14,8 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_5 = OptionDescription(name="test", doc="test", children=[]) +option_6 = BoolOption(name="activate", doc="activate", default=True) +option_7 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_7]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_newnocont/makedict/base.json b/tests/dictionaries/70container_newnocont/makedict/base.json index 797595b0..e894f5f6 100644 --- a/tests/dictionaries/70container_newnocont/makedict/base.json +++ b/tests/dictionaries/70container_newnocont/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{"rougail.general.mode_conteneur_actif": "non", "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_newnocont/tiramisu/base.py b/tests/dictionaries/70container_newnocont/tiramisu/base.py index 621b70cf..34a9ad0e 100644 --- a/tests/dictionaries/70container_newnocont/tiramisu/base.py +++ b/tests/dictionaries/70container_newnocont/tiramisu/base.py @@ -14,6 +14,8 @@ except: 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="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_5 = OptionDescription(name="test", doc="test", children=[]) +option_6 = BoolOption(name="activate", doc="activate", default=True) +option_7 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_7]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70container_newwithip/makedict/base.json b/tests/dictionaries/70container_newwithip/makedict/base.json index 7d28fa93..7b52a6a6 100644 --- a/tests/dictionaries/70container_newwithip/makedict/base.json +++ b/tests/dictionaries/70container_newwithip/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.adresse_ip_test": null} +{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.adresse_ip_test": null, "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70container_newwithip/tiramisu/base.py b/tests/dictionaries/70container_newwithip/tiramisu/base.py index e5b8fb5d..41c1d6cf 100644 --- a/tests/dictionaries/70container_newwithip/tiramisu/base.py +++ b/tests/dictionaries/70container_newwithip/tiramisu/base.py @@ -15,6 +15,8 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui" option_4 = IPOption(name="adresse_ip_test", doc="No change", allow_reserved=True, 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_6 = OptionDescription(name="test", doc="test", children=[]) +option_7 = BoolOption(name="activate", doc="activate", default=True) +option_8 = BoolOption(name="manage", doc="manage", default=True) +option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_8]) option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/70container_services/makedict/base.json b/tests/dictionaries/70container_services/makedict/base.json deleted file mode 100644 index eb10bec4..00000000 --- a/tests/dictionaries/70container_services/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "oui"} diff --git a/tests/dictionaries/70container_services/00-base.xml b/tests/dictionaries/70service_base/00-base.xml similarity index 100% rename from tests/dictionaries/70container_services/00-base.xml rename to tests/dictionaries/70service_base/00-base.xml diff --git a/tests/dictionaries/70container_services/__init__.py b/tests/dictionaries/70service_base/__init__.py similarity index 100% rename from tests/dictionaries/70container_services/__init__.py rename to tests/dictionaries/70service_base/__init__.py diff --git a/tests/dictionaries/70service_base/makedict/base.json b/tests/dictionaries/70service_base/makedict/base.json new file mode 100644 index 00000000..bf877dda --- /dev/null +++ b/tests/dictionaries/70service_base/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "oui", "services.testsrv.activate": true, "services.testsrv.manage": true} diff --git a/tests/dictionaries/70container_services/tiramisu/base.py b/tests/dictionaries/70service_base/tiramisu/base.py similarity index 87% rename from tests/dictionaries/70container_services/tiramisu/base.py rename to tests/dictionaries/70service_base/tiramisu/base.py index 6683d20a..84476b71 100644 --- a/tests/dictionaries/70container_services/tiramisu/base.py +++ b/tests/dictionaries/70service_base/tiramisu/base.py @@ -14,6 +14,8 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[]) +option_6 = BoolOption(name="activate", doc="activate", default=True) +option_7 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="testsrv", doc="testsrv", children=[option_6, option_7]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70service_not_managed/makedict/base.json b/tests/dictionaries/70service_not_managed/makedict/base.json index 92216d08..cd8226be 100644 --- a/tests/dictionaries/70service_not_managed/makedict/base.json +++ b/tests/dictionaries/70service_not_managed/makedict/base.json @@ -1 +1 @@ -{"rougail.var": "mailname", "services.test.files.test.engine": "creole", "services.test.files.test.group": "root", "services.test.files.test.included": "no", "services.test.files.test.mode": "0644", "services.test.files.test.name": "/tmp/test", "services.test.files.test.owner": "root", "services.test.files.test.source": "test", "services.test.files.test.activate": true} +{"rougail.var": "mailname", "services.test.files.test.engine": "creole", "services.test.files.test.group": "root", "services.test.files.test.included": "no", "services.test.files.test.mode": "0644", "services.test.files.test.name": "/tmp/test", "services.test.files.test.owner": "root", "services.test.files.test.source": "test", "services.test.files.test.activate": true, "services.test.activate": true, "services.test.manage": false} diff --git a/tests/dictionaries/70service_not_managed/tiramisu/base.py b/tests/dictionaries/70service_not_managed/tiramisu/base.py index 5bd8829a..7c51f1d8 100644 --- a/tests/dictionaries/70service_not_managed/tiramisu/base.py +++ b/tests/dictionaries/70service_not_managed/tiramisu/base.py @@ -23,7 +23,8 @@ option_13 = StrOption(name="source", doc="source", default="test") option_14 = BoolOption(name="activate", doc="activate", default=True) option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_8, option_9, option_10, option_11, option_12, option_13, option_14]) option_5 = OptionDescription(name="files", doc="files", children=[option_6]) -option_4 = OptionDescription(name="test", doc="test", children=[option_5]) -option_4.impl_set_information('manage', False) +option_15 = BoolOption(name="activate", doc="activate", default=True) +option_16 = BoolOption(name="manage", doc="manage", default=False) +option_4 = OptionDescription(name="test", doc="test", children=[option_5, option_15, option_16]) option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70service_servicelist/00-base.xml b/tests/dictionaries/70service_servicelist/00-base.xml new file mode 100644 index 00000000..e06cbe6b --- /dev/null +++ b/tests/dictionaries/70service_servicelist/00-base.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + no + + + + + yes + test + + + + diff --git a/tests/dictionaries/70service_servicelist/__init__.py b/tests/dictionaries/70service_servicelist/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70service_servicelist/makedict/base.json b/tests/dictionaries/70service_servicelist/makedict/base.json new file mode 100644 index 00000000..c53768ff --- /dev/null +++ b/tests/dictionaries/70service_servicelist/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": "no", "services.test.activate": true, "services.test.manage": true} diff --git a/tests/dictionaries/70service_servicelist/tiramisu/base.py b/tests/dictionaries/70service_servicelist/tiramisu/base.py new file mode 100644 index 00000000..51dee229 --- /dev/null +++ b/tests/dictionaries/70service_servicelist/tiramisu/base.py @@ -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_2 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_5 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_6 = BoolOption(name="manage", doc="manage", default=True) +option_4 = OptionDescription(name="test", doc="test", children=[option_5, option_6]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70service_servicelist_file/00-base.xml b/tests/dictionaries/70service_servicelist_file/00-base.xml new file mode 100644 index 00000000..8136e01d --- /dev/null +++ b/tests/dictionaries/70service_servicelist_file/00-base.xml @@ -0,0 +1,24 @@ + + + + + /etc/file + + + + + no + + + 192.168.0.1 + + + + + no + test + + + + diff --git a/tests/dictionaries/70service_servicelist_file/__init__.py b/tests/dictionaries/70service_servicelist_file/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70service_servicelist_file/makedict/base.json b/tests/dictionaries/70service_servicelist_file/makedict/base.json new file mode 100644 index 00000000..696512dc --- /dev/null +++ b/tests/dictionaries/70service_servicelist_file/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.1", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": false, "services.test.manage": true} diff --git a/tests/dictionaries/70service_servicelist_file/result/systemd/system/test.service b/tests/dictionaries/70service_servicelist_file/result/systemd/system/test.service new file mode 120000 index 00000000..dc1dc0cd --- /dev/null +++ b/tests/dictionaries/70service_servicelist_file/result/systemd/system/test.service @@ -0,0 +1 @@ +/dev/null \ No newline at end of file diff --git a/tests/dictionaries/70service_servicelist_file/result/tmpfiles.d/rougail.conf b/tests/dictionaries/70service_servicelist_file/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70service_servicelist_file/tiramisu/base.py b/tests/dictionaries/70service_servicelist_file/tiramisu/base.py new file mode 100644 index 00000000..2709b532 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_file/tiramisu/base.py @@ -0,0 +1,31 @@ +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="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) +option_3 = IPOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.1", allow_reserved=True, properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_8 = StrOption(name="engine", doc="engine", default="creole") +option_9 = StrOption(name="group", doc="group", default="root") +option_10 = StrOption(name="included", doc="included", default="no") +option_11 = StrOption(name="mode", doc="mode", default="0644") +option_12 = FilenameOption(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="activate", doc="activate", default=True) +option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("no")}))) +option_17 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70service_servicelist_file/tmpl/file b/tests/dictionaries/70service_servicelist_file/tmpl/file new file mode 100644 index 00000000..7ecb56eb --- /dev/null +++ b/tests/dictionaries/70service_servicelist_file/tmpl/file @@ -0,0 +1 @@ +no diff --git a/tests/dictionaries/70service_servicelist_ip/00-base.xml b/tests/dictionaries/70service_servicelist_ip/00-base.xml new file mode 100644 index 00000000..0eee58a5 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_ip/00-base.xml @@ -0,0 +1,24 @@ + + + + + nut_monitor_host + + + + + no + + + 192.168.0.1 + + + + + no + test + + + + diff --git a/tests/dictionaries/70service_servicelist_ip/__init__.py b/tests/dictionaries/70service_servicelist_ip/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70service_servicelist_ip/makedict/base.json b/tests/dictionaries/70service_servicelist_ip/makedict/base.json new file mode 100644 index 00000000..099b2ab3 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_ip/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.1", "services.test.ip.nut_monitor_host.name": "192.168.0.1", "services.test.ip.nut_monitor_host.activate": true, "services.test.activate": false, "services.test.manage": true} diff --git a/tests/dictionaries/70service_servicelist_ip/result/systemd/system/test.service b/tests/dictionaries/70service_servicelist_ip/result/systemd/system/test.service new file mode 120000 index 00000000..dc1dc0cd --- /dev/null +++ b/tests/dictionaries/70service_servicelist_ip/result/systemd/system/test.service @@ -0,0 +1 @@ +/dev/null \ No newline at end of file diff --git a/tests/dictionaries/70service_servicelist_ip/result/tmpfiles.d/rougail.conf b/tests/dictionaries/70service_servicelist_ip/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70service_servicelist_ip/tiramisu/base.py b/tests/dictionaries/70service_servicelist_ip/tiramisu/base.py new file mode 100644 index 00000000..26cbfc85 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_ip/tiramisu/base.py @@ -0,0 +1,25 @@ +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="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) +option_3 = IPOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.1", allow_reserved=True, properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_8 = SymLinkOption(name="name", opt=option_3) +option_9 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9]) +option_6 = OptionDescription(name="ip", doc="ip", children=[option_7]) +option_10 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("no")}))) +option_11 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_10, option_11]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70service_servicelist_not_managed/00-base.xml b/tests/dictionaries/70service_servicelist_not_managed/00-base.xml new file mode 100644 index 00000000..f9fc0eb5 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_not_managed/00-base.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + no + + + + + yes + test + + + + diff --git a/tests/dictionaries/70service_servicelist_not_managed/__init__.py b/tests/dictionaries/70service_servicelist_not_managed/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70service_servicelist_not_managed/makedict/base.json b/tests/dictionaries/70service_servicelist_not_managed/makedict/base.json new file mode 100644 index 00000000..f8798a39 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_not_managed/makedict/base.json @@ -0,0 +1 @@ +{"rougail.condition": "no", "services.test.activate": true, "services.test.manage": false} diff --git a/tests/dictionaries/70service_servicelist_not_managed/tiramisu/base.py b/tests/dictionaries/70service_servicelist_not_managed/tiramisu/base.py new file mode 100644 index 00000000..dc47598e --- /dev/null +++ b/tests/dictionaries/70service_servicelist_not_managed/tiramisu/base.py @@ -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_2 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_5 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_6 = BoolOption(name="manage", doc="manage", default=False) +option_4 = OptionDescription(name="test", doc="test", children=[option_5, option_6]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70services_ip/makedict/base.json b/tests/dictionaries/70services_ip/makedict/base.json index 74e4766a..df145db7 100644 --- a/tests/dictionaries/70services_ip/makedict/base.json +++ b/tests/dictionaries/70services_ip/makedict/base.json @@ -1 +1 @@ -{"rougail.nut_monitor_host": "192.168.0.1", "services.nut.ip.nut_monitor_host.name": "192.168.0.1", "services.nut.ip.nut_monitor_host.activate": true} +{"rougail.nut_monitor_host": "192.168.0.1", "services.nut.ip.nut_monitor_host.name": "192.168.0.1", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} diff --git a/tests/dictionaries/70services_ip/tiramisu/base.py b/tests/dictionaries/70services_ip/tiramisu/base.py index 0e134fd1..33b61ad6 100644 --- a/tests/dictionaries/70services_ip/tiramisu/base.py +++ b/tests/dictionaries/70services_ip/tiramisu/base.py @@ -17,6 +17,8 @@ option_7 = SymLinkOption(name="name", opt=option_2) option_8 = BoolOption(name="activate", doc="activate", default=True) option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8]) option_5 = OptionDescription(name="ip", doc="ip", children=[option_6]) -option_4 = OptionDescription(name="nut", doc="nut", children=[option_5]) +option_9 = BoolOption(name="activate", doc="activate", default=True) +option_10 = BoolOption(name="manage", doc="manage", default=True) +option_4 = OptionDescription(name="nut", doc="nut", children=[option_5, option_9, option_10]) option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70services_ip_cidr/makedict/base.json b/tests/dictionaries/70services_ip_cidr/makedict/base.json index 36dc5789..cc6e1280 100644 --- a/tests/dictionaries/70services_ip_cidr/makedict/base.json +++ b/tests/dictionaries/70services_ip_cidr/makedict/base.json @@ -1 +1 @@ -{"rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true} +{"rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} diff --git a/tests/dictionaries/70services_ip_cidr/tiramisu/base.py b/tests/dictionaries/70services_ip_cidr/tiramisu/base.py index 0ecd07a9..1f5ca44d 100644 --- a/tests/dictionaries/70services_ip_cidr/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_cidr/tiramisu/base.py @@ -17,6 +17,8 @@ option_7 = SymLinkOption(name="name", opt=option_2) option_8 = BoolOption(name="activate", doc="activate", default=True) option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8]) option_5 = OptionDescription(name="ip", doc="ip", children=[option_6]) -option_4 = OptionDescription(name="nut", doc="nut", children=[option_5]) +option_9 = BoolOption(name="activate", doc="activate", default=True) +option_10 = BoolOption(name="manage", doc="manage", default=True) +option_4 = OptionDescription(name="nut", doc="nut", children=[option_5, option_9, option_10]) option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70services_ip_iplist/makedict/base.json b/tests/dictionaries/70services_ip_iplist/makedict/base.json index cba8fcc6..4cdf6f51 100644 --- a/tests/dictionaries/70services_ip_iplist/makedict/base.json +++ b/tests/dictionaries/70services_ip_iplist/makedict/base.json @@ -1 +1 @@ -{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true} +{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} diff --git a/tests/dictionaries/70services_ip_iplist/tiramisu/base.py b/tests/dictionaries/70services_ip_iplist/tiramisu/base.py index f5bfbfea..d13f6ed7 100644 --- a/tests/dictionaries/70services_ip_iplist/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_iplist/tiramisu/base.py @@ -18,6 +18,8 @@ option_8 = SymLinkOption(name="name", opt=option_3) option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9]) option_6 = OptionDescription(name="ip", doc="ip", children=[option_7]) -option_5 = OptionDescription(name="nut", doc="nut", children=[option_6]) +option_10 = BoolOption(name="activate", doc="activate", default=True) +option_11 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="nut", doc="nut", children=[option_6, option_10, option_11]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70services_ip_iplist2/makedict/base.json b/tests/dictionaries/70services_ip_iplist2/makedict/base.json index a65ce884..3d3a13a2 100644 --- a/tests/dictionaries/70services_ip_iplist2/makedict/base.json +++ b/tests/dictionaries/70services_ip_iplist2/makedict/base.json @@ -1 +1 @@ -{"rougail.condition": "yes", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": false} +{"rougail.condition": "yes", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": false, "services.nut.activate": true, "services.nut.manage": true} diff --git a/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py b/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py index 76252065..de18fcf7 100644 --- a/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py @@ -18,6 +18,8 @@ option_8 = SymLinkOption(name="name", opt=option_3) option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9]) option_6 = OptionDescription(name="ip", doc="ip", children=[option_7]) -option_5 = OptionDescription(name="nut", doc="nut", children=[option_6]) +option_10 = BoolOption(name="activate", doc="activate", default=True) +option_11 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="nut", doc="nut", children=[option_6, option_10, option_11]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70services_ip_leadership/makedict/base.json b/tests/dictionaries/70services_ip_leadership/makedict/base.json index 52a897a6..c09ba74a 100644 --- a/tests/dictionaries/70services_ip_leadership/makedict/base.json +++ b/tests/dictionaries/70services_ip_leadership/makedict/base.json @@ -1 +1 @@ -{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": [{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": "255.255.255.0", "rougail.general.nut_monitor_netmask.nut_monitor_host": "192.168.1.0"}], "services.ntp.ip.nut_monitor_host.name": ["192.168.1.0"], "services.ntp.ip.nut_monitor_host.netmask": ["255.255.255.0"], "services.ntp.ip.nut_monitor_host.activate": true} +{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": [{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": "255.255.255.0", "rougail.general.nut_monitor_netmask.nut_monitor_host": "192.168.1.0"}], "services.ntp.ip.nut_monitor_host.name": ["192.168.1.0"], "services.ntp.ip.nut_monitor_host.netmask": ["255.255.255.0"], "services.ntp.ip.nut_monitor_host.activate": true, "services.ntp.activate": true, "services.ntp.manage": true} diff --git a/tests/dictionaries/70services_ip_leadership/tiramisu/base.py b/tests/dictionaries/70services_ip_leadership/tiramisu/base.py index 55440d9f..94ae54e7 100644 --- a/tests/dictionaries/70services_ip_leadership/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_leadership/tiramisu/base.py @@ -21,6 +21,8 @@ option_11 = SymLinkOption(name="netmask", opt=option_4) option_12 = BoolOption(name="activate", doc="activate", default=True) option_9 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_10, option_11, option_12]) option_8 = OptionDescription(name="ip", doc="ip", children=[option_9]) -option_7 = OptionDescription(name="ntp", doc="ntp", children=[option_8]) +option_13 = BoolOption(name="activate", doc="activate", default=True) +option_14 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="ntp", doc="ntp", children=[option_8, option_13, option_14]) option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/70services_ip_multi/makedict/base.json b/tests/dictionaries/70services_ip_multi/makedict/base.json index ca9e7792..62d6534c 100644 --- a/tests/dictionaries/70services_ip_multi/makedict/base.json +++ b/tests/dictionaries/70services_ip_multi/makedict/base.json @@ -1 +1 @@ -{"rougail.nut_monitor_host": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.name": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.activate": true} +{"rougail.nut_monitor_host": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.name": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} diff --git a/tests/dictionaries/70services_ip_multi/tiramisu/base.py b/tests/dictionaries/70services_ip_multi/tiramisu/base.py index a0789ee5..e4c17c0c 100644 --- a/tests/dictionaries/70services_ip_multi/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_multi/tiramisu/base.py @@ -17,6 +17,8 @@ option_7 = SymLinkOption(name="name", opt=option_2) option_8 = BoolOption(name="activate", doc="activate", default=True) option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8]) option_5 = OptionDescription(name="ip", doc="ip", children=[option_6]) -option_4 = OptionDescription(name="nut", doc="nut", children=[option_5]) +option_9 = BoolOption(name="activate", doc="activate", default=True) +option_10 = BoolOption(name="manage", doc="manage", default=True) +option_4 = OptionDescription(name="nut", doc="nut", children=[option_5, option_9, option_10]) option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/dictionaries/70services_ip_network/makedict/base.json b/tests/dictionaries/70services_ip_network/makedict/base.json index 1ca4cbe1..7ba68352 100644 --- a/tests/dictionaries/70services_ip_network/makedict/base.json +++ b/tests/dictionaries/70services_ip_network/makedict/base.json @@ -1 +1 @@ -{"rougail.nut_monitor_netmask": "255.255.255.0", "rougail.nut_monitor_host": "192.168.0.0", "services.nut.ip.nut_monitor_host.name": "192.168.0.0", "services.nut.ip.nut_monitor_host.netmask": "255.255.255.0", "services.nut.ip.nut_monitor_host.activate": true} +{"rougail.nut_monitor_netmask": "255.255.255.0", "rougail.nut_monitor_host": "192.168.0.0", "services.nut.ip.nut_monitor_host.name": "192.168.0.0", "services.nut.ip.nut_monitor_host.netmask": "255.255.255.0", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} diff --git a/tests/dictionaries/70services_ip_network/tiramisu/base.py b/tests/dictionaries/70services_ip_network/tiramisu/base.py index 41afffd5..992b4c29 100644 --- a/tests/dictionaries/70services_ip_network/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_network/tiramisu/base.py @@ -19,6 +19,8 @@ option_9 = SymLinkOption(name="netmask", opt=option_2) option_10 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9, option_10]) option_6 = OptionDescription(name="ip", doc="ip", children=[option_7]) -option_5 = OptionDescription(name="nut", doc="nut", children=[option_6]) +option_11 = BoolOption(name="activate", doc="activate", default=True) +option_12 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="nut", doc="nut", children=[option_6, option_11, option_12]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json b/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json index 65c9c77a..81ff5591 100644 --- a/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json +++ b/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json @@ -1 +1 @@ -{"rougail.nut_monitor_host": null, "services.nut.ip.nut_monitor_host.name": null, "services.nut.ip.nut_monitor_host.activate": true} +{"rougail.nut_monitor_host": null, "services.nut.ip.nut_monitor_host.name": null, "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} diff --git a/tests/dictionaries/70services_ip_not_mandatory/tiramisu/base.py b/tests/dictionaries/70services_ip_not_mandatory/tiramisu/base.py index 52078d73..e71c0c20 100644 --- a/tests/dictionaries/70services_ip_not_mandatory/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_not_mandatory/tiramisu/base.py @@ -17,6 +17,8 @@ option_7 = SymLinkOption(name="name", opt=option_2) option_8 = BoolOption(name="activate", doc="activate", default=True) option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8]) option_5 = OptionDescription(name="ip", doc="ip", children=[option_6]) -option_4 = OptionDescription(name="nut", doc="nut", children=[option_5]) +option_9 = BoolOption(name="activate", doc="activate", default=True) +option_10 = BoolOption(name="manage", doc="manage", default=True) +option_4 = OptionDescription(name="nut", doc="nut", children=[option_5, option_9, option_10]) option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) diff --git a/tests/test_3_template.py b/tests/test_3_template.py index a637cf0e..1bb423df 100644 --- a/tests/test_3_template.py +++ b/tests/test_3_template.py @@ -1,5 +1,5 @@ from os import listdir, mkdir -from os.path import join, isdir, isfile +from os.path import join, isdir, isfile, islink from shutil import rmtree from pytest import fixture, mark from lxml.etree import parse @@ -82,6 +82,8 @@ async def test_dictionary(test_dir): assert list_templates == list_results for result in list_results: template_file = join(dest_dir, result) + if islink(template_file) and islink(join(test_dir, 'result', result)): + continue if not isfile(template_file): raise Exception(f'{template_file} is not generated') with open(join(test_dir, 'result', result), 'r') as fh: From 38e54fe187f4de1aacbed1c94c4e7344637a5471 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 21 Feb 2021 19:51:09 +0100 Subject: [PATCH 141/168] tests: pretty print json in dump --- tests/dictionaries/00empty/makedict/base.json | 5 +- .../00load_autofreeze/makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../00load_autosave/makedict/base.json | 4 +- .../00load_autosaveexpert/makedict/base.json | 4 +- .../00load_comment/makedict/base.json | 4 +- .../00load_notype/makedict/base.json | 5 +- .../00load_save/makedict/base.json | 4 +- .../00load_subfolder/makedict/base.json | 5 +- .../01auto_autofreeze/makedict/base.json | 5 +- .../01auto_base/makedict/base.json | 5 +- .../01auto_withoutparam/makedict/base.json | 5 +- .../01base_domainname/makedict/base.json | 4 +- .../01base_file/makedict/base.json | 22 ++++++++- .../01base_file_include/makedict/base.json | 22 ++++++++- .../makedict/base.json | 30 +++++++++++- .../makedict/base.json | 30 +++++++++++- .../01base_file_patch/makedict/base.json | 22 ++++++++- .../01base_file_utfchar/makedict/base.json | 22 ++++++++- .../01base_float/makedict/base.json | 7 ++- .../01base_help_quote/makedict/base.json | 5 +- .../01base_multi/makedict/base.json | 6 ++- .../makedict/base.json | 4 +- .../makedict/base.json | 4 +- .../makedict/base.json | 4 +- .../makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../01base_value_quote/makedict/base.json | 4 +- .../makedict/base.json | 4 +- .../01family_description/makedict/base.json | 4 +- .../01fill_autofreeze/makedict/base.json | 6 ++- .../01fill_autosave/makedict/base.json | 5 +- .../01fill_base/makedict/base.json | 5 +- .../01fill_baseaccent/makedict/base.json | 5 +- .../01fill_mandatory/makedict/base.json | 5 +- .../01fill_number/makedict/base.json | 5 +- .../01fill_only_optional/makedict/base.json | 5 +- .../01fill_optional/makedict/base.json | 5 +- .../01fill_quote/makedict/base.json | 7 ++- .../01fill_target_optional/makedict/base.json | 4 +- .../makedict/base.json | 5 +- tests/dictionaries/01test/makedict/base.json | 4 +- .../01test_multi/makedict/base.json | 4 +- .../01test_multi_none/makedict/base.json | 4 +- .../01test_redefine/makedict/base.json | 4 +- .../01test_redefine_base/makedict/base.json | 4 +- .../01test_redefine_remove/makedict/base.json | 4 +- .../makedict/base.json | 5 +- .../10autosave_hidden/makedict/base.json | 5 +- .../10check_base/makedict/base.json | 5 +- .../makedict/base.json | 4 +- .../10check_no_param/makedict/base.json | 5 +- .../10check_option/makedict/base.json | 6 ++- .../10check_optional/makedict/base.json | 6 ++- .../10check_valid_differ/makedict/base.json | 5 +- .../makedict/base.json | 7 ++- .../makedict/base.json | 7 ++- .../makedict/base.json | 7 ++- .../makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../10fill_information/makedict/base.json | 4 +- .../makedict/base.json | 6 ++- .../10leadership_append/makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../10leadership_auto/makedict/base.json | 5 +- .../makedict/base.json | 17 ++++++- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../10leadership_mandatory/makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../10leadership_multi/makedict/base.json | 6 ++- .../10load_disabled_if_in/makedict/base.json | 6 ++- .../makedict/base.json | 5 +- .../makedict/base.json | 4 +- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 15 +++++- .../makedict/base.json | 15 +++++- .../makedict/base.json | 15 +++++- .../makedict/base.json | 15 +++++- .../makedict/base.json | 14 +++++- .../makedict/base.json | 6 ++- .../makedict/base.json | 5 +- .../makedict/base.json | 6 ++- .../makedict/base.json | 7 ++- .../makedict/base.json | 15 +++++- .../makedict/base.json | 4 +- .../makedict/base.json | 5 +- .../makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../10load_emptyvalue/makedict/base.json | 5 +- .../10load_frozenifin/makedict/base.json | 6 ++- .../10load_frozenifin_auto/makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../10load_frozenifnotin/makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../makedict/base.json | 7 ++- .../10load_leadership/makedict/base.json | 5 +- .../makedict/base.json | 7 ++- .../makedict/base.json | 18 ++++++- .../makedict/base.json | 13 ++++- .../makedict/base.json | 5 +- .../10load_leadership_name/makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../10load_mandatoryifin/makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../10load_multivalue/makedict/base.json | 7 ++- .../10valid_enum_accent/makedict/base.json | 5 +- .../10valid_enum_base/makedict/base.json | 5 +- .../makedict/base.json | 6 ++- .../10valid_enum_leader/makedict/base.json | 5 +- .../10valid_enum_mandatory/makedict/base.json | 5 +- .../10valid_enum_multi/makedict/base.json | 7 ++- .../10valid_enum_none/makedict/base.json | 5 +- .../10valid_enum_number/makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../makedict/base.json | 5 +- .../10valid_enum_quote/makedict/base.json | 5 +- .../10valid_enum_value/makedict/base.json | 4 +- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 14 +++++- .../makedict/base.json | 14 +++++- .../makedict/base.json | 14 +++++- .../makedict/base.json | 24 +++++++++- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 15 +++++- .../11valid_enum_variable/makedict/base.json | 9 +++- .../20family_append/makedict/base.json | 5 +- .../20family_appendaccent/makedict/base.json | 6 ++- .../20family_dynamic/makedict/base.json | 9 +++- .../20family_dynamic_calc/makedict/base.json | 10 +++- .../20family_dynamic_calc2/makedict/base.json | 10 +++- .../makedict/base.json | 10 +++- .../makedict/base.json | 9 +++- .../makedict/base.json | 10 +++- .../20family_empty/makedict/base.json | 4 +- .../20family_hidden/makedict/base.json | 4 +- .../20family_mode/makedict/base.json | 4 +- .../makedict/base.json | 5 +- .../20notemplating/makedict/base.json | 14 +++++- .../20override/makedict/base.json | 16 ++++++- .../makedict/base.json | 10 +++- .../20override_source/makedict/base.json | 10 +++- .../21family_empty/makedict/base.json | 4 +- .../makedict/base.json | 4 +- .../makedict/base.json | 4 +- .../30mandatory_withvalue/makedict/base.json | 4 +- .../makedict/base.json | 4 +- .../40condition_base/makedict/base.json | 7 ++- .../40condition_base_add/makedict/base.json | 7 ++- .../40condition_fallback/makedict/base.json | 4 +- .../40condition_optional/makedict/base.json | 6 ++- .../makedict/base.json | 6 ++- .../makedict/base.json | 4 +- .../40empty_param/makedict/base.json | 5 +- .../40empty_param2/makedict/base.json | 5 +- .../makedict/base.json | 10 +++- .../40ifin_leadership/makedict/base.json | 6 ++- .../40ifin_leadershipauto/makedict/base.json | 21 ++++++++- .../makedict/base.json | 34 +++++++++++++- .../40ifin_multi/makedict/base.json | 6 ++- .../40ifin_validenum/makedict/base.json | 5 +- .../45extra_without_family/makedict/base.json | 15 +++++- .../45multi_family/makedict/base.json | 4 +- .../45multi_family_basic/makedict/base.json | 4 +- .../45multi_family_expert/makedict/base.json | 4 +- .../45multi_family_order/makedict/base.json | 7 ++- .../45without_family/makedict/base.json | 4 +- .../50exists_exists/makedict/base.json | 4 +- .../50redefine_description/makedict/base.json | 4 +- .../51exists_nonexists/makedict/base.json | 6 ++- .../51exists_redefine/makedict/base.json | 4 +- .../51redefine_auto/makedict/base.json | 4 +- .../51redefine_autofill/makedict/base.json | 4 +- .../51redefine_family/makedict/base.json | 5 +- .../51redefine_fill/makedict/base.json | 4 +- .../51redefine_fillauto/makedict/base.json | 4 +- .../51redefine_help/makedict/base.json | 4 +- .../51redefine_hidden/makedict/base.json | 4 +- .../makedict/base.json | 4 +- .../makedict/base.json | 7 ++- .../makedict/base.json | 8 +++- .../51redefine_validenum/makedict/base.json | 4 +- .../51redefine_value/makedict/base.json | 5 +- .../51remove_fill/makedict/base.json | 5 +- .../52exists_redefine/makedict/base.json | 4 +- .../60action_external/makedict/base.json | 6 ++- .../makedict/base.json | 10 +++- .../60extra_group/makedict/base.json | 29 +++++++++++- .../60extra_help/makedict/base.json | 18 ++++++- .../60extra_load/makedict/base.json | 8 +++- .../60extra_mandatory/makedict/base.json | 9 +++- .../60extra_name_family/makedict/base.json | 8 +++- .../60extra_no_condition/makedict/base.json | 9 +++- .../60extra_redefine/makedict/base.json | 8 +++- .../makedict/base.json | 6 ++- .../60familyaction/makedict/base.json | 5 +- .../60familyaction_accent/makedict/base.json | 5 +- .../makedict/base.json | 6 ++- .../61extra_dyn/makedict/base.json | 7 ++- .../61extra_dyn_extra/makedict/base.json | 10 +++- .../70container_files/makedict/base.json | 22 ++++++++- .../makedict/base.json | 35 +++++++++++++- .../makedict/base.json | 47 ++++++++++++++++++- .../makedict/base.json | 16 ++++++- .../makedict/base.json | 30 +++++++++++- .../70container_filesmulti/makedict/base.json | 22 ++++++++- .../makedict/base.json | 14 +++++- .../70container_new/makedict/base.json | 6 ++- .../70container_newnocont/makedict/base.json | 6 ++- .../70container_newwithip/makedict/base.json | 7 ++- .../70container_save/makedict/base.json | 4 +- .../70service_base/makedict/base.json | 6 ++- .../70service_not_managed/makedict/base.json | 14 +++++- .../70service_servicelist/makedict/base.json | 6 ++- .../makedict/base.json | 15 +++++- .../makedict/base.json | 9 +++- .../makedict/base.json | 6 ++- .../70services_ip/makedict/base.json | 8 +++- .../70services_ip_cidr/makedict/base.json | 8 +++- .../70services_ip_iplist/makedict/base.json | 9 +++- .../70services_ip_iplist2/makedict/base.json | 9 +++- .../makedict/base.json | 18 ++++++- .../70services_ip_multi/makedict/base.json | 14 +++++- .../70services_ip_network/makedict/base.json | 10 +++- .../makedict/base.json | 8 +++- tests/test_2_makedict.py | 2 +- 243 files changed, 1742 insertions(+), 243 deletions(-) diff --git a/tests/dictionaries/00empty/makedict/base.json b/tests/dictionaries/00empty/makedict/base.json index 17c919d6..df4366ea 100644 --- a/tests/dictionaries/00empty/makedict/base.json +++ b/tests/dictionaries/00empty/makedict/base.json @@ -1 +1,4 @@ -{"services.tata.activate": true, "services.tata.manage": true} +{ + "services.tata.activate": true, + "services.tata.manage": true +} diff --git a/tests/dictionaries/00load_autofreeze/makedict/base.json b/tests/dictionaries/00load_autofreeze/makedict/base.json index c9de7171..3dfb67b1 100644 --- a/tests/dictionaries/00load_autofreeze/makedict/base.json +++ b/tests/dictionaries/00load_autofreeze/makedict/base.json @@ -1 +1,4 @@ -{"rougail.myvar": "no", "rougail.instanciated_module": false} +{ + "rougail.myvar": "no", + "rougail.instanciated_module": false +} diff --git a/tests/dictionaries/00load_autofreezeexpert/makedict/base.json b/tests/dictionaries/00load_autofreezeexpert/makedict/base.json index c3ee18d2..fcfea3be 100644 --- a/tests/dictionaries/00load_autofreezeexpert/makedict/base.json +++ b/tests/dictionaries/00load_autofreezeexpert/makedict/base.json @@ -1 +1,4 @@ -{"rougail.my_var": "no", "rougail.instanciated_module": false} +{ + "rougail.my_var": "no", + "rougail.instanciated_module": false +} diff --git a/tests/dictionaries/00load_autosave/makedict/base.json b/tests/dictionaries/00load_autosave/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/00load_autosave/makedict/base.json +++ b/tests/dictionaries/00load_autosave/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/00load_autosaveexpert/makedict/base.json b/tests/dictionaries/00load_autosaveexpert/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/00load_autosaveexpert/makedict/base.json +++ b/tests/dictionaries/00load_autosaveexpert/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/00load_comment/makedict/base.json b/tests/dictionaries/00load_comment/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/00load_comment/makedict/base.json +++ b/tests/dictionaries/00load_comment/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/00load_notype/makedict/base.json b/tests/dictionaries/00load_notype/makedict/base.json index 25dbe763..983f231e 100644 --- a/tests/dictionaries/00load_notype/makedict/base.json +++ b/tests/dictionaries/00load_notype/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.without_type": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.without_type": "non" +} diff --git a/tests/dictionaries/00load_save/makedict/base.json b/tests/dictionaries/00load_save/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/00load_save/makedict/base.json +++ b/tests/dictionaries/00load_save/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/00load_subfolder/makedict/base.json b/tests/dictionaries/00load_subfolder/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/00load_subfolder/makedict/base.json +++ b/tests/dictionaries/00load_subfolder/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01auto_autofreeze/makedict/base.json b/tests/dictionaries/01auto_autofreeze/makedict/base.json index 322df539..26eea288 100644 --- a/tests/dictionaries/01auto_autofreeze/makedict/base.json +++ b/tests/dictionaries/01auto_autofreeze/makedict/base.json @@ -1 +1,4 @@ -{"rougail.instanciated_module": false, "rougail.my_variable": "yes"} +{ + "rougail.instanciated_module": false, + "rougail.my_variable": "yes" +} diff --git a/tests/dictionaries/01auto_base/makedict/base.json b/tests/dictionaries/01auto_base/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/01auto_base/makedict/base.json +++ b/tests/dictionaries/01auto_base/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01auto_withoutparam/makedict/base.json b/tests/dictionaries/01auto_withoutparam/makedict/base.json index 86ba9458..f8d69705 100644 --- a/tests/dictionaries/01auto_withoutparam/makedict/base.json +++ b/tests/dictionaries/01auto_withoutparam/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": null, + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01base_domainname/makedict/base.json b/tests/dictionaries/01base_domainname/makedict/base.json index c593c56f..ffe723c3 100644 --- a/tests/dictionaries/01base_domainname/makedict/base.json +++ b/tests/dictionaries/01base_domainname/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.domain": "my.domain.name"} +{ + "rougail.general.domain": "my.domain.name" +} diff --git a/tests/dictionaries/01base_file/makedict/base.json b/tests/dictionaries/01base_file/makedict/base.json index 65b06eec..4aeec3f1 100644 --- a/tests/dictionaries/01base_file/makedict/base.json +++ b/tests/dictionaries/01base_file/makedict/base.json @@ -1 +1,21 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.files.file2.engine": "jinja2", + "services.test.files.file2.group": "root", + "services.test.files.file2.included": "no", + "services.test.files.file2.mode": "0644", + "services.test.files.file2.name": "/etc/file2", + "services.test.files.file2.owner": "root", + "services.test.files.file2.source": "file2", + "services.test.files.file2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/01base_file_include/makedict/base.json b/tests/dictionaries/01base_file_include/makedict/base.json index 65b06eec..4aeec3f1 100644 --- a/tests/dictionaries/01base_file_include/makedict/base.json +++ b/tests/dictionaries/01base_file_include/makedict/base.json @@ -1 +1,21 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.files.file2.engine": "jinja2", + "services.test.files.file2.group": "root", + "services.test.files.file2.included": "no", + "services.test.files.file2.mode": "0644", + "services.test.files.file2.name": "/etc/file2", + "services.test.files.file2.owner": "root", + "services.test.files.file2.source": "file2", + "services.test.files.file2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/01base_file_include_content/makedict/base.json b/tests/dictionaries/01base_file_include_content/makedict/base.json index dfd8cb67..39e9f290 100644 --- a/tests/dictionaries/01base_file_include_content/makedict/base.json +++ b/tests/dictionaries/01base_file_include_content/makedict/base.json @@ -1 +1,29 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.files.incfile.engine": "creole", "services.test.files.incfile.group": "root", "services.test.files.incfile.included": "content", "services.test.files.incfile.mode": "0644", "services.test.files.incfile.name": "/etc/dir/incfile", "services.test.files.incfile.owner": "root", "services.test.files.incfile.source": "incfile", "services.test.files.incfile.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.files.file2.engine": "jinja2", + "services.test.files.file2.group": "root", + "services.test.files.file2.included": "no", + "services.test.files.file2.mode": "0644", + "services.test.files.file2.name": "/etc/file2", + "services.test.files.file2.owner": "root", + "services.test.files.file2.source": "file2", + "services.test.files.file2.activate": true, + "services.test.files.incfile.engine": "creole", + "services.test.files.incfile.group": "root", + "services.test.files.incfile.included": "content", + "services.test.files.incfile.mode": "0644", + "services.test.files.incfile.name": "/etc/dir/incfile", + "services.test.files.incfile.owner": "root", + "services.test.files.incfile.source": "incfile", + "services.test.files.incfile.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/01base_file_include_name/makedict/base.json b/tests/dictionaries/01base_file_include_name/makedict/base.json index 7eee37db..a7d36dac 100644 --- a/tests/dictionaries/01base_file_include_name/makedict/base.json +++ b/tests/dictionaries/01base_file_include_name/makedict/base.json @@ -1 +1,29 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.files.incfile.engine": "creole", "services.test.files.incfile.group": "root", "services.test.files.incfile.included": "name", "services.test.files.incfile.mode": "0644", "services.test.files.incfile.name": "/etc/dir/incfile", "services.test.files.incfile.owner": "root", "services.test.files.incfile.source": "incfile", "services.test.files.incfile.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.files.file2.engine": "jinja2", + "services.test.files.file2.group": "root", + "services.test.files.file2.included": "no", + "services.test.files.file2.mode": "0644", + "services.test.files.file2.name": "/etc/file2", + "services.test.files.file2.owner": "root", + "services.test.files.file2.source": "file2", + "services.test.files.file2.activate": true, + "services.test.files.incfile.engine": "creole", + "services.test.files.incfile.group": "root", + "services.test.files.incfile.included": "name", + "services.test.files.incfile.mode": "0644", + "services.test.files.incfile.name": "/etc/dir/incfile", + "services.test.files.incfile.owner": "root", + "services.test.files.incfile.source": "incfile", + "services.test.files.incfile.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/01base_file_patch/makedict/base.json b/tests/dictionaries/01base_file_patch/makedict/base.json index 65b06eec..4aeec3f1 100644 --- a/tests/dictionaries/01base_file_patch/makedict/base.json +++ b/tests/dictionaries/01base_file_patch/makedict/base.json @@ -1 +1,21 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.files.file2.engine": "jinja2", + "services.test.files.file2.group": "root", + "services.test.files.file2.included": "no", + "services.test.files.file2.mode": "0644", + "services.test.files.file2.name": "/etc/file2", + "services.test.files.file2.owner": "root", + "services.test.files.file2.source": "file2", + "services.test.files.file2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/01base_file_utfchar/makedict/base.json b/tests/dictionaries/01base_file_utfchar/makedict/base.json index caa2f4dc..75dfca14 100644 --- a/tests/dictionaries/01base_file_utfchar/makedict/base.json +++ b/tests/dictionaries/01base_file_utfchar/makedict/base.json @@ -1 +1,21 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.engine": "creole", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.included": "no", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true, "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.engine": "jinja2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.included": "no", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.source": "systemd-makefs@dev-disk-by\\x2dpartlabel2", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.engine": "creole", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.included": "no", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true, + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.engine": "jinja2", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.group": "root", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.included": "no", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.mode": "0644", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel2", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.owner": "root", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.source": "systemd-makefs@dev-disk-by\\x2dpartlabel2", + "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/01base_float/makedict/base.json b/tests/dictionaries/01base_float/makedict/base.json index 113d425d..99e81271 100644 --- a/tests/dictionaries/01base_float/makedict/base.json +++ b/tests/dictionaries/01base_float/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.float": 0.527, "rougail.general.float_multi": [0.527]} +{ + "rougail.general.float": 0.527, + "rougail.general.float_multi": [ + 0.527 + ] +} diff --git a/tests/dictionaries/01base_help_quote/makedict/base.json b/tests/dictionaries/01base_help_quote/makedict/base.json index d715f446..230e4fc1 100644 --- a/tests/dictionaries/01base_help_quote/makedict/base.json +++ b/tests/dictionaries/01base_help_quote/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": null} +{ + "rougail.general.mode_conteneur_actif": null, + "rougail.general.mode_conteneur_actif1": null +} diff --git a/tests/dictionaries/01base_multi/makedict/base.json b/tests/dictionaries/01base_multi/makedict/base.json index b11e88ef..feedadc6 100644 --- a/tests/dictionaries/01base_multi/makedict/base.json +++ b/tests/dictionaries/01base_multi/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": ["non"]} +{ + "rougail.general.mode_conteneur_actif": [ + "non" + ] +} diff --git a/tests/dictionaries/01base_value_doublequote/makedict/base.json b/tests/dictionaries/01base_value_doublequote/makedict/base.json index 7de2e09f..8b946678 100644 --- a/tests/dictionaries/01base_value_doublequote/makedict/base.json +++ b/tests/dictionaries/01base_value_doublequote/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "quote\""} +{ + "rougail.general.mode_conteneur_actif": "quote\"" +} diff --git a/tests/dictionaries/01base_value_doublequote2/makedict/base.json b/tests/dictionaries/01base_value_doublequote2/makedict/base.json index 0022addb..5e62b4e3 100644 --- a/tests/dictionaries/01base_value_doublequote2/makedict/base.json +++ b/tests/dictionaries/01base_value_doublequote2/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "quote'\""} +{ + "rougail.general.mode_conteneur_actif": "quote'\"" +} diff --git a/tests/dictionaries/01base_value_doublequote3/makedict/base.json b/tests/dictionaries/01base_value_doublequote3/makedict/base.json index 9495e078..6fb0f941 100644 --- a/tests/dictionaries/01base_value_doublequote3/makedict/base.json +++ b/tests/dictionaries/01base_value_doublequote3/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "quote\\\"\\'"} +{ + "rougail.general.mode_conteneur_actif": "quote\\\"\\'" +} diff --git a/tests/dictionaries/01base_value_multi_doublequote/makedict/base.json b/tests/dictionaries/01base_value_multi_doublequote/makedict/base.json index 81964b35..8fab16f4 100644 --- a/tests/dictionaries/01base_value_multi_doublequote/makedict/base.json +++ b/tests/dictionaries/01base_value_multi_doublequote/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": ["quote\""]} +{ + "rougail.general.mode_conteneur_actif": [ + "quote\"" + ] +} diff --git a/tests/dictionaries/01base_value_multi_doublequote2/makedict/base.json b/tests/dictionaries/01base_value_multi_doublequote2/makedict/base.json index 43d5306d..ca58e02d 100644 --- a/tests/dictionaries/01base_value_multi_doublequote2/makedict/base.json +++ b/tests/dictionaries/01base_value_multi_doublequote2/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": ["quote'\""]} +{ + "rougail.general.mode_conteneur_actif": [ + "quote'\"" + ] +} diff --git a/tests/dictionaries/01base_value_multi_quote/makedict/base.json b/tests/dictionaries/01base_value_multi_quote/makedict/base.json index 60a9a4fb..687df2ba 100644 --- a/tests/dictionaries/01base_value_multi_quote/makedict/base.json +++ b/tests/dictionaries/01base_value_multi_quote/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": ["quote'"]} +{ + "rougail.general.mode_conteneur_actif": [ + "quote'" + ] +} diff --git a/tests/dictionaries/01base_value_quote/makedict/base.json b/tests/dictionaries/01base_value_quote/makedict/base.json index 3ccb2eda..a2a512d5 100644 --- a/tests/dictionaries/01base_value_quote/makedict/base.json +++ b/tests/dictionaries/01base_value_quote/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "quote'"} +{ + "rougail.general.mode_conteneur_actif": "quote'" +} diff --git a/tests/dictionaries/01base_var_name_same_family/makedict/base.json b/tests/dictionaries/01base_var_name_same_family/makedict/base.json index 949887bb..03f140af 100644 --- a/tests/dictionaries/01base_var_name_same_family/makedict/base.json +++ b/tests/dictionaries/01base_var_name_same_family/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.general": "non"} +{ + "rougail.general.general": "non" +} diff --git a/tests/dictionaries/01family_description/makedict/base.json b/tests/dictionaries/01family_description/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/01family_description/makedict/base.json +++ b/tests/dictionaries/01family_description/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/01fill_autofreeze/makedict/base.json b/tests/dictionaries/01fill_autofreeze/makedict/base.json index 58c9b691..2f399273 100644 --- a/tests/dictionaries/01fill_autofreeze/makedict/base.json +++ b/tests/dictionaries/01fill_autofreeze/makedict/base.json @@ -1 +1,5 @@ -{"rougail.my_var1": "no", "rougail.my_var2": "no", "rougail.instanciated_module": false} +{ + "rougail.my_var1": "no", + "rougail.my_var2": "no", + "rougail.instanciated_module": false +} diff --git a/tests/dictionaries/01fill_autosave/makedict/base.json b/tests/dictionaries/01fill_autosave/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/01fill_autosave/makedict/base.json +++ b/tests/dictionaries/01fill_autosave/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01fill_base/makedict/base.json b/tests/dictionaries/01fill_base/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/01fill_base/makedict/base.json +++ b/tests/dictionaries/01fill_base/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01fill_baseaccent/makedict/base.json b/tests/dictionaries/01fill_baseaccent/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/01fill_baseaccent/makedict/base.json +++ b/tests/dictionaries/01fill_baseaccent/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01fill_mandatory/makedict/base.json b/tests/dictionaries/01fill_mandatory/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/01fill_mandatory/makedict/base.json +++ b/tests/dictionaries/01fill_mandatory/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01fill_number/makedict/base.json b/tests/dictionaries/01fill_number/makedict/base.json index 87a5f7d7..e807c5bf 100644 --- a/tests/dictionaries/01fill_number/makedict/base.json +++ b/tests/dictionaries/01fill_number/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": 3, "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": 3, + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01fill_only_optional/makedict/base.json b/tests/dictionaries/01fill_only_optional/makedict/base.json index 86ba9458..f8d69705 100644 --- a/tests/dictionaries/01fill_only_optional/makedict/base.json +++ b/tests/dictionaries/01fill_only_optional/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": null, + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01fill_optional/makedict/base.json b/tests/dictionaries/01fill_optional/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/01fill_optional/makedict/base.json +++ b/tests/dictionaries/01fill_optional/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01fill_quote/makedict/base.json b/tests/dictionaries/01fill_quote/makedict/base.json index 8b0ff964..478f39ef 100644 --- a/tests/dictionaries/01fill_quote/makedict/base.json +++ b/tests/dictionaries/01fill_quote/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "quote'", "rougail.general.mode_conteneur_actif1": "quote\"", "rougail.general.mode_conteneur_actif2": "quote\"'", "rougail.general.mode_conteneur_actif3": "quote\"\\'"} +{ + "rougail.general.mode_conteneur_actif": "quote'", + "rougail.general.mode_conteneur_actif1": "quote\"", + "rougail.general.mode_conteneur_actif2": "quote\"'", + "rougail.general.mode_conteneur_actif3": "quote\"\\'" +} diff --git a/tests/dictionaries/01fill_target_optional/makedict/base.json b/tests/dictionaries/01fill_target_optional/makedict/base.json index aa4ad28e..6cbc4d6b 100644 --- a/tests/dictionaries/01fill_target_optional/makedict/base.json +++ b/tests/dictionaries/01fill_target_optional/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json index 7401e42f..87584b21 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json +++ b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json @@ -1 +1,4 @@ -{"rougail.instanciated_module": false, "rougail.my_var": "yes"} +{ + "rougail.instanciated_module": false, + "rougail.my_var": "yes" +} diff --git a/tests/dictionaries/01test/makedict/base.json b/tests/dictionaries/01test/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/01test/makedict/base.json +++ b/tests/dictionaries/01test/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/01test_multi/makedict/base.json b/tests/dictionaries/01test_multi/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/01test_multi/makedict/base.json +++ b/tests/dictionaries/01test_multi/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/01test_multi_none/makedict/base.json b/tests/dictionaries/01test_multi_none/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/01test_multi_none/makedict/base.json +++ b/tests/dictionaries/01test_multi_none/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/01test_redefine/makedict/base.json b/tests/dictionaries/01test_redefine/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/01test_redefine/makedict/base.json +++ b/tests/dictionaries/01test_redefine/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/01test_redefine_base/makedict/base.json b/tests/dictionaries/01test_redefine_base/makedict/base.json index d3a9c907..9b3f9ac4 100644 --- a/tests/dictionaries/01test_redefine_base/makedict/base.json +++ b/tests/dictionaries/01test_redefine_base/makedict/base.json @@ -1 +1,3 @@ -{"rougail.my_variable": null} +{ + "rougail.my_variable": null +} diff --git a/tests/dictionaries/01test_redefine_remove/makedict/base.json b/tests/dictionaries/01test_redefine_remove/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/01test_redefine_remove/makedict/base.json +++ b/tests/dictionaries/01test_redefine_remove/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json b/tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json index 2a8f28f8..7fbc0348 100644 --- a/tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json +++ b/tests/dictionaries/02autosave_hidden_frozenifin/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": "oui"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.autosavevar": "oui" +} diff --git a/tests/dictionaries/10autosave_hidden/makedict/base.json b/tests/dictionaries/10autosave_hidden/makedict/base.json index 2a8f28f8..7fbc0348 100644 --- a/tests/dictionaries/10autosave_hidden/makedict/base.json +++ b/tests/dictionaries/10autosave_hidden/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": "oui"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.autosavevar": "oui" +} diff --git a/tests/dictionaries/10check_base/makedict/base.json b/tests/dictionaries/10check_base/makedict/base.json index 0279c93a..46bb5ef4 100644 --- a/tests/dictionaries/10check_base/makedict/base.json +++ b/tests/dictionaries/10check_base/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "b", "rougail.general.int": null} +{ + "rougail.general.mode_conteneur_actif": "b", + "rougail.general.int": null +} diff --git a/tests/dictionaries/10check_base_target_optional/makedict/base.json b/tests/dictionaries/10check_base_target_optional/makedict/base.json index d3a9c907..9b3f9ac4 100644 --- a/tests/dictionaries/10check_base_target_optional/makedict/base.json +++ b/tests/dictionaries/10check_base_target_optional/makedict/base.json @@ -1 +1,3 @@ -{"rougail.my_variable": null} +{ + "rougail.my_variable": null +} diff --git a/tests/dictionaries/10check_no_param/makedict/base.json b/tests/dictionaries/10check_no_param/makedict/base.json index 0279c93a..46bb5ef4 100644 --- a/tests/dictionaries/10check_no_param/makedict/base.json +++ b/tests/dictionaries/10check_no_param/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "b", "rougail.general.int": null} +{ + "rougail.general.mode_conteneur_actif": "b", + "rougail.general.int": null +} diff --git a/tests/dictionaries/10check_option/makedict/base.json b/tests/dictionaries/10check_option/makedict/base.json index fa46e9fc..df55d4f3 100644 --- a/tests/dictionaries/10check_option/makedict/base.json +++ b/tests/dictionaries/10check_option/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "b", "rougail.general.int2": 100, "rougail.general.int": null} +{ + "rougail.general.mode_conteneur_actif": "b", + "rougail.general.int2": 100, + "rougail.general.int": null +} diff --git a/tests/dictionaries/10check_optional/makedict/base.json b/tests/dictionaries/10check_optional/makedict/base.json index 50c9a71e..20ba7242 100644 --- a/tests/dictionaries/10check_optional/makedict/base.json +++ b/tests/dictionaries/10check_optional/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "b", "rougail.general.int": null, "rougail.general.int2": null} +{ + "rougail.general.mode_conteneur_actif": "b", + "rougail.general.int": null, + "rougail.general.int2": null +} diff --git a/tests/dictionaries/10check_valid_differ/makedict/base.json b/tests/dictionaries/10check_valid_differ/makedict/base.json index bf7550e6..a13f65aa 100644 --- a/tests/dictionaries/10check_valid_differ/makedict/base.json +++ b/tests/dictionaries/10check_valid_differ/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/10check_valid_differ_add/makedict/base.json b/tests/dictionaries/10check_valid_differ_add/makedict/base.json index 32db0bf5..69769780 100644 --- a/tests/dictionaries/10check_valid_differ_add/makedict/base.json +++ b/tests/dictionaries/10check_valid_differ_add/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.general.mode_conteneur_actif3": "oui"} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non", + "rougail.general.mode_conteneur_actif3": "oui" +} diff --git a/tests/dictionaries/10check_valid_differ_removecheck/makedict/base.json b/tests/dictionaries/10check_valid_differ_removecheck/makedict/base.json index 32db0bf5..69769780 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/makedict/base.json +++ b/tests/dictionaries/10check_valid_differ_removecheck/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.general.mode_conteneur_actif3": "oui"} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non", + "rougail.general.mode_conteneur_actif3": "oui" +} diff --git a/tests/dictionaries/10check_valid_in_network/makedict/base.json b/tests/dictionaries/10check_valid_in_network/makedict/base.json index b82b5b43..dca555a4 100644 --- a/tests/dictionaries/10check_valid_in_network/makedict/base.json +++ b/tests/dictionaries/10check_valid_in_network/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.adresse_ip_eth0": null, "rougail.general.adresse_netmask_eth0": null, "rougail.general.adresse_ip": null} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.adresse_ip_eth0": null, + "rougail.general.adresse_netmask_eth0": null, + "rougail.general.adresse_ip": null +} diff --git a/tests/dictionaries/10check_valid_in_network_cidr/makedict/base.json b/tests/dictionaries/10check_valid_in_network_cidr/makedict/base.json index 3d0e2f80..814a2f1a 100644 --- a/tests/dictionaries/10check_valid_in_network_cidr/makedict/base.json +++ b/tests/dictionaries/10check_valid_in_network_cidr/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.adresse_ip_eth0": null, "rougail.general.adresse_ip": null} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.adresse_ip_eth0": null, + "rougail.general.adresse_ip": null +} diff --git a/tests/dictionaries/10check_valid_ipnetmask/makedict/base.json b/tests/dictionaries/10check_valid_ipnetmask/makedict/base.json index 7fe0b8af..145e7424 100644 --- a/tests/dictionaries/10check_valid_ipnetmask/makedict/base.json +++ b/tests/dictionaries/10check_valid_ipnetmask/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.adresse_ip_eth0": null, "rougail.general.adresse_netmask_eth0": null} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.adresse_ip_eth0": null, + "rougail.general.adresse_netmask_eth0": null +} diff --git a/tests/dictionaries/10fill_information/makedict/base.json b/tests/dictionaries/10fill_information/makedict/base.json index 5f62f349..904ffb4e 100644 --- a/tests/dictionaries/10fill_information/makedict/base.json +++ b/tests/dictionaries/10fill_information/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "value"} +{ + "rougail.general.mode_conteneur_actif": "value" +} diff --git a/tests/dictionaries/10frozenifin_unknown_valid_enum_number/makedict/base.json b/tests/dictionaries/10frozenifin_unknown_valid_enum_number/makedict/base.json index b61138dc..7a9ad41b 100644 --- a/tests/dictionaries/10frozenifin_unknown_valid_enum_number/makedict/base.json +++ b/tests/dictionaries/10frozenifin_unknown_valid_enum_number/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": 1, "rougail.enumfam.test_variable": null} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": 1, + "rougail.enumfam.test_variable": null +} diff --git a/tests/dictionaries/10leadership_append/makedict/base.json b/tests/dictionaries/10leadership_append/makedict/base.json index 9e804f6a..14aaf55f 100644 --- a/tests/dictionaries/10leadership_append/makedict/base.json +++ b/tests/dictionaries/10leadership_append/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_append_hidden/makedict/base.json b/tests/dictionaries/10leadership_append_hidden/makedict/base.json index 9e804f6a..14aaf55f 100644 --- a/tests/dictionaries/10leadership_append_hidden/makedict/base.json +++ b/tests/dictionaries/10leadership_append_hidden/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_append_name/makedict/base.json b/tests/dictionaries/10leadership_append_name/makedict/base.json index 2be64a76..1b3a3e8e 100644 --- a/tests/dictionaries/10leadership_append_name/makedict/base.json +++ b/tests/dictionaries/10leadership_append_name/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leadership.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leadership.leader": [] +} diff --git a/tests/dictionaries/10leadership_auto/makedict/base.json b/tests/dictionaries/10leadership_auto/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/10leadership_auto/makedict/base.json +++ b/tests/dictionaries/10leadership_auto/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_auto_index/makedict/base.json b/tests/dictionaries/10leadership_auto_index/makedict/base.json index 010ea979..33b6cf4f 100644 --- a/tests/dictionaries/10leadership_auto_index/makedict/base.json +++ b/tests/dictionaries/10leadership_auto_index/makedict/base.json @@ -1 +1,16 @@ -{"rougail.leader.leader": [{"rougail.leader.leader": "a", "rougail.leader.follower1": 0}, {"rougail.leader.leader": "b", "rougail.leader.follower1": 1}, {"rougail.leader.leader": "c", "rougail.leader.follower1": 2}]} +{ + "rougail.leader.leader": [ + { + "rougail.leader.leader": "a", + "rougail.leader.follower1": 0 + }, + { + "rougail.leader.leader": "b", + "rougail.leader.follower1": 1 + }, + { + "rougail.leader.leader": "c", + "rougail.leader.follower1": 2 + } + ] +} diff --git a/tests/dictionaries/10leadership_autoleader/makedict/base.json b/tests/dictionaries/10leadership_autoleader/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/10leadership_autoleader/makedict/base.json +++ b/tests/dictionaries/10leadership_autoleader/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json b/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json index 1691edbc..fe8a1c7a 100644 --- a/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json +++ b/tests/dictionaries/10leadership_autoleader_expert/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.leadermode.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json b/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json +++ b/tests/dictionaries/10leadership_autosaveexpert/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_familyaccent/makedict/base.json b/tests/dictionaries/10leadership_familyaccent/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/10leadership_familyaccent/makedict/base.json +++ b/tests/dictionaries/10leadership_familyaccent/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_leader_hidden/makedict/base.json b/tests/dictionaries/10leadership_leader_hidden/makedict/base.json index 1691edbc..fe8a1c7a 100644 --- a/tests/dictionaries/10leadership_leader_hidden/makedict/base.json +++ b/tests/dictionaries/10leadership_leader_hidden/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.leadermode.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json b/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json index 1691edbc..fe8a1c7a 100644 --- a/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json +++ b/tests/dictionaries/10leadership_leader_hidden_if_in/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.leadermode.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_leader_hidden_if_in_name/makedict/base.json b/tests/dictionaries/10leadership_leader_hidden_if_in_name/makedict/base.json index 553ab0b0..ba697460 100644 --- a/tests/dictionaries/10leadership_leader_hidden_if_in_name/makedict/base.json +++ b/tests/dictionaries/10leadership_leader_hidden_if_in_name/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.other.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.leadermode.other.leader": [] +} diff --git a/tests/dictionaries/10leadership_leadermandatory/makedict/base.json b/tests/dictionaries/10leadership_leadermandatory/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/10leadership_leadermandatory/makedict/base.json +++ b/tests/dictionaries/10leadership_leadermandatory/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_mandatory/makedict/base.json b/tests/dictionaries/10leadership_mandatory/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/10leadership_mandatory/makedict/base.json +++ b/tests/dictionaries/10leadership_mandatory/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json b/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json index e40cb9a7..af7d636d 100644 --- a/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json +++ b/tests/dictionaries/10leadership_mandatoryfollower/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.nut_monitor_netmask.nut_monitor_netmask": []} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.nut_monitor_netmask.nut_monitor_netmask": [] +} diff --git a/tests/dictionaries/10leadership_multi/makedict/base.json b/tests/dictionaries/10leadership_multi/makedict/base.json index 1b4d93cb..53442331 100644 --- a/tests/dictionaries/10leadership_multi/makedict/base.json +++ b/tests/dictionaries/10leadership_multi/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader1.leader1": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [], + "rougail.general1.leader1.leader1": [] +} diff --git a/tests/dictionaries/10load_disabled_if_in/makedict/base.json b/tests/dictionaries/10load_disabled_if_in/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_disabled_if_in/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json index d47f4067..60b5bb4c 100644 --- a/tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.condition": "no", "rougail.general.variable2": null} +{ + "rougail.general.condition": "no", + "rougail.general.variable2": null +} diff --git a/tests/dictionaries/10load_disabled_if_in_list_optional/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_list_optional/makedict/base.json index 9da78c4c..18b52fac 100644 --- a/tests/dictionaries/10load_disabled_if_in_list_optional/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_list_optional/makedict/base.json @@ -1 +1,3 @@ -{"rougail.condition": true} +{ + "rougail.condition": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json index d9ca2c8e..fd3b2474 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json index c1d375e0..bf0ac0f1 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "no", "rougail.general.test_variable": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "no", + "rougail.general.condition2": "no", + "rougail.general.test_variable": "no", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json index 981ea298..1df1f7e5 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/makedict/base.json @@ -1 +1,14 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "no", + "rougail.general.condition2": "no", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json index cc8a3018..030a9425 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/makedict/base.json @@ -1 +1,14 @@ -{"rougail.general.condition": "yes", "rougail.general.condition2": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "yes", + "rougail.general.condition2": "no", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json index ff296f1b..0ec41763 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/makedict/base.json @@ -1 +1,14 @@ -{"rougail.general.condition": "yes", "rougail.general.condition2": "yes", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "yes", + "rougail.general.condition2": "yes", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json index e8f83ea3..9fde9a9d 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/makedict/base.json @@ -1 +1,14 @@ -{"rougail.general.condition": "no", "rougail.general.condition2": "yes", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "no", + "rougail.general.condition2": "yes", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json index 15068ac2..ca7c5bae 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/makedict/base.json @@ -1 +1,13 @@ -{"rougail.general.condition": "oui", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "oui", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_in_none/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_none/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_disabled_if_in_none/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_none/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_disabled_if_in_variable/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_variable/makedict/base.json index 6c66feb5..7ae93283 100644 --- a/tests/dictionaries/10load_disabled_if_in_variable/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_variable/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "tous"} +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "tous" +} diff --git a/tests/dictionaries/10load_disabled_if_in_variable2/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_variable2/makedict/base.json index fb7866b3..450218a7 100644 --- a/tests/dictionaries/10load_disabled_if_in_variable2/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_in_variable2/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "aucun", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "aucun", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/makedict/base.json b/tests/dictionaries/10load_disabled_if_inaccent_family/makedict/base.json index 6d963f23..14d8f805 100644 --- a/tests/dictionaries/10load_disabled_if_inaccent_family/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_inaccent_family/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.general2.mode_conteneur_actif3": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "rougail.general2.mode_conteneur_actif3": "non" +} diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json b/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json index c654c2d0..a7732a1f 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback/makedict/base.json @@ -1 +1,14 @@ -{"rougail.general.condition": "no", "rougail.general.disable_variable": "no", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "no", + "rougail.general.disable_variable": "no", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/makedict/base.json b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/makedict/base.json index 5f9738da..c2441e80 100644 --- a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/makedict/base.json +++ b/tests/dictionaries/10load_disabled_if_not_in_fallback_force/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.condition": "non"} +{ + "rougail.general.condition": "non" +} diff --git a/tests/dictionaries/10load_disabledifin_fallback/makedict/base.json b/tests/dictionaries/10load_disabledifin_fallback/makedict/base.json index f91225f3..afb429c0 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/makedict/base.json +++ b/tests/dictionaries/10load_disabledifin_fallback/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/makedict/base.json b/tests/dictionaries/10load_disabledifin_fallback_force/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/makedict/base.json +++ b/tests/dictionaries/10load_disabledifin_fallback_force/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/makedict/base.json b/tests/dictionaries/10load_disabledifin_whithouttype/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_disabledifin_whithouttype/makedict/base.json +++ b/tests/dictionaries/10load_disabledifin_whithouttype/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_emptyvalue/makedict/base.json b/tests/dictionaries/10load_emptyvalue/makedict/base.json index e907fc60..121c737e 100644 --- a/tests/dictionaries/10load_emptyvalue/makedict/base.json +++ b/tests/dictionaries/10load_emptyvalue/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif2": null} +{ + "rougail.general.mode_conteneur_actif": null, + "rougail.general.mode_conteneur_actif2": null +} diff --git a/tests/dictionaries/10load_frozenifin/makedict/base.json b/tests/dictionaries/10load_frozenifin/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_frozenifin/makedict/base.json +++ b/tests/dictionaries/10load_frozenifin/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_frozenifin_auto/makedict/base.json b/tests/dictionaries/10load_frozenifin_auto/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_frozenifin_auto/makedict/base.json +++ b/tests/dictionaries/10load_frozenifin_auto/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_frozenifin_multiparam/makedict/base.json b/tests/dictionaries/10load_frozenifin_multiparam/makedict/base.json index 3e41cfc3..13a9e66c 100644 --- a/tests/dictionaries/10load_frozenifin_multiparam/makedict/base.json +++ b/tests/dictionaries/10load_frozenifin_multiparam/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_frozenifin_noexist/makedict/base.json b/tests/dictionaries/10load_frozenifin_noexist/makedict/base.json index 3e41cfc3..13a9e66c 100644 --- a/tests/dictionaries/10load_frozenifin_noexist/makedict/base.json +++ b/tests/dictionaries/10load_frozenifin_noexist/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_frozenifin_variable/makedict/base.json b/tests/dictionaries/10load_frozenifin_variable/makedict/base.json index 7aa1f222..5b7d5b3a 100644 --- a/tests/dictionaries/10load_frozenifin_variable/makedict/base.json +++ b/tests/dictionaries/10load_frozenifin_variable/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "tous", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "tous", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_frozenifnotin/makedict/base.json b/tests/dictionaries/10load_frozenifnotin/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_frozenifnotin/makedict/base.json +++ b/tests/dictionaries/10load_frozenifnotin/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json b/tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json index 3e41cfc3..13a9e66c 100644 --- a/tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json +++ b/tests/dictionaries/10load_frozenifnotin_noexist/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_hidden_if_empty_family/makedict/base.json b/tests/dictionaries/10load_hidden_if_empty_family/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_hidden_if_empty_family/makedict/base.json +++ b/tests/dictionaries/10load_hidden_if_empty_family/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_hidden_if_family/makedict/base.json b/tests/dictionaries/10load_hidden_if_family/makedict/base.json index 6d963f23..14d8f805 100644 --- a/tests/dictionaries/10load_hidden_if_family/makedict/base.json +++ b/tests/dictionaries/10load_hidden_if_family/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.general2.mode_conteneur_actif3": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "rougail.general2.mode_conteneur_actif3": "non" +} diff --git a/tests/dictionaries/10load_leadership/makedict/base.json b/tests/dictionaries/10load_leadership/makedict/base.json index 9e804f6a..14aaf55f 100644 --- a/tests/dictionaries/10load_leadership/makedict/base.json +++ b/tests/dictionaries/10load_leadership/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_default_multi/makedict/base.json b/tests/dictionaries/10load_leadership_default_multi/makedict/base.json index 3a48366f..0b5a23e5 100644 --- a/tests/dictionaries/10load_leadership_default_multi/makedict/base.json +++ b/tests/dictionaries/10load_leadership_default_multi/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": [ + "non" + ], + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json b/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json index a4b5c0a4..a7343384 100644 --- a/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json +++ b/tests/dictionaries/10load_leadership_default_submulti/makedict/base.json @@ -1 +1,17 @@ -{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [{"rougail.general.leader.leader": "leader", "rougail.general.leader.follower1": ["value"], "rougail.general.leader.follower2": ["value1", "value2"]}]} +{ + "rougail.general.mode_conteneur_actif": [ + "non" + ], + "rougail.general.leader.leader": [ + { + "rougail.general.leader.leader": "leader", + "rougail.general.leader.follower1": [ + "value" + ], + "rougail.general.leader.follower2": [ + "value1", + "value2" + ] + } + ] +} diff --git a/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json b/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json index 64540f5e..b923902d 100644 --- a/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json +++ b/tests/dictionaries/10load_leadership_defaultmulti_leader/makedict/base.json @@ -1 +1,12 @@ -{"rougail.general.mode_conteneur_actif": ["non"], "rougail.general.leader.leader": [{"rougail.general.leader.leader": "value", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}]} +{ + "rougail.general.mode_conteneur_actif": [ + "non" + ], + "rougail.general.leader.leader": [ + { + "rougail.general.leader.leader": "value", + "rougail.general.leader.follower1": null, + "rougail.general.leader.follower2": null + } + ] +} diff --git a/tests/dictionaries/10load_leadership_description/makedict/base.json b/tests/dictionaries/10load_leadership_description/makedict/base.json index 9e804f6a..14aaf55f 100644 --- a/tests/dictionaries/10load_leadership_description/makedict/base.json +++ b/tests/dictionaries/10load_leadership_description/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_name/makedict/base.json b/tests/dictionaries/10load_leadership_name/makedict/base.json index df80fe56..0f5932d1 100644 --- a/tests/dictionaries/10load_leadership_name/makedict/base.json +++ b/tests/dictionaries/10load_leadership_name/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.other_name.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.other_name.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json b/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json index 9cdf5c3e..5a7a908d 100644 --- a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json +++ b/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general_1.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general_1.leader.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_submulti/makedict/base.json b/tests/dictionaries/10load_leadership_submulti/makedict/base.json index 9e804f6a..14aaf55f 100644 --- a/tests/dictionaries/10load_leadership_submulti/makedict/base.json +++ b/tests/dictionaries/10load_leadership_submulti/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [] +} diff --git a/tests/dictionaries/10load_mandatoryifin/makedict/base.json b/tests/dictionaries/10load_mandatoryifin/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_mandatoryifin/makedict/base.json +++ b/tests/dictionaries/10load_mandatoryifin/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json index 3e41cfc3..13a9e66c 100644 --- a/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "tous", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_multivalue/makedict/base.json b/tests/dictionaries/10load_multivalue/makedict/base.json index d65d28b0..d82bd782 100644 --- a/tests/dictionaries/10load_multivalue/makedict/base.json +++ b/tests/dictionaries/10load_multivalue/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": ["non", "oui"]} +{ + "rougail.general.mode_conteneur_actif": [ + "non", + "oui" + ] +} diff --git a/tests/dictionaries/10valid_enum_accent/makedict/base.json b/tests/dictionaries/10valid_enum_accent/makedict/base.json index 51f95bc0..58c810c5 100644 --- a/tests/dictionaries/10valid_enum_accent/makedict/base.json +++ b/tests/dictionaries/10valid_enum_accent/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "c"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "c" +} diff --git a/tests/dictionaries/10valid_enum_base/makedict/base.json b/tests/dictionaries/10valid_enum_base/makedict/base.json index 51f95bc0..58c810c5 100644 --- a/tests/dictionaries/10valid_enum_base/makedict/base.json +++ b/tests/dictionaries/10valid_enum_base/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "c"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "c" +} diff --git a/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json b/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json index ec589332..6c0cbe28 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json +++ b/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar2": "c", "rougail.enumfam.enumvar": "c"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar2": "c", + "rougail.enumfam.enumvar": "c" +} diff --git a/tests/dictionaries/10valid_enum_leader/makedict/base.json b/tests/dictionaries/10valid_enum_leader/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/10valid_enum_leader/makedict/base.json +++ b/tests/dictionaries/10valid_enum_leader/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10valid_enum_mandatory/makedict/base.json b/tests/dictionaries/10valid_enum_mandatory/makedict/base.json index d875ba96..41a55286 100644 --- a/tests/dictionaries/10valid_enum_mandatory/makedict/base.json +++ b/tests/dictionaries/10valid_enum_mandatory/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "a"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "a" +} diff --git a/tests/dictionaries/10valid_enum_multi/makedict/base.json b/tests/dictionaries/10valid_enum_multi/makedict/base.json index e40e3d93..b581c6d9 100644 --- a/tests/dictionaries/10valid_enum_multi/makedict/base.json +++ b/tests/dictionaries/10valid_enum_multi/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.multi": ["a"]} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.multi": [ + "a" + ] +} diff --git a/tests/dictionaries/10valid_enum_none/makedict/base.json b/tests/dictionaries/10valid_enum_none/makedict/base.json index 0a000772..07f78c4a 100644 --- a/tests/dictionaries/10valid_enum_none/makedict/base.json +++ b/tests/dictionaries/10valid_enum_none/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "b"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "b" +} diff --git a/tests/dictionaries/10valid_enum_number/makedict/base.json b/tests/dictionaries/10valid_enum_number/makedict/base.json index b69cd0a7..ef9d9758 100644 --- a/tests/dictionaries/10valid_enum_number/makedict/base.json +++ b/tests/dictionaries/10valid_enum_number/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": 1} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": 1 +} diff --git a/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json b/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json index 7047db72..e8e0dc0f 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json +++ b/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": 3} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": 3 +} diff --git a/tests/dictionaries/10valid_enum_param_empty/makedict/base.json b/tests/dictionaries/10valid_enum_param_empty/makedict/base.json index 9f9d92af..53dfede8 100644 --- a/tests/dictionaries/10valid_enum_param_empty/makedict/base.json +++ b/tests/dictionaries/10valid_enum_param_empty/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": null} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": null +} diff --git a/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json b/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json index 9f9d92af..53dfede8 100644 --- a/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json +++ b/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": null} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": null +} diff --git a/tests/dictionaries/10valid_enum_quote/makedict/base.json b/tests/dictionaries/10valid_enum_quote/makedict/base.json index 43d40597..c63f634d 100644 --- a/tests/dictionaries/10valid_enum_quote/makedict/base.json +++ b/tests/dictionaries/10valid_enum_quote/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "quote'"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "quote'" +} diff --git a/tests/dictionaries/10valid_enum_value/makedict/base.json b/tests/dictionaries/10valid_enum_value/makedict/base.json index bcf489f7..9e37bc12 100644 --- a/tests/dictionaries/10valid_enum_value/makedict/base.json +++ b/tests/dictionaries/10valid_enum_value/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "b"} +{ + "rougail.general.mode_conteneur_actif": "b" +} diff --git a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json index 35415a54..f2fd3666 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": true, "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": true, + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json index 80ae7c66..e031fca5 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json @@ -1 +1,13 @@ -{"rougail.general.condition": true, "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": true, + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json index 39dc850f..4b7d64d9 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json @@ -1 +1,13 @@ -{"rougail.general.condition": false, "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": false, + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} 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 e3e0a34f..332511ae 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,13 @@ -{"rougail.general.condition": "oui", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "oui", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json index 6eee3998..5590d9b3 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json @@ -1 +1,23 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": true, "services.test.files.file2.engine": "creole", "services.test.files.file2.group": "root", "services.test.files.file2.included": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/tmp/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": true, + "services.test.files.file2.engine": "creole", + "services.test.files.file2.group": "root", + "services.test.files.file2.included": "no", + "services.test.files.file2.mode": "0644", + "services.test.files.file2.name": "/tmp/file2", + "services.test.files.file2.owner": "root", + "services.test.files.file2.source": "file2", + "services.test.files.file2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json index 60576b02..cf42ee84 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json +++ b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json index 60576b02..cf42ee84 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json index 60576b02..cf42ee84 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json index 60576b02..cf42ee84 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} 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 f6f29e5f..1e05ae49 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,14 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "services.test.files.file1.engine": "creole", "services.test.files.file1.group": "root", "services.test.files.file1.included": "no", "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.activate": false, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "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.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11valid_enum_variable/makedict/base.json b/tests/dictionaries/11valid_enum_variable/makedict/base.json index 2c5c721d..0d2bcba8 100644 --- a/tests/dictionaries/11valid_enum_variable/makedict/base.json +++ b/tests/dictionaries/11valid_enum_variable/makedict/base.json @@ -1 +1,8 @@ -{"rougail.general.mode_conteneur_actif": "a", "rougail.general.var": ["a", "b", "c"]} +{ + "rougail.general.mode_conteneur_actif": "a", + "rougail.general.var": [ + "a", + "b", + "c" + ] +} diff --git a/tests/dictionaries/20family_append/makedict/base.json b/tests/dictionaries/20family_append/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/20family_append/makedict/base.json +++ b/tests/dictionaries/20family_append/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/20family_appendaccent/makedict/base.json b/tests/dictionaries/20family_appendaccent/makedict/base.json index abc90084..ec650bb0 100644 --- a/tests/dictionaries/20family_appendaccent/makedict/base.json +++ b/tests/dictionaries/20family_appendaccent/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.other.mode_conteneur_actif3": "non"} +{ + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non", + "rougail.other.mode_conteneur_actif3": "non" +} diff --git a/tests/dictionaries/20family_dynamic/makedict/base.json b/tests/dictionaries/20family_dynamic/makedict/base.json index 64024485..f3dfb591 100644 --- a/tests/dictionaries/20family_dynamic/makedict/base.json +++ b/tests/dictionaries/20family_dynamic/makedict/base.json @@ -1 +1,8 @@ -{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": null, "rougail.dynval2.vardynval2": null} +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": null, + "rougail.dynval2.vardynval2": null +} diff --git a/tests/dictionaries/20family_dynamic_calc/makedict/base.json b/tests/dictionaries/20family_dynamic_calc/makedict/base.json index c26e3740..9b99cc84 100644 --- a/tests/dictionaries/20family_dynamic_calc/makedict/base.json +++ b/tests/dictionaries/20family_dynamic_calc/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": "val"} +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": "val", + "rougail.dynval2.vardynval2": "val", + "rougail.new.newvar": "val" +} diff --git a/tests/dictionaries/20family_dynamic_calc2/makedict/base.json b/tests/dictionaries/20family_dynamic_calc2/makedict/base.json index 82b6fff8..856ad009 100644 --- a/tests/dictionaries/20family_dynamic_calc2/makedict/base.json +++ b/tests/dictionaries/20family_dynamic_calc2/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": null} +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": "val", + "rougail.dynval2.vardynval2": "val", + "rougail.new.newvar": null +} diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json index 09b64ff8..c1f25445 100644 --- a/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json +++ b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val1", "rougail.dynval2.vardynval2": "val2", "rougail.new.newvar": null} +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": "val1", + "rougail.dynval2.vardynval2": "val2", + "rougail.new.newvar": null +} diff --git a/tests/dictionaries/20family_dynamic_description/makedict/base.json b/tests/dictionaries/20family_dynamic_description/makedict/base.json index 64024485..f3dfb591 100644 --- a/tests/dictionaries/20family_dynamic_description/makedict/base.json +++ b/tests/dictionaries/20family_dynamic_description/makedict/base.json @@ -1 +1,8 @@ -{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": null, "rougail.dynval2.vardynval2": null} +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": null, + "rougail.dynval2.vardynval2": null +} diff --git a/tests/dictionaries/20family_dynamic_number/makedict/base.json b/tests/dictionaries/20family_dynamic_number/makedict/base.json index ceae633c..3ba060bb 100644 --- a/tests/dictionaries/20family_dynamic_number/makedict/base.json +++ b/tests/dictionaries/20family_dynamic_number/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.varname": [1, 2], "rougail.dyn1.vardyn1": "val", "rougail.dyn2.vardyn2": "val", "rougail.new.newvar": "val"} +{ + "rougail.general.varname": [ + 1, + 2 + ], + "rougail.dyn1.vardyn1": "val", + "rougail.dyn2.vardyn2": "val", + "rougail.new.newvar": "val" +} diff --git a/tests/dictionaries/20family_empty/makedict/base.json b/tests/dictionaries/20family_empty/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/20family_empty/makedict/base.json +++ b/tests/dictionaries/20family_empty/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/20family_hidden/makedict/base.json b/tests/dictionaries/20family_hidden/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/20family_hidden/makedict/base.json +++ b/tests/dictionaries/20family_hidden/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/20family_mode/makedict/base.json b/tests/dictionaries/20family_mode/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/20family_mode/makedict/base.json +++ b/tests/dictionaries/20family_mode/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/20family_modeleadership/makedict/base.json b/tests/dictionaries/20family_modeleadership/makedict/base.json index 107d7b1c..9031a92a 100644 --- a/tests/dictionaries/20family_modeleadership/makedict/base.json +++ b/tests/dictionaries/20family_modeleadership/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/20notemplating/makedict/base.json b/tests/dictionaries/20notemplating/makedict/base.json index 118174dc..52a445f3 100644 --- a/tests/dictionaries/20notemplating/makedict/base.json +++ b/tests/dictionaries/20notemplating/makedict/base.json @@ -1 +1,13 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "none", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.files.file.engine": "none", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/20override/makedict/base.json b/tests/dictionaries/20override/makedict/base.json index 9b9f194a..df29ea4a 100644 --- a/tests/dictionaries/20override/makedict/base.json +++ b/tests/dictionaries/20override/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "creole", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true, "services.test.activate": true, "services.test.manage": true, "services.test2.overrides.test2_service.engine": "jinja2", "services.test2.overrides.test2_service.name": "test2", "services.test2.overrides.test2_service.source": "test2.service", "services.test2.overrides.test2_service.activate": true, "services.test2.activate": true, "services.test2.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.overrides.test_service.engine": "creole", + "services.test.overrides.test_service.name": "test", + "services.test.overrides.test_service.source": "test.service", + "services.test.overrides.test_service.activate": true, + "services.test.activate": true, + "services.test.manage": true, + "services.test2.overrides.test2_service.engine": "jinja2", + "services.test2.overrides.test2_service.name": "test2", + "services.test2.overrides.test2_service.source": "test2.service", + "services.test2.overrides.test2_service.activate": true, + "services.test2.activate": true, + "services.test2.manage": true +} diff --git a/tests/dictionaries/20override_no_templating/makedict/base.json b/tests/dictionaries/20override_no_templating/makedict/base.json index 3283f09c..82581028 100644 --- a/tests/dictionaries/20override_no_templating/makedict/base.json +++ b/tests/dictionaries/20override_no_templating/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "none", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.overrides.test_service.engine": "none", + "services.test.overrides.test_service.name": "test", + "services.test.overrides.test_service.source": "test.service", + "services.test.overrides.test_service.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/20override_source/makedict/base.json b/tests/dictionaries/20override_source/makedict/base.json index 8672bb97..0856e35c 100644 --- a/tests/dictionaries/20override_source/makedict/base.json +++ b/tests/dictionaries/20override_source/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test2_service.engine": "creole", "services.test.overrides.test2_service.name": "test", "services.test.overrides.test2_service.source": "test2.service", "services.test.overrides.test2_service.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.overrides.test2_service.engine": "creole", + "services.test.overrides.test2_service.name": "test", + "services.test.overrides.test2_service.source": "test2.service", + "services.test.overrides.test2_service.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/21family_empty/makedict/base.json b/tests/dictionaries/21family_empty/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/21family_empty/makedict/base.json +++ b/tests/dictionaries/21family_empty/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json b/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json +++ b/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json index 5f62f349..904ffb4e 100644 --- a/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "value"} +{ + "rougail.general.mode_conteneur_actif": "value" +} diff --git a/tests/dictionaries/30mandatory_withvalue/makedict/base.json b/tests/dictionaries/30mandatory_withvalue/makedict/base.json index 5f62f349..904ffb4e 100644 --- a/tests/dictionaries/30mandatory_withvalue/makedict/base.json +++ b/tests/dictionaries/30mandatory_withvalue/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "value"} +{ + "rougail.general.mode_conteneur_actif": "value" +} diff --git a/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json b/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json index 5f62f349..904ffb4e 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json +++ b/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "value"} +{ + "rougail.general.mode_conteneur_actif": "value" +} diff --git a/tests/dictionaries/40condition_base/makedict/base.json b/tests/dictionaries/40condition_base/makedict/base.json index ee42ef2d..e21c64e6 100644 --- a/tests/dictionaries/40condition_base/makedict/base.json +++ b/tests/dictionaries/40condition_base/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/40condition_base_add/makedict/base.json b/tests/dictionaries/40condition_base_add/makedict/base.json index ee42ef2d..e21c64e6 100644 --- a/tests/dictionaries/40condition_base_add/makedict/base.json +++ b/tests/dictionaries/40condition_base_add/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/40condition_fallback/makedict/base.json b/tests/dictionaries/40condition_fallback/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/40condition_fallback/makedict/base.json +++ b/tests/dictionaries/40condition_fallback/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/40condition_optional/makedict/base.json b/tests/dictionaries/40condition_optional/makedict/base.json index 6008a9ce..0858ba1b 100644 --- a/tests/dictionaries/40condition_optional/makedict/base.json +++ b/tests/dictionaries/40condition_optional/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/40condition_optional_empty/makedict/base.json b/tests/dictionaries/40condition_optional_empty/makedict/base.json index 6008a9ce..0858ba1b 100644 --- a/tests/dictionaries/40condition_optional_empty/makedict/base.json +++ b/tests/dictionaries/40condition_optional_empty/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/40condition_optional_family/makedict/base.json b/tests/dictionaries/40condition_optional_family/makedict/base.json index 9da78c4c..18b52fac 100644 --- a/tests/dictionaries/40condition_optional_family/makedict/base.json +++ b/tests/dictionaries/40condition_optional_family/makedict/base.json @@ -1 +1,3 @@ -{"rougail.condition": true} +{ + "rougail.condition": true +} diff --git a/tests/dictionaries/40empty_param/makedict/base.json b/tests/dictionaries/40empty_param/makedict/base.json index 0dd31190..36d66f3d 100644 --- a/tests/dictionaries/40empty_param/makedict/base.json +++ b/tests/dictionaries/40empty_param/makedict/base.json @@ -1 +1,4 @@ -{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"} +{ + "rougail.proxy_authentifie.toto1": null, + "rougail.proxy_authentifie.toto2": "3127" +} diff --git a/tests/dictionaries/40empty_param2/makedict/base.json b/tests/dictionaries/40empty_param2/makedict/base.json index 0dd31190..36d66f3d 100644 --- a/tests/dictionaries/40empty_param2/makedict/base.json +++ b/tests/dictionaries/40empty_param2/makedict/base.json @@ -1 +1,4 @@ -{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"} +{ + "rougail.proxy_authentifie.toto1": null, + "rougail.proxy_authentifie.toto2": "3127" +} diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json index 944631ab..608b4c52 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json +++ b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": [{"rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": "non"}]} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": [ + { + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": "non" + } + ] +} diff --git a/tests/dictionaries/40ifin_leadership/makedict/base.json b/tests/dictionaries/40ifin_leadership/makedict/base.json index 22441eab..2d556dde 100644 --- a/tests/dictionaries/40ifin_leadership/makedict/base.json +++ b/tests/dictionaries/40ifin_leadership/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "oui", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json index 5e1a706b..abb03d5a 100644 --- a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json @@ -1 +1,20 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "oui", + "rougail.general.leader.leader": [ + { + "rougail.general.leader.leader": "a", + "rougail.general.leader.follower2": null + } + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json index cd209af3..df5efe3b 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json @@ -1 +1,33 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [{"rougail.general.leader.leader": "a", "rougail.general.leader.follower2": null}, {"rougail.general.leader.leader": "b", "rougail.general.leader.follower1": null, "rougail.general.leader.follower2": null}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "oui", + "rougail.general.leader.leader": [ + { + "rougail.general.leader.leader": "a", + "rougail.general.leader.follower2": null + }, + { + "rougail.general.leader.leader": "b", + "rougail.general.leader.follower1": null, + "rougail.general.leader.follower2": null + } + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.mailname2.engine": "jinja2", + "services.test.files.mailname2.group": "root", + "services.test.files.mailname2.included": "no", + "services.test.files.mailname2.mode": "0644", + "services.test.files.mailname2.name": "/etc/mailname2", + "services.test.files.mailname2.owner": "root", + "services.test.files.mailname2.source": "mailname2", + "services.test.files.mailname2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/40ifin_multi/makedict/base.json b/tests/dictionaries/40ifin_multi/makedict/base.json index 4c3844b8..79c29948 100644 --- a/tests/dictionaries/40ifin_multi/makedict/base.json +++ b/tests/dictionaries/40ifin_multi/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general2.mode_conteneur_actif2": "non", "rougail.general2.mode_conteneur_actif3": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif2": "non", + "rougail.general2.mode_conteneur_actif3": "non" +} diff --git a/tests/dictionaries/40ifin_validenum/makedict/base.json b/tests/dictionaries/40ifin_validenum/makedict/base.json index 6b1c9cf7..16d3139d 100644 --- a/tests/dictionaries/40ifin_validenum/makedict/base.json +++ b/tests/dictionaries/40ifin_validenum/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general2.mode_conteneur_actif3": "a"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif3": "a" +} diff --git a/tests/dictionaries/45extra_without_family/makedict/base.json b/tests/dictionaries/45extra_without_family/makedict/base.json index fd4af5ed..632cddc9 100644 --- a/tests/dictionaries/45extra_without_family/makedict/base.json +++ b/tests/dictionaries/45extra_without_family/makedict/base.json @@ -1 +1,14 @@ -{"rougail.my_var": "rougail", "extra.my_var": null, "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.my_var": "rougail", + "extra.my_var": null, + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/45multi_family/makedict/base.json b/tests/dictionaries/45multi_family/makedict/base.json index 536366a7..75283a63 100644 --- a/tests/dictionaries/45multi_family/makedict/base.json +++ b/tests/dictionaries/45multi_family/makedict/base.json @@ -1 +1,3 @@ -{"rougail.base.subfamily.variable": null} +{ + "rougail.base.subfamily.variable": null +} diff --git a/tests/dictionaries/45multi_family_basic/makedict/base.json b/tests/dictionaries/45multi_family_basic/makedict/base.json index 536366a7..75283a63 100644 --- a/tests/dictionaries/45multi_family_basic/makedict/base.json +++ b/tests/dictionaries/45multi_family_basic/makedict/base.json @@ -1 +1,3 @@ -{"rougail.base.subfamily.variable": null} +{ + "rougail.base.subfamily.variable": null +} diff --git a/tests/dictionaries/45multi_family_expert/makedict/base.json b/tests/dictionaries/45multi_family_expert/makedict/base.json index 536366a7..75283a63 100644 --- a/tests/dictionaries/45multi_family_expert/makedict/base.json +++ b/tests/dictionaries/45multi_family_expert/makedict/base.json @@ -1 +1,3 @@ -{"rougail.base.subfamily.variable": null} +{ + "rougail.base.subfamily.variable": null +} diff --git a/tests/dictionaries/45multi_family_order/makedict/base.json b/tests/dictionaries/45multi_family_order/makedict/base.json index 69da8f2d..617399c0 100644 --- a/tests/dictionaries/45multi_family_order/makedict/base.json +++ b/tests/dictionaries/45multi_family_order/makedict/base.json @@ -1 +1,6 @@ -{"rougail.variable1": null, "rougail.base.variable2": null, "rougail.base.subfamily.variable3": null, "rougail.base.variable4": null} +{ + "rougail.variable1": null, + "rougail.base.variable2": null, + "rougail.base.subfamily.variable3": null, + "rougail.base.variable4": null +} diff --git a/tests/dictionaries/45without_family/makedict/base.json b/tests/dictionaries/45without_family/makedict/base.json index 1aa60ad0..774ccc4b 100644 --- a/tests/dictionaries/45without_family/makedict/base.json +++ b/tests/dictionaries/45without_family/makedict/base.json @@ -1 +1,3 @@ -{"rougail.variable": null} +{ + "rougail.variable": null +} diff --git a/tests/dictionaries/50exists_exists/makedict/base.json b/tests/dictionaries/50exists_exists/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/50exists_exists/makedict/base.json +++ b/tests/dictionaries/50exists_exists/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/50redefine_description/makedict/base.json b/tests/dictionaries/50redefine_description/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/50redefine_description/makedict/base.json +++ b/tests/dictionaries/50redefine_description/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/51exists_nonexists/makedict/base.json b/tests/dictionaries/51exists_nonexists/makedict/base.json index 701610f6..4eee7b61 100644 --- a/tests/dictionaries/51exists_nonexists/makedict/base.json +++ b/tests/dictionaries/51exists_nonexists/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "oui"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "oui" +} diff --git a/tests/dictionaries/51exists_redefine/makedict/base.json b/tests/dictionaries/51exists_redefine/makedict/base.json index eb10bec4..50112b17 100644 --- a/tests/dictionaries/51exists_redefine/makedict/base.json +++ b/tests/dictionaries/51exists_redefine/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "oui"} +{ + "rougail.general.mode_conteneur_actif": "oui" +} diff --git a/tests/dictionaries/51redefine_auto/makedict/base.json b/tests/dictionaries/51redefine_auto/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_auto/makedict/base.json +++ b/tests/dictionaries/51redefine_auto/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_autofill/makedict/base.json b/tests/dictionaries/51redefine_autofill/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_autofill/makedict/base.json +++ b/tests/dictionaries/51redefine_autofill/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_family/makedict/base.json b/tests/dictionaries/51redefine_family/makedict/base.json index 54b3faed..1b9934fc 100644 --- a/tests/dictionaries/51redefine_family/makedict/base.json +++ b/tests/dictionaries/51redefine_family/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general2.mode_conteneur_actif2": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/51redefine_fill/makedict/base.json b/tests/dictionaries/51redefine_fill/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_fill/makedict/base.json +++ b/tests/dictionaries/51redefine_fill/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_fillauto/makedict/base.json b/tests/dictionaries/51redefine_fillauto/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_fillauto/makedict/base.json +++ b/tests/dictionaries/51redefine_fillauto/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_help/makedict/base.json b/tests/dictionaries/51redefine_help/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/51redefine_help/makedict/base.json +++ b/tests/dictionaries/51redefine_help/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/51redefine_hidden/makedict/base.json b/tests/dictionaries/51redefine_hidden/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/51redefine_hidden/makedict/base.json +++ b/tests/dictionaries/51redefine_hidden/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/51redefine_remove_check/makedict/base.json b/tests/dictionaries/51redefine_remove_check/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/51redefine_remove_check/makedict/base.json +++ b/tests/dictionaries/51redefine_remove_check/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/51redefine_remove_condition/makedict/base.json b/tests/dictionaries/51redefine_remove_condition/makedict/base.json index ee42ef2d..e21c64e6 100644 --- a/tests/dictionaries/51redefine_remove_condition/makedict/base.json +++ b/tests/dictionaries/51redefine_remove_condition/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json index ecfa44c8..0c9b2780 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json @@ -1 +1,7 @@ -{"rougail.my_var": "no", "rougail.condition": "no", "rougail.my_var1": "no", "rougail.my_var2": "no", "rougail.instanciated_module": false} +{ + "rougail.my_var": "no", + "rougail.condition": "no", + "rougail.my_var1": "no", + "rougail.my_var2": "no", + "rougail.instanciated_module": false +} diff --git a/tests/dictionaries/51redefine_validenum/makedict/base.json b/tests/dictionaries/51redefine_validenum/makedict/base.json index ef30ef31..7ca93417 100644 --- a/tests/dictionaries/51redefine_validenum/makedict/base.json +++ b/tests/dictionaries/51redefine_validenum/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "a"} +{ + "rougail.general.mode_conteneur_actif": "a" +} diff --git a/tests/dictionaries/51redefine_value/makedict/base.json b/tests/dictionaries/51redefine_value/makedict/base.json index 76f57513..993bf2df 100644 --- a/tests/dictionaries/51redefine_value/makedict/base.json +++ b/tests/dictionaries/51redefine_value/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "oui"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "oui" +} diff --git a/tests/dictionaries/51remove_fill/makedict/base.json b/tests/dictionaries/51remove_fill/makedict/base.json index bf7550e6..a13f65aa 100644 --- a/tests/dictionaries/51remove_fill/makedict/base.json +++ b/tests/dictionaries/51remove_fill/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/52exists_redefine/makedict/base.json b/tests/dictionaries/52exists_redefine/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/52exists_redefine/makedict/base.json +++ b/tests/dictionaries/52exists_redefine/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/60action_external/makedict/base.json b/tests/dictionaries/60action_external/makedict/base.json index 0b1ab7e2..553f555e 100644 --- a/tests/dictionaries/60action_external/makedict/base.json +++ b/tests/dictionaries/60action_external/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "extra.test.delay": 0, "extra.test.calc_url": "http://localhost/"} +{ + "rougail.general.mode_conteneur_actif": "non", + "extra.test.delay": 0, + "extra.test.calc_url": "http://localhost/" +} diff --git a/tests/dictionaries/60extra_externalspacecondition/makedict/base.json b/tests/dictionaries/60extra_externalspacecondition/makedict/base.json index a14f48fe..86a2ac86 100644 --- a/tests/dictionaries/60extra_externalspacecondition/makedict/base.json +++ b/tests/dictionaries/60extra_externalspacecondition/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.my_var": "no", "rougail.general.my_var1": "no", "rougail.general.instanciated_module": false, "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": "none", "extra.ejabberd.mode": "pre", "extra1.external.description": "test"} +{ + "rougail.general.my_var": "no", + "rougail.general.my_var1": "no", + "rougail.general.instanciated_module": false, + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": "none", + "extra.ejabberd.mode": "pre", + "extra1.external.description": "test" +} diff --git a/tests/dictionaries/60extra_group/makedict/base.json b/tests/dictionaries/60extra_group/makedict/base.json index 54eb0f87..43604c9f 100644 --- a/tests/dictionaries/60extra_group/makedict/base.json +++ b/tests/dictionaries/60extra_group/makedict/base.json @@ -1 +1,28 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": [{"extra.ejabberd.description.description": "test", "extra.ejabberd.description.mode": "pre"}], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description.description": [ + { + "extra.ejabberd.description.description": "test", + "extra.ejabberd.description.mode": "pre" + } + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.mailname2.engine": "jinja2", + "services.test.files.mailname2.group": "root", + "services.test.files.mailname2.included": "no", + "services.test.files.mailname2.mode": "0644", + "services.test.files.mailname2.name": "/etc/mailname2", + "services.test.files.mailname2.owner": "root", + "services.test.files.mailname2.source": "mailname2", + "services.test.files.mailname2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/60extra_help/makedict/base.json b/tests/dictionaries/60extra_help/makedict/base.json index e7ce63c0..9b605156 100644 --- a/tests/dictionaries/60extra_help/makedict/base.json +++ b/tests/dictionaries/60extra_help/makedict/base.json @@ -1 +1,17 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre", + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/60extra_load/makedict/base.json b/tests/dictionaries/60extra_load/makedict/base.json index 816c41bd..242a818d 100644 --- a/tests/dictionaries/60extra_load/makedict/base.json +++ b/tests/dictionaries/60extra_load/makedict/base.json @@ -1 +1,7 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/60extra_mandatory/makedict/base.json b/tests/dictionaries/60extra_mandatory/makedict/base.json index 3d194686..1934991a 100644 --- a/tests/dictionaries/60extra_mandatory/makedict/base.json +++ b/tests/dictionaries/60extra_mandatory/makedict/base.json @@ -1 +1,8 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "extra.ejabberd.var1": null} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre", + "extra.ejabberd.var1": null +} diff --git a/tests/dictionaries/60extra_name_family/makedict/base.json b/tests/dictionaries/60extra_name_family/makedict/base.json index eb7df63a..08a3bf0f 100644 --- a/tests/dictionaries/60extra_name_family/makedict/base.json +++ b/tests/dictionaries/60extra_name_family/makedict/base.json @@ -1 +1,7 @@ -{"rougail.extra.mode_conteneur_actif": "non", "rougail.extra.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre"} +{ + "rougail.extra.mode_conteneur_actif": "non", + "rougail.extra.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/60extra_no_condition/makedict/base.json b/tests/dictionaries/60extra_no_condition/makedict/base.json index 3e045bf4..5efa7f94 100644 --- a/tests/dictionaries/60extra_no_condition/makedict/base.json +++ b/tests/dictionaries/60extra_no_condition/makedict/base.json @@ -1 +1,8 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "rougail.general.module_instancie": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": "none", "extra.ejabberd.mode": "pre"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "rougail.general.module_instancie": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": "none", + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/60extra_redefine/makedict/base.json b/tests/dictionaries/60extra_redefine/makedict/base.json index 816c41bd..242a818d 100644 --- a/tests/dictionaries/60extra_redefine/makedict/base.json +++ b/tests/dictionaries/60extra_redefine/makedict/base.json @@ -1 +1,7 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/60extra_variable_name_extra/makedict/base.json b/tests/dictionaries/60extra_variable_name_extra/makedict/base.json index 60d4d218..1c12b906 100644 --- a/tests/dictionaries/60extra_variable_name_extra/makedict/base.json +++ b/tests/dictionaries/60extra_variable_name_extra/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.extra": null} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.extra": null +} diff --git a/tests/dictionaries/60familyaction/makedict/base.json b/tests/dictionaries/60familyaction/makedict/base.json index efe896ec..9a96ae51 100644 --- a/tests/dictionaries/60familyaction/makedict/base.json +++ b/tests/dictionaries/60familyaction/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "extra.test.delay": 0} +{ + "rougail.general.mode_conteneur_actif": "non", + "extra.test.delay": 0 +} diff --git a/tests/dictionaries/60familyaction_accent/makedict/base.json b/tests/dictionaries/60familyaction_accent/makedict/base.json index efe896ec..9a96ae51 100644 --- a/tests/dictionaries/60familyaction_accent/makedict/base.json +++ b/tests/dictionaries/60familyaction_accent/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "extra.test.delay": 0} +{ + "rougail.general.mode_conteneur_actif": "non", + "extra.test.delay": 0 +} diff --git a/tests/dictionaries/60familyaction_mandatory/makedict/base.json b/tests/dictionaries/60familyaction_mandatory/makedict/base.json index c5da58ed..8287bf85 100644 --- a/tests/dictionaries/60familyaction_mandatory/makedict/base.json +++ b/tests/dictionaries/60familyaction_mandatory/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "extra.test.delay": 0, "extra.test.day": null} +{ + "rougail.general.mode_conteneur_actif": "non", + "extra.test.delay": 0, + "extra.test.day": null +} diff --git a/tests/dictionaries/61extra_dyn/makedict/base.json b/tests/dictionaries/61extra_dyn/makedict/base.json index 4df71f24..5315f611 100644 --- a/tests/dictionaries/61extra_dyn/makedict/base.json +++ b/tests/dictionaries/61extra_dyn/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.varname": ["a"], "extra.ejabberda.modea": null} +{ + "rougail.general.varname": [ + "a" + ], + "extra.ejabberda.modea": null +} diff --git a/tests/dictionaries/61extra_dyn_extra/makedict/base.json b/tests/dictionaries/61extra_dyn_extra/makedict/base.json index 27255994..ac9cdf70 100644 --- a/tests/dictionaries/61extra_dyn_extra/makedict/base.json +++ b/tests/dictionaries/61extra_dyn_extra/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.varname": ["a"], "extra.general.varname": ["a"], "extra.ejabberda.modea": null} +{ + "rougail.general.varname": [ + "a" + ], + "extra.general.varname": [ + "a" + ], + "extra.ejabberda.modea": null +} diff --git a/tests/dictionaries/70container_files/makedict/base.json b/tests/dictionaries/70container_files/makedict/base.json index a282ce2a..fe8b4c83 100644 --- a/tests/dictionaries/70container_files/makedict/base.json +++ b/tests/dictionaries/70container_files/makedict/base.json @@ -1 +1,21 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.rougail_conf.engine": "creole", "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.included": "no", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "oui", + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.rougail_conf.engine": "creole", + "services.test.files.rougail_conf.group": "root", + "services.test.files.rougail_conf.included": "no", + "services.test.files.rougail_conf.mode": "0644", + "services.test.files.rougail_conf.name": "/rougail.conf", + "services.test.files.rougail_conf.owner": "root", + "services.test.files.rougail_conf.source": "rougail.conf", + "services.test.files.rougail_conf.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json index 5a6d32c4..d4514538 100644 --- a/tests/dictionaries/70container_files_symlink_multi/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi/makedict/base.json @@ -1 +1,34 @@ -{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.file_name2": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.file_name": [ + "/etc/mailname", + "/etc/mailname2" + ], + "rougail.file_name2": [ + "/etc/mailname3", + "/etc/mailname4" + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": [ + "/etc/mailname", + "/etc/mailname2" + ], + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.mailname2.engine": "jinja2", + "services.test.files.mailname2.group": "root", + "services.test.files.mailname2.included": "no", + "services.test.files.mailname2.mode": "0644", + "services.test.files.mailname2.name": [ + "/etc/mailname3", + "/etc/mailname4" + ], + "services.test.files.mailname2.owner": "root", + "services.test.files.mailname2.source": "mailname2", + "services.test.files.mailname2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json index 3538f49e..c5bacd74 100644 --- a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/base.json @@ -1 +1,46 @@ -{"rougail.file_name": ["/etc/mailname", "/etc/mailname2"], "rougail.file_name2": ["/etc/mailname3", "/etc/mailname4"], "rougail.var": ["mailname", "mailname2"], "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": ["/etc/mailname", "/etc/mailname2"], "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.variable": ["mailname", "mailname2"], "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "jinja2", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": ["/etc/mailname3", "/etc/mailname4"], "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.variable": ["mailname", "mailname2"], "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.file_name": [ + "/etc/mailname", + "/etc/mailname2" + ], + "rougail.file_name2": [ + "/etc/mailname3", + "/etc/mailname4" + ], + "rougail.var": [ + "mailname", + "mailname2" + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": [ + "/etc/mailname", + "/etc/mailname2" + ], + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.variable": [ + "mailname", + "mailname2" + ], + "services.test.files.mailname.activate": true, + "services.test.files.mailname2.engine": "jinja2", + "services.test.files.mailname2.group": "root", + "services.test.files.mailname2.included": "no", + "services.test.files.mailname2.mode": "0644", + "services.test.files.mailname2.name": [ + "/etc/mailname3", + "/etc/mailname4" + ], + "services.test.files.mailname2.owner": "root", + "services.test.files.mailname2.source": "mailname2", + "services.test.files.mailname2.variable": [ + "mailname", + "mailname2" + ], + "services.test.files.mailname2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json index 74235a0b..e072ad39 100644 --- a/tests/dictionaries/70container_files_symlink_variable/makedict/base.json +++ b/tests/dictionaries/70container_files_symlink_variable/makedict/base.json @@ -1 +1,15 @@ -{"rougail.file_name": "/etc/mailname", "rougail.var": "mailname", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.variable": "mailname", "services.test.files.mailname.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.file_name": "/etc/mailname", + "rougail.var": "mailname", + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.variable": "mailname", + "services.test.files.mailname.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_files_twice/makedict/base.json b/tests/dictionaries/70container_files_twice/makedict/base.json index bd97710f..24f9d673 100644 --- a/tests/dictionaries/70container_files_twice/makedict/base.json +++ b/tests/dictionaries/70container_files_twice/makedict/base.json @@ -1 +1,29 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname_1.engine": "creole", "services.test.files.mailname_1.group": "root", "services.test.files.mailname_1.included": "no", "services.test.files.mailname_1.mode": "0644", "services.test.files.mailname_1.name": "/etc/eole/mailname", "services.test.files.mailname_1.owner": "root", "services.test.files.mailname_1.source": "mailname", "services.test.files.mailname_1.activate": true, "services.test.files.rougail_conf.engine": "creole", "services.test.files.rougail_conf.group": "root", "services.test.files.rougail_conf.included": "no", "services.test.files.rougail_conf.mode": "0644", "services.test.files.rougail_conf.name": "/rougail.conf", "services.test.files.rougail_conf.owner": "root", "services.test.files.rougail_conf.source": "rougail.conf", "services.test.files.rougail_conf.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "oui", + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.mailname_1.engine": "creole", + "services.test.files.mailname_1.group": "root", + "services.test.files.mailname_1.included": "no", + "services.test.files.mailname_1.mode": "0644", + "services.test.files.mailname_1.name": "/etc/eole/mailname", + "services.test.files.mailname_1.owner": "root", + "services.test.files.mailname_1.source": "mailname", + "services.test.files.mailname_1.activate": true, + "services.test.files.rougail_conf.engine": "creole", + "services.test.files.rougail_conf.group": "root", + "services.test.files.rougail_conf.included": "no", + "services.test.files.rougail_conf.mode": "0644", + "services.test.files.rougail_conf.name": "/rougail.conf", + "services.test.files.rougail_conf.owner": "root", + "services.test.files.rougail_conf.source": "rougail.conf", + "services.test.files.rougail_conf.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_filesmulti/makedict/base.json b/tests/dictionaries/70container_filesmulti/makedict/base.json index 4ea58299..f9f24114 100644 --- a/tests/dictionaries/70container_filesmulti/makedict/base.json +++ b/tests/dictionaries/70container_filesmulti/makedict/base.json @@ -1 +1,21 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname.engine": "creole", "services.test.files.mailname.group": "root", "services.test.files.mailname.included": "no", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.activate": true, "services.test.files.mailname2.engine": "creole", "services.test.files.mailname2.group": "root", "services.test.files.mailname2.included": "no", "services.test.files.mailname2.mode": "0644", "services.test.files.mailname2.name": "/etc/mailname2", "services.test.files.mailname2.owner": "root", "services.test.files.mailname2.source": "mailname2", "services.test.files.mailname2.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "oui", + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.mailname2.engine": "creole", + "services.test.files.mailname2.group": "root", + "services.test.files.mailname2.included": "no", + "services.test.files.mailname2.mode": "0644", + "services.test.files.mailname2.name": "/etc/mailname2", + "services.test.files.mailname2.owner": "root", + "services.test.files.mailname2.source": "mailname2", + "services.test.files.mailname2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_filesredefine/makedict/base.json b/tests/dictionaries/70container_filesredefine/makedict/base.json index 3ffb0e06..02f6cd11 100644 --- a/tests/dictionaries/70container_filesredefine/makedict/base.json +++ b/tests/dictionaries/70container_filesredefine/makedict/base.json @@ -1 +1,13 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.files.mailname_new.engine": "creole", "services.test.files.mailname_new.group": "root", "services.test.files.mailname_new.included": "no", "services.test.files.mailname_new.mode": "0644", "services.test.files.mailname_new.name": "/etc/mailname", "services.test.files.mailname_new.owner": "root", "services.test.files.mailname_new.source": "mailname.new", "services.test.files.mailname_new.activate": true, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "oui", + "services.test.files.mailname_new.engine": "creole", + "services.test.files.mailname_new.group": "root", + "services.test.files.mailname_new.included": "no", + "services.test.files.mailname_new.mode": "0644", + "services.test.files.mailname_new.name": "/etc/mailname", + "services.test.files.mailname_new.owner": "root", + "services.test.files.mailname_new.source": "mailname.new", + "services.test.files.mailname_new.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_new/makedict/base.json b/tests/dictionaries/70container_new/makedict/base.json index 0ecf390c..a9753778 100644 --- a/tests/dictionaries/70container_new/makedict/base.json +++ b/tests/dictionaries/70container_new/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "oui", + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_newnocont/makedict/base.json b/tests/dictionaries/70container_newnocont/makedict/base.json index e894f5f6..e38686ea 100644 --- a/tests/dictionaries/70container_newnocont/makedict/base.json +++ b/tests/dictionaries/70container_newnocont/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_newwithip/makedict/base.json b/tests/dictionaries/70container_newwithip/makedict/base.json index 7b52a6a6..b8740113 100644 --- a/tests/dictionaries/70container_newwithip/makedict/base.json +++ b/tests/dictionaries/70container_newwithip/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.adresse_ip_test": null, "services.test.activate": true, "services.test.manage": true} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.adresse_ip_test": null, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70container_save/makedict/base.json b/tests/dictionaries/70container_save/makedict/base.json index eb10bec4..50112b17 100644 --- a/tests/dictionaries/70container_save/makedict/base.json +++ b/tests/dictionaries/70container_save/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "oui"} +{ + "rougail.general.mode_conteneur_actif": "oui" +} diff --git a/tests/dictionaries/70service_base/makedict/base.json b/tests/dictionaries/70service_base/makedict/base.json index bf877dda..d89ef3da 100644 --- a/tests/dictionaries/70service_base/makedict/base.json +++ b/tests/dictionaries/70service_base/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "oui", "services.testsrv.activate": true, "services.testsrv.manage": true} +{ + "rougail.general.mode_conteneur_actif": "oui", + "services.testsrv.activate": true, + "services.testsrv.manage": true +} diff --git a/tests/dictionaries/70service_not_managed/makedict/base.json b/tests/dictionaries/70service_not_managed/makedict/base.json index cd8226be..e67af74a 100644 --- a/tests/dictionaries/70service_not_managed/makedict/base.json +++ b/tests/dictionaries/70service_not_managed/makedict/base.json @@ -1 +1,13 @@ -{"rougail.var": "mailname", "services.test.files.test.engine": "creole", "services.test.files.test.group": "root", "services.test.files.test.included": "no", "services.test.files.test.mode": "0644", "services.test.files.test.name": "/tmp/test", "services.test.files.test.owner": "root", "services.test.files.test.source": "test", "services.test.files.test.activate": true, "services.test.activate": true, "services.test.manage": false} +{ + "rougail.var": "mailname", + "services.test.files.test.engine": "creole", + "services.test.files.test.group": "root", + "services.test.files.test.included": "no", + "services.test.files.test.mode": "0644", + "services.test.files.test.name": "/tmp/test", + "services.test.files.test.owner": "root", + "services.test.files.test.source": "test", + "services.test.files.test.activate": true, + "services.test.activate": true, + "services.test.manage": false +} diff --git a/tests/dictionaries/70service_servicelist/makedict/base.json b/tests/dictionaries/70service_servicelist/makedict/base.json index c53768ff..939e54eb 100644 --- a/tests/dictionaries/70service_servicelist/makedict/base.json +++ b/tests/dictionaries/70service_servicelist/makedict/base.json @@ -1 +1,5 @@ -{"rougail.condition": "no", "services.test.activate": true, "services.test.manage": true} +{ + "rougail.condition": "no", + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/70service_servicelist_file/makedict/base.json b/tests/dictionaries/70service_servicelist_file/makedict/base.json index 696512dc..0c5252fa 100644 --- a/tests/dictionaries/70service_servicelist_file/makedict/base.json +++ b/tests/dictionaries/70service_servicelist_file/makedict/base.json @@ -1 +1,14 @@ -{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.1", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.included": "no", "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.activate": true, "services.test.activate": false, "services.test.manage": true} +{ + "rougail.condition": "no", + "rougail.nut_monitor_host": "192.168.0.1", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "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.activate": true, + "services.test.activate": false, + "services.test.manage": true +} diff --git a/tests/dictionaries/70service_servicelist_ip/makedict/base.json b/tests/dictionaries/70service_servicelist_ip/makedict/base.json index 099b2ab3..07338b83 100644 --- a/tests/dictionaries/70service_servicelist_ip/makedict/base.json +++ b/tests/dictionaries/70service_servicelist_ip/makedict/base.json @@ -1 +1,8 @@ -{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.1", "services.test.ip.nut_monitor_host.name": "192.168.0.1", "services.test.ip.nut_monitor_host.activate": true, "services.test.activate": false, "services.test.manage": true} +{ + "rougail.condition": "no", + "rougail.nut_monitor_host": "192.168.0.1", + "services.test.ip.nut_monitor_host.name": "192.168.0.1", + "services.test.ip.nut_monitor_host.activate": true, + "services.test.activate": false, + "services.test.manage": true +} diff --git a/tests/dictionaries/70service_servicelist_not_managed/makedict/base.json b/tests/dictionaries/70service_servicelist_not_managed/makedict/base.json index f8798a39..14db4b00 100644 --- a/tests/dictionaries/70service_servicelist_not_managed/makedict/base.json +++ b/tests/dictionaries/70service_servicelist_not_managed/makedict/base.json @@ -1 +1,5 @@ -{"rougail.condition": "no", "services.test.activate": true, "services.test.manage": false} +{ + "rougail.condition": "no", + "services.test.activate": true, + "services.test.manage": false +} diff --git a/tests/dictionaries/70services_ip/makedict/base.json b/tests/dictionaries/70services_ip/makedict/base.json index df145db7..d333bde1 100644 --- a/tests/dictionaries/70services_ip/makedict/base.json +++ b/tests/dictionaries/70services_ip/makedict/base.json @@ -1 +1,7 @@ -{"rougail.nut_monitor_host": "192.168.0.1", "services.nut.ip.nut_monitor_host.name": "192.168.0.1", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} +{ + "rougail.nut_monitor_host": "192.168.0.1", + "services.nut.ip.nut_monitor_host.name": "192.168.0.1", + "services.nut.ip.nut_monitor_host.activate": true, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/dictionaries/70services_ip_cidr/makedict/base.json b/tests/dictionaries/70services_ip_cidr/makedict/base.json index cc6e1280..9097e24c 100644 --- a/tests/dictionaries/70services_ip_cidr/makedict/base.json +++ b/tests/dictionaries/70services_ip_cidr/makedict/base.json @@ -1 +1,7 @@ -{"rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} +{ + "rougail.nut_monitor_host": "192.168.0.0/24", + "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", + "services.nut.ip.nut_monitor_host.activate": true, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/dictionaries/70services_ip_iplist/makedict/base.json b/tests/dictionaries/70services_ip_iplist/makedict/base.json index 4cdf6f51..8c62d10b 100644 --- a/tests/dictionaries/70services_ip_iplist/makedict/base.json +++ b/tests/dictionaries/70services_ip_iplist/makedict/base.json @@ -1 +1,8 @@ -{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} +{ + "rougail.condition": "no", + "rougail.nut_monitor_host": "192.168.0.0/24", + "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", + "services.nut.ip.nut_monitor_host.activate": true, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/dictionaries/70services_ip_iplist2/makedict/base.json b/tests/dictionaries/70services_ip_iplist2/makedict/base.json index 3d3a13a2..8c1cc4a7 100644 --- a/tests/dictionaries/70services_ip_iplist2/makedict/base.json +++ b/tests/dictionaries/70services_ip_iplist2/makedict/base.json @@ -1 +1,8 @@ -{"rougail.condition": "yes", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": false, "services.nut.activate": true, "services.nut.manage": true} +{ + "rougail.condition": "yes", + "rougail.nut_monitor_host": "192.168.0.0/24", + "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", + "services.nut.ip.nut_monitor_host.activate": false, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/dictionaries/70services_ip_leadership/makedict/base.json b/tests/dictionaries/70services_ip_leadership/makedict/base.json index c09ba74a..af10e88a 100644 --- a/tests/dictionaries/70services_ip_leadership/makedict/base.json +++ b/tests/dictionaries/70services_ip_leadership/makedict/base.json @@ -1 +1,17 @@ -{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": [{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": "255.255.255.0", "rougail.general.nut_monitor_netmask.nut_monitor_host": "192.168.1.0"}], "services.ntp.ip.nut_monitor_host.name": ["192.168.1.0"], "services.ntp.ip.nut_monitor_host.netmask": ["255.255.255.0"], "services.ntp.ip.nut_monitor_host.activate": true, "services.ntp.activate": true, "services.ntp.manage": true} +{ + "rougail.general.nut_monitor_netmask.nut_monitor_netmask": [ + { + "rougail.general.nut_monitor_netmask.nut_monitor_netmask": "255.255.255.0", + "rougail.general.nut_monitor_netmask.nut_monitor_host": "192.168.1.0" + } + ], + "services.ntp.ip.nut_monitor_host.name": [ + "192.168.1.0" + ], + "services.ntp.ip.nut_monitor_host.netmask": [ + "255.255.255.0" + ], + "services.ntp.ip.nut_monitor_host.activate": true, + "services.ntp.activate": true, + "services.ntp.manage": true +} diff --git a/tests/dictionaries/70services_ip_multi/makedict/base.json b/tests/dictionaries/70services_ip_multi/makedict/base.json index 62d6534c..9e7241f3 100644 --- a/tests/dictionaries/70services_ip_multi/makedict/base.json +++ b/tests/dictionaries/70services_ip_multi/makedict/base.json @@ -1 +1,13 @@ -{"rougail.nut_monitor_host": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.name": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} +{ + "rougail.nut_monitor_host": [ + "192.168.0.1", + "192.168.0.2" + ], + "services.nut.ip.nut_monitor_host.name": [ + "192.168.0.1", + "192.168.0.2" + ], + "services.nut.ip.nut_monitor_host.activate": true, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/dictionaries/70services_ip_network/makedict/base.json b/tests/dictionaries/70services_ip_network/makedict/base.json index 7ba68352..dc76fb00 100644 --- a/tests/dictionaries/70services_ip_network/makedict/base.json +++ b/tests/dictionaries/70services_ip_network/makedict/base.json @@ -1 +1,9 @@ -{"rougail.nut_monitor_netmask": "255.255.255.0", "rougail.nut_monitor_host": "192.168.0.0", "services.nut.ip.nut_monitor_host.name": "192.168.0.0", "services.nut.ip.nut_monitor_host.netmask": "255.255.255.0", "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} +{ + "rougail.nut_monitor_netmask": "255.255.255.0", + "rougail.nut_monitor_host": "192.168.0.0", + "services.nut.ip.nut_monitor_host.name": "192.168.0.0", + "services.nut.ip.nut_monitor_host.netmask": "255.255.255.0", + "services.nut.ip.nut_monitor_host.activate": true, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json b/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json index 81ff5591..d3ad5532 100644 --- a/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json +++ b/tests/dictionaries/70services_ip_not_mandatory/makedict/base.json @@ -1 +1,7 @@ -{"rougail.nut_monitor_host": null, "services.nut.ip.nut_monitor_host.name": null, "services.nut.ip.nut_monitor_host.activate": true, "services.nut.activate": true, "services.nut.manage": true} +{ + "rougail.nut_monitor_host": null, + "services.nut.ip.nut_monitor_host.name": null, + "services.nut.ip.nut_monitor_host.activate": true, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/test_2_makedict.py b/tests/test_2_makedict.py index 617cbe7b..db5069ca 100644 --- a/tests/test_2_makedict.py +++ b/tests/test_2_makedict.py @@ -53,7 +53,7 @@ async def launch_flattener(test_dir): mkdir(makedict_dir) if not isfile(makedict_file) or debug: with open(makedict_file, 'w') as fh: - dump(config_dict, fh) + dump(config_dict, fh, indent=4) fh.write('\n') if not isfile(makedict_file): if config_dict: From 2ca7b9a6fc4bf359e01cd4c454d79bb9e190be3a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 22 Feb 2021 19:28:51 +0100 Subject: [PATCH 142/168] personaze mode --- doc/dev/config.md | 19 +++++ doc/mode.md | 4 +- src/rougail/__init__.py | 3 +- src/rougail/annotator/__init__.py | 6 +- src/rougail/annotator/check.py | 1 + src/rougail/annotator/condition.py | 11 ++- src/rougail/annotator/family.py | 77 +++++++++++++------ src/rougail/annotator/property.py | 12 ++- src/rougail/annotator/service.py | 2 +- src/rougail/config.py | 4 + src/rougail/convert.py | 9 +-- src/rougail/data/rougail.dtd | 4 +- src/rougail/path.py | 3 +- src/rougail/tiramisureflector.py | 2 +- .../00load_autofreeze/tiramisu/base.py | 2 +- .../00load_autofreezeexpert/tiramisu/base.py | 2 +- .../dictionaries/00load_autosave/00-base.xml | 1 + .../00load_autosave/makedict/base.json | 1 + .../00load_autosave/tiramisu/base.py | 7 +- .../00load_autosaveexpert/00-base.xml | 1 + .../00load_autosaveexpert/makedict/base.json | 1 + .../00load_autosaveexpert/tiramisu/base.py | 7 +- .../01auto_autofreeze/tiramisu/base.py | 2 +- .../01fill_autofreeze/tiramisu/base.py | 2 +- .../dictionaries/01fill_autosave/00-base.xml | 1 + .../01fill_autosave/makedict/base.json | 1 + .../01fill_autosave/tiramisu/base.py | 9 ++- .../tiramisu/base.py | 2 +- .../02autosave_hidden_frozenifin/00-base.xml | 1 + .../makedict/base.json | 1 + .../tiramisu/base.py | 9 ++- .../10autosave_hidden/00-base.xml | 1 + .../10autosave_hidden/makedict/base.json | 1 + .../10autosave_hidden/tiramisu/base.py | 9 ++- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../80leadership_auto_save/00-base.xml | 1 + .../dictionaries/80mode_conflict/00-base.xml | 3 +- tests/personalize_mode/dictionary/00-base.xml | 11 +++ tests/test_1_flattener.py | 6 -- tests/test_others.py | 43 +++++++++++ 41 files changed, 204 insertions(+), 82 deletions(-) create mode 100644 tests/personalize_mode/dictionary/00-base.xml create mode 100644 tests/test_others.py diff --git a/doc/dev/config.md b/doc/dev/config.md index 7c804f88..5e1210f8 100644 --- a/doc/dev/config.md +++ b/doc/dev/config.md @@ -73,3 +73,22 @@ Le répertoire de destination des fichiers générés est géré dans la clef "d ## La variable auto_freeze La propriété auto_freeze n'est appliqué que une variable spécifique passe à True. Par défaut le nom de la variable est "instancied_module", mais il est possible de changer le nom de cette variable via la clef "auto_freeze_variable". + +## Les modes + +Les modes sont personnalisables dans Rougail. Par défaut les modes sont "basic", "normal" et "expert". +Il est possible de changer cette liste via la clef "modes_level". + +Si vous changer ces valeurs, penser à changer les modes par défaut des familles et des variables. + +## Le mode par défaut pour une famille + +Le mode par défaut d'une famille est "basic". Il est possible de changer le mode par défaut d'une famille via la clef "default_family_mode". + +## Le mode par défaut pour une variable + +Le mode par défaut d'une variable est "normal". Il est possible de changer le mode par défaut d'une variable via la clef "default_variable_mode". + +## Le nom des fonctions internes + +Il est possible d'ajouter des fonctions interne via la clef "internal_functions". diff --git a/doc/mode.md b/doc/mode.md index 66bc294e..21d928d0 100644 --- a/doc/mode.md +++ b/doc/mode.md @@ -1,8 +1,10 @@ Mode ==== -Il existe trois "mode" dans Rougail : +Par défault, il existe trois "mode" dans Rougail : - basic : variables indispensables à la mise en place d'un service - normal : variables couramment modifié par l'utilisateur - expert : variables a manipuler avec précausion et en toute connaissance de cause + +Il est possible de personnaliser les modes dans la [configuration de rougail](dev/config.md) diff --git a/src/rougail/__init__.py b/src/rougail/__init__.py index ccad5b9a..a36f3a94 100644 --- a/src/rougail/__init__.py +++ b/src/rougail/__init__.py @@ -27,6 +27,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from .convert import RougailConvert from .template.systemd import RougailSystemdTemplate from .config import RougailConfig -from .annotator import modes -__ALL__ = ('RougailConvert', 'RougailSystemdTemplate', 'RougailConfig', 'modes') +__ALL__ = ('RougailConvert', 'RougailSystemdTemplate', 'RougailConfig') diff --git a/src/rougail/annotator/__init__.py b/src/rougail/annotator/__init__.py index 9b1faa68..6c1ee0c6 100644 --- a/src/rougail/annotator/__init__.py +++ b/src/rougail/annotator/__init__.py @@ -31,11 +31,11 @@ from .check import CheckAnnotator from .value import ValueAnnotator from .condition import ConditionAnnotator from .fill import FillAnnotator -from .family import FamilyAnnotator, modes +from .family import FamilyAnnotator from .property import PropertyAnnotator class SpaceAnnotator: # pylint: disable=R0903 - """Transformations applied on a CreoleObjSpace instance + """Transformations applied on a object instance """ def __init__(self, objectspace, eosfunc_file): self.objectspace = objectspace @@ -54,4 +54,4 @@ class SpaceAnnotator: # pylint: disable=R0903 PropertyAnnotator(objectspace) -__all__ = ('SpaceAnnotator', 'CONVERT_OPTION', 'modes') +__all__ = ('SpaceAnnotator', 'CONVERT_OPTION') diff --git a/src/rougail/annotator/check.py b/src/rougail/annotator/check.py index 8d497a14..00915f04 100644 --- a/src/rougail/annotator/check.py +++ b/src/rougail/annotator/check.py @@ -50,6 +50,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): self.only_variable = True self.functions = dir(load_modules(eosfunc_file)) self.functions.extend(INTERNAL_FUNCTIONS) + self.functions.extend(self.objectspace.rougailconfig['internal_functions']) self.target_is_uniq = False self.convert_target(self.objectspace.space.constraints.check) self.convert_param(self.objectspace.space.constraints.check) diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 4c7ba92c..8272705a 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -72,13 +72,16 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): only if auto_freeze_variable is True this variable is frozen """ for variable in self.get_variables(): - if not variable.auto_freeze: + if not variable.auto_freeze and not variable.auto_save: continue if variable.namespace != self.objectspace.rougailconfig['variable_namespace']: msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') raise DictConsistencyError(msg, 49, variable.xmlfiles) new_condition = self.objectspace.condition(variable.xmlfiles) - new_condition.name = 'auto_frozen_if_not_in' + if variable.auto_freeze: + new_condition.name = 'auto_frozen_if_not_in' + else: + new_condition.name = 'auto_saved_if_not_in' new_condition.namespace = variable.namespace new_condition.source = self.objectspace.rougailconfig['auto_freeze_variable'] new_param = self.objectspace.param(variable.xmlfiles) @@ -147,7 +150,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): if condition_name.startswith('hidden_if_'): return ['hidden', 'frozen', 'force_default_on_freeze'] if condition_name == 'auto_frozen_if_not_in': - return ['auto_frozen'] + return ['force_store_value', 'frozen'] + if condition_name == 'auto_saved_if_not_in': + return ['force_store_value'] return [condition_name.split('_', 1)[0]] def _get_family_variables_from_target(self, diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index eec0c4ff..da3c4421 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -30,18 +30,12 @@ from ..utils import normalize_family from .variable import Walk -#mode order is important -modes_level = ('basic', 'normal', 'expert') - - class Mode: # pylint: disable=R0903 """Class to manage mode level """ def __init__(self, - name: str, level: int, ) -> None: - self.name = name self.level = level def __gt__(self, @@ -50,9 +44,6 @@ class Mode: # pylint: disable=R0903 return other.level < self.level -modes = {name: Mode(name, idx) for idx, name in enumerate(modes_level)} - - class FamilyAnnotator(Walk): """Annotate family """ @@ -62,6 +53,7 @@ class FamilyAnnotator(Walk): self.objectspace = objectspace if not hasattr(self.objectspace.space, 'variables'): return + self.modes = {name: Mode(idx) for idx, name in enumerate(self.objectspace.rougailconfig['modes_level'])} self.remove_empty_families() self.family_names() self.change_modes() @@ -104,13 +96,34 @@ class FamilyAnnotator(Walk): def change_modes(self): """change the mode of variables """ + modes_level = self.objectspace.rougailconfig['modes_level'] + default_variable_mode = self.objectspace.rougailconfig['default_variable_mode'] + if default_variable_mode not in modes_level: + msg = _(f'default variable mode "{default_variable_mode}" is not a valid mode, ' + f'valid modes are {modes_level}') + raise DictConsistencyError(msg, 72, None) + default_family_mode = self.objectspace.rougailconfig['default_family_mode'] + if default_family_mode not in modes_level: + msg = _(f'default family mode "{default_family_mode}" is not a valid mode, ' + f'valid modes are {modes_level}') + raise DictConsistencyError(msg, 73, None) families = list(self.get_families()) for family in families: + self.valid_mode(family) self._set_default_mode(family) families.reverse() for family in families: self._change_family_mode(family) + def valid_mode(self, + obj, + ) -> None: + modes_level = self.objectspace.rougailconfig['modes_level'] + if hasattr(obj, 'mode') and obj.mode not in modes_level: + msg = _(f'mode "{obj.mode}" for "{obj.name}" is not a valid mode, ' + f'valid modes are {modes_level}') + raise DictConsistencyError(msg, 71, obj.xmlfiles) + def _set_default_mode(self, family: 'self.objectspace.family', ) -> None: @@ -121,6 +134,7 @@ class FamilyAnnotator(Walk): if not hasattr(family, 'variable'): return for variable in family.variable.values(): + self.valid_mode(variable) if isinstance(variable, self.objectspace.family): if family_mode and not self._has_mode(variable): self._set_auto_mode(variable, family_mode) @@ -143,13 +157,13 @@ class FamilyAnnotator(Walk): # if its mode is not defined by the user if not self._has_mode(variable) and \ (variable.auto_save is True or variable.auto_freeze is True): - self._set_auto_mode(variable, modes_level[0]) + variable.mode = self.objectspace.rougailconfig['modes_level'][0] # mandatory variable without value is a basic variable elif not self._has_mode(variable) and \ variable.mandatory is True and \ not hasattr(variable, 'default') and \ not hasattr(variable, 'default_multi'): - self._set_auto_mode(variable, modes_level[0]) + variable.mode = self.objectspace.rougailconfig['modes_level'][0] elif family_mode and not self._has_mode(variable): self._set_auto_mode(variable, family_mode) @@ -164,6 +178,7 @@ class FamilyAnnotator(Walk): ) -> None: leader_mode = None for follower in leadership.variable: + self.valid_mode(follower) if follower.auto_save is True: msg = _(f'leader/followers "{follower.name}" could not be auto_save') raise DictConsistencyError(msg, 29, leadership.xmlfiles) @@ -171,14 +186,18 @@ class FamilyAnnotator(Walk): msg = f'leader/followers "{follower.name}" could not be auto_freeze' raise DictConsistencyError(_(msg), 30, leadership.xmlfiles) if leader_mode is not None: - if modes[leader_mode] > modes[follower.mode]: + if hasattr(follower, 'mode'): + follower_mode = follower.mode + else: + follower_mode = self.objectspace.rougailconfig['default_variable_mode'] + if self.modes[leader_mode] > self.modes[follower_mode]: if self._has_mode(follower) and not self._has_mode(leadership.variable[0]): # if follower has mode but not the leader - self._set_auto_mode(leadership.variable[0], follower.mode) + self._set_auto_mode(leadership.variable[0], follower_mode) else: # leader's mode is minimum level if self._has_mode(follower): - msg = _(f'the follower "{follower.name}" is in "{follower.mode}" mode ' + msg = _(f'the follower "{follower.name}" is in "{follower_mode}" mode ' f'but leader have the higher mode "{leader_mode}"') raise DictConsistencyError(msg, 63, follower.xmlfiles) self._set_auto_mode(follower, leader_mode) @@ -186,8 +205,13 @@ class FamilyAnnotator(Walk): family_mode, ) if leader_mode is None: - leader_mode = leadership.variable[0].mode - self._set_auto_mode(leadership, leadership.variable[0].mode) + if hasattr(leadership.variable[0], 'mode'): + leader_mode = leadership.variable[0].mode + else: + leader_mode = self.objectspace.rougailconfig['default_variable_mode'] + if hasattr(leadership.variable[0], 'mode'): + leader_mode = leadership.variable[0].mode + self._set_auto_mode(leadership, leader_mode) def _change_family_mode(self, family: 'self.objectspace.family', @@ -195,8 +219,8 @@ class FamilyAnnotator(Walk): if hasattr(family, 'mode'): family_mode = family.mode else: - family_mode = modes_level[1] - min_variable_mode = modes_level[-1] + family_mode = self.objectspace.rougailconfig['default_family_mode'] + min_variable_mode = self.objectspace.rougailconfig['modes_level'][-1] # change variable mode, but not if variables are not in a family if hasattr(family, 'variable'): for variable in family.variable.values(): @@ -208,9 +232,12 @@ class FamilyAnnotator(Walk): func(variable, family_mode, ) - if modes[min_variable_mode] > modes[variable.mode]: + elif not hasattr(variable, 'mode'): + variable.mode = self.objectspace.rougailconfig['default_family_mode'] + if self.modes[min_variable_mode] > self.modes[variable.mode]: min_variable_mode = variable.mode - if hasattr(family, 'mode') and family.mode != min_variable_mode: + if isinstance(family, self.objectspace.family) and \ + (not hasattr(family, 'mode') or family.mode != min_variable_mode): # set the lower variable mode to family if self._has_mode(family): msg = _(f'the family "{family.name}" is in "{family.mode}" mode but variables and ' @@ -222,13 +249,19 @@ class FamilyAnnotator(Walk): variable, family_mode: str, ) -> None: + if hasattr(variable, 'mode'): + variable_mode = variable.mode + else: + variable_mode = self.objectspace.rougailconfig['default_variable_mode'] # none basic variable in high level family has to be in high level - if modes[variable.mode] < modes[family_mode]: + if self.modes[variable_mode] < self.modes[family_mode]: if self._has_mode(variable): - msg = _(f'the variable "{variable.name}" is in "{variable.mode}" mode ' + msg = _(f'the variable "{variable.name}" is in "{variable_mode}" mode ' f'but family has the higher family mode "{family_mode}"') raise DictConsistencyError(msg, 61, variable.xmlfiles) self._set_auto_mode(variable, family_mode) + if not hasattr(variable, 'mode'): + variable.mode = variable_mode def _change_variable_mode_leader(self, leadership, diff --git a/src/rougail/annotator/property.py b/src/rougail/annotator/property.py index 848320ba..f81207da 100644 --- a/src/rougail/annotator/property.py +++ b/src/rougail/annotator/property.py @@ -29,11 +29,8 @@ from ..error import DictConsistencyError from .variable import Walk -PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze', +PROPERTIES = ('hidden', 'frozen', 'force_default_on_freeze', 'force_store_value', 'disabled', 'mandatory') -CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], - 'auto_freeze': ['force_store_value', 'auto_freeze'], - } class PropertyAnnotator(Walk): @@ -54,7 +51,8 @@ class PropertyAnnotator(Walk): """ # hidden variable is also frozen if isinstance(variable, self.objectspace.variable) and variable.hidden is True: - variable.frozen = True + if not variable.auto_freeze: + variable.frozen = True if not variable.auto_save and \ not variable.auto_freeze and \ 'force_default_on_freeze' not in vars(variable): @@ -64,8 +62,8 @@ class PropertyAnnotator(Walk): for prop in PROPERTIES: if hasattr(variable, prop): if getattr(variable, prop) is True: - for subprop in CONVERT_PROPERTIES.get(prop, [prop]): - variable.properties.append(subprop) +# for subprop in CONVERT_PROPERTIES.get(prop, [prop]): + variable.properties.append(prop) setattr(variable, prop, None) if hasattr(variable, 'mode') and variable.mode: variable.properties.append(variable.mode) diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index e75c3170..e09260e9 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -31,7 +31,7 @@ from ..i18n import _ from ..utils import normalize_family from ..error import DictConsistencyError from ..config import RougailConfig -# a CreoleObjSpace's attribute has some annotations +# a object's attribute has some annotations # that shall not be present in the exported (flatened) XML ERASED_ATTRIBUTES = ('redefine', 'exists', 'optional', 'remove_check', 'namespace', 'remove_condition', 'path', 'instance_mode', 'index', diff --git a/src/rougail/config.py b/src/rougail/config.py index 6f8dbdd0..b9690dee 100644 --- a/src/rougail/config.py +++ b/src/rougail/config.py @@ -43,4 +43,8 @@ RougailConfig = {'dictionaries_dir': [join(ROUGAILROOT, 'dictionaries')], 'variable_namespace': 'rougail', 'auto_freeze_variable': 'instanciated_module', 'default_engine': 'creole', + 'internal_functions': [], + 'modes_level': ['basic', 'normal', 'expert'], + 'default_family_mode': 'basic', + 'default_variable_mode': 'normal', } diff --git a/src/rougail/convert.py b/src/rougail/convert.py index 2e746a6b..9d6a595c 100644 --- a/src/rougail/convert.py +++ b/src/rougail/convert.py @@ -27,12 +27,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Sample usage:: - >>> from rougail import Rougail - >>> rougail = Rougail() - >>> rougail.load_dictionaries(['/usr/share/rougail/dicos']) - >>> rougail.load_extra_dictionaries('extra1', ['/usr/share/rougail/extra1']) - >>> rougail.space_visitor('/usr/share/rougail/funcs.py') - >>> tiramisu = rougail.save() + >>> from rougail import RougailConvert + >>> rougail = RougailConvert() + >>> tiramisu = rougail.save('tiramisu.py') The Rougail diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 8fbb6c05..ddf92e3f 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -80,7 +80,7 @@ - + @@ -97,7 +97,7 @@ - + diff --git a/src/rougail/path.py b/src/rougail/path.py index f18d055d..acfdebe1 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -30,8 +30,7 @@ from .utils import normalize_family class Path: - """Helper class to handle the `path` attribute of a CreoleObjSpace - instance. + """Helper class to handle the `path` attribute. sample: path="creole.general.condition" """ diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 3fff6b2a..c589dfa4 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -55,7 +55,7 @@ class TiramisuReflector: ): self.index = 0 self.text = [] - if isfile(funcs_path): + if funcs_path and isfile(funcs_path): self.text.extend(["from importlib.machinery import SourceFileLoader", "from importlib.util import spec_from_loader, module_from_spec", f"loader = SourceFileLoader('func', '{funcs_path}')", diff --git a/tests/dictionaries/00load_autofreeze/tiramisu/base.py b/tests/dictionaries/00load_autofreeze/tiramisu/base.py index 43889062..d8e34b87 100644 --- a/tests/dictionaries/00load_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreeze/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_3 = BoolOption(name="instanciated_module", doc="instanciated_module", default=False, properties=frozenset({"mandatory", "normal"})) -option_2 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"auto_freeze", "force_store_value", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "mandatory", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py index 85abcb29..c4dd11b4 100644 --- a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_3 = BoolOption(name="instanciated_module", doc="instanciated_module", default=False, properties=frozenset({"mandatory", "normal"})) -option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"auto_freeze", "expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "mandatory", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/00load_autosave/00-base.xml b/tests/dictionaries/00load_autosave/00-base.xml index 7a44967a..216d5cd5 100644 --- a/tests/dictionaries/00load_autosave/00-base.xml +++ b/tests/dictionaries/00load_autosave/00-base.xml @@ -1,6 +1,7 @@ + non diff --git a/tests/dictionaries/00load_autosave/makedict/base.json b/tests/dictionaries/00load_autosave/makedict/base.json index 25056378..dfcc8f87 100644 --- a/tests/dictionaries/00load_autosave/makedict/base.json +++ b/tests/dictionaries/00load_autosave/makedict/base.json @@ -1,3 +1,4 @@ { + "rougail.instanciated_module": true, "rougail.general.mode_conteneur_actif": "non" } diff --git a/tests/dictionaries/00load_autosave/tiramisu/base.py b/tests/dictionaries/00load_autosave/tiramisu/base.py index e5f8b1dc..cd1929b0 100644 --- a/tests/dictionaries/00load_autosave/tiramisu/base.py +++ b/tests/dictionaries/00load_autosave/tiramisu/base.py @@ -11,7 +11,8 @@ try: from tiramisu3 import * except: from tiramisu import * -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "force_store_value", "mandatory"})) -option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"basic"})) -option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_2 = BoolOption(name="instanciated_module", doc="instanciated_module", default=True, properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "mandatory", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = OptionDescription(name="general", doc="général", children=[option_4], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/00load_autosaveexpert/00-base.xml b/tests/dictionaries/00load_autosaveexpert/00-base.xml index a9cd293b..66db324d 100644 --- a/tests/dictionaries/00load_autosaveexpert/00-base.xml +++ b/tests/dictionaries/00load_autosaveexpert/00-base.xml @@ -1,6 +1,7 @@ + non diff --git a/tests/dictionaries/00load_autosaveexpert/makedict/base.json b/tests/dictionaries/00load_autosaveexpert/makedict/base.json index 25056378..dfcc8f87 100644 --- a/tests/dictionaries/00load_autosaveexpert/makedict/base.json +++ b/tests/dictionaries/00load_autosaveexpert/makedict/base.json @@ -1,3 +1,4 @@ { + "rougail.instanciated_module": true, "rougail.general.mode_conteneur_actif": "non" } diff --git a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py index 7e90b49c..b4cf6221 100644 --- a/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autosaveexpert/tiramisu/base.py @@ -11,7 +11,8 @@ try: from tiramisu3 import * except: from tiramisu import * -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "force_store_value", "mandatory"})) -option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"expert"})) -option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_2 = BoolOption(name="instanciated_module", doc="instanciated_module", default=True, properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = OptionDescription(name="general", doc="général", children=[option_4], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py index 37cd5726..47062f40 100644 --- a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_2 = BoolOption(name="instanciated_module", doc="instanciated_module", default=False, properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"auto_freeze", "force_store_value", "frozen", "hidden", "normal", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "hidden", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py index 6fbfb95a..c129f050 100644 --- a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py @@ -13,6 +13,6 @@ except: from tiramisu import * option_3 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = BoolOption(name="instanciated_module", doc="instanciated_module", default=False, properties=frozenset({"mandatory", "normal"})) -option_2 = StrOption(name="my_var1", doc="my_var1", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"auto_freeze", "force_store_value", "normal", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="my_var1", doc="my_var1", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"basic", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01fill_autosave/00-base.xml b/tests/dictionaries/01fill_autosave/00-base.xml index 8f8e5745..fb85eacb 100644 --- a/tests/dictionaries/01fill_autosave/00-base.xml +++ b/tests/dictionaries/01fill_autosave/00-base.xml @@ -1,6 +1,7 @@ + non diff --git a/tests/dictionaries/01fill_autosave/makedict/base.json b/tests/dictionaries/01fill_autosave/makedict/base.json index 3f1a7b00..2cff867e 100644 --- a/tests/dictionaries/01fill_autosave/makedict/base.json +++ b/tests/dictionaries/01fill_autosave/makedict/base.json @@ -1,4 +1,5 @@ { + "rougail.instanciated_module": true, "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non" } diff --git a/tests/dictionaries/01fill_autosave/tiramisu/base.py b/tests/dictionaries/01fill_autosave/tiramisu/base.py index c862d7ed..7bfb4956 100644 --- a/tests/dictionaries/01fill_autosave/tiramisu/base.py +++ b/tests/dictionaries/01fill_autosave/tiramisu/base.py @@ -11,8 +11,9 @@ try: from tiramisu3 import * except: from tiramisu import * -option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"basic", "force_store_value"})) -option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) -option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_2 = BoolOption(name="instanciated_module", doc="instanciated_module", default=True, properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_5)))), properties=frozenset({"basic", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = OptionDescription(name="general", doc="general", children=[option_4, option_5], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py index 5704e7b6..7f8f70c6 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_2 = BoolOption(name="instanciated_module", doc="instanciated_module", default=False, properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"auto_freeze", "force_store_value", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml b/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml index 905827c6..a11fb61b 100644 --- a/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml +++ b/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml @@ -1,6 +1,7 @@ + - + True my_var diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/makedict/after.json b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/after.json new file mode 100644 index 00000000..bb359545 --- /dev/null +++ b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.server_deployed": { + "owner": "default", + "value": false + }, + "rougail.my_var": { + "owner": "forced", + "value": "yes" + } +} diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json index 87584b21..465c3cba 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json +++ b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/base.json @@ -1,4 +1,4 @@ { - "rougail.instanciated_module": false, + "rougail.server_deployed": false, "rougail.my_var": "yes" } diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/makedict/before.json b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/before.json new file mode 100644 index 00000000..a35981a8 --- /dev/null +++ b/tests/dictionaries/01hidden_if_in_autofreeze/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.server_deployed": { + "owner": "default", + "value": false + }, + "rougail.my_var": { + "owner": "default", + "value": "yes" + } +} diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py index 7f8f70c6..7cb46046 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py @@ -11,7 +11,7 @@ try: from tiramisu3 import * except: from tiramisu import * -option_2 = BoolOption(name="instanciated_module", doc="instanciated_module", default=False, properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"})) +option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01test/makedict/after.json b/tests/dictionaries/01test/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test/makedict/before.json b/tests/dictionaries/01test/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_multi/makedict/after.json b/tests/dictionaries/01test_multi/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_multi/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_multi/makedict/before.json b/tests/dictionaries/01test_multi/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_multi/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_multi_none/makedict/after.json b/tests/dictionaries/01test_multi_none/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_multi_none/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_multi_none/makedict/before.json b/tests/dictionaries/01test_multi_none/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_multi_none/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_redefine/makedict/after.json b/tests/dictionaries/01test_redefine/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_redefine/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_redefine/makedict/before.json b/tests/dictionaries/01test_redefine/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_redefine/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_redefine_base/makedict/after.json b/tests/dictionaries/01test_redefine_base/makedict/after.json new file mode 100644 index 00000000..bd891042 --- /dev/null +++ b/tests/dictionaries/01test_redefine_base/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.my_variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/01test_redefine_base/makedict/before.json b/tests/dictionaries/01test_redefine_base/makedict/before.json new file mode 100644 index 00000000..bd891042 --- /dev/null +++ b/tests/dictionaries/01test_redefine_base/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.my_variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/01test_redefine_remove/makedict/after.json b/tests/dictionaries/01test_redefine_remove/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_redefine_remove/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/01test_redefine_remove/makedict/before.json b/tests/dictionaries/01test_redefine_remove/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/01test_redefine_remove/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml b/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml index a11fb61b..bd6972f8 100644 --- a/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml +++ b/tests/dictionaries/02autosave_hidden_frozenifin/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/60extra_externalspacecondition/makedict/after.json b/tests/dictionaries/60extra_externalspacecondition/makedict/after.json new file mode 100644 index 00000000..b2dd92d1 --- /dev/null +++ b/tests/dictionaries/60extra_externalspacecondition/makedict/after.json @@ -0,0 +1,30 @@ +{ + "rougail.general.my_var": { + "owner": "forced", + "value": "no" + }, + "rougail.general.my_var1": { + "owner": "default", + "value": "no" + }, + "rougail.general.server_deployed": { + "owner": "default", + "value": false + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra1.external.description": { + "owner": "default", + "value": "test" + } +} diff --git a/tests/dictionaries/60extra_externalspacecondition/makedict/base.json b/tests/dictionaries/60extra_externalspacecondition/makedict/base.json index 86a2ac86..1c500131 100644 --- a/tests/dictionaries/60extra_externalspacecondition/makedict/base.json +++ b/tests/dictionaries/60extra_externalspacecondition/makedict/base.json @@ -1,7 +1,7 @@ { "rougail.general.my_var": "no", "rougail.general.my_var1": "no", - "rougail.general.instanciated_module": false, + "rougail.general.server_deployed": false, "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": "none", "extra.ejabberd.mode": "pre", diff --git a/tests/dictionaries/60extra_externalspacecondition/makedict/before.json b/tests/dictionaries/60extra_externalspacecondition/makedict/before.json new file mode 100644 index 00000000..c979ff36 --- /dev/null +++ b/tests/dictionaries/60extra_externalspacecondition/makedict/before.json @@ -0,0 +1,30 @@ +{ + "rougail.general.my_var": { + "owner": "default", + "value": "no" + }, + "rougail.general.my_var1": { + "owner": "default", + "value": "no" + }, + "rougail.general.server_deployed": { + "owner": "default", + "value": false + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra1.external.description": { + "owner": "default", + "value": "test" + } +} diff --git a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py index 34785a5f..3a3b21ea 100644 --- a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py +++ b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py @@ -11,8 +11,8 @@ try: from tiramisu3 import * except: from tiramisu import * -option_5 = BoolOption(name="instanciated_module", doc="instanciated_module", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "mandatory", Calculation(func.calc_value, Params(ParamValue('force_store_value'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_5 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="my_var1", doc="my_var1", default="no", 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({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) diff --git a/tests/dictionaries/60extra_group/makedict/after.json b/tests/dictionaries/60extra_group/makedict/after.json new file mode 100644 index 00000000..9aa0c6bf --- /dev/null +++ b/tests/dictionaries/60extra_group/makedict/after.json @@ -0,0 +1,96 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description.description": { + "owner": "default", + "value": [ + "test" + ] + }, + "extra.ejabberd.description.mode": { + "owner": [ + "default" + ], + "value": [ + "pre" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_group/makedict/before.json b/tests/dictionaries/60extra_group/makedict/before.json new file mode 100644 index 00000000..9aa0c6bf --- /dev/null +++ b/tests/dictionaries/60extra_group/makedict/before.json @@ -0,0 +1,96 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description.description": { + "owner": "default", + "value": [ + "test" + ] + }, + "extra.ejabberd.description.mode": { + "owner": [ + "default" + ], + "value": [ + "pre" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_help/makedict/after.json b/tests/dictionaries/60extra_help/makedict/after.json new file mode 100644 index 00000000..5b40c269 --- /dev/null +++ b/tests/dictionaries/60extra_help/makedict/after.json @@ -0,0 +1,62 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_help/makedict/before.json b/tests/dictionaries/60extra_help/makedict/before.json new file mode 100644 index 00000000..5b40c269 --- /dev/null +++ b/tests/dictionaries/60extra_help/makedict/before.json @@ -0,0 +1,62 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_load/makedict/after.json b/tests/dictionaries/60extra_load/makedict/after.json new file mode 100644 index 00000000..383ce093 --- /dev/null +++ b/tests/dictionaries/60extra_load/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_load/makedict/before.json b/tests/dictionaries/60extra_load/makedict/before.json new file mode 100644 index 00000000..383ce093 --- /dev/null +++ b/tests/dictionaries/60extra_load/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_mandatory/makedict/after.json b/tests/dictionaries/60extra_mandatory/makedict/after.json new file mode 100644 index 00000000..bd4b713a --- /dev/null +++ b/tests/dictionaries/60extra_mandatory/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra.ejabberd.var1": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60extra_mandatory/makedict/before.json b/tests/dictionaries/60extra_mandatory/makedict/before.json new file mode 100644 index 00000000..bd4b713a --- /dev/null +++ b/tests/dictionaries/60extra_mandatory/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra.ejabberd.var1": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60extra_name_family/makedict/after.json b/tests/dictionaries/60extra_name_family/makedict/after.json new file mode 100644 index 00000000..19d92883 --- /dev/null +++ b/tests/dictionaries/60extra_name_family/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.extra.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.extra.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_name_family/makedict/before.json b/tests/dictionaries/60extra_name_family/makedict/before.json new file mode 100644 index 00000000..19d92883 --- /dev/null +++ b/tests/dictionaries/60extra_name_family/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.extra.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.extra.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_no_condition/makedict/after.json b/tests/dictionaries/60extra_no_condition/makedict/after.json new file mode 100644 index 00000000..0b78d652 --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "rougail.general.module_instancie": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_no_condition/makedict/before.json b/tests/dictionaries/60extra_no_condition/makedict/before.json new file mode 100644 index 00000000..0b78d652 --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "rougail.general.module_instancie": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_redefine/makedict/after.json b/tests/dictionaries/60extra_redefine/makedict/after.json new file mode 100644 index 00000000..383ce093 --- /dev/null +++ b/tests/dictionaries/60extra_redefine/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_redefine/makedict/before.json b/tests/dictionaries/60extra_redefine/makedict/before.json new file mode 100644 index 00000000..383ce093 --- /dev/null +++ b/tests/dictionaries/60extra_redefine/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_variable_name_extra/makedict/after.json b/tests/dictionaries/60extra_variable_name_extra/makedict/after.json new file mode 100644 index 00000000..12c84953 --- /dev/null +++ b/tests/dictionaries/60extra_variable_name_extra/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.extra": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60extra_variable_name_extra/makedict/before.json b/tests/dictionaries/60extra_variable_name_extra/makedict/before.json new file mode 100644 index 00000000..12c84953 --- /dev/null +++ b/tests/dictionaries/60extra_variable_name_extra/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.extra": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60familyaction/makedict/after.json b/tests/dictionaries/60familyaction/makedict/after.json new file mode 100644 index 00000000..00d8ee8c --- /dev/null +++ b/tests/dictionaries/60familyaction/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + } +} diff --git a/tests/dictionaries/60familyaction/makedict/before.json b/tests/dictionaries/60familyaction/makedict/before.json new file mode 100644 index 00000000..00d8ee8c --- /dev/null +++ b/tests/dictionaries/60familyaction/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + } +} diff --git a/tests/dictionaries/60familyaction_accent/makedict/after.json b/tests/dictionaries/60familyaction_accent/makedict/after.json new file mode 100644 index 00000000..00d8ee8c --- /dev/null +++ b/tests/dictionaries/60familyaction_accent/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + } +} diff --git a/tests/dictionaries/60familyaction_accent/makedict/before.json b/tests/dictionaries/60familyaction_accent/makedict/before.json new file mode 100644 index 00000000..00d8ee8c --- /dev/null +++ b/tests/dictionaries/60familyaction_accent/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + } +} diff --git a/tests/dictionaries/60familyaction_mandatory/makedict/after.json b/tests/dictionaries/60familyaction_mandatory/makedict/after.json new file mode 100644 index 00000000..8ba0e34e --- /dev/null +++ b/tests/dictionaries/60familyaction_mandatory/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + }, + "extra.test.day": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60familyaction_mandatory/makedict/before.json b/tests/dictionaries/60familyaction_mandatory/makedict/before.json new file mode 100644 index 00000000..8ba0e34e --- /dev/null +++ b/tests/dictionaries/60familyaction_mandatory/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + }, + "extra.test.day": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/61extra_dyn/makedict/after.json b/tests/dictionaries/61extra_dyn/makedict/after.json new file mode 100644 index 00000000..648ee5b1 --- /dev/null +++ b/tests/dictionaries/61extra_dyn/makedict/after.json @@ -0,0 +1,12 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "a" + ] + }, + "extra.ejabberda.modea": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/61extra_dyn/makedict/before.json b/tests/dictionaries/61extra_dyn/makedict/before.json new file mode 100644 index 00000000..648ee5b1 --- /dev/null +++ b/tests/dictionaries/61extra_dyn/makedict/before.json @@ -0,0 +1,12 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "a" + ] + }, + "extra.ejabberda.modea": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/61extra_dyn_extra/makedict/after.json b/tests/dictionaries/61extra_dyn_extra/makedict/after.json new file mode 100644 index 00000000..a14294f6 --- /dev/null +++ b/tests/dictionaries/61extra_dyn_extra/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "a" + ] + }, + "extra.general.varname": { + "owner": "default", + "value": [ + "a" + ] + }, + "extra.ejabberda.modea": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/61extra_dyn_extra/makedict/before.json b/tests/dictionaries/61extra_dyn_extra/makedict/before.json new file mode 100644 index 00000000..a14294f6 --- /dev/null +++ b/tests/dictionaries/61extra_dyn_extra/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "a" + ] + }, + "extra.general.varname": { + "owner": "default", + "value": [ + "a" + ] + }, + "extra.ejabberda.modea": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/70container_files/makedict/after.json b/tests/dictionaries/70container_files/makedict/after.json new file mode 100644 index 00000000..5c192e2b --- /dev/null +++ b/tests/dictionaries/70container_files/makedict/after.json @@ -0,0 +1,78 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.rougail_conf.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.rougail_conf.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.rougail_conf.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.rougail_conf.name": { + "owner": "default", + "value": "/rougail.conf" + }, + "services.test.files.rougail_conf.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.source": { + "owner": "default", + "value": "rougail.conf" + }, + "services.test.files.rougail_conf.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files/makedict/before.json b/tests/dictionaries/70container_files/makedict/before.json new file mode 100644 index 00000000..5c192e2b --- /dev/null +++ b/tests/dictionaries/70container_files/makedict/before.json @@ -0,0 +1,78 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.rougail_conf.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.rougail_conf.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.rougail_conf.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.rougail_conf.name": { + "owner": "default", + "value": "/rougail.conf" + }, + "services.test.files.rougail_conf.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.source": { + "owner": "default", + "value": "rougail.conf" + }, + "services.test.files.rougail_conf.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_symlink_multi/makedict/after.json b/tests/dictionaries/70container_files_symlink_multi/makedict/after.json new file mode 100644 index 00000000..e3a6bf88 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_multi/makedict/after.json @@ -0,0 +1,94 @@ +{ + "rougail.file_name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "rougail.file_name2": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_symlink_multi/makedict/before.json b/tests/dictionaries/70container_files_symlink_multi/makedict/before.json new file mode 100644 index 00000000..e3a6bf88 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_multi/makedict/before.json @@ -0,0 +1,94 @@ +{ + "rougail.file_name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "rougail.file_name2": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/after.json b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/after.json new file mode 100644 index 00000000..6711d294 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/after.json @@ -0,0 +1,115 @@ +{ + "rougail.file_name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "rougail.file_name2": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "rougail.var": { + "owner": "default", + "value": [ + "mailname", + "mailname2" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.variable": { + "owner": "default", + "value": [ + "mailname", + "mailname2" + ] + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.variable": { + "owner": "default", + "value": [ + "mailname", + "mailname2" + ] + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_symlink_multi_variable/makedict/before.json b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/before.json new file mode 100644 index 00000000..6711d294 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_multi_variable/makedict/before.json @@ -0,0 +1,115 @@ +{ + "rougail.file_name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "rougail.file_name2": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "rougail.var": { + "owner": "default", + "value": [ + "mailname", + "mailname2" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": [ + "/etc/mailname", + "/etc/mailname2" + ] + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.variable": { + "owner": "default", + "value": [ + "mailname", + "mailname2" + ] + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": [ + "/etc/mailname3", + "/etc/mailname4" + ] + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.variable": { + "owner": "default", + "value": [ + "mailname", + "mailname2" + ] + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_symlink_variable/makedict/after.json b/tests/dictionaries/70container_files_symlink_variable/makedict/after.json new file mode 100644 index 00000000..e48099e4 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_variable/makedict/after.json @@ -0,0 +1,54 @@ +{ + "rougail.file_name": { + "owner": "default", + "value": "/etc/mailname" + }, + "rougail.var": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.variable": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_symlink_variable/makedict/before.json b/tests/dictionaries/70container_files_symlink_variable/makedict/before.json new file mode 100644 index 00000000..e48099e4 --- /dev/null +++ b/tests/dictionaries/70container_files_symlink_variable/makedict/before.json @@ -0,0 +1,54 @@ +{ + "rougail.file_name": { + "owner": "default", + "value": "/etc/mailname" + }, + "rougail.var": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.variable": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_twice/makedict/after.json b/tests/dictionaries/70container_files_twice/makedict/after.json new file mode 100644 index 00000000..2cd2d9ea --- /dev/null +++ b/tests/dictionaries/70container_files_twice/makedict/after.json @@ -0,0 +1,110 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname_1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname_1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname_1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname_1.name": { + "owner": "default", + "value": "/etc/eole/mailname" + }, + "services.test.files.mailname_1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_1.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname_1.activate": { + "owner": "default", + "value": true + }, + "services.test.files.rougail_conf.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.rougail_conf.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.rougail_conf.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.rougail_conf.name": { + "owner": "default", + "value": "/rougail.conf" + }, + "services.test.files.rougail_conf.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.source": { + "owner": "default", + "value": "rougail.conf" + }, + "services.test.files.rougail_conf.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_files_twice/makedict/before.json b/tests/dictionaries/70container_files_twice/makedict/before.json new file mode 100644 index 00000000..2cd2d9ea --- /dev/null +++ b/tests/dictionaries/70container_files_twice/makedict/before.json @@ -0,0 +1,110 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname_1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname_1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname_1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname_1.name": { + "owner": "default", + "value": "/etc/eole/mailname" + }, + "services.test.files.mailname_1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_1.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname_1.activate": { + "owner": "default", + "value": true + }, + "services.test.files.rougail_conf.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.rougail_conf.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.rougail_conf.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.rougail_conf.name": { + "owner": "default", + "value": "/rougail.conf" + }, + "services.test.files.rougail_conf.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.rougail_conf.source": { + "owner": "default", + "value": "rougail.conf" + }, + "services.test.files.rougail_conf.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_filesmulti/makedict/after.json b/tests/dictionaries/70container_filesmulti/makedict/after.json new file mode 100644 index 00000000..1a7923ae --- /dev/null +++ b/tests/dictionaries/70container_filesmulti/makedict/after.json @@ -0,0 +1,78 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_filesmulti/makedict/before.json b/tests/dictionaries/70container_filesmulti/makedict/before.json new file mode 100644 index 00000000..1a7923ae --- /dev/null +++ b/tests/dictionaries/70container_filesmulti/makedict/before.json @@ -0,0 +1,78 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_filesredefine/makedict/after.json b/tests/dictionaries/70container_filesredefine/makedict/after.json new file mode 100644 index 00000000..74cbb06d --- /dev/null +++ b/tests/dictionaries/70container_filesredefine/makedict/after.json @@ -0,0 +1,46 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname_new.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname_new.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_new.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname_new.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname_new.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname_new.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_new.source": { + "owner": "default", + "value": "mailname.new" + }, + "services.test.files.mailname_new.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_filesredefine/makedict/before.json b/tests/dictionaries/70container_filesredefine/makedict/before.json new file mode 100644 index 00000000..74cbb06d --- /dev/null +++ b/tests/dictionaries/70container_filesredefine/makedict/before.json @@ -0,0 +1,46 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.files.mailname_new.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname_new.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_new.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname_new.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname_new.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname_new.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname_new.source": { + "owner": "default", + "value": "mailname.new" + }, + "services.test.files.mailname_new.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_new/makedict/after.json b/tests/dictionaries/70container_new/makedict/after.json new file mode 100644 index 00000000..07fda6ef --- /dev/null +++ b/tests/dictionaries/70container_new/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_new/makedict/before.json b/tests/dictionaries/70container_new/makedict/before.json new file mode 100644 index 00000000..07fda6ef --- /dev/null +++ b/tests/dictionaries/70container_new/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_newnocont/makedict/after.json b/tests/dictionaries/70container_newnocont/makedict/after.json new file mode 100644 index 00000000..b7f1fd9e --- /dev/null +++ b/tests/dictionaries/70container_newnocont/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_newnocont/makedict/before.json b/tests/dictionaries/70container_newnocont/makedict/before.json new file mode 100644 index 00000000..b7f1fd9e --- /dev/null +++ b/tests/dictionaries/70container_newnocont/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_newwithip/makedict/after.json b/tests/dictionaries/70container_newwithip/makedict/after.json new file mode 100644 index 00000000..cfa1cc50 --- /dev/null +++ b/tests/dictionaries/70container_newwithip/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "rougail.general.adresse_ip_test": { + "owner": "default", + "value": null + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_newwithip/makedict/before.json b/tests/dictionaries/70container_newwithip/makedict/before.json new file mode 100644 index 00000000..cfa1cc50 --- /dev/null +++ b/tests/dictionaries/70container_newwithip/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "rougail.general.adresse_ip_test": { + "owner": "default", + "value": null + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70container_save/makedict/after.json b/tests/dictionaries/70container_save/makedict/after.json new file mode 100644 index 00000000..3a4c0953 --- /dev/null +++ b/tests/dictionaries/70container_save/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/70container_save/makedict/before.json b/tests/dictionaries/70container_save/makedict/before.json new file mode 100644 index 00000000..3a4c0953 --- /dev/null +++ b/tests/dictionaries/70container_save/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/70service_base/makedict/after.json b/tests/dictionaries/70service_base/makedict/after.json new file mode 100644 index 00000000..c8847b43 --- /dev/null +++ b/tests/dictionaries/70service_base/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.testsrv.activate": { + "owner": "default", + "value": true + }, + "services.testsrv.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_base/makedict/before.json b/tests/dictionaries/70service_base/makedict/before.json new file mode 100644 index 00000000..c8847b43 --- /dev/null +++ b/tests/dictionaries/70service_base/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "services.testsrv.activate": { + "owner": "default", + "value": true + }, + "services.testsrv.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_not_managed/makedict/after.json b/tests/dictionaries/70service_not_managed/makedict/after.json new file mode 100644 index 00000000..03f90b20 --- /dev/null +++ b/tests/dictionaries/70service_not_managed/makedict/after.json @@ -0,0 +1,46 @@ +{ + "rougail.var": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.test.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.test.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.test.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.test.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.test.name": { + "owner": "default", + "value": "/tmp/test" + }, + "services.test.files.test.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.test.source": { + "owner": "default", + "value": "test" + }, + "services.test.files.test.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": false + } +} diff --git a/tests/dictionaries/70service_not_managed/makedict/before.json b/tests/dictionaries/70service_not_managed/makedict/before.json new file mode 100644 index 00000000..03f90b20 --- /dev/null +++ b/tests/dictionaries/70service_not_managed/makedict/before.json @@ -0,0 +1,46 @@ +{ + "rougail.var": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.test.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.test.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.test.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.test.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.test.name": { + "owner": "default", + "value": "/tmp/test" + }, + "services.test.files.test.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.test.source": { + "owner": "default", + "value": "test" + }, + "services.test.files.test.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": false + } +} diff --git a/tests/dictionaries/70service_servicelist/makedict/after.json b/tests/dictionaries/70service_servicelist/makedict/after.json new file mode 100644 index 00000000..70056b4a --- /dev/null +++ b/tests/dictionaries/70service_servicelist/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist/makedict/before.json b/tests/dictionaries/70service_servicelist/makedict/before.json new file mode 100644 index 00000000..70056b4a --- /dev/null +++ b/tests/dictionaries/70service_servicelist/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist_file/makedict/after.json b/tests/dictionaries/70service_servicelist_file/makedict/after.json new file mode 100644 index 00000000..0df03129 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_file/makedict/after.json @@ -0,0 +1,50 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": false + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist_file/makedict/before.json b/tests/dictionaries/70service_servicelist_file/makedict/before.json new file mode 100644 index 00000000..0df03129 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_file/makedict/before.json @@ -0,0 +1,50 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": false + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist_ip/makedict/after.json b/tests/dictionaries/70service_servicelist_ip/makedict/after.json new file mode 100644 index 00000000..73263cb6 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_ip/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.test.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.test.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": false + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist_ip/makedict/before.json b/tests/dictionaries/70service_servicelist_ip/makedict/before.json new file mode 100644 index 00000000..73263cb6 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_ip/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.test.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.test.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": false + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist_not_managed/makedict/after.json b/tests/dictionaries/70service_servicelist_not_managed/makedict/after.json new file mode 100644 index 00000000..983c1185 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_not_managed/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": false + } +} diff --git a/tests/dictionaries/70service_servicelist_not_managed/makedict/before.json b/tests/dictionaries/70service_servicelist_not_managed/makedict/before.json new file mode 100644 index 00000000..983c1185 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_not_managed/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": false + } +} diff --git a/tests/dictionaries/70services_ip/makedict/after.json b/tests/dictionaries/70services_ip/makedict/after.json new file mode 100644 index 00000000..7090ae97 --- /dev/null +++ b/tests/dictionaries/70services_ip/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip/makedict/before.json b/tests/dictionaries/70services_ip/makedict/before.json new file mode 100644 index 00000000..7090ae97 --- /dev/null +++ b/tests/dictionaries/70services_ip/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.1" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_cidr/makedict/after.json b/tests/dictionaries/70services_ip_cidr/makedict/after.json new file mode 100644 index 00000000..f9eedc89 --- /dev/null +++ b/tests/dictionaries/70services_ip_cidr/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_cidr/makedict/before.json b/tests/dictionaries/70services_ip_cidr/makedict/before.json new file mode 100644 index 00000000..f9eedc89 --- /dev/null +++ b/tests/dictionaries/70services_ip_cidr/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_iplist/makedict/after.json b/tests/dictionaries/70services_ip_iplist/makedict/after.json new file mode 100644 index 00000000..e182cf46 --- /dev/null +++ b/tests/dictionaries/70services_ip_iplist/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_iplist/makedict/before.json b/tests/dictionaries/70services_ip_iplist/makedict/before.json new file mode 100644 index 00000000..e182cf46 --- /dev/null +++ b/tests/dictionaries/70services_ip_iplist/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_iplist2/makedict/after.json b/tests/dictionaries/70services_ip_iplist2/makedict/after.json new file mode 100644 index 00000000..75059141 --- /dev/null +++ b/tests/dictionaries/70services_ip_iplist2/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "yes" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": false + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_iplist2/makedict/before.json b/tests/dictionaries/70services_ip_iplist2/makedict/before.json new file mode 100644 index 00000000..75059141 --- /dev/null +++ b/tests/dictionaries/70services_ip_iplist2/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.condition": { + "owner": "default", + "value": "yes" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0/24" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": false + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_leadership/makedict/after.json b/tests/dictionaries/70services_ip_leadership/makedict/after.json new file mode 100644 index 00000000..5a0141a7 --- /dev/null +++ b/tests/dictionaries/70services_ip_leadership/makedict/after.json @@ -0,0 +1,42 @@ +{ + "rougail.general.nut_monitor_netmask.nut_monitor_netmask": { + "owner": "default", + "value": [ + "255.255.255.0" + ] + }, + "rougail.general.nut_monitor_netmask.nut_monitor_host": { + "owner": [ + "default" + ], + "value": [ + "192.168.1.0" + ] + }, + "services.ntp.ip.nut_monitor_host.name": { + "owner": [ + "default" + ], + "value": [ + "192.168.1.0" + ] + }, + "services.ntp.ip.nut_monitor_host.netmask": { + "owner": "default", + "value": [ + "255.255.255.0" + ] + }, + "services.ntp.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.ntp.activate": { + "owner": "default", + "value": true + }, + "services.ntp.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_leadership/makedict/before.json b/tests/dictionaries/70services_ip_leadership/makedict/before.json new file mode 100644 index 00000000..5a0141a7 --- /dev/null +++ b/tests/dictionaries/70services_ip_leadership/makedict/before.json @@ -0,0 +1,42 @@ +{ + "rougail.general.nut_monitor_netmask.nut_monitor_netmask": { + "owner": "default", + "value": [ + "255.255.255.0" + ] + }, + "rougail.general.nut_monitor_netmask.nut_monitor_host": { + "owner": [ + "default" + ], + "value": [ + "192.168.1.0" + ] + }, + "services.ntp.ip.nut_monitor_host.name": { + "owner": [ + "default" + ], + "value": [ + "192.168.1.0" + ] + }, + "services.ntp.ip.nut_monitor_host.netmask": { + "owner": "default", + "value": [ + "255.255.255.0" + ] + }, + "services.ntp.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.ntp.activate": { + "owner": "default", + "value": true + }, + "services.ntp.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_multi/makedict/after.json b/tests/dictionaries/70services_ip_multi/makedict/after.json new file mode 100644 index 00000000..c8561374 --- /dev/null +++ b/tests/dictionaries/70services_ip_multi/makedict/after.json @@ -0,0 +1,28 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": [ + "192.168.0.1", + "192.168.0.2" + ] + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": [ + "192.168.0.1", + "192.168.0.2" + ] + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_multi/makedict/before.json b/tests/dictionaries/70services_ip_multi/makedict/before.json new file mode 100644 index 00000000..c8561374 --- /dev/null +++ b/tests/dictionaries/70services_ip_multi/makedict/before.json @@ -0,0 +1,28 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": [ + "192.168.0.1", + "192.168.0.2" + ] + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": [ + "192.168.0.1", + "192.168.0.2" + ] + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_network/makedict/after.json b/tests/dictionaries/70services_ip_network/makedict/after.json new file mode 100644 index 00000000..64270526 --- /dev/null +++ b/tests/dictionaries/70services_ip_network/makedict/after.json @@ -0,0 +1,30 @@ +{ + "rougail.nut_monitor_netmask": { + "owner": "default", + "value": "255.255.255.0" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0" + }, + "services.nut.ip.nut_monitor_host.netmask": { + "owner": "default", + "value": "255.255.255.0" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_network/makedict/before.json b/tests/dictionaries/70services_ip_network/makedict/before.json new file mode 100644 index 00000000..64270526 --- /dev/null +++ b/tests/dictionaries/70services_ip_network/makedict/before.json @@ -0,0 +1,30 @@ +{ + "rougail.nut_monitor_netmask": { + "owner": "default", + "value": "255.255.255.0" + }, + "rougail.nut_monitor_host": { + "owner": "default", + "value": "192.168.0.0" + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": "192.168.0.0" + }, + "services.nut.ip.nut_monitor_host.netmask": { + "owner": "default", + "value": "255.255.255.0" + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_not_mandatory/makedict/after.json b/tests/dictionaries/70services_ip_not_mandatory/makedict/after.json new file mode 100644 index 00000000..048ea242 --- /dev/null +++ b/tests/dictionaries/70services_ip_not_mandatory/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": null + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": null + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_not_mandatory/makedict/before.json b/tests/dictionaries/70services_ip_not_mandatory/makedict/before.json new file mode 100644 index 00000000..048ea242 --- /dev/null +++ b/tests/dictionaries/70services_ip_not_mandatory/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.nut_monitor_host": { + "owner": "default", + "value": null + }, + "services.nut.ip.nut_monitor_host.name": { + "owner": "default", + "value": null + }, + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/80leadership_auto_save/00-base.xml b/tests/dictionaries/80leadership_auto_save/00-base.xml index 57eacdf7..be9f75ad 100644 --- a/tests/dictionaries/80leadership_auto_save/00-base.xml +++ b/tests/dictionaries/80leadership_auto_save/00-base.xml @@ -1,7 +1,7 @@ - + non diff --git a/tests/dictionaries/80leadership_autofreeze/00-base.xml b/tests/dictionaries/80leadership_autofreeze/00-base.xml index 35741c0b..41349632 100644 --- a/tests/dictionaries/80leadership_autofreeze/00-base.xml +++ b/tests/dictionaries/80leadership_autofreeze/00-base.xml @@ -2,7 +2,7 @@ - + diff --git a/tests/dictionaries/80mode_conflict/00-base.xml b/tests/dictionaries/80mode_conflict/00-base.xml index 657937ca..52f4562b 100644 --- a/tests/dictionaries/80mode_conflict/00-base.xml +++ b/tests/dictionaries/80mode_conflict/00-base.xml @@ -1,7 +1,7 @@ - + non diff --git a/tests/test_2_makedict.py b/tests/test_2_makedict.py index db5069ca..9a042630 100644 --- a/tests/test_2_makedict.py +++ b/tests/test_2_makedict.py @@ -5,6 +5,7 @@ from os import listdir, mkdir from json import dump, load, dumps, loads from tiramisu import Config +from tiramisu.error import PropertiesOptionError dico_dirs = 'tests/dictionaries' @@ -37,30 +38,77 @@ def test_dir(request): async def launch_flattener(test_dir): makedict_dir = join(test_dir, 'makedict') makedict_file = join(makedict_dir, 'base.json') + makedict_before = join(makedict_dir, 'before.json') + makedict_after = join(makedict_dir, 'after.json') modulepath = test_dir.replace('/', '.') + '.tiramisu.base' mod = __import__(modulepath) for token in modulepath.split(".")[1:]: mod = getattr(mod, token) config = await Config(mod.option_0) + # change default rights + ro_origin = await config.property.getdefault('read_only', 'append') + ro_append = frozenset(ro_origin - {'force_store_value'}) + rw_origin = await config.property.getdefault('read_write', 'append') + rw_append = frozenset(rw_origin - {'force_store_value'}) + await config.property.setdefault(ro_append, 'read_only', 'append') + await config.property.setdefault(rw_append, 'read_write', 'append') + await config.information.set('test_information', 'value') await config.property.read_only() await config.property.pop('mandatory') await config.information.set('info', 'value') config_dict = await config.value.dict(leader_to_list=True) - if config_dict: - if not isdir(makedict_dir): - mkdir(makedict_dir) - if not isfile(makedict_file) or debug: - with open(makedict_file, 'w') as fh: - dump(config_dict, fh, indent=4) - fh.write('\n') + if not isdir(makedict_dir): + mkdir(makedict_dir) + if not isfile(makedict_file) or debug: + with open(makedict_file, 'w') as fh: + dump(config_dict, fh, indent=4) + fh.write('\n') if not isfile(makedict_file): - if config_dict: - raise Exception('dict is not empty') - else: - with open(makedict_file, 'r') as fh: - assert load(fh) == loads(dumps(config_dict)) + raise Exception('dict is not empty') + with open(makedict_file, 'r') as fh: + assert load(fh) == loads(dumps(config_dict)) + # + await value_owner(makedict_before, config) + # deploy + ro = await config.property.getdefault('read_only', 'append') + ro = frozenset(list(ro) + ['force_store_value']) + await config.property.setdefault(ro, 'read_only', 'append') + rw = await config.property.getdefault('read_write', 'append') + rw = frozenset(list(rw) + ['force_store_value']) + await config.property.setdefault(rw, 'read_write', 'append') + await config.property.add('force_store_value') + # + await value_owner(makedict_after, config) + +async def value_owner(makedict_value_owner, config): + ret = {} + for key in await config.option.list(recursive=True): + path = await key.option.path() + if await key.option.isfollower(): + value = [] + owner = [] + for idx in range(0, await key.value.len()): + try: + option = config.option(path, idx) + value.append(await option.value.get()) + owner.append(await option.owner.get()) + except PropertiesOptionError as err: + value.append(str(err)) + owner.append('error') + else: + value = await key.value.get() + owner = await key.owner.get() + ret[path] = {'owner': owner, + 'value': value, + } + if not isfile(makedict_value_owner) or debug: + with open(makedict_value_owner, 'w') as fh: + dump(ret, fh, indent=4) + fh.write('\n') + with open(makedict_value_owner, 'r') as fh: + assert load(fh) == loads(dumps(ret)) @mark.asyncio From 88f864cd2a0865aa4e5f4bf23b9cb12c4570bd6a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 26 Feb 2021 22:22:38 +0100 Subject: [PATCH 146/168] allow multiple IP --- src/rougail/annotator/service.py | 6 --- src/rougail/template/base.py | 19 ++++--- src/rougail/template/systemd.py | 54 +++++++++++++------ .../10leadership_accent/makedict/after.json | 4 -- .../10leadership_accent/makedict/before.json | 4 -- .../makedict/after.json | 4 -- .../makedict/before.json | 4 -- .../00-base.xml | 5 +- .../__init__.py | 0 .../70services_ip_twice/makedict/after.json | 34 ++++++++++++ .../70services_ip_twice/makedict/base.json | 10 ++++ .../70services_ip_twice/makedict/before.json | 34 ++++++++++++ .../system/nut.service.d/rougail_ip.conf | 4 ++ .../result/tmpfiles.d/rougail.conf} | 0 .../70services_ip_twice/tiramisu/base.py | 28 ++++++++++ 15 files changed, 166 insertions(+), 44 deletions(-) rename tests/dictionaries/{80services_ip_twice => 70services_ip_twice}/00-base.xml (69%) rename tests/dictionaries/{80services_ip_twice => 70services_ip_twice}/__init__.py (100%) create mode 100644 tests/dictionaries/70services_ip_twice/makedict/after.json create mode 100644 tests/dictionaries/70services_ip_twice/makedict/base.json create mode 100644 tests/dictionaries/70services_ip_twice/makedict/before.json create mode 100644 tests/dictionaries/70services_ip_twice/result/systemd/system/nut.service.d/rougail_ip.conf rename tests/dictionaries/{80services_ip_twice/errno_67 => 70services_ip_twice/result/tmpfiles.d/rougail.conf} (100%) create mode 100644 tests/dictionaries/70services_ip_twice/tiramisu/base.py diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index 61e82d11..f040743e 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -52,7 +52,6 @@ class ServiceAnnotator: """ def __init__(self, objectspace): self.objectspace = objectspace - self.uniq_ip = [] self.uniq_overrides = [] if 'network_type' not in self.objectspace.types: self.objectspace.types['network_type'] = self.objectspace.types['ip_type'] @@ -287,11 +286,6 @@ class ServiceAnnotator: ip, service_name, ) -> None: - if service_name in self.uniq_ip: - msg = _('only one IP is allowed by service, ' - 'please use a variable multiple if you want have more than one IP') - raise DictConsistencyError(msg, 67, ip.xmlfiles) - self.uniq_ip.append(service_name) variable = self.objectspace.paths.get_variable(ip.name, ip.xmlfiles) if variable.type not in ['ip', 'network', 'network_cidr']: msg = _(f'ip cannot be linked to "{variable.type}" variable "{ip.name}"') diff --git a/src/rougail/template/base.py b/src/rougail/template/base.py index 35fe8232..a609d581 100644 --- a/src/rougail/template/base.py +++ b/src/rougail/template/base.py @@ -254,12 +254,15 @@ class RougailBaseTemplate: else: var = None func = f'_instance_{type}' - filename, source, destfile, var = getattr(self, func)(filevar, - filename, - service_name, - variable, - idx, - ) + data = getattr(self, func)(filevar, + filename, + service_name, + variable, + idx, + ) + if data is None: + continue + filename, source, destfile, var = data destfilename = join(self.destinations_dir, destfile[1:]) makedirs(dirname(destfilename), exist_ok=True) self.log.info(_(f"{filevar['engine']} processing: '{destfilename}'")) @@ -307,6 +310,7 @@ class RougailBaseTemplate: self.instance_file(fill, type_, service_name) else: self.log.debug(_("Instantiation of file '{filename}' disabled")) + self.post_instance_service(service_name) self.post_instance() chdir(ori_dir) @@ -315,6 +319,9 @@ class RougailBaseTemplate: ): raise NotImplementedError(_('cannot desactivate a service')) + def post_instance_service(self, service_name): # pragma: no cover + pass + def post_instance(self): # pragma: no cover pass diff --git a/src/rougail/template/systemd.py b/src/rougail/template/systemd.py index e5ec065e..a81ea321 100644 --- a/src/rougail/template/systemd.py +++ b/src/rougail/template/systemd.py @@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -from typing import Dict +from typing import Dict, Any from os import makedirs, symlink from os.path import dirname, isfile, join from ipaddress import ip_network @@ -62,6 +62,13 @@ z %%filename - - - - - class RougailSystemdTemplate(RougailBaseTemplate): + def __init__(self, # pylint: disable=R0913 + config: 'Config', + rougailconfig: 'RougailConfig'=None, + ) -> None: + self.ip_per_service = None + super().__init__(config, rougailconfig) + def _instance_files(self, filevar: Dict, destfile: str, @@ -95,25 +102,22 @@ class RougailSystemdTemplate(RougailBaseTemplate): def _instance_ip(self, filevar: Dict, - destfile, + ip, service_name: str, + var: Any, + idx: int, *args, ) -> tuple: + if self.ip_per_service is None: + self.ip_per_service = [] if 'netmask' in filevar: - if isinstance(filevar['name'], list): - variable = [str(ip_network(f'{net}/{mask}')) - for net, mask in zip(filevar['name'], filevar['netmask'])] + if isinstance(filevar["netmask"], list): + netmask = filevar['netmask'][idx] else: - variable = str(ip_network(f'{filevar["name"]}/{filevar["netmask"]}')) - else: - variable = filevar['name'] - if not isinstance(variable, list): - if variable is None: - variable = [] - else: - variable = [variable] - filevar['engine'] = 'creole' - return None, ROUGAIL_IP_TEMPLATE, f'/systemd/system/{service_name}.service.d/rougail_ip.conf', variable + netmask = filevar['netmask'] + self.ip_per_service.append(str(ip_network(f'{ip}/{netmask}'))) + elif ip: + self.ip_per_service.append(ip) def desactive_service(self, service_name: str, @@ -122,6 +126,26 @@ class RougailSystemdTemplate(RougailBaseTemplate): makedirs(dirname(filename), exist_ok=True) symlink('/dev/null', filename) + def post_instance_service(self, + service_name: str, + ) -> None: # pragma: no cover + if self.ip_per_service is None: + return + destfile = f'/systemd/system/{service_name}.service.d/rougail_ip.conf' + destfilename = join(self.destinations_dir, destfile[1:]) + makedirs(dirname(destfilename), exist_ok=True) + self.log.info(_(f"creole processing: '{destfilename}'")) + self.engines['creole'].process(filename=None, + source=ROUGAIL_IP_TEMPLATE, + true_destfilename=destfile, + destfilename=destfilename, + destdir=self.destinations_dir, + variable=self.ip_per_service, + rougail_variables_dict=self.rougail_variables_dict, + eosfunc=self.eosfunc, + ) + self.ip_per_service = None + def post_instance(self): destfile = '/tmpfiles.d/rougail.conf' destfilename = join(self.destinations_dir, destfile[1:]) diff --git a/tests/dictionaries/10leadership_accent/makedict/after.json b/tests/dictionaries/10leadership_accent/makedict/after.json index 6dedaf65..f77abfc0 100644 --- a/tests/dictionaries/10leadership_accent/makedict/after.json +++ b/tests/dictionaries/10leadership_accent/makedict/after.json @@ -14,9 +14,5 @@ "rougail.general1.leader.follower2": { "owner": [], "value": [] - }, - "rougail.general1.leader.follower3": { - "owner": [], - "value": [] } } diff --git a/tests/dictionaries/10leadership_accent/makedict/before.json b/tests/dictionaries/10leadership_accent/makedict/before.json index 6dedaf65..f77abfc0 100644 --- a/tests/dictionaries/10leadership_accent/makedict/before.json +++ b/tests/dictionaries/10leadership_accent/makedict/before.json @@ -14,9 +14,5 @@ "rougail.general1.leader.follower2": { "owner": [], "value": [] - }, - "rougail.general1.leader.follower3": { - "owner": [], - "value": [] } } diff --git a/tests/dictionaries/10leadership_accent_leader/makedict/after.json b/tests/dictionaries/10leadership_accent_leader/makedict/after.json index 6dedaf65..f77abfc0 100644 --- a/tests/dictionaries/10leadership_accent_leader/makedict/after.json +++ b/tests/dictionaries/10leadership_accent_leader/makedict/after.json @@ -14,9 +14,5 @@ "rougail.general1.leader.follower2": { "owner": [], "value": [] - }, - "rougail.general1.leader.follower3": { - "owner": [], - "value": [] } } diff --git a/tests/dictionaries/10leadership_accent_leader/makedict/before.json b/tests/dictionaries/10leadership_accent_leader/makedict/before.json index 6dedaf65..f77abfc0 100644 --- a/tests/dictionaries/10leadership_accent_leader/makedict/before.json +++ b/tests/dictionaries/10leadership_accent_leader/makedict/before.json @@ -14,9 +14,5 @@ "rougail.general1.leader.follower2": { "owner": [], "value": [] - }, - "rougail.general1.leader.follower3": { - "owner": [], - "value": [] } } diff --git a/tests/dictionaries/80services_ip_twice/00-base.xml b/tests/dictionaries/70services_ip_twice/00-base.xml similarity index 69% rename from tests/dictionaries/80services_ip_twice/00-base.xml rename to tests/dictionaries/70services_ip_twice/00-base.xml index 62e32106..16d6c77c 100644 --- a/tests/dictionaries/80services_ip_twice/00-base.xml +++ b/tests/dictionaries/70services_ip_twice/00-base.xml @@ -5,7 +5,7 @@ nut_monitor_host - nut_monitor_host + nut_monitor_host2 @@ -13,6 +13,9 @@ 192.168.0.1 + + 192.168.0.2 + diff --git a/tests/dictionaries/10load_disabled_if_in_twice/__init__.py b/tests/dictionaries/10load_disabled_if_in_twice/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10load_disabled_if_in_twice/makedict/after.json b/tests/dictionaries/10load_disabled_if_in_twice/makedict/after.json new file mode 100644 index 00000000..41b04961 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_twice/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.my_var1": { + "owner": "default", + "value": "no" + } +} diff --git a/tests/dictionaries/10load_disabled_if_in_twice/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_twice/makedict/base.json new file mode 100644 index 00000000..1978f1f4 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_twice/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.my_var1": "no" +} diff --git a/tests/dictionaries/10load_disabled_if_in_twice/makedict/before.json b/tests/dictionaries/10load_disabled_if_in_twice/makedict/before.json new file mode 100644 index 00000000..41b04961 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_twice/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.my_var1": { + "owner": "default", + "value": "no" + } +} diff --git a/tests/dictionaries/10load_disabled_if_in_twice/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_twice/tiramisu/base.py new file mode 100644 index 00000000..b0c31d57 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_twice/tiramisu/base.py @@ -0,0 +1,18 @@ +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="my_var1", doc="my_var1", default="no", properties=frozenset({"mandatory", "normal"})) +option_3 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue("no")}))})) +option_4 = StrOption(name="my_var3", doc="my_var3", default="no", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("no")}))})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py index 5d2a297a..4d25c74b 100644 --- a/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_variable/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="tous", properties=frozenset({"mandatory", "normal"})) -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), 'expected': ParamOption(option_4)}))})) +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': ParamOption(option_4)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py index 13e16a9e..9299ae2b 100644 --- a/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_variable2/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="aucun", properties=frozenset({"mandatory", "normal"})) -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), 'expected': ParamOption(option_4)}))})) +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': ParamOption(option_4)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py index 10e93750..45e36d9b 100644 --- a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py @@ -12,10 +12,10 @@ try: 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), '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), 'expected': ParamValue("oui")}))})) +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), 'expected': ParamValue("oui")}))})) +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]) diff --git a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py index 656cab58..3aed64dc 100644 --- a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback/tiramisu/base.py @@ -13,7 +13,7 @@ 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({"disabled", "mandatory", "normal"})) -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), '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="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py index 8d8d5df5..750899b5 100644 --- a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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), '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), 'expected': ParamValue("oui")}))})) +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="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py index 8d8d5df5..750899b5 100644 --- a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py +++ b/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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), '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), 'expected': ParamValue("oui")}))})) +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="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin/tiramisu/base.py b/tests/dictionaries/10load_frozenifin/tiramisu/base.py index 2dd35738..05a35bb4 100644 --- a/tests/dictionaries/10load_frozenifin/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py index 90bf1c7c..48d2417e 100644 --- a/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_auto/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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=Calculation(func.calc_val, Params((ParamValue("non")))), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("non")))), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py index b0166485..c42b9391 100644 --- a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/base.py @@ -12,8 +12,8 @@ try: except: from tiramisu import * option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")}))})) -option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("authentifié")}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("authentifié")}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("tous")})), Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("authentifié")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("authentifié")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py b/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py index d2d5ec72..e3af4d3f 100644 --- a/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifin_variable/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="tous", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamOption(option_4)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamOption(option_4)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py index 1e993f2d..f289bc8d 100644 --- a/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py +++ b/tests/dictionaries/10load_frozenifnotin/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) -option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py b/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py index 5ca6ff4f..e07b4f4e 100644 --- a/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py +++ b/tests/dictionaries/10load_hidden_if_empty_family/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), 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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py index b2a2e853..d48d848c 100644 --- a/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py +++ b/tests/dictionaries/10load_hidden_if_family/tiramisu/base.py @@ -12,10 +12,10 @@ try: 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), 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('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), 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", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) -option_6 = OptionDescription(name="general2", doc="Général2", children=[option_7], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_7 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_6 = OptionDescription(name="general2", doc="Général2", children=[option_7], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), 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]) diff --git a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py index 363b44b0..1e189936 100644 --- a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py +++ b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('mandatory'), 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('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index e18a413c..add634a6 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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), 'expected': ParamValue("oui")}))})) -option_5 = BoolOption(name="mode_conteneur_actif2", doc="No change", default=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +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 = BoolOption(name="mode_conteneur_actif2", doc="No change", default=True, 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="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="engine", doc="engine", default="creole") 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 8162b1f3..cd687323 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -12,8 +12,8 @@ try: except: from tiramisu import * option_3 = StrOption(name="condition", doc="No change", default="oui", 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), '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), 'expected': ParamValue("oui")}))})) +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="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="engine", doc="engine", default="creole") 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 1834cf14..90d94571 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -12,8 +12,8 @@ try: 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), '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), 'expected': ParamValue("oui")}))})) +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="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_10 = StrOption(name="engine", doc="engine", default="creole") diff --git a/tests/dictionaries/20family_appendaccent/tiramisu/base.py b/tests/dictionaries/20family_appendaccent/tiramisu/base.py index cd378b9d..31ad812c 100644 --- a/tests/dictionaries/20family_appendaccent/tiramisu/base.py +++ b/tests/dictionaries/20family_appendaccent/tiramisu/base.py @@ -12,7 +12,7 @@ try: 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), 'expected': ParamValue("non")}))})) +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"})) diff --git a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py index 2dc884f9..39b54a6b 100644 --- a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py @@ -15,8 +15,8 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_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), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=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), '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_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_base/tiramisu/base.py b/tests/dictionaries/40condition_base/tiramisu/base.py index a7fba4b2..5db66c79 100644 --- a/tests/dictionaries/40condition_base/tiramisu/base.py +++ b/tests/dictionaries/40condition_base/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) -option_6 = 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_4, todict=True), 'expected': ParamValue("oui")}))})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_6 = 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_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_base_add/tiramisu/base.py b/tests/dictionaries/40condition_base_add/tiramisu/base.py index a7fba4b2..5db66c79 100644 --- a/tests/dictionaries/40condition_base_add/tiramisu/base.py +++ b/tests/dictionaries/40condition_base_add/tiramisu/base.py @@ -13,8 +13,8 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) -option_6 = 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_4, todict=True), 'expected': ParamValue("oui")}))})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_6 = 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_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_optional/tiramisu/base.py b/tests/dictionaries/40condition_optional/tiramisu/base.py index ecf65c60..e3fb7b1d 100644 --- a/tests/dictionaries/40condition_optional/tiramisu/base.py +++ b/tests/dictionaries/40condition_optional/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_optional_family/tiramisu/base.py b/tests/dictionaries/40condition_optional_family/tiramisu/base.py index c6650f5b..7b6cc832 100644 --- a/tests/dictionaries/40condition_optional_family/tiramisu/base.py +++ b/tests/dictionaries/40condition_optional_family/tiramisu/base.py @@ -13,6 +13,6 @@ except: from tiramisu import * option_2 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="my_variable", doc="my_variable", properties=frozenset({"normal"})) -option_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True)}))})) +option_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40ifin_leadership/tiramisu/base.py b/tests/dictionaries/40ifin_leadership/tiramisu/base.py index f9167dde..6def79cd 100644 --- a/tests/dictionaries/40ifin_leadership/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadership/tiramisu/base.py @@ -14,7 +14,7 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True) -option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) 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({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index 1e0df8df..7dd16c28 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -14,7 +14,7 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a'], properties=frozenset({"mandatory"})) -option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) 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({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py index 32ae5f4c..a9db138d 100644 --- a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -14,7 +14,7 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a', 'b'], properties=frozenset({"mandatory"})) -option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_6, todict=True), 'expected': ParamValue("a")}))})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_6, todict=True, notraisepropertyerror=True), 'expected': ParamValue("a")}))})) 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({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) diff --git a/tests/dictionaries/40ifin_multi/tiramisu/base.py b/tests/dictionaries/40ifin_multi/tiramisu/base.py index c56c018f..e9fc2084 100644 --- a/tests/dictionaries/40ifin_multi/tiramisu/base.py +++ b/tests/dictionaries/40ifin_multi/tiramisu/base.py @@ -14,7 +14,7 @@ except: 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="non", 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), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui")}))})) +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]) diff --git a/tests/dictionaries/51redefine_family/tiramisu/base.py b/tests/dictionaries/51redefine_family/tiramisu/base.py index 60c05013..93b17ad1 100644 --- a/tests/dictionaries/51redefine_family/tiramisu/base.py +++ b/tests/dictionaries/51redefine_family/tiramisu/base.py @@ -14,6 +14,6 @@ except: 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="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_4 = OptionDescription(name="general2", doc="general2", children=[option_5], properties=frozenset({"hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))})) +option_4 = OptionDescription(name="general2", doc="general2", children=[option_5], properties=frozenset({"hidden", "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_4]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py index d0fe6263..57094f7f 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py @@ -12,7 +12,7 @@ try: except: from tiramisu import * option_6 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_6, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_6, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="my_var1", doc="my_var1", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_5 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py index 3a3b21ea..688009ee 100644 --- a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py +++ b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py @@ -12,7 +12,7 @@ try: except: from tiramisu import * option_5 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_5, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="my_var1", doc="my_var1", default="no", 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({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) @@ -22,6 +22,6 @@ option_10 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), defaul option_7 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_8, option_9, option_10], properties=frozenset({"normal"})) option_6 = OptionDescription(name="extra", doc="extra", children=[option_7]) option_13 = StrOption(name="description", doc="description", default="test", properties=frozenset({"mandatory", "normal"})) -option_12 = OptionDescription(name="external", doc="external", children=[option_13], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_8, todict=True), 'expected': ParamValue("non")}))})) +option_12 = OptionDescription(name="external", doc="external", children=[option_13], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_8, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))})) option_11 = OptionDescription(name="extra1", doc="extra1", children=[option_12]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6, option_11]) diff --git a/tests/dictionaries/70services_ip_iplist/tiramisu/base.py b/tests/dictionaries/70services_ip_iplist/tiramisu/base.py index d13f6ed7..0c6b84fc 100644 --- a/tests/dictionaries/70services_ip_iplist/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_iplist/tiramisu/base.py @@ -12,7 +12,7 @@ try: except: from tiramisu import * option_2 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) -option_3 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0/24", cidr=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue("yes")}))})) +option_3 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0/24", cidr=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_8 = SymLinkOption(name="name", opt=option_3) option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) From f4538004c7f1e5d1921399822fb09e5b06b7046c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 27 Feb 2021 18:07:03 +0100 Subject: [PATCH 148/168] activate with disabled variable --- src/rougail/annotator/condition.py | 1 + .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 4 +-- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../70service_servicelist/tiramisu/base.py | 2 +- .../00-base.xml | 29 +++++++++++++++++++ .../__init__.py | 0 .../makedict/after.json | 14 +++++++++ .../makedict/base.json | 5 ++++ .../makedict/before.json | 14 +++++++++ .../tiramisu/base.py | 21 ++++++++++++++ .../tiramisu/base.py | 2 +- .../70service_servicelist_ip/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../70services_ip_iplist/tiramisu/base.py | 2 +- .../70services_ip_iplist2/tiramisu/base.py | 2 +- 29 files changed, 107 insertions(+), 23 deletions(-) create mode 100644 tests/dictionaries/70service_servicelist_disabled_if_in/00-base.xml create mode 100644 tests/dictionaries/70service_servicelist_disabled_if_in/__init__.py create mode 100644 tests/dictionaries/70service_servicelist_disabled_if_in/makedict/after.json create mode 100644 tests/dictionaries/70service_servicelist_disabled_if_in/makedict/base.json create mode 100644 tests/dictionaries/70service_servicelist_disabled_if_in/makedict/before.json create mode 100644 tests/dictionaries/70service_servicelist_disabled_if_in/tiramisu/base.py diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 6abad827..14c2ece9 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -250,6 +250,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): param3.name = f'condition_{fill.index}' param3.type = 'variable' param3.text = condition.source.path + param3.propertyerror = False fill.param.append(param3) param4 = self.objectspace.param(target.xmlfiles) param4.name = f'expected_{fill.index}' diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py index 9df307eb..d52b30b7 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py index 1b8a08c1..d1247ffa 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param2/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py index 3330ca68..163d7bc3 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param3/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py index 089d269f..db26c7d4 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param4/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py index 9822c077..cb1ba8f8 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param5/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py index 9823a059..458930f2 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param6/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py index 9605eec2..3abc58ac 100644 --- a/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py +++ b/tests/dictionaries/10load_disabled_if_in_multi_param_disabled/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index add634a6..c867565c 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_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/etc/file") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("oui")}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), '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_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py index 886e0b0e..acf353d6 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py @@ -21,7 +21,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") option_12 = FilenameOption(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="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)}))) +option_15 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(True)}))) option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) option_16 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py index 85c4017b..d44a6fbc 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py @@ -21,7 +21,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644") option_12 = FilenameOption(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="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(True)}))) +option_15 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(True)}))) option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) option_16 = BoolOption(name="activate", doc="activate", default=True) 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 cd687323..8e122af1 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_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/etc/file") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("oui")}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), '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_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) 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 90d94571..4bd9cc16 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_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file1") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("oui")}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), '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_17]) option_19 = StrOption(name="engine", doc="engine", default="creole") option_20 = StrOption(name="group", doc="group", default="root") @@ -32,7 +32,7 @@ option_22 = StrOption(name="mode", doc="mode", default="0644") option_23 = FilenameOption(name="name", doc="name", default="/tmp/file2") option_24 = StrOption(name="owner", doc="owner", default="root") option_25 = StrOption(name="source", doc="source", default="file2") -option_26 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("oui")}))) +option_26 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("oui")}))) option_18 = OptionDescription(name="file2", doc="file2", children=[option_19, option_20, option_21, option_22, option_23, option_24, option_25, option_26]) option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_18]) option_27 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 60c349da..158e1708 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 60c349da..158e1708 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index 41408f0f..db0d3b12 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_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True), 'condition_1': ParamOption(option_5), 'expected_1': ParamValue("oui"), 'reverse_condition_1': ParamValue(True), 'condition_operator': ParamValue("OR")}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True), 'condition_1': ParamOption(option_5, notraisepropertyerror=True), 'expected_1': ParamValue("oui"), 'reverse_condition_1': ParamValue(True), 'condition_operator': ParamValue("OR")}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index 4c08cfca..9bdaaa29 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_13 = StrOption(name="mode", doc="mode", default="0644") option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") option_15 = StrOption(name="owner", doc="owner", default="root") option_16 = StrOption(name="source", doc="source", default="file") -option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue("statique"), 'reverse_condition_0': ParamValue(True)}))) +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("statique"), 'reverse_condition_0': ParamValue(True)}))) option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) option_8 = OptionDescription(name="files", doc="files", children=[option_9]) option_18 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/70service_servicelist/tiramisu/base.py b/tests/dictionaries/70service_servicelist/tiramisu/base.py index 51dee229..ef89c05e 100644 --- a/tests/dictionaries/70service_servicelist/tiramisu/base.py +++ b/tests/dictionaries/70service_servicelist/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_2 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_5 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_5 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2, notraisepropertyerror=True), 'expected_0': ParamValue("yes")}))) option_6 = BoolOption(name="manage", doc="manage", default=True) option_4 = OptionDescription(name="test", doc="test", children=[option_5, option_6]) option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) diff --git a/tests/dictionaries/70service_servicelist_disabled_if_in/00-base.xml b/tests/dictionaries/70service_servicelist_disabled_if_in/00-base.xml new file mode 100644 index 00000000..0e21a232 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_disabled_if_in/00-base.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + no + + + no + + + + + no + condition2 + + + yes + test + + + + diff --git a/tests/dictionaries/70service_servicelist_disabled_if_in/__init__.py b/tests/dictionaries/70service_servicelist_disabled_if_in/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/after.json b/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/after.json new file mode 100644 index 00000000..2eba5258 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.condition1": { + "owner": "default", + "value": "no" + }, + "services.test.activate": { + "owner": "default", + "value": false + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/base.json b/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/base.json new file mode 100644 index 00000000..e97d9ea7 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/base.json @@ -0,0 +1,5 @@ +{ + "rougail.condition1": "no", + "services.test.activate": false, + "services.test.manage": true +} diff --git a/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/before.json b/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/before.json new file mode 100644 index 00000000..2eba5258 --- /dev/null +++ b/tests/dictionaries/70service_servicelist_disabled_if_in/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.condition1": { + "owner": "default", + "value": "no" + }, + "services.test.activate": { + "owner": "default", + "value": false + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70service_servicelist_disabled_if_in/tiramisu/base.py b/tests/dictionaries/70service_servicelist_disabled_if_in/tiramisu/base.py new file mode 100644 index 00000000..3bbe733f --- /dev/null +++ b/tests/dictionaries/70service_servicelist_disabled_if_in/tiramisu/base.py @@ -0,0 +1,21 @@ +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="condition1", doc="condition1", default="no", properties=frozenset({"mandatory", "normal"})) +option_3 = StrOption(name="condition2", doc="condition2", default="no", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue("no")}))})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_6 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("yes")}))) +option_7 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_7]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/70service_servicelist_file/tiramisu/base.py b/tests/dictionaries/70service_servicelist_file/tiramisu/base.py index 2709b532..fa6bc7f2 100644 --- a/tests/dictionaries/70service_servicelist_file/tiramisu/base.py +++ b/tests/dictionaries/70service_servicelist_file/tiramisu/base.py @@ -24,7 +24,7 @@ option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_6 = OptionDescription(name="files", doc="files", children=[option_7]) -option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("no")}))) +option_16 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2, notraisepropertyerror=True), 'expected_0': ParamValue("no")}))) option_17 = BoolOption(name="manage", doc="manage", default=True) option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) diff --git a/tests/dictionaries/70service_servicelist_ip/tiramisu/base.py b/tests/dictionaries/70service_servicelist_ip/tiramisu/base.py index 26cbfc85..c0e08ca4 100644 --- a/tests/dictionaries/70service_servicelist_ip/tiramisu/base.py +++ b/tests/dictionaries/70service_servicelist_ip/tiramisu/base.py @@ -18,7 +18,7 @@ option_8 = SymLinkOption(name="name", opt=option_3) option_9 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9]) option_6 = OptionDescription(name="ip", doc="ip", children=[option_7]) -option_10 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("no")}))) +option_10 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2, notraisepropertyerror=True), 'expected_0': ParamValue("no")}))) option_11 = BoolOption(name="manage", doc="manage", default=True) option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_10, option_11]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) diff --git a/tests/dictionaries/70service_servicelist_not_managed/tiramisu/base.py b/tests/dictionaries/70service_servicelist_not_managed/tiramisu/base.py index dc47598e..86622e84 100644 --- a/tests/dictionaries/70service_servicelist_not_managed/tiramisu/base.py +++ b/tests/dictionaries/70service_servicelist_not_managed/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_2 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_5 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_5 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2, notraisepropertyerror=True), 'expected_0': ParamValue("yes")}))) option_6 = BoolOption(name="manage", doc="manage", default=False) option_4 = OptionDescription(name="test", doc="test", children=[option_5, option_6]) option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) diff --git a/tests/dictionaries/70services_ip_iplist/tiramisu/base.py b/tests/dictionaries/70services_ip_iplist/tiramisu/base.py index 0c6b84fc..d2f61d0e 100644 --- a/tests/dictionaries/70services_ip_iplist/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_iplist/tiramisu/base.py @@ -15,7 +15,7 @@ option_2 = StrOption(name="condition", doc="condition", default="no", properties option_3 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0/24", cidr=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_8 = SymLinkOption(name="name", opt=option_3) -option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2, notraisepropertyerror=True), 'expected_0': ParamValue("yes")}))) option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9]) option_6 = OptionDescription(name="ip", doc="ip", children=[option_7]) option_10 = BoolOption(name="activate", doc="activate", default=True) diff --git a/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py b/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py index de18fcf7..2473f86a 100644 --- a/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py +++ b/tests/dictionaries/70services_ip_iplist2/tiramisu/base.py @@ -15,7 +15,7 @@ option_2 = StrOption(name="condition", doc="condition", default="yes", propertie option_3 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0/24", cidr=True, properties=frozenset({"mandatory", "normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_8 = SymLinkOption(name="name", opt=option_3) -option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")}))) +option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2, notraisepropertyerror=True), 'expected_0': ParamValue("yes")}))) option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9]) option_6 = OptionDescription(name="ip", doc="ip", children=[option_7]) option_10 = BoolOption(name="activate", doc="activate", default=True) From 651d89dd04a0f4dbe912bc05c2cce9f5e34501cd Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 28 Feb 2021 20:16:57 +0100 Subject: [PATCH 149/168] add new engine creole_legacy --- src/rougail/data/rougail.dtd | 2 +- src/rougail/template/engine/__init__.py | 4 +- src/rougail/template/engine/creole.py | 26 ++-- src/rougail/template/engine/creole_legacy.py | 123 +++++++++++++++++++ 4 files changed, 136 insertions(+), 19 deletions(-) create mode 100644 src/rougail/template/engine/creole_legacy.py diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index f74ee7e9..2b5c5eb6 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -67,7 +67,7 @@ - + diff --git a/src/rougail/template/engine/__init__.py b/src/rougail/template/engine/__init__.py index 26989911..d6cbaa55 100644 --- a/src/rougail/template/engine/__init__.py +++ b/src/rougail/template/engine/__init__.py @@ -1,4 +1,4 @@ -from . import none, creole, jinja2 +from . import none, creole, jinja2, creole_legacy -__all__ = ('none', 'creole', 'jinja2') +__all__ = ('none', 'creole', 'jinja2', 'creole_legacy') diff --git a/src/rougail/template/engine/creole.py b/src/rougail/template/engine/creole.py index e71d48e6..2e84cb3b 100644 --- a/src/rougail/template/engine/creole.py +++ b/src/rougail/template/engine/creole.py @@ -34,25 +34,16 @@ from ...utils import normalize_family from ...error import TemplateError -@classmethod -def cl_compile(kls, *args, **kwargs): - """Rewrite compile methode to force some settings - """ - kwargs['compilerSettings'] = {'directiveStartToken' : '%', - 'cheetahVarStartToken' : '%%', - 'EOLSlurpToken' : '%', - 'commentStartToken' : '#', - 'multiLineCommentStartToken' : '#*', - 'multiLineCommentEndToken' : '*#', - } - return kls.old_compile(*args, **kwargs) # pylint: disable=E1101 -Template.old_compile = Template.compile -Template.compile = cl_compile - - class CheetahTemplate(Template): # pylint: disable=W0223 """Construct a cheetah templating object """ + compilerSettings = {'directiveStartToken' : '%', + 'cheetahVarStartToken' : '%%', + 'EOLSlurpToken' : '%', + 'commentStartToken' : '#', + 'multiLineCommentStartToken' : '#*', + 'multiLineCommentEndToken' : '*#', + } def __init__(self, filename: str, source: str, @@ -66,11 +57,13 @@ class CheetahTemplate(Template): # pylint: disable=W0223 Template.__init__(self, file=filename, searchList=[context, eosfunc, extra_context], + compilerSettings=self.compilerSettings, ) else: Template.__init__(self, source=source, searchList=[context, eosfunc, extra_context], + compilerSettings=self.compilerSettings, ) # FORK of Cheetah function, do not replace '\\' by '/' @@ -92,6 +85,7 @@ class CheetahTemplate(Template): # pylint: disable=W0223 return None +# Sync to creole_legacy.py def process(filename: str, source: str, true_destfilename: str, diff --git a/src/rougail/template/engine/creole_legacy.py b/src/rougail/template/engine/creole_legacy.py new file mode 100644 index 00000000..a775207e --- /dev/null +++ b/src/rougail/template/engine/creole_legacy.py @@ -0,0 +1,123 @@ +"""Legacy Creole engine + +Created by: +EOLE (http://eole.orion.education.fr) +Copyright (C) 2005-2018 + +Forked by: +Cadoles (http://www.cadoles.com) +Copyright (C) 2021 + +distribued with GPL-2 or later license + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +""" + + +from typing import Dict, Any +from Cheetah.NameMapper import NotFound + +from .creole import CheetahTemplate as oriCheetahTemplate +from ...i18n import _ +from ...utils import normalize_family +from ...error import TemplateError + + +class IsDefined: + """ + filtre permettant de ne pas lever d'exception au cas où + la variable Creole n'est pas définie + """ + def __init__(self, context): + self.context = context + + def __call__(self, varname): + if '.' in varname: + splitted_var = varname.split('.') + if len(splitted_var) != 2: + msg = u"Group variables must be of type master.slave" + raise KeyError(msg) + master, slave = splitted_var + if master in self.context: + return slave in self.context[master].slave.keys() + return False + else: + return varname in self.context + + +class CheetahTemplate(oriCheetahTemplate): + compilerSettings = {'directiveStartToken' : '%', + 'cheetahVarStartToken' : '%%', + 'EOLSlurpToken' : '%', + 'PSPStartToken' : 'µ' * 10, + 'PSPEndToken' : 'µ' * 10, + 'commentStartToken' : 'µ' * 10, + 'commentEndToken' : 'µ' * 10, + 'multiLineCommentStartToken' : 'µ' * 10, + 'multiLineCommentEndToken' : 'µ' * 10} + def __init__(self, + filename: str, + source: str, + context, + eosfunc: Dict, + extra_context: Dict, + ): + extra_context['is_defined'] = IsDefined(context) + super().__init__(filename, source, context, eosfunc, extra_context) + + +# Sync to creole.py +def process(filename: str, + source: str, + true_destfilename: str, + destfilename: str, + destdir: str, + variable: Any, + rougail_variables_dict: Dict, + eosfunc: Dict, + ): + """Process a cheetah template + """ + # full path of the destination file + try: + extra_context = {'normalize_family': normalize_family, + 'rougail_filename': true_destfilename, + 'rougail_destination_dir': destdir, + } + if variable is not None: + extra_context['rougail_variable'] = variable + cheetah_template = CheetahTemplate(filename, + source, + rougail_variables_dict, + eosfunc, + extra_context, + ) + data = str(cheetah_template) + except NotFound as err: # pragma: no cover + varname = err.args[0][13:-1] + if filename: + msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}" + else: + msg = f"Error: unknown variable used in file {destfilename}: {varname}" + raise TemplateError(_(msg)) from err + except Exception as err: # pragma: no cover + if filename: + msg = _(f"Error while instantiating template {filename} to {destfilename}: {err}") + else: + msg = _(f"Error while instantiating filename {destfilename}: {err}") + raise TemplateError(msg) from err + + with open(destfilename, 'w') as file_h: + file_h.write(data) From af8f0bfc9a5f38c88766fdfeb53c59f4d432709a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 28 Feb 2021 20:38:45 +0100 Subject: [PATCH 150/168] support heritage --- src/rougail/template/engine/creole.py | 39 +++++++++++--------- src/rougail/template/engine/creole_legacy.py | 26 ++++++++----- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/rougail/template/engine/creole.py b/src/rougail/template/engine/creole.py index 2e84cb3b..631283d1 100644 --- a/src/rougail/template/engine/creole.py +++ b/src/rougail/template/engine/creole.py @@ -34,16 +34,25 @@ from ...utils import normalize_family from ...error import TemplateError +@classmethod +def cl_compile(kls, *args, **kwargs): + """Rewrite compile methode to force some settings + """ + kwargs['compilerSettings'] = {'directiveStartToken' : '%', + 'cheetahVarStartToken' : '%%', + 'EOLSlurpToken' : '%', + 'commentStartToken' : '#', + 'multiLineCommentStartToken' : '#*', + 'multiLineCommentEndToken' : '*#', + } + return kls.old_compile(*args, **kwargs) # pylint: disable=E1101 +Template.old_compile = Template.compile +Template.compile = cl_compile + + class CheetahTemplate(Template): # pylint: disable=W0223 """Construct a cheetah templating object """ - compilerSettings = {'directiveStartToken' : '%', - 'cheetahVarStartToken' : '%%', - 'EOLSlurpToken' : '%', - 'commentStartToken' : '#', - 'multiLineCommentStartToken' : '#*', - 'multiLineCommentEndToken' : '*#', - } def __init__(self, filename: str, source: str, @@ -54,17 +63,13 @@ class CheetahTemplate(Template): # pylint: disable=W0223 """Initialize Creole CheetahTemplate """ if filename is not None: - Template.__init__(self, - file=filename, - searchList=[context, eosfunc, extra_context], - compilerSettings=self.compilerSettings, - ) + super().__init__(file=filename, + searchList=[context, eosfunc, extra_context], + ) else: - Template.__init__(self, - source=source, - searchList=[context, eosfunc, extra_context], - compilerSettings=self.compilerSettings, - ) + super().__init__(source=source, + searchList=[context, eosfunc, extra_context], + ) # FORK of Cheetah function, do not replace '\\' by '/' def serverSidePath(self, diff --git a/src/rougail/template/engine/creole_legacy.py b/src/rougail/template/engine/creole_legacy.py index a775207e..b002d90c 100644 --- a/src/rougail/template/engine/creole_legacy.py +++ b/src/rougail/template/engine/creole_legacy.py @@ -35,6 +35,23 @@ from ...utils import normalize_family from ...error import TemplateError +@classmethod +def cl_compile(kls, *args, **kwargs): + """Rewrite compile methode to force some settings + """ + kwargs['compilerSettings'] = {'directiveStartToken' : u'%', + 'cheetahVarStartToken' : u'%%', + 'EOLSlurpToken' : u'%', + 'PSPStartToken' : u'µ' * 10, + 'PSPEndToken' : u'µ' * 10, + 'commentStartToken' : u'µ' * 10, + 'commentEndToken' : u'µ' * 10, + 'multiLineCommentStartToken' : u'µ' * 10, + 'multiLineCommentEndToken' : u'µ' * 10} + return kls.old_compile(*args, **kwargs) # pylint: disable=E1101 +oriCheetahTemplate.compile = cl_compile + + class IsDefined: """ filtre permettant de ne pas lever d'exception au cas où @@ -58,15 +75,6 @@ class IsDefined: class CheetahTemplate(oriCheetahTemplate): - compilerSettings = {'directiveStartToken' : '%', - 'cheetahVarStartToken' : '%%', - 'EOLSlurpToken' : '%', - 'PSPStartToken' : 'µ' * 10, - 'PSPEndToken' : 'µ' * 10, - 'commentStartToken' : 'µ' * 10, - 'commentEndToken' : 'µ' * 10, - 'multiLineCommentStartToken' : 'µ' * 10, - 'multiLineCommentEndToken' : 'µ' * 10} def __init__(self, filename: str, source: str, From cbd1081371543a392244ee107aa40ef818a95322 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 28 Feb 2021 20:40:18 +0100 Subject: [PATCH 151/168] better support of auto_freeze --- src/rougail/annotator/condition.py | 4 ++-- tests/dictionaries/00load_autofreeze/tiramisu/base.py | 2 +- tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py | 2 +- tests/dictionaries/01auto_autofreeze/tiramisu/base.py | 2 +- tests/dictionaries/01fill_autofreeze/tiramisu/base.py | 2 +- tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py | 2 +- .../51redefine_removecondition_nonautofreeze/tiramisu/base.py | 2 +- .../60extra_externalspacecondition/tiramisu/base.py | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 14c2ece9..d0cc54f0 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -81,7 +81,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): if variable.auto_save: continue new_condition = self.objectspace.condition(variable.xmlfiles) - new_condition.name = 'auto_frozen_if_not_in' + new_condition.name = 'auto_frozen_if_in' new_condition.namespace = variable.namespace new_condition.source = self.objectspace.rougailconfig['auto_freeze_variable'] new_param = self.objectspace.param(variable.xmlfiles) @@ -149,7 +149,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): """ if condition_name.startswith('hidden_if_'): return ['hidden', 'frozen', 'force_default_on_freeze'] - if condition_name == 'auto_frozen_if_not_in': + if condition_name == 'auto_frozen_if_in': return ['frozen'] return [condition_name.split('_', 1)[0]] diff --git a/tests/dictionaries/00load_autofreeze/tiramisu/base.py b/tests/dictionaries/00load_autofreeze/tiramisu/base.py index a37aa8f5..d8426bc8 100644 --- a/tests/dictionaries/00load_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreeze/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_3 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"})) -option_2 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py index 7a82f798..cb7cbd09 100644 --- a/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py +++ b/tests/dictionaries/00load_autofreezeexpert/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_3 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"})) -option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py index 6c3cfb38..c98e9f07 100644 --- a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", "hidden", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", "hidden", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py index 2b77761a..dda85a1d 100644 --- a/tests/dictionaries/01fill_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01fill_autofreeze/tiramisu/base.py @@ -13,6 +13,6 @@ except: from tiramisu import * option_3 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"})) -option_2 = StrOption(name="my_var1", doc="my_var1", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="my_var1", doc="my_var1", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py index 3dba1e57..2fc25e86 100644 --- a/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py +++ b/tests/dictionaries/01hidden_if_in_autofreeze/tiramisu/base.py @@ -12,6 +12,6 @@ try: except: from tiramisu import * option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py index 57094f7f..bc4a6466 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py @@ -12,7 +12,7 @@ try: except: from tiramisu import * option_6 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_6, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_6, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="my_var1", doc="my_var1", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_5 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal"})) diff --git a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py index 688009ee..f6352ae5 100644 --- a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py +++ b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py @@ -12,7 +12,7 @@ try: except: from tiramisu import * option_5 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_5, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))})) +option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_5, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) option_4 = StrOption(name="my_var1", doc="my_var1", default="no", 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({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) From b049cb93247a2390e0ddb733c6dce3fd2d433421 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 28 Feb 2021 20:41:57 +0100 Subject: [PATCH 152/168] file name information if option is not found --- src/rougail/annotator/group.py | 2 +- src/rougail/annotator/service.py | 2 +- src/rougail/path.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py index 8c32ca1a..00b1f25e 100644 --- a/src/rougail/annotator/group.py +++ b/src/rougail/annotator/group.py @@ -50,7 +50,7 @@ class GroupAnnotator: if group.leader in cache_paths: leader_fam_path = cache_paths[group.leader] else: - leader_fam_path = self.objectspace.paths.get_variable_family_path(group.leader) + leader_fam_path = self.objectspace.paths.get_variable_family_path(group.leader, group.xmlfiles) cache_paths[group.leader] = leader_fam_path follower_names = list(group.follower.keys()) leader = self.objectspace.paths.get_variable(group.leader) diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index f040743e..809b9a8b 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -297,7 +297,7 @@ class ServiceAnnotator: msg = _(f'ip with ip_type "{variable.type}" must have netmask') raise DictConsistencyError(msg, 64, ip.xmlfiles) if hasattr(ip, 'netmask'): - netmask = self.objectspace.paths.get_variable(ip.netmask) + netmask = self.objectspace.paths.get_variable(ip.netmask, ip.xmlfiles) if netmask.type != 'netmask': msg = _(f'netmask in ip must have type "netmask", not "{netmask.type}"') raise DictConsistencyError(msg, 65, ip.xmlfiles) diff --git a/src/rougail/path.py b/src/rougail/path.py index ba2c43a0..bf5daf3b 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -187,10 +187,11 @@ class Path: def get_variable_family_path(self, name: str, + xmlfiles: List[str]=False, ) -> str: # pylint: disable=C0111 """Get the full path of a family """ - return self._get_variable(name)['family'] + return self._get_variable(name, xmlfiles=xmlfiles)['family'] def get_variable_path(self, name: str, From 5eeaaedded730ab97b456f39db0e8661772c289f Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 28 Feb 2021 21:07:36 +0100 Subject: [PATCH 153/168] hack to support valid_network_netmask --- src/rougail/tiramisureflector.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 483387c2..bb1ad6fa 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -267,7 +267,8 @@ class Common: params = [f'{option_name}'] if hasattr(param, 'suffix'): param_type = 'ParamDynOption' - params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}']) + family = param.family.reflector_object.get() + params.extend([f"'{param.suffix}'", f'{family}']) else: param_type = 'ParamOption' if not param.propertyerror: @@ -328,14 +329,22 @@ class Variable(Common): kwargs = [] # has parameters function = child.name + new_args = [] if hasattr(child, 'param'): for param in child.param: value = self.populate_param(param) if not hasattr(param, 'name'): - args.append(str(value)) +# args.append(str(value)) + new_args.append(str(value)) else: kwargs.append(f"'{param.name}': " + value) - ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')' +# ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')' + if function == 'valid_network_netmask': + new_args.extend(args) + else: + args.extend(new_args) + new_args = args + ret = f'Calculation(func.{function}, Params((' + ', '.join(new_args) + ')' if kwargs: ret += ', kwargs={' + ', '.join(kwargs) + '}' ret += ')' From 55c3021a5dbb3b4f19b43bc09ab10e24d19ba06c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 28 Feb 2021 21:08:25 +0100 Subject: [PATCH 154/168] first support to RougailUpgrade --- src/rougail/__init__.py | 3 +- src/rougail/error.py | 5 + src/rougail/update.py | 486 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 493 insertions(+), 1 deletion(-) create mode 100644 src/rougail/update.py diff --git a/src/rougail/__init__.py b/src/rougail/__init__.py index a36f3a94..c6cb4ae5 100644 --- a/src/rougail/__init__.py +++ b/src/rougail/__init__.py @@ -27,5 +27,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from .convert import RougailConvert from .template.systemd import RougailSystemdTemplate from .config import RougailConfig +from rougail.update import RougailUpgrade -__ALL__ = ('RougailConvert', 'RougailSystemdTemplate', 'RougailConfig') +__ALL__ = ('RougailConvert', 'RougailSystemdTemplate', 'RougailConfig', 'RougailUpgrade') diff --git a/src/rougail/error.py b/src/rougail/error.py index 68cd61a7..7795378c 100644 --- a/src/rougail/error.py +++ b/src/rougail/error.py @@ -70,3 +70,8 @@ class DictConsistencyError(Exception): msg = _(f'{msg} in {display_xmlfiles(xmlfiles)}') super().__init__(msg) self.errno = errno + + +class UpgradeError(Exception): + """Error during XML upgrade + """ diff --git a/src/rougail/update.py b/src/rougail/update.py new file mode 100644 index 00000000..e0e2028d --- /dev/null +++ b/src/rougail/update.py @@ -0,0 +1,486 @@ +"""Update Rougail XML file to new version + +Cadoles (http://www.cadoles.com) +Copyright (C) 2021 + +distribued with GPL-2 or later license + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +""" + +from typing import List +from os.path import join, isfile, basename +from os import listdir +from lxml.etree import DTD, parse, XMLParser, XMLSyntaxError # pylint: disable=E0611 +from lxml.etree import Element, SubElement, tostring + +from .i18n import _ +from .error import UpgradeError + + +VERSIONS = {'creole': ['1'], + 'rougail': ['0.9'], + } + + +def get_function_name(root, version): + version = version.replace('.', '_') + return f'update_{root}_{version}' + + +FUNCTION_VERSIONS = [get_function_name(root, version) for root, versions in VERSIONS.items() for version in versions] + + +class RougailUpgrade: + def __init__(self, test=False, upgrade_help=None): + self.test = test + if upgrade_help is None: + upgrade_help = {} + self.upgrade_help = upgrade_help + + def load_xml_from_folders(self, + srcfolder: str, + dstfolder: str, + ): + """Loads all the XML files located in the xmlfolders' list + + :param xmlfolders: list of full folder's name + """ + filenames = [filename for filename in listdir(srcfolder) if filename.endswith('.xml')] + filenames.sort() + for filename in filenames: + xmlsrc = join(srcfolder, filename) + xmldst = join(dstfolder, filename) + try: + parser = XMLParser(remove_blank_text=True) + document = parse(xmlsrc, parser) + except XMLSyntaxError as err: + raise Exception(_(f'not a XML file: {err}')) from err + root = document.getroot() + search_function_name = get_function_name(root.tag, root.attrib.get('version', '1')) + function_found = False + for function_version in FUNCTION_VERSIONS: + if function_found and hasattr(self, function_version): + upgrade_help = self.upgrade_help.get(function_version, {}).get(filename, {}) + root = getattr(self, function_version)(root, upgrade_help) + if function_version == search_function_name: + function_found = True + with open(xmldst, 'wb') as xmlfh: + xmlfh.write(tostring(root, pretty_print=True, encoding="UTF-8", xml_declaration=True)) + # if + # if not self.dtd.validate(document): + # dtd_error = self.dtd.error_log.filter_from_errors()[0] + # msg = _(f'not a valid XML file: {dtd_error}') + # raise DictConsistencyError(msg, 43, [xmlfile]) + # yield xmlfile, document.getroot() + + + def update_rougail_0_9(self, + root: 'Element', + upgrade_help: dict, + ) -> 'Element': + # rename root + root.tag = 'rougail' + root.attrib['version'] = '0.9' + variables_auto_valid_enum = {} + variables_help = {} + families_help = {} + variables = {} + families = {} + valid_enums = {} + current_service = upgrade_help.get('services', {}).get('default', 'unknown') + files = {current_service: {}} + ips = {current_service: []} + servicelists = {} + test_unknowns_variables = set() + autos = [] + constraints_obj = None + for subelement in root: + if not isinstance(subelement.tag, str): + # XML comment + continue + for subsubelement in subelement: + if not isinstance(subsubelement.tag, str): + # XML comment + continue + for subsubsubelement in subsubelement: + if not isinstance(subsubsubelement.tag, str): + # XML comment + continue + if subsubsubelement.tag == 'variable': + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove', []): + subsubelement.remove(subsubsubelement) + continue + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}): + subsubsubelement.attrib['type'] = upgrade_help['variables']['type'][subsubsubelement.attrib['name']] + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('add', []): + subsubsubelement.attrib['hidden'] = 'True' + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('remove', []): + self.remove(subsubsubelement, 'hidden', optional=True) + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('remove', []): + self.remove(subsubsubelement, 'mandatory', optional=True) + variables[subsubsubelement.attrib['name']] = subsubsubelement + type = subsubsubelement.attrib.get('type') + if type in ['oui/non', 'yes/no', 'on/off']: + variables_auto_valid_enum.setdefault(subsubsubelement.attrib['type'], []).append(subsubsubelement.attrib['name']) + del subsubsubelement.attrib['type'] + elif type == 'hostname_strict': + subsubsubelement.attrib['type'] = 'hostname' + elif type == 'domain_strict': + subsubsubelement.attrib['type'] = 'domain' + elif type == 'string': + del subsubsubelement.attrib['type'] + if self.test and subsubsubelement.attrib.get('auto_freeze') == 'True': + del subsubsubelement.attrib['auto_freeze'] + #if self.test and subsubsubelement.attrib.get('redefine') == 'True': + # subsubsubelement.attrib['exists'] = 'False' + # del subsubsubelement.attrib['redefine'] + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('redefine', {}).get('remove', {}): + del subsubsubelement.attrib['redefine'] + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove_check', []): + subsubsubelement.attrib['remove_check'] = 'True' + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mode', {}).get('modify', {}): + subsubsubelement.attrib['mode'] = upgrade_help.get('variables', {}).get('mode', {}).get('modify', {})[subsubsubelement.attrib['name']] + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('test', {}): + subsubsubelement.attrib['test'] = upgrade_help.get('variables', {}).get('test', {})[subsubsubelement.attrib['name']] +# for value in subsubsubelement: +# if value.text is None: +# value.attrib['type'] = 'nil' + elif subsubsubelement.tag == 'param': + type = subsubsubelement.attrib.get('type') + if type == 'eole': + subsubsubelement.attrib['type'] = 'variable' + type = 'variable' + elif type in ('container', 'context', 'python'): + raise UpgradeError(_(f'cannot convert param with type "{type}"')) + if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib: + subsubsubelement.attrib['type'] = 'number' + if subsubelement.attrib['name'] == 'valid_enum' and not type: + if subsubsubelement.attrib.get('name') == 'checkval': + raise UpgradeError(_('checkval in valid_enum is no more supported')) + for val in eval(subsubsubelement.text): + SubElement(subsubelement, 'param').text = str(val) + subsubelement.remove(subsubsubelement) + self.move(subsubsubelement, 'hidden', 'propertyerror', optional=True) + if type == 'variable' and subsubsubelement.text in upgrade_help.get('variables', {}).get('rename', []): + subsubsubelement.text = upgrade_help.get('variables', {}).get('rename', [])[subsubsubelement.text] + up = upgrade_help.get('params', {}).get(subsubsubelement.text) + if up: + if 'text' in up: + subsubsubelement.text = up['text'] + if 'type' in up: + subsubsubelement.attrib['type'] = up['type'] + elif subsubsubelement.tag == 'target': + type = subsubsubelement.attrib.get('type') + if type in ['service_accesslist', 'service_restrictionlist', 'interfacelist', 'hostlist']: + subsubelement.remove(subsubsubelement) +# elif self.test and type in ['filelist', 'variable', 'servicelist']: +# subsubsubelement.attrib['optional'] = "True" + elif (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []): + subsubelement.remove(subsubsubelement) + elif type == 'family' and subsubsubelement.text in upgrade_help.get('families', {}).get('remove', []): + subsubelement.remove(subsubsubelement) + up = upgrade_help.get('targets', {}).get(subsubsubelement.text) + if up: + if 'optional' in up: + subsubsubelement.attrib['optional'] = up['optional'] + has_target = False + for target in subsubelement: + if target.tag == 'target': + has_target = True + break + if not has_target: + subelement.remove(subsubelement) + continue + elif subsubsubelement.tag == 'slave': + subsubsubelement.tag = 'follower' + if subelement.tag == 'containers': + current_service = self.upgrade_container(subsubsubelement, current_service, files, ips, servicelists, upgrade_help) + subsubelement.remove(subsubsubelement) + if subelement.tag == 'help': + if subsubelement.tag == 'variable': + if not subsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove', []): + variables_help[subsubelement.attrib['name']] = subsubelement.text + elif subsubelement.tag == 'family': + if subsubelement.attrib['name'] not in upgrade_help.get('families', {}).get('remove', []): + families_help[subsubelement.attrib['name']] = subsubelement.text + else: + raise Exception(f'unknown help tag {subsubelement.tag}') + subelement.remove(subsubelement) + continue + if subsubelement.tag == 'auto': + if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []): + subelement.remove(subsubelement) + continue + autos.append(subsubelement.attrib['target']) + subsubelement.tag = 'fill' + if subsubelement.tag in ['fill', 'check']: + if subsubelement.tag == 'check' and subsubelement.attrib['name'] == 'valid_enum': + if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []): + subelement.remove(subsubelement) + continue + params = [] + for param in subsubelement: + if param.tag == 'param': + params.append(param.text) + key = '~'.join(params) + if key in valid_enums: + SubElement(valid_enums[key], 'target').text = subsubelement.attrib['target'] + subelement.remove(subsubelement) + continue + valid_enums['~'.join(params)] = subsubelement + if subsubelement.tag == 'fill' and subsubelement.attrib['target'] in upgrade_help.get('fills', {}).get('remove', []): + subelement.remove(subsubelement) + continue + if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []): + subelement.remove(subsubelement) + continue + if subsubelement.attrib['name'] == 'valid_networknetmask': + subsubelement.attrib['name'] = 'valid_network_netmask' + target = SubElement(subsubelement, 'target') + target.text = subsubelement.attrib['target'] + if self.test: + target.attrib['optional'] = 'True' + del subsubelement.attrib['target'] + elif subsubelement.tag == 'separators': + subelement.remove(subsubelement) + elif subsubelement.tag == 'condition': + if subsubelement.attrib['source'] in upgrade_help.get('variables', {}).get('remove', []): + try: + subelement.remove(subsubelement) + except: + pass + else: + if subsubelement.attrib['name'] == 'hidden_if_not_in': + subsubelement.attrib['name'] = 'disabled_if_not_in' + if subsubelement.attrib['name'] == 'hidden_if_in': + subsubelement.attrib['name'] = 'disabled_if_in' + if subsubelement.attrib['name'] == 'frozen_if_in': + subsubelement.attrib['name'] = 'hidden_if_in' + self.move(subsubelement, 'fallback', 'optional', optional='True') + if subsubelement.attrib['source'] in upgrade_help.get('variables', {}).get('rename', []): + subsubelement.attrib['source'] = upgrade_help.get('variables', {}).get('rename', [])[subsubelement.attrib['source']] + elif subsubelement.tag == 'group': + if subsubelement.attrib['master'] in upgrade_help.get('groups', {}).get('remove', []): + subelement.remove(subsubelement) + else: + self.move(subsubelement, 'master', 'leader') + if subsubelement.attrib['leader'] in upgrade_help.get('groups', {}).get('reorder', {}): + for follower in subsubelement: + subsubelement.remove(follower) + for follower in upgrade_help.get('groups', {}).get('reorder', {})[subsubelement.attrib['leader']]: + SubElement(subsubelement, 'follower').text = follower + if subelement.tag == 'files': + current_service = self.upgrade_container(subsubelement, current_service, files, ips, servicelists, upgrade_help) + subelement.remove(subsubelement) + if subsubelement.tag == 'family': + self.remove(subsubelement, 'icon', optional=True) + if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('mode', {}).get('remove', []) and 'mode' in subsubelement.attrib: + del subsubelement.attrib['mode'] + if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('rename', {}): + subsubelement.attrib['name'] = upgrade_help.get('families', {}).get('rename', {})[subsubelement.attrib['name']] + if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('remove', []): + subelement.remove(subsubelement) + continue + if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('hidden', {}).get('add', []): + subsubelement.attrib['hidden'] = 'True' + families[subsubelement.attrib['name']] = subsubelement + # if empty, remove + if is_empty(subelement) or subelement.tag in ['containers', 'files', 'help']: + root.remove(subelement) + continue + # copy subelement + if subelement.tag == 'constraints': + constraints_obj = subelement + services = None + service_elt = {} + for variable, obj in upgrade_help.get('variables', {}).get('add', {}).items(): + family = next(iter(families.values())) + variables[variable] = SubElement(family, 'variable', name=variable) + if 'value' in obj: + SubElement(variables[variable], 'value').text = obj['value'] + for name in ['hidden', 'exists']: + if name in obj: + variables[variable].attrib[name] = obj[name] + files_is_empty = True + for lst in files.values(): + if len(lst): + files_is_empty = False + break + if not files_is_empty: + services = Element('services') + root.insert(0, services) + for service_name, lst in files.items(): + service = self.create_service(services, service_name, service_elt, servicelists, upgrade_help) + for file_ in lst.values(): + self.move(file_, 'name_type', 'file_type', optional=True) + if 'file_type' in file_.attrib and file_.attrib['file_type'] == 'SymLinkOption': + file_.attrib['file_type'] = 'variable' + if variables[file_.text].attrib['type'] == 'string': + variables[file_.text].attrib['type'] = 'filename' + self.remove(file_, 'rm', optional=True) + self.remove(file_, 'mkdir', optional=True) + service.append(file_) + ips_is_empty = True + for lst in ips.values(): + if len(lst): + ips_is_empty = False + break + if not ips_is_empty: + if services is None: + services = Element('services') + root.insert(0, services) + for service_name, lst in ips.items(): + service = self.create_service(services, service_name, service_elt, servicelists, upgrade_help) + for ip in lst: + if ip.text in upgrade_help.get('ips', {}).get('remove', []): + continue + for type in ['ip_type', 'netmask_type']: + if type in ip.attrib and ip.attrib[type] == 'SymLinkOption': + ip.attrib[type] = 'variable' + if 'netmask' in ip.attrib: + if ip.attrib['netmask'] == '255.255.255.255': + del ip.attrib['netmask'] + if ip.text in variables and 'type' not in variables[ip.text].attrib: + variables[ip.text].attrib['type'] = 'ip' + else: + if ip.text in variables and 'type' not in variables[ip.text].attrib: + variables[ip.text].attrib['type'] = 'network' + if ip.attrib['netmask'] in variables and 'type' not in variables[ip.attrib['netmask']].attrib: + variables[ip.attrib['netmask']].attrib['type'] = 'netmask' + elif ip.text in variables and 'type' not in variables[ip.text].attrib: + variables[ip.text].attrib['type'] = 'ip' + self.remove(ip, 'interface') + self.remove(ip, 'interface_type', optional=True) + self.remove(ip, 'service_restrictionlist', optional=True) + service.append(ip) + if ips_is_empty and files_is_empty: + for service_name in files: + if services is None: + services = Element('services') + root.insert(0, services) + if service_name != 'unknown': + self.create_service(services, service_name, service_elt, servicelists, upgrade_help) + if constraints_obj is None: + constraints_obj = SubElement(root, 'constraints') + if variables_auto_valid_enum: + for type, variables_valid_enum in variables_auto_valid_enum.items(): + valid_enum = SubElement(constraints_obj, 'check') + valid_enum.attrib['name'] = 'valid_enum' + for val in type.split('/'): + param = SubElement(valid_enum, 'param') + param.text = val + for variable in variables_valid_enum: + target = SubElement(valid_enum, 'target') + target.text = variable + for name, text in variables_help.items(): + variables[name].attrib['help'] = text + for name, text in families_help.items(): + families[name].attrib['help'] = text + for auto in autos: + if auto in variables: + variables[auto].attrib['hidden'] = 'True' + else: + # redefine value in first family + family = next(iter(families.values())) + variable = SubElement(family, 'variable', name=auto, redefine="True", hidden="True") + if self.test: + del variable.attrib['redefine'] + return root + + @staticmethod + def move(elt, src, dst, optional=False): + if src == 'text': + value = elt.text + elt.text = None + else: + if optional and src not in elt.attrib: + return + value = elt.attrib[src] + del elt.attrib[src] + # + if dst == 'text': + elt.text = value + else: + elt.attrib[dst] = value + + @staticmethod + def remove(elt, src, optional=False): + if optional and src not in elt.attrib: + return + del elt.attrib[src] + + @staticmethod + def create_service(services, service_name, service_elt, servicelists, upgrade_help): + if service_name in service_elt: + return service_elt[service_name] + service = SubElement(services, 'service') + service.attrib['name'] = service_name + if service_name == 'unknown': + service.attrib['manage'] = 'False' + service_elt[service_name] = service + if upgrade_help.get('servicelists', {}).get(service_name): + service.attrib['servicelist'] = upgrade_help.get('servicelists', {}).get(service_name) + elif service_name in servicelists: + service.attrib['servicelist'] = servicelists[service_name] + return service + + def upgrade_container(self, elt, current_service, files, ips, servicelists, upgrade_help): + if elt.tag == 'file': + self.move(elt, 'name', 'text') + self.remove(elt, 'del_comment', optional=True) + elt.attrib['engine'] = 'creole_legacy' + if (not 'instance_mode' in elt.attrib or elt.attrib['instance_mode'] != 'when_container') and \ + elt.text not in upgrade_help.get('files', {}).get('remove', {}): + files[current_service][elt.text] = elt + elif elt.tag in ['host', 'disknod', 'fstab', 'interface', 'package', 'service_access']: + pass + elif elt.tag == 'service_restriction': + for restriction in elt: + if restriction.tag == 'ip' and restriction.text != '0.0.0.0': + self.remove(restriction, 'ip_type', optional=True) + self.remove(restriction, 'netmask_type', optional=True) + ips[current_service].append(restriction) + elif elt.tag == 'service': + new_name = elt.text + if current_service == 'unknown': + if new_name in files: + raise Exception('hu?') + files[new_name] = files[current_service] + del files[current_service] + ips[new_name] = ips[current_service] + del ips[current_service] + elif new_name not in files: + files[new_name] = {} + ips[new_name] = [] + current_service = new_name + if 'servicelist' in elt.attrib: + servicelists[current_service] = elt.attrib['servicelist'] + else: + raise Exception(f'unknown containers tag {elt.tag}') + return current_service + + +def is_empty(elt, not_check_attrib=False): + if not not_check_attrib and elt.attrib: + return False + empty = True + for file_ in elt: + empty = False + return empty + + +def update_creole_1(): + print('pfff') From e11105db32cd959922b3727ae6baad9b3c94ba31 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 8 Mar 2021 06:52:01 +0100 Subject: [PATCH 155/168] calculation with param 'information' from a variable --- doc/param/information.md | 16 +++++++++++++++- doc/variable/simple.md | 4 ++++ src/rougail/data/rougail.dtd | 2 +- src/rougail/tiramisureflector.py | 2 ++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/param/information.md b/doc/param/information.md index ad7bf1ec..93f7ea98 100644 --- a/doc/param/information.md +++ b/doc/param/information.md @@ -1,6 +1,8 @@ # Paramètre de type information -Le paramètre peut être la valeur est issue d'une information de la configuration. +## Les informations de la configuration + +Le paramètre peut être la valeur est issue d'une information de la configuration : ``` server_name @@ -8,3 +10,15 @@ Le paramètre peut être la valeur est issue d'une information de la configurati Dans ce cas, l'information de la configuration "server_name" sera utilisé comme valeur du paramètre. Si l'information n'existe pas, la paramètre aura la valeur "None". + +## Les informations de la cible + +Le paramètre peut être la valeur est issue d'une information de la cible du calcul : + +``` +test +help +``` + +Dans ce cas, l'information de la configuration "test" ou "help" sera utilisé comme valeur du paramètre. +Si l'information n'existe pas, la paramètre aura la valeur "None". diff --git a/doc/variable/simple.md b/doc/variable/simple.md index 3d12c788..86a231b9 100644 --- a/doc/variable/simple.md +++ b/doc/variable/simple.md @@ -29,6 +29,8 @@ En plus de la description, il est possible de préciser une aide complémentaire ``` +Cette aide peut être utilisé à tout moment comme valeur [d'un paramètre](../param/information.md). + ## Le type de la variable Une variable a un type. Ce type permet de définir les valeurs acceptées par cette variable : @@ -234,6 +236,8 @@ Il est possible de préciser plusieurs valeurs avec le séparateur "|" : ``` +Cette valeur peut être utilisé à tout moment comme valeur [d'un paramètre](../param/information.md). + ## Mode de la variable Le [mode](../mode.md) par défaut d'une variable correspond au [mode](../mode.md) de la [famille](../family/README.md). diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 2b5c5eb6..499fd53b 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -121,7 +121,7 @@ - + diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index bb1ad6fa..470e2477 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -252,6 +252,8 @@ class Common: return self.build_option_param(param) if param.type == 'information': return f'ParamInformation("{param.text}", None)' + if param.type == 'target_information': + return f'ParamSelfInformation("{param.text}", None)' if param.type == 'suffix': return 'ParamSuffix()' if param.type == 'index': From 6a12504e8ccaa0288baa80277b508a9ae35abba2 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 8 Mar 2021 06:52:49 +0100 Subject: [PATCH 156/168] remove variable in param and remove check --- src/rougail/update.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rougail/update.py b/src/rougail/update.py index e0e2028d..6173b47e 100644 --- a/src/rougail/update.py +++ b/src/rougail/update.py @@ -167,6 +167,9 @@ class RougailUpgrade: raise UpgradeError(_(f'cannot convert param with type "{type}"')) if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib: subsubsubelement.attrib['type'] = 'number' + if (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []): + subsubelement.remove(subsubsubelement) + continue if subsubelement.attrib['name'] == 'valid_enum' and not type: if subsubsubelement.attrib.get('name') == 'checkval': raise UpgradeError(_('checkval in valid_enum is no more supported')) @@ -244,6 +247,9 @@ class RougailUpgrade: if subsubelement.tag == 'fill' and subsubelement.attrib['target'] in upgrade_help.get('fills', {}).get('remove', []): subelement.remove(subsubelement) continue + if subsubelement.tag == 'check' and subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('remove', []): + subelement.remove(subsubelement) + continue if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []): subelement.remove(subsubelement) continue From fc686e9b7fed05846517f491b5c19250440e52cf Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 8 Mar 2021 17:56:28 +0100 Subject: [PATCH 157/168] if name is a variable, it could be disabled --- src/rougail/template/base.py | 2 +- .../70services_ip_disabled/00-base.xml | 18 ++++++++++++++ .../70services_ip_disabled/__init__.py | 0 .../makedict/after.json | 14 +++++++++++ .../70services_ip_disabled/makedict/base.json | 5 ++++ .../makedict/before.json | 14 +++++++++++ .../system/nut.service.d/rougail_ip.conf | 2 ++ .../result/tmpfiles.d/rougail.conf | 0 .../70services_ip_disabled/tiramisu/base.py | 24 +++++++++++++++++++ 9 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 tests/dictionaries/70services_ip_disabled/00-base.xml create mode 100644 tests/dictionaries/70services_ip_disabled/__init__.py create mode 100644 tests/dictionaries/70services_ip_disabled/makedict/after.json create mode 100644 tests/dictionaries/70services_ip_disabled/makedict/base.json create mode 100644 tests/dictionaries/70services_ip_disabled/makedict/before.json create mode 100644 tests/dictionaries/70services_ip_disabled/result/systemd/system/nut.service.d/rougail_ip.conf create mode 100644 tests/dictionaries/70services_ip_disabled/result/tmpfiles.d/rougail.conf create mode 100644 tests/dictionaries/70services_ip_disabled/tiramisu/base.py diff --git a/src/rougail/template/base.py b/src/rougail/template/base.py index a609d581..83c5a3cf 100644 --- a/src/rougail/template/base.py +++ b/src/rougail/template/base.py @@ -241,7 +241,7 @@ class RougailBaseTemplate: variable = filevar['variable'] else: variable = None - filenames = filevar['name'] + filenames = filevar.get('name') if not isinstance(filenames, list): filenames = [filenames] if variable and not isinstance(variable, list): diff --git a/tests/dictionaries/70services_ip_disabled/00-base.xml b/tests/dictionaries/70services_ip_disabled/00-base.xml new file mode 100644 index 00000000..6167071b --- /dev/null +++ b/tests/dictionaries/70services_ip_disabled/00-base.xml @@ -0,0 +1,18 @@ + + + + + + + nut_monitor_host + + + + + + 192.168.0.1 + + + + diff --git a/tests/dictionaries/70services_ip_disabled/__init__.py b/tests/dictionaries/70services_ip_disabled/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70services_ip_disabled/makedict/after.json b/tests/dictionaries/70services_ip_disabled/makedict/after.json new file mode 100644 index 00000000..f74a308d --- /dev/null +++ b/tests/dictionaries/70services_ip_disabled/makedict/after.json @@ -0,0 +1,14 @@ +{ + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_disabled/makedict/base.json b/tests/dictionaries/70services_ip_disabled/makedict/base.json new file mode 100644 index 00000000..552126f5 --- /dev/null +++ b/tests/dictionaries/70services_ip_disabled/makedict/base.json @@ -0,0 +1,5 @@ +{ + "services.nut.ip.nut_monitor_host.activate": true, + "services.nut.activate": true, + "services.nut.manage": true +} diff --git a/tests/dictionaries/70services_ip_disabled/makedict/before.json b/tests/dictionaries/70services_ip_disabled/makedict/before.json new file mode 100644 index 00000000..f74a308d --- /dev/null +++ b/tests/dictionaries/70services_ip_disabled/makedict/before.json @@ -0,0 +1,14 @@ +{ + "services.nut.ip.nut_monitor_host.activate": { + "owner": "default", + "value": true + }, + "services.nut.activate": { + "owner": "default", + "value": true + }, + "services.nut.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/70services_ip_disabled/result/systemd/system/nut.service.d/rougail_ip.conf b/tests/dictionaries/70services_ip_disabled/result/systemd/system/nut.service.d/rougail_ip.conf new file mode 100644 index 00000000..9c0580a9 --- /dev/null +++ b/tests/dictionaries/70services_ip_disabled/result/systemd/system/nut.service.d/rougail_ip.conf @@ -0,0 +1,2 @@ +[Service] +IPAddressDeny=any diff --git a/tests/dictionaries/70services_ip_disabled/result/tmpfiles.d/rougail.conf b/tests/dictionaries/70services_ip_disabled/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/70services_ip_disabled/tiramisu/base.py b/tests/dictionaries/70services_ip_disabled/tiramisu/base.py new file mode 100644 index 00000000..fafb6505 --- /dev/null +++ b/tests/dictionaries/70services_ip_disabled/tiramisu/base.py @@ -0,0 +1,24 @@ +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 = IPOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.1", allow_reserved=True, properties=frozenset({"disabled", "mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = SymLinkOption(name="name", opt=option_2) +option_8 = BoolOption(name="activate", doc="activate", default=True) +option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8]) +option_5 = OptionDescription(name="ip", doc="ip", children=[option_6]) +option_9 = BoolOption(name="activate", doc="activate", default=True) +option_10 = BoolOption(name="manage", doc="manage", default=True) +option_4 = OptionDescription(name="nut", doc="nut", children=[option_5, option_9, option_10]) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3]) From 12acf2a3f43b0b76acc08e675887707ca1557ce5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:05:50 +0100 Subject: [PATCH 158/168] update tests --- .../01base_domainname/00-base.xml | 2 +- .../02fill_multi_calc_val/00-base.xml | 19 ++++++++++++ .../__init__.py | 0 .../02fill_multi_calc_val/makedict/after.json | 12 +++++++ .../02fill_multi_calc_val/makedict/base.json | 6 ++++ .../makedict/before.json | 12 +++++++ .../02fill_multi_calc_val/tiramisu/base.py | 17 ++++++++++ .../02fill_multi_calc_val_multi/00-base.xml | 20 ++++++++++++ .../__init__.py} | 0 .../makedict/after.json | 18 +++++++++++ .../makedict/base.json | 12 +++++++ .../makedict/before.json | 18 +++++++++++ .../tiramisu/base.py | 17 ++++++++++ .../10check_no_param/tiramisu/base.py | 2 +- .../10check_option/tiramisu/base.py | 2 +- .../10check_optional/tiramisu/base.py | 2 +- .../10check_valid_differ/tiramisu/base.py | 2 +- .../10check_valid_differ_add/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../10check_valid_in_network/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../10check_valid_ipnetmask/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../11valid_enum_function/00-base.xml | 20 ++++++++++++ .../11valid_enum_function/__init__.py | 0 .../11valid_enum_function/makedict/after.json | 6 ++++ .../11valid_enum_function/makedict/base.json | 3 ++ .../makedict/before.json | 6 ++++ .../11valid_enum_function/tiramisu/base.py | 17 ++++++++++ .../20family_dynamic/tiramisu/base.py | 2 +- .../20family_dynamic_calc/tiramisu/base.py | 2 +- .../20family_dynamic_calc2/tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../tiramisu/base.py | 2 +- .../20family_dynamic_number/tiramisu/base.py | 2 +- tests/dictionaries/40ifin_multi2/00-base.xml | 31 +++++++++++++++++++ tests/dictionaries/40ifin_multi2/__init__.py | 0 .../40ifin_multi2/makedict/after.json | 10 ++++++ .../40ifin_multi2/makedict/base.json | 4 +++ .../40ifin_multi2/makedict/before.json | 10 ++++++ .../40ifin_multi2/tiramisu/base.py | 20 ++++++++++++ .../00-base.xml | 4 +-- .../61extra_auto_freeze/__init__.py | 0 .../extra_dirs/extra/00-base.xml | 0 .../61extra_auto_freeze/makedict/after.json | 14 +++++++++ .../61extra_auto_freeze/makedict/base.json | 5 +++ .../61extra_auto_freeze/makedict/before.json | 14 +++++++++ .../61extra_auto_freeze/tiramisu/base.py | 21 +++++++++++++ .../dictionaries/61extra_dyn/tiramisu/base.py | 2 +- .../61extra_dyn_extra/tiramisu/base.py | 2 +- 50 files changed, 352 insertions(+), 22 deletions(-) create mode 100644 tests/dictionaries/02fill_multi_calc_val/00-base.xml rename tests/dictionaries/{80extra_auto_freeze => 02fill_multi_calc_val}/__init__.py (100%) create mode 100644 tests/dictionaries/02fill_multi_calc_val/makedict/after.json create mode 100644 tests/dictionaries/02fill_multi_calc_val/makedict/base.json create mode 100644 tests/dictionaries/02fill_multi_calc_val/makedict/before.json create mode 100644 tests/dictionaries/02fill_multi_calc_val/tiramisu/base.py create mode 100644 tests/dictionaries/02fill_multi_calc_val_multi/00-base.xml rename tests/dictionaries/{80extra_auto_freeze/errno_49 => 02fill_multi_calc_val_multi/__init__.py} (100%) create mode 100644 tests/dictionaries/02fill_multi_calc_val_multi/makedict/after.json create mode 100644 tests/dictionaries/02fill_multi_calc_val_multi/makedict/base.json create mode 100644 tests/dictionaries/02fill_multi_calc_val_multi/makedict/before.json create mode 100644 tests/dictionaries/02fill_multi_calc_val_multi/tiramisu/base.py create mode 100644 tests/dictionaries/11valid_enum_function/00-base.xml create mode 100644 tests/dictionaries/11valid_enum_function/__init__.py create mode 100644 tests/dictionaries/11valid_enum_function/makedict/after.json create mode 100644 tests/dictionaries/11valid_enum_function/makedict/base.json create mode 100644 tests/dictionaries/11valid_enum_function/makedict/before.json create mode 100644 tests/dictionaries/11valid_enum_function/tiramisu/base.py create mode 100644 tests/dictionaries/40ifin_multi2/00-base.xml create mode 100644 tests/dictionaries/40ifin_multi2/__init__.py create mode 100644 tests/dictionaries/40ifin_multi2/makedict/after.json create mode 100644 tests/dictionaries/40ifin_multi2/makedict/base.json create mode 100644 tests/dictionaries/40ifin_multi2/makedict/before.json create mode 100644 tests/dictionaries/40ifin_multi2/tiramisu/base.py rename tests/dictionaries/{80extra_auto_freeze => 61extra_auto_freeze}/00-base.xml (70%) create mode 100644 tests/dictionaries/61extra_auto_freeze/__init__.py rename tests/dictionaries/{80extra_auto_freeze => 61extra_auto_freeze}/extra_dirs/extra/00-base.xml (100%) create mode 100644 tests/dictionaries/61extra_auto_freeze/makedict/after.json create mode 100644 tests/dictionaries/61extra_auto_freeze/makedict/base.json create mode 100644 tests/dictionaries/61extra_auto_freeze/makedict/before.json create mode 100644 tests/dictionaries/61extra_auto_freeze/tiramisu/base.py diff --git a/tests/dictionaries/01base_domainname/00-base.xml b/tests/dictionaries/01base_domainname/00-base.xml index 3e2a265d..343c76d1 100644 --- a/tests/dictionaries/01base_domainname/00-base.xml +++ b/tests/dictionaries/01base_domainname/00-base.xml @@ -2,7 +2,7 @@ - + my.domain.name diff --git a/tests/dictionaries/02fill_multi_calc_val/00-base.xml b/tests/dictionaries/02fill_multi_calc_val/00-base.xml new file mode 100644 index 00000000..f12a5cfe --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val/00-base.xml @@ -0,0 +1,19 @@ + + + + + no + + + + + + + var1 + True + var2 + + + + diff --git a/tests/dictionaries/80extra_auto_freeze/__init__.py b/tests/dictionaries/02fill_multi_calc_val/__init__.py similarity index 100% rename from tests/dictionaries/80extra_auto_freeze/__init__.py rename to tests/dictionaries/02fill_multi_calc_val/__init__.py diff --git a/tests/dictionaries/02fill_multi_calc_val/makedict/after.json b/tests/dictionaries/02fill_multi_calc_val/makedict/after.json new file mode 100644 index 00000000..2b3a9e6f --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val/makedict/after.json @@ -0,0 +1,12 @@ +{ + "rougail.var1": { + "owner": "default", + "value": "no" + }, + "rougail.var2": { + "owner": "default", + "value": [ + "no" + ] + } +} diff --git a/tests/dictionaries/02fill_multi_calc_val/makedict/base.json b/tests/dictionaries/02fill_multi_calc_val/makedict/base.json new file mode 100644 index 00000000..7bf9abe0 --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val/makedict/base.json @@ -0,0 +1,6 @@ +{ + "rougail.var1": "no", + "rougail.var2": [ + "no" + ] +} diff --git a/tests/dictionaries/02fill_multi_calc_val/makedict/before.json b/tests/dictionaries/02fill_multi_calc_val/makedict/before.json new file mode 100644 index 00000000..2b3a9e6f --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val/makedict/before.json @@ -0,0 +1,12 @@ +{ + "rougail.var1": { + "owner": "default", + "value": "no" + }, + "rougail.var2": { + "owner": "default", + "value": [ + "no" + ] + } +} diff --git a/tests/dictionaries/02fill_multi_calc_val/tiramisu/base.py b/tests/dictionaries/02fill_multi_calc_val/tiramisu/base.py new file mode 100644 index 00000000..db712d76 --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/02fill_multi_calc_val_multi/00-base.xml b/tests/dictionaries/02fill_multi_calc_val_multi/00-base.xml new file mode 100644 index 00000000..ac1e413d --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val_multi/00-base.xml @@ -0,0 +1,20 @@ + + + + + no + yes + maybe + + + + + + + var1 + var2 + + + + diff --git a/tests/dictionaries/80extra_auto_freeze/errno_49 b/tests/dictionaries/02fill_multi_calc_val_multi/__init__.py similarity index 100% rename from tests/dictionaries/80extra_auto_freeze/errno_49 rename to tests/dictionaries/02fill_multi_calc_val_multi/__init__.py diff --git a/tests/dictionaries/02fill_multi_calc_val_multi/makedict/after.json b/tests/dictionaries/02fill_multi_calc_val_multi/makedict/after.json new file mode 100644 index 00000000..e0b9759c --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val_multi/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.var1": { + "owner": "default", + "value": [ + "no", + "yes", + "maybe" + ] + }, + "rougail.var2": { + "owner": "default", + "value": [ + "no", + "yes", + "maybe" + ] + } +} diff --git a/tests/dictionaries/02fill_multi_calc_val_multi/makedict/base.json b/tests/dictionaries/02fill_multi_calc_val_multi/makedict/base.json new file mode 100644 index 00000000..6e46ffd3 --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val_multi/makedict/base.json @@ -0,0 +1,12 @@ +{ + "rougail.var1": [ + "no", + "yes", + "maybe" + ], + "rougail.var2": [ + "no", + "yes", + "maybe" + ] +} diff --git a/tests/dictionaries/02fill_multi_calc_val_multi/makedict/before.json b/tests/dictionaries/02fill_multi_calc_val_multi/makedict/before.json new file mode 100644 index 00000000..e0b9759c --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val_multi/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.var1": { + "owner": "default", + "value": [ + "no", + "yes", + "maybe" + ] + }, + "rougail.var2": { + "owner": "default", + "value": [ + "no", + "yes", + "maybe" + ] + } +} diff --git a/tests/dictionaries/02fill_multi_calc_val_multi/tiramisu/base.py b/tests/dictionaries/02fill_multi_calc_val_multi/tiramisu/base.py new file mode 100644 index 00000000..1f9559b1 --- /dev/null +++ b/tests/dictionaries/02fill_multi_calc_val_multi/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/10check_no_param/tiramisu/base.py b/tests/dictionaries/10check_no_param/tiramisu/base.py index 7f9a91e7..f4d2cc56 100644 --- a/tests/dictionaries/10check_no_param/tiramisu/base.py +++ b/tests/dictionaries/10check_no_param/tiramisu/base.py @@ -12,7 +12,7 @@ try: except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"})) -option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption())), warnings_only=False)], properties=frozenset({"normal"})) +option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption(whole=False))), warnings_only=False)], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_option/tiramisu/base.py b/tests/dictionaries/10check_option/tiramisu/base.py index 0a98381e..d84c7409 100644 --- a/tests/dictionaries/10check_option/tiramisu/base.py +++ b/tests/dictionaries/10check_option/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"})) option_4 = IntOption(name="int2", doc="No change", default=100, properties=frozenset({"mandatory", "normal"})) -option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption()), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"})) +option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption(whole=False)), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_optional/tiramisu/base.py b/tests/dictionaries/10check_optional/tiramisu/base.py index a57c0530..473dfcd5 100644 --- a/tests/dictionaries/10check_optional/tiramisu/base.py +++ b/tests/dictionaries/10check_optional/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"})) option_5 = IntOption(name="int2", doc="No change", properties=frozenset({"normal"})) -option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"normal"})) +option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_valid_differ/tiramisu/base.py b/tests/dictionaries/10check_valid_differ/tiramisu/base.py index 4adb6a71..4d5cb900 100644 --- a/tests/dictionaries/10check_valid_differ/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ/tiramisu/base.py @@ -12,7 +12,7 @@ try: except: from tiramisu import * option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False)], properties=frozenset({"mandatory", "normal"})) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False)], properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py index 9b178bd4..990e977f 100644 --- a/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_add/tiramisu/base.py @@ -14,7 +14,7 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"})) +option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py index 15666891..07b78f1b 100644 --- a/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_differ_removecheck/tiramisu/base.py @@ -14,7 +14,7 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) -option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"})) +option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_valid_in_network/tiramisu/base.py b/tests/dictionaries/10check_valid_in_network/tiramisu/base.py index b52f3d18..cdcd205c 100644 --- a/tests/dictionaries/10check_valid_in_network/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_in_network/tiramisu/base.py @@ -14,7 +14,7 @@ except: option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", properties=frozenset({"basic", "mandatory"})) -option_6 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(), ParamOption(option_4), ParamOption(option_5))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) +option_6 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(whole=False), ParamOption(option_4), ParamOption(option_5))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py b/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py index cbffa263..7a9f5198 100644 --- a/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_in_network_cidr/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", cidr=True, properties=frozenset({"basic", "mandatory"})) -option_5 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) +option_5 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py index 94fb4430..51c47409 100644 --- a/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py +++ b/tests/dictionaries/10check_valid_ipnetmask/tiramisu/base.py @@ -13,7 +13,7 @@ except: from tiramisu import * option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"})) -option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], properties=frozenset({"basic", "mandatory"})) +option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=True)], properties=frozenset({"basic", "mandatory"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py index f7c85630..c2eb1b41 100644 --- a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py @@ -15,7 +15,7 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non" option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_6 = StrOption(name="leader", doc="leader", multi=True) option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"})) -option_8 = StrOption(name="follower2", doc="follower2", multi=submulti, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"})) +option_8 = StrOption(name="follower2", doc="follower2", multi=submulti, default=[Calculation(func.calc_val, Params((ParamOption(option_7))))], properties=frozenset({"normal"})) option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"})) option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) diff --git a/tests/dictionaries/11valid_enum_function/00-base.xml b/tests/dictionaries/11valid_enum_function/00-base.xml new file mode 100644 index 00000000..81bbe2fa --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/00-base.xml @@ -0,0 +1,20 @@ + + + + + + 9 + + + + + + trange + 0 + 10 + var + + + + diff --git a/tests/dictionaries/11valid_enum_function/__init__.py b/tests/dictionaries/11valid_enum_function/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/11valid_enum_function/makedict/after.json b/tests/dictionaries/11valid_enum_function/makedict/after.json new file mode 100644 index 00000000..49800b2a --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.var": { + "owner": "default", + "value": 9 + } +} diff --git a/tests/dictionaries/11valid_enum_function/makedict/base.json b/tests/dictionaries/11valid_enum_function/makedict/base.json new file mode 100644 index 00000000..6eeb5601 --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.general.var": 9 +} diff --git a/tests/dictionaries/11valid_enum_function/makedict/before.json b/tests/dictionaries/11valid_enum_function/makedict/before.json new file mode 100644 index 00000000..49800b2a --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.var": { + "owner": "default", + "value": 9 + } +} diff --git a/tests/dictionaries/11valid_enum_function/tiramisu/base.py b/tests/dictionaries/11valid_enum_function/tiramisu/base.py new file mode 100644 index 00000000..c4f1545e --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/tiramisu/base.py @@ -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_3 = ChoiceOption(name="var", doc="New variable", values=Calculation(func.trange, Params((ParamValue(0), ParamValue(10)))), default=9, properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic/tiramisu/base.py b/tests/dictionaries/20family_dynamic/tiramisu/base.py index 96ff3a94..732b3599 100644 --- a/tests/dictionaries/20family_dynamic/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic/tiramisu/base.py @@ -15,6 +15,6 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_5 = StrOption(name="vardyn", doc="No change", properties=frozenset({"normal"})) -option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py index 8daf2096..f95a1bb2 100644 --- a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py @@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal"})) -option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) option_7 = StrOption(name="newvar", doc="No change", default=Calculation(func.calc_val, Params((ParamDynOption(option_5, 'val1', option_4)))), properties=frozenset({"normal"})) option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) diff --git a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py index 39b54a6b..d665934b 100644 --- a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py @@ -16,7 +16,7 @@ option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1 option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_7 = StrOption(name="newvar", doc="No change", properties=frozenset({"normal"})) option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))})) -option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))})) option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py index 25700e76..3bceab1b 100644 --- a/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py @@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_5 = StrOption(name="vardyn", doc="No change", default=Calculation(func.calc_val, Params((ParamSuffix()))), properties=frozenset({"normal"})) -option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) option_7 = StrOption(name="newvar", doc="No change", properties=frozenset({"normal"})) option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) diff --git a/tests/dictionaries/20family_dynamic_description/tiramisu/base.py b/tests/dictionaries/20family_dynamic_description/tiramisu/base.py index 27f284aa..43a78559 100644 --- a/tests/dictionaries/20family_dynamic_description/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_description/tiramisu/base.py @@ -15,6 +15,6 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_5 = StrOption(name="vardyn", doc="No change", properties=frozenset({"normal"})) -option_4 = ConvertDynOptionDescription(name="dyn", doc="Dyn ", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="Dyn ", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_number/tiramisu/base.py b/tests/dictionaries/20family_dynamic_number/tiramisu/base.py index 75fad259..6f1ba49e 100644 --- a/tests/dictionaries/20family_dynamic_number/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_number/tiramisu/base.py @@ -15,7 +15,7 @@ from rougail.tiramisu import ConvertDynOptionDescription option_3 = IntOption(name="varname", doc="No change", multi=True, default=[1, 2], default_multi=1, properties=frozenset({"mandatory", "normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal"})) -option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) option_7 = StrOption(name="newvar", doc="No change", default=Calculation(func.calc_val, Params((ParamDynOption(option_5, '1', option_4)))), properties=frozenset({"normal"})) option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) diff --git a/tests/dictionaries/40ifin_multi2/00-base.xml b/tests/dictionaries/40ifin_multi2/00-base.xml new file mode 100644 index 00000000..498b2c08 --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/00-base.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + oui + mode_conteneur_actif3 + + + oui + mode_conteneur_actif3 + + + + diff --git a/tests/dictionaries/40ifin_multi2/__init__.py b/tests/dictionaries/40ifin_multi2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/40ifin_multi2/makedict/after.json b/tests/dictionaries/40ifin_multi2/makedict/after.json new file mode 100644 index 00000000..4efa6e2f --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/40ifin_multi2/makedict/base.json b/tests/dictionaries/40ifin_multi2/makedict/base.json new file mode 100644 index 00000000..ec1b5d8c --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/makedict/base.json @@ -0,0 +1,4 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif2": "oui" +} diff --git a/tests/dictionaries/40ifin_multi2/makedict/before.json b/tests/dictionaries/40ifin_multi2/makedict/before.json new file mode 100644 index 00000000..4efa6e2f --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/40ifin_multi2/tiramisu/base.py b/tests/dictionaries/40ifin_multi2/tiramisu/base.py new file mode 100644 index 00000000..1047e2c1 --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/80extra_auto_freeze/00-base.xml b/tests/dictionaries/61extra_auto_freeze/00-base.xml similarity index 70% rename from tests/dictionaries/80extra_auto_freeze/00-base.xml rename to tests/dictionaries/61extra_auto_freeze/00-base.xml index fbfaa0c4..761ed99c 100644 --- a/tests/dictionaries/80extra_auto_freeze/00-base.xml +++ b/tests/dictionaries/61extra_auto_freeze/00-base.xml @@ -2,9 +2,7 @@ - - non - + diff --git a/tests/dictionaries/61extra_auto_freeze/__init__.py b/tests/dictionaries/61extra_auto_freeze/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80extra_auto_freeze/extra_dirs/extra/00-base.xml b/tests/dictionaries/61extra_auto_freeze/extra_dirs/extra/00-base.xml similarity index 100% rename from tests/dictionaries/80extra_auto_freeze/extra_dirs/extra/00-base.xml rename to tests/dictionaries/61extra_auto_freeze/extra_dirs/extra/00-base.xml diff --git a/tests/dictionaries/61extra_auto_freeze/makedict/after.json b/tests/dictionaries/61extra_auto_freeze/makedict/after.json new file mode 100644 index 00000000..fbe17107 --- /dev/null +++ b/tests/dictionaries/61extra_auto_freeze/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.server_deployed": { + "owner": "default", + "value": true + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.mode": { + "owner": "forced", + "value": "pre" + } +} diff --git a/tests/dictionaries/61extra_auto_freeze/makedict/base.json b/tests/dictionaries/61extra_auto_freeze/makedict/base.json new file mode 100644 index 00000000..42890f47 --- /dev/null +++ b/tests/dictionaries/61extra_auto_freeze/makedict/base.json @@ -0,0 +1,5 @@ +{ + "rougail.general.server_deployed": true, + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/61extra_auto_freeze/makedict/before.json b/tests/dictionaries/61extra_auto_freeze/makedict/before.json new file mode 100644 index 00000000..8f32cc77 --- /dev/null +++ b/tests/dictionaries/61extra_auto_freeze/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.server_deployed": { + "owner": "default", + "value": true + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/61extra_auto_freeze/tiramisu/base.py b/tests/dictionaries/61extra_auto_freeze/tiramisu/base.py new file mode 100644 index 00000000..e71f2178 --- /dev/null +++ b/tests/dictionaries/61extra_auto_freeze/tiramisu/base.py @@ -0,0 +1,21 @@ +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 = BoolOption(name="server_deployed", doc="No change", default=True, properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="activer_ejabberd", 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], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = StrOption(name="mode", doc="mode", default="pre", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) +option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7], properties=frozenset({"basic"})) +option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/61extra_dyn/tiramisu/base.py b/tests/dictionaries/61extra_dyn/tiramisu/base.py index 29dce486..82721798 100644 --- a/tests/dictionaries/61extra_dyn/tiramisu/base.py +++ b/tests/dictionaries/61extra_dyn/tiramisu/base.py @@ -16,6 +16,6 @@ option_3 = StrOption(name="varname", doc="No change", multi=True, default=['a'], option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_6 = StrOption(name="mode", doc="mode", properties=frozenset({"normal"})) -option_5 = ConvertDynOptionDescription(name="ejabberd", doc="ejabberd", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), children=[option_6], properties=frozenset({"normal"})) +option_5 = ConvertDynOptionDescription(name="ejabberd", doc="ejabberd", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_6], properties=frozenset({"normal"})) option_4 = OptionDescription(name="extra", doc="extra", children=[option_5]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/61extra_dyn_extra/tiramisu/base.py b/tests/dictionaries/61extra_dyn_extra/tiramisu/base.py index f9ab1985..b5f31810 100644 --- a/tests/dictionaries/61extra_dyn_extra/tiramisu/base.py +++ b/tests/dictionaries/61extra_dyn_extra/tiramisu/base.py @@ -18,6 +18,6 @@ option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_6 = StrOption(name="varname", doc="No change", multi=True, default=['a'], default_multi="a", properties=frozenset({"mandatory", "normal"})) option_5 = OptionDescription(name="general", doc="général", children=[option_6], properties=frozenset({"normal"})) option_8 = StrOption(name="mode", doc="mode", properties=frozenset({"normal"})) -option_7 = ConvertDynOptionDescription(name="ejabberd", doc="ejabberd", suffixes=Calculation(func.calc_value, Params((ParamOption(option_6)))), children=[option_8], properties=frozenset({"normal"})) +option_7 = ConvertDynOptionDescription(name="ejabberd", doc="ejabberd", suffixes=Calculation(func.calc_value, Params((ParamOption(option_6, notraisepropertyerror=True)))), children=[option_8], properties=frozenset({"normal"})) option_4 = OptionDescription(name="extra", doc="extra", children=[option_5, option_7]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) From 63e679036b2fdaf0d6bf0ce5b68aec2ef4053bed Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:14:08 +0100 Subject: [PATCH 159/168] add valid_enum with function and rename domain type to domainname --- src/rougail/annotator/check.py | 17 ++++++++++++++++- src/rougail/annotator/param.py | 10 ++++++++++ src/rougail/annotator/variable.py | 2 +- src/rougail/data/rougail.dtd | 4 ++-- src/rougail/tiramisureflector.py | 18 +++++++++++------- tests/eosfunc/test.py | 5 +++++ 6 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/rougail/annotator/check.py b/src/rougail/annotator/check.py index fda7f8f3..f2e1bdde 100644 --- a/src/rougail/annotator/check.py +++ b/src/rougail/annotator/check.py @@ -52,6 +52,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): self.functions.extend(INTERNAL_FUNCTIONS) self.functions.extend(self.objectspace.rougailconfig['internal_functions']) self.target_is_uniq = False + self.allow_function = True self.convert_target(self.objectspace.space.constraints.check) self.convert_param(self.objectspace.space.constraints.check) self.check_check() @@ -132,11 +133,23 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): has_variable = False values = [] has_nil = False + is_function = False for param in check.param: if has_variable: msg = _(f'only one "variable" parameter is allowed for valid_enum ' f'of variable "{variable.name}"') raise DictConsistencyError(msg, 5, param.xmlfiles) + if param.type == 'function': + is_function = True + choice = self.objectspace.choice(variable.xmlfiles) + choice.name = param.text + choice.type = 'function' + choice.param = [] + variable.values.append(choice) + continue + if is_function: + variable.values[0].param.append(param) + continue param_type = variable.ori_type if param.type == 'variable': has_variable = True @@ -148,7 +161,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): msg = _(f'only multi "variable" parameter is allowed for valid_enum ' f'of variable "{variable.name}"') raise DictConsistencyError(msg, 6, param.xmlfiles) - param_type = 'calculation' + param_type = 'variable' elif param.type == 'nil': has_nil = True values.append(param.text) @@ -156,6 +169,8 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator): choice.name = param.text choice.type = param_type variable.values.append(choice) + if is_function: + return None if 'mandatory' not in vars(variable): variable.mandatory = not has_nil elif variable.mandatory is False: diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index 1b874bfe..1fc6090c 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -82,6 +82,16 @@ class ParamAnnotator: if err.errno != 42 or not param.optional: raise err param_to_delete.append(param_idx) + elif param.type == 'function': + if not self.allow_function: + msg = _(f'cannot use "function" type') + raise DictConsistencyError(msg, 74, param.xmlfiles) + if not param.text in self.functions: + msg = _(f'cannot find function "{param.text}"') + raise DictConsistencyError(msg, 67, param.xmlfiles) + if param_idx != 0: + msg = _(f'function "{param.text}" must only set has first parameter') + raise DictConsistencyError(msg, 75, param.xmlfiles) elif variable_type: self._convert_with_variable_type(variable_type, param) continue diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 1949b441..1cecf742 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -50,7 +50,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), 'broadcast': dict(opttype="BroadcastOption"), 'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}), - 'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', + 'domainname': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}), 'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}), diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 499fd53b..a3da5858 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -86,7 +86,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 470e2477..318e6dd3 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -296,9 +296,11 @@ class Variable(Common): keys['opt'] = self.elt.opt.reflector_object.get() if hasattr(self.elt, 'values'): values = self.elt.values - if values[0].type == 'calculation': + if values[0].type == 'variable': value = values[0].name.reflector_object.get() keys['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))" + elif values[0].type == 'function': + keys['values'] = self.calculation_value(self.elt.values[0], []) else: keys['values'] = str(tuple([val.name for val in values])) if hasattr(self.elt, 'multi') and self.elt.multi: @@ -309,11 +311,11 @@ class Variable(Common): if isinstance(value, str): value = self.convert_str(value) elif isinstance(value, self.objectspace.value): - value = self.calculation_value(value, []) + value = self.calculation_value(value, [], calc_multi=value.calc_multi) keys[key] = value if hasattr(self.elt, 'validators'): keys['validators'] = '[' + ', '.join([self.calculation_value(val, - ['ParamSelfOption()']) for val in self.elt.validators]) + ']' + ['ParamSelfOption(whole=False)']) for val in self.elt.validators]) + ']' for key in ['min_number', 'max_number']: if hasattr(self.elt, key): keys[key] = getattr(self.elt, key) @@ -325,6 +327,7 @@ class Variable(Common): def calculation_value(self, child, args, + calc_multi=False, ) -> str: """Generate calculated value """ @@ -336,11 +339,9 @@ class Variable(Common): for param in child.param: value = self.populate_param(param) if not hasattr(param, 'name'): -# args.append(str(value)) new_args.append(str(value)) else: kwargs.append(f"'{param.name}': " + value) -# ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')' if function == 'valid_network_netmask': new_args.extend(args) else: @@ -352,7 +353,10 @@ class Variable(Common): ret += ')' if hasattr(child, 'warnings_only'): ret += f', warnings_only={child.warnings_only}' - return ret + ')' + ret = ret + ')' + if calc_multi: + ret = '[' + ret + ']' + return ret class Family(Common): @@ -383,5 +387,5 @@ class Family(Common): ) -> None: if hasattr(self.elt, 'suffixes'): dyn = self.elt.suffixes.reflector_object.get() - keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}))))" + keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}, notraisepropertyerror=True))))" keys['children'] = '[' + ', '.join([child.get() for child in self.children]) + ']' diff --git a/tests/eosfunc/test.py b/tests/eosfunc/test.py index 13bd0452..5be27593 100644 --- a/tests/eosfunc/test.py +++ b/tests/eosfunc/test.py @@ -1,5 +1,10 @@ from tiramisu import valid_not_equal, valid_ip_netmask, calc_value, valid_in_network + +def trange(start, stop): + return list(range(start, stop)) + + def calc_val(*args, **kwargs): if len(args) > 0: return args[0] From d895c46729b4c91c599d074bff4d76bb0b2b481c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:15:34 +0100 Subject: [PATCH 160/168] auto_freeze is now allowed in extra --- src/rougail/annotator/condition.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index d0cc54f0..f8f6f8fc 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -50,6 +50,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): return self.target_is_uniq = False self.only_variable = False + self.allow_function = False self.convert_target(self.objectspace.space.constraints.condition) self.check_condition_optional() self.convert_condition_source() @@ -74,9 +75,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): for variable in self.get_variables(): if not variable.auto_freeze and not variable.auto_save: continue - if variable.namespace != self.objectspace.rougailconfig['variable_namespace']: - msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') - raise DictConsistencyError(msg, 49, variable.xmlfiles) + #if variable.namespace != self.objectspace.rougailconfig['variable_namespace']: + # msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') + # raise DictConsistencyError(msg, 49, variable.xmlfiles) variable.force_store_value = True if variable.auto_save: continue @@ -89,7 +90,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk): new_condition.param = [new_param] new_target = self.objectspace.target(variable.xmlfiles) new_target.type = 'variable' - new_target.name = variable.name + new_target.name = variable.path new_condition.target = [new_target] if not hasattr(self.objectspace.space, 'constraints'): self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) From 9eb6a67ac6935d3fee6eb2ceb4ccd9b2d09cb08a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:16:06 +0100 Subject: [PATCH 161/168] manage fill with multi variable --- src/rougail/annotator/fill.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/rougail/annotator/fill.py b/src/rougail/annotator/fill.py index 356c38d3..481979de 100644 --- a/src/rougail/annotator/fill.py +++ b/src/rougail/annotator/fill.py @@ -32,6 +32,9 @@ from .target import TargetAnnotator from .param import ParamAnnotator +CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename') + + class FillAnnotator(TargetAnnotator, ParamAnnotator): """Fill annotator """ @@ -46,11 +49,20 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator): self.functions = dir(load_modules(eosfunc_file)) self.target_is_uniq = True self.only_variable = True + self.allow_function = False self.convert_target(self.objectspace.space.constraints.fill) self.convert_param(self.objectspace.space.constraints.fill) self.fill_to_value() del self.objectspace.space.constraints.fill + def calc_is_multi(self, variable: 'self.objectspace.variable') -> bool: + multi = variable.multi + if multi is False: + return multi + if multi == 'submulti': + return True + return not self.objectspace.paths.is_follower(variable.path) + def fill_to_value(self) -> None: """valid and manage """ @@ -65,6 +77,11 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator): value = self.objectspace.value(fill.xmlfiles) value.type = 'calculation' value.name = fill.name + if fill.name not in CALC_MULTI: + is_calc_multi = self.calc_is_multi(target.name) + else: + is_calc_multi = False + value.calc_multi = is_calc_multi if target.name.namespace == 'services': target.name.default = value else: From e66a462710028057074ca45d18c175097a462d17 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:31:05 +0100 Subject: [PATCH 162/168] add creole_client and is_empty in creole_legacy --- src/rougail/template/engine/creole_legacy.py | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/rougail/template/engine/creole_legacy.py b/src/rougail/template/engine/creole_legacy.py index b002d90c..b40ed2fc 100644 --- a/src/rougail/template/engine/creole_legacy.py +++ b/src/rougail/template/engine/creole_legacy.py @@ -74,6 +74,27 @@ class IsDefined: return varname in self.context +class CreoleClient(): + def get(self, path): + path = path.replace('/', '.') + if path.startswith('.'): + path = path[1:] + if '.' not in path: + return self.context[path] + else: + root, path = path.split('.', 1) + obj = self.context[root] + for var in path.split('.'): + obj = getattr(obj, var) + return obj + + +def is_empty(data): + if str(data) in ['', '""', "''", "[]", "['']", '[""]', "None"]: + return True + return False + + class CheetahTemplate(oriCheetahTemplate): def __init__(self, filename: str, @@ -82,7 +103,12 @@ class CheetahTemplate(oriCheetahTemplate): eosfunc: Dict, extra_context: Dict, ): + creole_client = CreoleClient() + creole_client.context=context extra_context['is_defined'] = IsDefined(context) + extra_context['creole_client'] = creole_client + extra_context['is_empty'] = is_empty + extra_context['_creole_filename'] = extra_context['rougail_filename'] super().__init__(filename, source, context, eosfunc, extra_context) From 1e6c9060b51bf71e280e6649b272e6fa1f35b729 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:31:29 +0100 Subject: [PATCH 163/168] better debug information --- src/rougail/template/base.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rougail/template/base.py b/src/rougail/template/base.py index 83c5a3cf..66aaa661 100644 --- a/src/rougail/template/base.py +++ b/src/rougail/template/base.py @@ -166,11 +166,14 @@ class RougailExtra: try: return self.suboption[key] except KeyError: - raise AttributeError + raise AttributeError(f'unable to find extra "{key}"') def __iter__(self): return iter(self.suboption.values()) + def items(self): + return self.suboption.items() + class RougailBaseTemplate: """Engine to process Creole cheetah template @@ -231,7 +234,7 @@ class RougailBaseTemplate: def instance_file(self, filevar: Dict, - type: str, + type_: str, service_name: str, ) -> None: """Run templatisation on one file @@ -253,7 +256,7 @@ class RougailBaseTemplate: var = variable[idx] else: var = None - func = f'_instance_{type}' + func = f'_instance_{type_}' data = getattr(self, func)(filevar, filename, service_name, From 20de4443ae13430c46496abf255c05f09281178e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:32:08 +0100 Subject: [PATCH 164/168] do not generate empty file --- src/rougail/template/systemd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rougail/template/systemd.py b/src/rougail/template/systemd.py index a81ea321..34ba60d1 100644 --- a/src/rougail/template/systemd.py +++ b/src/rougail/template/systemd.py @@ -58,7 +58,8 @@ z %%filename - - - - - %end if %end for %end if -%end for""" +%end for +""" class RougailSystemdTemplate(RougailBaseTemplate): From 2b2cc4cf203534c81a8bb84973aabc2322574251 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 27 Mar 2021 07:44:13 +0100 Subject: [PATCH 165/168] name in family or variable must be valid --- src/rougail/annotator/family.py | 2 -- src/rougail/annotator/variable.py | 2 -- src/rougail/objspace.py | 16 ++++++------- src/rougail/utils.py | 16 +++++++++++++ .../dictionaries/00load_autosave/00-base.xml | 2 +- .../00load_autosaveexpert/00-base.xml | 2 +- tests/dictionaries/00load_comment/00-base.xml | 2 +- tests/dictionaries/00load_notype/00-base.xml | 2 +- tests/dictionaries/00load_save/00-base.xml | 2 +- .../dictionaries/00load_subfolder/99-base.xml | 2 +- .../00load_subfolder/subfolder/00-base.xml | 2 +- .../01fill_baseaccent/makedict/after.json | 10 -------- .../01fill_baseaccent/makedict/base.json | 4 ---- .../01fill_baseaccent/makedict/before.json | 10 -------- .../01fill_baseaccent/tiramisu/base.py | 18 --------------- .../02autosave_hidden_frozenifin/00-base.xml | 2 +- .../10autosave_hidden/00-base.xml | 2 +- .../10leadership_accent/makedict/after.json | 18 --------------- .../10leadership_accent/makedict/base.json | 4 ---- .../10leadership_accent/makedict/before.json | 18 --------------- .../10leadership_accent/tiramisu/base.py | 22 ------------------ .../makedict/after.json | 18 --------------- .../makedict/base.json | 4 ---- .../makedict/before.json | 18 --------------- .../tiramisu/base.py | 22 ------------------ .../makedict/after.json | 18 --------------- .../makedict/base.json | 4 ---- .../makedict/before.json | 18 --------------- .../tiramisu/base.py | 21 ----------------- .../00-base.xml | 2 +- .../makedict/after.json | 18 --------------- .../makedict/base.json | 6 ----- .../makedict/before.json | 18 --------------- .../tiramisu/base.py | 21 ----------------- .../10load_hidden_if_empty_family/00-base.xml | 6 ++--- .../10load_hidden_if_family/00-base.xml | 6 ++--- .../makedict/after.json | 18 --------------- .../makedict/base.json | 4 ---- .../makedict/before.json | 18 --------------- .../tiramisu/base.py | 22 ------------------ .../20family_appendaccent/makedict/after.json | 14 ----------- .../20family_appendaccent/makedict/base.json | 5 ---- .../makedict/before.json | 14 ----------- .../20family_appendaccent/tiramisu/base.py | 21 ----------------- tests/dictionaries/40empty_param/00_base.xml | 2 +- tests/dictionaries/40empty_param2/00_base.xml | 2 +- .../60action_external/00-base.xml | 2 +- .../00-base.xml | 2 +- tests/dictionaries/60extra_group/00-base.xml | 2 +- tests/dictionaries/60extra_help/00-base.xml | 2 +- tests/dictionaries/60extra_load/00-base.xml | 2 +- .../60extra_mandatory/00-base.xml | 2 +- .../60extra_no_condition/00-base.xml | 2 +- .../dictionaries/60extra_redefine/00-base.xml | 2 +- .../60extra_variable_name_extra/00-base.xml | 2 +- tests/dictionaries/60familyaction/00-base.xml | 2 +- .../60familyaction_accent/makedict/after.json | 10 -------- .../60familyaction_accent/makedict/base.json | 4 ---- .../makedict/before.json | 10 -------- .../60familyaction_accent/tiramisu/base.py | 20 ---------------- .../60familyaction_mandatory/00-base.xml | 2 +- .../61extra_auto_freeze/00-base.xml | 2 +- tests/dictionaries/61extra_dyn/00-base.xml | 2 +- .../61extra_dyn_extra/00-base.xml | 2 +- .../extra_dirs/extra/00-base.xml | 2 +- .../70container_files/00-base.xml | 6 +---- .../70container_files_twice/00-base.xml | 6 +---- .../70container_filesmulti/00-base.xml | 6 +---- .../70container_filesredefine/00-base.xml | 6 +---- .../dictionaries/70container_new/00-base.xml | 6 +---- .../70container_newnocont/00-base.xml | 6 +---- .../70container_newwithip/00-base.xml | 6 +---- .../dictionaries/70container_save/00-base.xml | 2 +- tests/dictionaries/70service_base/00-base.xml | 2 +- .../70services_ip_leadership/00-base.xml | 6 +---- .../80condition_itself/00-base.xml | 4 ++-- .../00-base.xml | 2 +- .../00-base.xml | 5 +--- .../80empty_param_number/00_base.xml | 5 +--- .../80empty_typeeole_eole/00_base.xml | 2 +- .../80empty_typeeole_number/00_base.xml | 18 +++++---------- .../00-base.xml | 2 +- .../__init__.py | 0 .../errno_41 | 0 .../extra_dirs/extra/00-base.xml | 0 .../extra_dirs/extra1/00-base.xml | 0 .../00-base.xml | 2 +- .../__init__.py | 0 .../errno_38 | 0 .../extra_dirs/extra/00-base.xml | 0 .../extra_dirs/extra1/00-base.xml | 0 .../00-base.xml | 2 +- .../__init__.py | 0 .../errno_38 | 0 .../extra_dirs/extra/00-base.xml | 0 .../dictionaries/80extra_rougail/00-base.xml | 2 +- .../dictionaries/80extra_services/00-base.xml | 2 +- .../00-base.xml | 0 .../01-base.xml | 0 .../02-base.xml | 0 .../__init__.py | 0 .../errno_76} | 0 .../00-base.xml | 0 .../__init__.py | 0 .../errno_76} | 0 .../extra_dirs/extra/00-base.xml | 0 .../00-base.xml | 0 .../__init__.py | 0 .../errno_76} | 0 .../00-base.xml | 0 .../__init__.py | 0 .../errno_76} | 0 .../00-base.xml | 0 .../__init__.py | 0 .../errno_76} | 0 .../00-base.xml | 0 .../80leadership_familyaccent/__init__.py | 0 .../80leadership_familyaccent/errno_76 | 0 .../00-base.xml | 0 .../__init__.py | 0 .../errno_76 | 0 .../00-base.xml | 0 .../01-base.xml | 0 .../__init__.py | 0 .../errno_76 | 0 .../dictionaries/80mode_conflict/00-base.xml | 2 +- .../80variable_accent/00-base.xml | 23 +++++++++++++++++++ .../01-base.xml} | 5 ---- .../02-base.xml} | 4 ++-- .../80variable_accent/__init__.py | 0 tests/dictionaries/80variable_accent/errno_76 | 0 tests/dictionaries/80variable_up/00-base.xml | 23 +++++++++++++++++++ tests/dictionaries/80variable_up/__init__.py | 0 tests/dictionaries/80variable_up/errno_76 | 0 .../81extra_externalspace/00-base.xml | 2 +- 135 files changed, 134 insertions(+), 575 deletions(-) delete mode 100644 tests/dictionaries/01fill_baseaccent/makedict/after.json delete mode 100644 tests/dictionaries/01fill_baseaccent/makedict/base.json delete mode 100644 tests/dictionaries/01fill_baseaccent/makedict/before.json delete mode 100644 tests/dictionaries/01fill_baseaccent/tiramisu/base.py delete mode 100644 tests/dictionaries/10leadership_accent/makedict/after.json delete mode 100644 tests/dictionaries/10leadership_accent/makedict/base.json delete mode 100644 tests/dictionaries/10leadership_accent/makedict/before.json delete mode 100644 tests/dictionaries/10leadership_accent/tiramisu/base.py delete mode 100644 tests/dictionaries/10leadership_accent_leader/makedict/after.json delete mode 100644 tests/dictionaries/10leadership_accent_leader/makedict/base.json delete mode 100644 tests/dictionaries/10leadership_accent_leader/makedict/before.json delete mode 100644 tests/dictionaries/10leadership_accent_leader/tiramisu/base.py delete mode 100644 tests/dictionaries/10leadership_familyaccent/makedict/after.json delete mode 100644 tests/dictionaries/10leadership_familyaccent/makedict/base.json delete mode 100644 tests/dictionaries/10leadership_familyaccent/makedict/before.json delete mode 100644 tests/dictionaries/10leadership_familyaccent/tiramisu/base.py delete mode 100644 tests/dictionaries/10load_disabled_if_inaccent_family/makedict/after.json delete mode 100644 tests/dictionaries/10load_disabled_if_inaccent_family/makedict/base.json delete mode 100644 tests/dictionaries/10load_disabled_if_inaccent_family/makedict/before.json delete mode 100644 tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/base.py delete mode 100644 tests/dictionaries/10load_leadership_normalize_family/makedict/after.json delete mode 100644 tests/dictionaries/10load_leadership_normalize_family/makedict/base.json delete mode 100644 tests/dictionaries/10load_leadership_normalize_family/makedict/before.json delete mode 100644 tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py delete mode 100644 tests/dictionaries/20family_appendaccent/makedict/after.json delete mode 100644 tests/dictionaries/20family_appendaccent/makedict/base.json delete mode 100644 tests/dictionaries/20family_appendaccent/makedict/before.json delete mode 100644 tests/dictionaries/20family_appendaccent/tiramisu/base.py delete mode 100644 tests/dictionaries/60familyaction_accent/makedict/after.json delete mode 100644 tests/dictionaries/60familyaction_accent/makedict/base.json delete mode 100644 tests/dictionaries/60familyaction_accent/makedict/before.json delete mode 100644 tests/dictionaries/60familyaction_accent/tiramisu/base.py rename tests/dictionaries/{60extra_externalspaceauto => 80extra_externalspaceauto}/00-base.xml (84%) rename tests/dictionaries/{01fill_baseaccent => 80extra_externalspaceauto}/__init__.py (100%) rename tests/dictionaries/{60extra_externalspaceauto => 80extra_externalspaceauto}/errno_41 (100%) rename tests/dictionaries/{60extra_externalspaceauto => 80extra_externalspaceauto}/extra_dirs/extra/00-base.xml (100%) rename tests/dictionaries/{60extra_externalspaceauto => 80extra_externalspaceauto}/extra_dirs/extra1/00-base.xml (100%) rename tests/dictionaries/{60extra_externalspacecondition2 => 80extra_externalspacecondition2}/00-base.xml (84%) rename tests/dictionaries/{10leadership_accent => 80extra_externalspacecondition2}/__init__.py (100%) rename tests/dictionaries/{60extra_externalspacecondition2 => 80extra_externalspacecondition2}/errno_38 (100%) rename tests/dictionaries/{60extra_externalspacecondition2 => 80extra_externalspacecondition2}/extra_dirs/extra/00-base.xml (100%) rename tests/dictionaries/{60extra_externalspacecondition2 => 80extra_externalspacecondition2}/extra_dirs/extra1/00-base.xml (100%) rename tests/dictionaries/{60extra_externalspacecondition3 => 80extra_externalspacecondition3}/00-base.xml (84%) rename tests/dictionaries/{10leadership_accent_leader => 80extra_externalspacecondition3}/__init__.py (100%) rename tests/dictionaries/{60extra_externalspacecondition3 => 80extra_externalspacecondition3}/errno_38 (100%) rename tests/dictionaries/{60extra_externalspacecondition3 => 80extra_externalspacecondition3}/extra_dirs/extra/00-base.xml (100%) rename tests/dictionaries/{20family_appendaccent => 80family_appendaccent}/00-base.xml (100%) rename tests/dictionaries/{20family_appendaccent => 80family_appendaccent}/01-base.xml (100%) rename tests/dictionaries/{20family_appendaccent => 80family_appendaccent}/02-base.xml (100%) rename tests/dictionaries/{10leadership_familyaccent => 80family_appendaccent}/__init__.py (100%) rename tests/dictionaries/{10load_disabled_if_inaccent_family/__init__.py => 80family_appendaccent/errno_76} (100%) rename tests/dictionaries/{60familyaction_accent => 80familyaction_accent}/00-base.xml (100%) rename tests/dictionaries/{10load_leadership_normalize_family => 80familyaction_accent}/__init__.py (100%) rename tests/dictionaries/{20family_appendaccent/__init__.py => 80familyaction_accent/errno_76} (100%) rename tests/dictionaries/{60familyaction_accent => 80familyaction_accent}/extra_dirs/extra/00-base.xml (100%) rename tests/dictionaries/{01fill_baseaccent => 80fill_baseaccent}/00-base.xml (100%) rename tests/dictionaries/{60extra_externalspaceauto => 80fill_baseaccent}/__init__.py (100%) rename tests/dictionaries/{60extra_externalspacecondition2/__init__.py => 80fill_baseaccent/errno_76} (100%) rename tests/dictionaries/{10leadership_accent => 80leadership_accent}/00-base.xml (100%) rename tests/dictionaries/{60extra_externalspacecondition3 => 80leadership_accent}/__init__.py (100%) rename tests/dictionaries/{60familyaction_accent/__init__.py => 80leadership_accent/errno_76} (100%) rename tests/dictionaries/{10leadership_accent_leader => 80leadership_accent_leader}/00-base.xml (100%) rename tests/dictionaries/{80family_changeaccent => 80leadership_accent_leader}/__init__.py (100%) rename tests/dictionaries/{80family_changeaccent/errno_47 => 80leadership_accent_leader/errno_76} (100%) rename tests/dictionaries/{10leadership_familyaccent => 80leadership_familyaccent}/00-base.xml (100%) create mode 100644 tests/dictionaries/80leadership_familyaccent/__init__.py create mode 100644 tests/dictionaries/80leadership_familyaccent/errno_76 rename tests/dictionaries/{10load_disabled_if_inaccent_family => 80load_disabled_if_inaccent_family}/00-base.xml (100%) create mode 100644 tests/dictionaries/80load_disabled_if_inaccent_family/__init__.py create mode 100644 tests/dictionaries/80load_disabled_if_inaccent_family/errno_76 rename tests/dictionaries/{10load_leadership_normalize_family => 80load_leadership_normalize_family}/00-base.xml (100%) rename tests/dictionaries/{10load_leadership_normalize_family => 80load_leadership_normalize_family}/01-base.xml (100%) create mode 100644 tests/dictionaries/80load_leadership_normalize_family/__init__.py create mode 100644 tests/dictionaries/80load_leadership_normalize_family/errno_76 create mode 100644 tests/dictionaries/80variable_accent/00-base.xml rename tests/dictionaries/{80family_changeaccent/00-base.xml => 80variable_accent/01-base.xml} (62%) rename tests/dictionaries/{80family_changeaccent/01-base.xml => 80variable_accent/02-base.xml} (57%) create mode 100644 tests/dictionaries/80variable_accent/__init__.py create mode 100644 tests/dictionaries/80variable_accent/errno_76 create mode 100644 tests/dictionaries/80variable_up/00-base.xml create mode 100644 tests/dictionaries/80variable_up/__init__.py create mode 100644 tests/dictionaries/80variable_up/errno_76 diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index da3c4421..45f4e1b9 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from ..i18n import _ from ..error import DictConsistencyError -from ..utils import normalize_family from .variable import Walk @@ -91,7 +90,6 @@ class FamilyAnnotator(Walk): family.description = family.name family.doc = family.description del family.description - family.name = normalize_family(family.name) def change_modes(self): """change the mode of variables diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 1cecf742..cc492605 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from ..i18n import _ from ..error import DictConsistencyError from ..objspace import convert_boolean -from ..utils import normalize_family CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), @@ -171,7 +170,6 @@ class VariableAnnotator(Walk): # pylint: disable=R0903 if not variable.value: del variable.value variable.doc = variable.description - variable.name = normalize_family(variable.name) del variable.description if variable_type == 'follower': if variable.multi is True: diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index b7b2878f..191cf007 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -29,7 +29,7 @@ from typing import Optional from .i18n import _ from .xmlreflector import XMLReflector -from .utils import normalize_family +from .utils import valid_variable_family_name from .error import SpaceObjShallNotBeUpdated, DictConsistencyError from .path import Path @@ -197,7 +197,7 @@ class RougailObjSpace: if child.tag == 'family': if child.attrib['name'] in family_names: msg = _(f'Family "{child.attrib["name"]}" is set several times') - raise DictConsistencyError(msg, 44, xmlfile) + raise DictConsistencyError(msg, 44, [xmlfile]) family_names.append(child.attrib['name']) try: # variable objects creation @@ -296,6 +296,7 @@ class RougailObjSpace: """A redefinable object could be created or updated """ existed_var = self.get_existed_obj(name, + xmlfile, space, child, namespace, @@ -337,6 +338,7 @@ class RougailObjSpace: def get_existed_obj(self, name: str, + xmlfile: str, space: str, child, namespace: str, @@ -344,7 +346,7 @@ class RougailObjSpace: """if an object exists, return it """ if child.tag in ['variable', 'family']: - name = normalize_family(name) + valid_variable_family_name(name, [xmlfile]) if child.tag == 'variable': # pylint: disable=E1101 if namespace != self.rougailconfig['variable_namespace']: name = space.path + '.' + name @@ -468,18 +470,18 @@ class RougailObjSpace: """ if isinstance(variableobj, self.variable): # pylint: disable=E1101 if 'name' in document.attrib: - family_name = normalize_family(document.attrib['name']) + family_name = document.attrib['name'] else: family_name = namespace self.paths.add_variable(namespace, - normalize_family(variableobj.name), + variableobj.name, space.path, document.attrib.get('dynamic') is not None, variableobj, ) elif isinstance(variableobj, self.family): # pylint: disable=E1101 - family_name = normalize_family(variableobj.name) + family_name = variableobj.name if namespace != self.rougailconfig['variable_namespace']: family_name = namespace + '.' + family_name self.paths.add_family(namespace, @@ -502,8 +504,6 @@ class RougailObjSpace: if isinstance(variableobj, Redefinable): name = variableobj.name tag = FORCE_TAG.get(child.tag, child.tag) - if child.tag in ['family', 'variable']: - name = normalize_family(name) getattr(space, tag)[name] = variableobj elif isinstance(variableobj, UnRedefinable): getattr(space, child.tag).append(variableobj) diff --git a/src/rougail/utils.py b/src/rougail/utils.py index c94565ea..f80b00de 100644 --- a/src/rougail/utils.py +++ b/src/rougail/utils.py @@ -26,10 +26,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ from typing import List from unicodedata import normalize, combining +import re from importlib.machinery import SourceFileLoader from importlib.util import spec_from_loader, module_from_spec +from .i18n import _ +from .error import DictConsistencyError + +NAME_REGEXP = re.compile(r"^[a-z0-9_]*$") + + +def valid_variable_family_name(name: str, + xmlfiles: List[str], + ) -> None: + match = NAME_REGEXP.search(name) + if not match: + msg = _(f'invalid variable or family name "{name}" must only contains ' + 'lowercase ascii character, number or _') + raise DictConsistencyError(msg, 76, xmlfiles) + def normalize_family(family_name: str) -> str: """replace space, accent, uppercase, ... by valid character diff --git a/tests/dictionaries/00load_autosave/00-base.xml b/tests/dictionaries/00load_autosave/00-base.xml index 882ec86f..28d7d0cf 100644 --- a/tests/dictionaries/00load_autosave/00-base.xml +++ b/tests/dictionaries/00load_autosave/00-base.xml @@ -2,7 +2,7 @@ - + non diff --git a/tests/dictionaries/00load_autosaveexpert/00-base.xml b/tests/dictionaries/00load_autosaveexpert/00-base.xml index b2450b1d..63b1dd76 100644 --- a/tests/dictionaries/00load_autosaveexpert/00-base.xml +++ b/tests/dictionaries/00load_autosaveexpert/00-base.xml @@ -2,7 +2,7 @@ - + non diff --git a/tests/dictionaries/00load_comment/00-base.xml b/tests/dictionaries/00load_comment/00-base.xml index 97015669..e781b9f8 100644 --- a/tests/dictionaries/00load_comment/00-base.xml +++ b/tests/dictionaries/00load_comment/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/10load_hidden_if_family/00-base.xml b/tests/dictionaries/10load_hidden_if_family/00-base.xml index 83b07acd..85ea05f1 100644 --- a/tests/dictionaries/10load_hidden_if_family/00-base.xml +++ b/tests/dictionaries/10load_hidden_if_family/00-base.xml @@ -1,7 +1,7 @@ - + non @@ -12,7 +12,7 @@ non - + @@ -24,7 +24,7 @@ oui mode_conteneur_actif mode_conteneur_actif2 - Général2 + general2 diff --git a/tests/dictionaries/10load_leadership_normalize_family/makedict/after.json b/tests/dictionaries/10load_leadership_normalize_family/makedict/after.json deleted file mode 100644 index 6cb952c2..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/makedict/after.json +++ /dev/null @@ -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": [] - } -} diff --git a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json b/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json deleted file mode 100644 index 5a7a908d..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "rougail.general.mode_conteneur_actif": "non", - "rougail.general_1.leader.leader": [] -} diff --git a/tests/dictionaries/10load_leadership_normalize_family/makedict/before.json b/tests/dictionaries/10load_leadership_normalize_family/makedict/before.json deleted file mode 100644 index 6cb952c2..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/makedict/before.json +++ /dev/null @@ -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": [] - } -} diff --git a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py b/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py deleted file mode 100644 index 8a959c5f..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py +++ /dev/null @@ -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]) diff --git a/tests/dictionaries/20family_appendaccent/makedict/after.json b/tests/dictionaries/20family_appendaccent/makedict/after.json deleted file mode 100644 index a50319de..00000000 --- a/tests/dictionaries/20family_appendaccent/makedict/after.json +++ /dev/null @@ -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" - } -} diff --git a/tests/dictionaries/20family_appendaccent/makedict/base.json b/tests/dictionaries/20family_appendaccent/makedict/base.json deleted file mode 100644 index ec650bb0..00000000 --- a/tests/dictionaries/20family_appendaccent/makedict/base.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rougail.general.mode_conteneur_actif1": "non", - "rougail.general.mode_conteneur_actif2": "non", - "rougail.other.mode_conteneur_actif3": "non" -} diff --git a/tests/dictionaries/20family_appendaccent/makedict/before.json b/tests/dictionaries/20family_appendaccent/makedict/before.json deleted file mode 100644 index a50319de..00000000 --- a/tests/dictionaries/20family_appendaccent/makedict/before.json +++ /dev/null @@ -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" - } -} diff --git a/tests/dictionaries/20family_appendaccent/tiramisu/base.py b/tests/dictionaries/20family_appendaccent/tiramisu/base.py deleted file mode 100644 index 31ad812c..00000000 --- a/tests/dictionaries/20family_appendaccent/tiramisu/base.py +++ /dev/null @@ -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]) diff --git a/tests/dictionaries/40empty_param/00_base.xml b/tests/dictionaries/40empty_param/00_base.xml index c8c7a5f2..155081f5 100644 --- a/tests/dictionaries/40empty_param/00_base.xml +++ b/tests/dictionaries/40empty_param/00_base.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/dictionaries/40empty_param2/00_base.xml b/tests/dictionaries/40empty_param2/00_base.xml index c8e29ae7..dd301fda 100644 --- a/tests/dictionaries/40empty_param2/00_base.xml +++ b/tests/dictionaries/40empty_param2/00_base.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/dictionaries/60action_external/00-base.xml b/tests/dictionaries/60action_external/00-base.xml index fe0ee547..46d87131 100644 --- a/tests/dictionaries/60action_external/00-base.xml +++ b/tests/dictionaries/60action_external/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/60extra_externalspacecondition/00-base.xml b/tests/dictionaries/60extra_externalspacecondition/00-base.xml index f766ed4e..a525e91a 100644 --- a/tests/dictionaries/60extra_externalspacecondition/00-base.xml +++ b/tests/dictionaries/60extra_externalspacecondition/00-base.xml @@ -1,7 +1,7 @@ - + no diff --git a/tests/dictionaries/60extra_group/00-base.xml b/tests/dictionaries/60extra_group/00-base.xml index 6d1b7533..268c2024 100644 --- a/tests/dictionaries/60extra_group/00-base.xml +++ b/tests/dictionaries/60extra_group/00-base.xml @@ -7,7 +7,7 @@ - + diff --git a/tests/dictionaries/60extra_help/00-base.xml b/tests/dictionaries/60extra_help/00-base.xml index c9079ecb..d8156c27 100644 --- a/tests/dictionaries/60extra_help/00-base.xml +++ b/tests/dictionaries/60extra_help/00-base.xml @@ -8,7 +8,7 @@ - + diff --git a/tests/dictionaries/60extra_load/00-base.xml b/tests/dictionaries/60extra_load/00-base.xml index de43b548..32dae3d3 100644 --- a/tests/dictionaries/60extra_load/00-base.xml +++ b/tests/dictionaries/60extra_load/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/60extra_mandatory/00-base.xml b/tests/dictionaries/60extra_mandatory/00-base.xml index de43b548..32dae3d3 100644 --- a/tests/dictionaries/60extra_mandatory/00-base.xml +++ b/tests/dictionaries/60extra_mandatory/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/60extra_no_condition/00-base.xml b/tests/dictionaries/60extra_no_condition/00-base.xml index 4037fc84..4e809b8b 100644 --- a/tests/dictionaries/60extra_no_condition/00-base.xml +++ b/tests/dictionaries/60extra_no_condition/00-base.xml @@ -1,7 +1,7 @@ - + non diff --git a/tests/dictionaries/60extra_redefine/00-base.xml b/tests/dictionaries/60extra_redefine/00-base.xml index de43b548..32dae3d3 100644 --- a/tests/dictionaries/60extra_redefine/00-base.xml +++ b/tests/dictionaries/60extra_redefine/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/60extra_variable_name_extra/00-base.xml b/tests/dictionaries/60extra_variable_name_extra/00-base.xml index de43b548..32dae3d3 100644 --- a/tests/dictionaries/60extra_variable_name_extra/00-base.xml +++ b/tests/dictionaries/60extra_variable_name_extra/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/60familyaction/00-base.xml b/tests/dictionaries/60familyaction/00-base.xml index fe0ee547..46d87131 100644 --- a/tests/dictionaries/60familyaction/00-base.xml +++ b/tests/dictionaries/60familyaction/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/60familyaction_accent/makedict/after.json b/tests/dictionaries/60familyaction_accent/makedict/after.json deleted file mode 100644 index 00d8ee8c..00000000 --- a/tests/dictionaries/60familyaction_accent/makedict/after.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "rougail.general.mode_conteneur_actif": { - "owner": "default", - "value": "non" - }, - "extra.test.delay": { - "owner": "default", - "value": 0 - } -} diff --git a/tests/dictionaries/60familyaction_accent/makedict/base.json b/tests/dictionaries/60familyaction_accent/makedict/base.json deleted file mode 100644 index 9a96ae51..00000000 --- a/tests/dictionaries/60familyaction_accent/makedict/base.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "rougail.general.mode_conteneur_actif": "non", - "extra.test.delay": 0 -} diff --git a/tests/dictionaries/60familyaction_accent/makedict/before.json b/tests/dictionaries/60familyaction_accent/makedict/before.json deleted file mode 100644 index 00d8ee8c..00000000 --- a/tests/dictionaries/60familyaction_accent/makedict/before.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "rougail.general.mode_conteneur_actif": { - "owner": "default", - "value": "non" - }, - "extra.test.delay": { - "owner": "default", - "value": 0 - } -} diff --git a/tests/dictionaries/60familyaction_accent/tiramisu/base.py b/tests/dictionaries/60familyaction_accent/tiramisu/base.py deleted file mode 100644 index 6f61d69e..00000000 --- a/tests/dictionaries/60familyaction_accent/tiramisu/base.py +++ /dev/null @@ -1,20 +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({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) -option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) -option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) -option_6 = IntOption(name="delay", doc="délai en minutes avant lancement", default=0, properties=frozenset({"mandatory", "normal"})) -option_5 = OptionDescription(name="test", doc="test", children=[option_6], properties=frozenset({"normal"})) -option_4 = OptionDescription(name="extra", doc="extra", children=[option_5]) -option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/60familyaction_mandatory/00-base.xml b/tests/dictionaries/60familyaction_mandatory/00-base.xml index fe0ee547..46d87131 100644 --- a/tests/dictionaries/60familyaction_mandatory/00-base.xml +++ b/tests/dictionaries/60familyaction_mandatory/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/61extra_auto_freeze/00-base.xml b/tests/dictionaries/61extra_auto_freeze/00-base.xml index 761ed99c..a41f67c6 100644 --- a/tests/dictionaries/61extra_auto_freeze/00-base.xml +++ b/tests/dictionaries/61extra_auto_freeze/00-base.xml @@ -1,7 +1,7 @@ - + - nut_monitor_host diff --git a/tests/dictionaries/80condition_itself/00-base.xml b/tests/dictionaries/80condition_itself/00-base.xml index 0938579d..cec7d54f 100644 --- a/tests/dictionaries/80condition_itself/00-base.xml +++ b/tests/dictionaries/80condition_itself/00-base.xml @@ -2,11 +2,11 @@ - + - + leader-leader replicationType diff --git a/tests/dictionaries/80container_files_symlink_without_source/00-base.xml b/tests/dictionaries/80container_files_symlink_without_source/00-base.xml index 770da073..2b582d74 100644 --- a/tests/dictionaries/80container_files_symlink_without_source/00-base.xml +++ b/tests/dictionaries/80container_files_symlink_without_source/00-base.xml @@ -6,7 +6,7 @@ - + diff --git a/tests/dictionaries/80container_filesredefine_error/00-base.xml b/tests/dictionaries/80container_filesredefine_error/00-base.xml index cab09549..2bdfa029 100644 --- a/tests/dictionaries/80container_filesredefine_error/00-base.xml +++ b/tests/dictionaries/80container_filesredefine_error/00-base.xml @@ -1,15 +1,12 @@ - /etc/mailname - - - + diff --git a/tests/dictionaries/80empty_param_number/00_base.xml b/tests/dictionaries/80empty_param_number/00_base.xml index 3a916091..ec51ecd9 100644 --- a/tests/dictionaries/80empty_param_number/00_base.xml +++ b/tests/dictionaries/80empty_param_number/00_base.xml @@ -1,9 +1,7 @@ - - - + @@ -11,7 +9,6 @@ - diff --git a/tests/dictionaries/80empty_typeeole_eole/00_base.xml b/tests/dictionaries/80empty_typeeole_eole/00_base.xml index f711df19..306c2d0b 100644 --- a/tests/dictionaries/80empty_typeeole_eole/00_base.xml +++ b/tests/dictionaries/80empty_typeeole_eole/00_base.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/dictionaries/80empty_typeeole_number/00_base.xml b/tests/dictionaries/80empty_typeeole_number/00_base.xml index 65196e0f..41cc206a 100644 --- a/tests/dictionaries/80empty_typeeole_number/00_base.xml +++ b/tests/dictionaries/80empty_typeeole_number/00_base.xml @@ -1,25 +1,19 @@ - - - - - - - 3127 - - + + + + 3127 + - non 3128 toto2 - toto1 + toto1 - diff --git a/tests/dictionaries/60extra_externalspaceauto/00-base.xml b/tests/dictionaries/80extra_externalspaceauto/00-base.xml similarity index 84% rename from tests/dictionaries/60extra_externalspaceauto/00-base.xml rename to tests/dictionaries/80extra_externalspaceauto/00-base.xml index 804dc25d..0217e0ff 100644 --- a/tests/dictionaries/60extra_externalspaceauto/00-base.xml +++ b/tests/dictionaries/80extra_externalspaceauto/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/01fill_baseaccent/__init__.py b/tests/dictionaries/80extra_externalspaceauto/__init__.py similarity index 100% rename from tests/dictionaries/01fill_baseaccent/__init__.py rename to tests/dictionaries/80extra_externalspaceauto/__init__.py diff --git a/tests/dictionaries/60extra_externalspaceauto/errno_41 b/tests/dictionaries/80extra_externalspaceauto/errno_41 similarity index 100% rename from tests/dictionaries/60extra_externalspaceauto/errno_41 rename to tests/dictionaries/80extra_externalspaceauto/errno_41 diff --git a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra/00-base.xml b/tests/dictionaries/80extra_externalspaceauto/extra_dirs/extra/00-base.xml similarity index 100% rename from tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra/00-base.xml rename to tests/dictionaries/80extra_externalspaceauto/extra_dirs/extra/00-base.xml diff --git a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml b/tests/dictionaries/80extra_externalspaceauto/extra_dirs/extra1/00-base.xml similarity index 100% rename from tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml rename to tests/dictionaries/80extra_externalspaceauto/extra_dirs/extra1/00-base.xml diff --git a/tests/dictionaries/60extra_externalspacecondition2/00-base.xml b/tests/dictionaries/80extra_externalspacecondition2/00-base.xml similarity index 84% rename from tests/dictionaries/60extra_externalspacecondition2/00-base.xml rename to tests/dictionaries/80extra_externalspacecondition2/00-base.xml index 804dc25d..0217e0ff 100644 --- a/tests/dictionaries/60extra_externalspacecondition2/00-base.xml +++ b/tests/dictionaries/80extra_externalspacecondition2/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/10leadership_accent/__init__.py b/tests/dictionaries/80extra_externalspacecondition2/__init__.py similarity index 100% rename from tests/dictionaries/10leadership_accent/__init__.py rename to tests/dictionaries/80extra_externalspacecondition2/__init__.py diff --git a/tests/dictionaries/60extra_externalspacecondition2/errno_38 b/tests/dictionaries/80extra_externalspacecondition2/errno_38 similarity index 100% rename from tests/dictionaries/60extra_externalspacecondition2/errno_38 rename to tests/dictionaries/80extra_externalspacecondition2/errno_38 diff --git a/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra/00-base.xml b/tests/dictionaries/80extra_externalspacecondition2/extra_dirs/extra/00-base.xml similarity index 100% rename from tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra/00-base.xml rename to tests/dictionaries/80extra_externalspacecondition2/extra_dirs/extra/00-base.xml diff --git a/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra1/00-base.xml b/tests/dictionaries/80extra_externalspacecondition2/extra_dirs/extra1/00-base.xml similarity index 100% rename from tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra1/00-base.xml rename to tests/dictionaries/80extra_externalspacecondition2/extra_dirs/extra1/00-base.xml diff --git a/tests/dictionaries/60extra_externalspacecondition3/00-base.xml b/tests/dictionaries/80extra_externalspacecondition3/00-base.xml similarity index 84% rename from tests/dictionaries/60extra_externalspacecondition3/00-base.xml rename to tests/dictionaries/80extra_externalspacecondition3/00-base.xml index 804dc25d..0217e0ff 100644 --- a/tests/dictionaries/60extra_externalspacecondition3/00-base.xml +++ b/tests/dictionaries/80extra_externalspacecondition3/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/10leadership_accent_leader/__init__.py b/tests/dictionaries/80extra_externalspacecondition3/__init__.py similarity index 100% rename from tests/dictionaries/10leadership_accent_leader/__init__.py rename to tests/dictionaries/80extra_externalspacecondition3/__init__.py diff --git a/tests/dictionaries/60extra_externalspacecondition3/errno_38 b/tests/dictionaries/80extra_externalspacecondition3/errno_38 similarity index 100% rename from tests/dictionaries/60extra_externalspacecondition3/errno_38 rename to tests/dictionaries/80extra_externalspacecondition3/errno_38 diff --git a/tests/dictionaries/60extra_externalspacecondition3/extra_dirs/extra/00-base.xml b/tests/dictionaries/80extra_externalspacecondition3/extra_dirs/extra/00-base.xml similarity index 100% rename from tests/dictionaries/60extra_externalspacecondition3/extra_dirs/extra/00-base.xml rename to tests/dictionaries/80extra_externalspacecondition3/extra_dirs/extra/00-base.xml diff --git a/tests/dictionaries/80extra_rougail/00-base.xml b/tests/dictionaries/80extra_rougail/00-base.xml index de43b548..d8b5f8f0 100644 --- a/tests/dictionaries/80extra_rougail/00-base.xml +++ b/tests/dictionaries/80extra_rougail/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/80extra_services/00-base.xml b/tests/dictionaries/80extra_services/00-base.xml index de43b548..d8b5f8f0 100644 --- a/tests/dictionaries/80extra_services/00-base.xml +++ b/tests/dictionaries/80extra_services/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/20family_appendaccent/00-base.xml b/tests/dictionaries/80family_appendaccent/00-base.xml similarity index 100% rename from tests/dictionaries/20family_appendaccent/00-base.xml rename to tests/dictionaries/80family_appendaccent/00-base.xml diff --git a/tests/dictionaries/20family_appendaccent/01-base.xml b/tests/dictionaries/80family_appendaccent/01-base.xml similarity index 100% rename from tests/dictionaries/20family_appendaccent/01-base.xml rename to tests/dictionaries/80family_appendaccent/01-base.xml diff --git a/tests/dictionaries/20family_appendaccent/02-base.xml b/tests/dictionaries/80family_appendaccent/02-base.xml similarity index 100% rename from tests/dictionaries/20family_appendaccent/02-base.xml rename to tests/dictionaries/80family_appendaccent/02-base.xml diff --git a/tests/dictionaries/10leadership_familyaccent/__init__.py b/tests/dictionaries/80family_appendaccent/__init__.py similarity index 100% rename from tests/dictionaries/10leadership_familyaccent/__init__.py rename to tests/dictionaries/80family_appendaccent/__init__.py diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/__init__.py b/tests/dictionaries/80family_appendaccent/errno_76 similarity index 100% rename from tests/dictionaries/10load_disabled_if_inaccent_family/__init__.py rename to tests/dictionaries/80family_appendaccent/errno_76 diff --git a/tests/dictionaries/60familyaction_accent/00-base.xml b/tests/dictionaries/80familyaction_accent/00-base.xml similarity index 100% rename from tests/dictionaries/60familyaction_accent/00-base.xml rename to tests/dictionaries/80familyaction_accent/00-base.xml diff --git a/tests/dictionaries/10load_leadership_normalize_family/__init__.py b/tests/dictionaries/80familyaction_accent/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_normalize_family/__init__.py rename to tests/dictionaries/80familyaction_accent/__init__.py diff --git a/tests/dictionaries/20family_appendaccent/__init__.py b/tests/dictionaries/80familyaction_accent/errno_76 similarity index 100% rename from tests/dictionaries/20family_appendaccent/__init__.py rename to tests/dictionaries/80familyaction_accent/errno_76 diff --git a/tests/dictionaries/60familyaction_accent/extra_dirs/extra/00-base.xml b/tests/dictionaries/80familyaction_accent/extra_dirs/extra/00-base.xml similarity index 100% rename from tests/dictionaries/60familyaction_accent/extra_dirs/extra/00-base.xml rename to tests/dictionaries/80familyaction_accent/extra_dirs/extra/00-base.xml diff --git a/tests/dictionaries/01fill_baseaccent/00-base.xml b/tests/dictionaries/80fill_baseaccent/00-base.xml similarity index 100% rename from tests/dictionaries/01fill_baseaccent/00-base.xml rename to tests/dictionaries/80fill_baseaccent/00-base.xml diff --git a/tests/dictionaries/60extra_externalspaceauto/__init__.py b/tests/dictionaries/80fill_baseaccent/__init__.py similarity index 100% rename from tests/dictionaries/60extra_externalspaceauto/__init__.py rename to tests/dictionaries/80fill_baseaccent/__init__.py diff --git a/tests/dictionaries/60extra_externalspacecondition2/__init__.py b/tests/dictionaries/80fill_baseaccent/errno_76 similarity index 100% rename from tests/dictionaries/60extra_externalspacecondition2/__init__.py rename to tests/dictionaries/80fill_baseaccent/errno_76 diff --git a/tests/dictionaries/10leadership_accent/00-base.xml b/tests/dictionaries/80leadership_accent/00-base.xml similarity index 100% rename from tests/dictionaries/10leadership_accent/00-base.xml rename to tests/dictionaries/80leadership_accent/00-base.xml diff --git a/tests/dictionaries/60extra_externalspacecondition3/__init__.py b/tests/dictionaries/80leadership_accent/__init__.py similarity index 100% rename from tests/dictionaries/60extra_externalspacecondition3/__init__.py rename to tests/dictionaries/80leadership_accent/__init__.py diff --git a/tests/dictionaries/60familyaction_accent/__init__.py b/tests/dictionaries/80leadership_accent/errno_76 similarity index 100% rename from tests/dictionaries/60familyaction_accent/__init__.py rename to tests/dictionaries/80leadership_accent/errno_76 diff --git a/tests/dictionaries/10leadership_accent_leader/00-base.xml b/tests/dictionaries/80leadership_accent_leader/00-base.xml similarity index 100% rename from tests/dictionaries/10leadership_accent_leader/00-base.xml rename to tests/dictionaries/80leadership_accent_leader/00-base.xml diff --git a/tests/dictionaries/80family_changeaccent/__init__.py b/tests/dictionaries/80leadership_accent_leader/__init__.py similarity index 100% rename from tests/dictionaries/80family_changeaccent/__init__.py rename to tests/dictionaries/80leadership_accent_leader/__init__.py diff --git a/tests/dictionaries/80family_changeaccent/errno_47 b/tests/dictionaries/80leadership_accent_leader/errno_76 similarity index 100% rename from tests/dictionaries/80family_changeaccent/errno_47 rename to tests/dictionaries/80leadership_accent_leader/errno_76 diff --git a/tests/dictionaries/10leadership_familyaccent/00-base.xml b/tests/dictionaries/80leadership_familyaccent/00-base.xml similarity index 100% rename from tests/dictionaries/10leadership_familyaccent/00-base.xml rename to tests/dictionaries/80leadership_familyaccent/00-base.xml diff --git a/tests/dictionaries/80leadership_familyaccent/__init__.py b/tests/dictionaries/80leadership_familyaccent/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80leadership_familyaccent/errno_76 b/tests/dictionaries/80leadership_familyaccent/errno_76 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/00-base.xml b/tests/dictionaries/80load_disabled_if_inaccent_family/00-base.xml similarity index 100% rename from tests/dictionaries/10load_disabled_if_inaccent_family/00-base.xml rename to tests/dictionaries/80load_disabled_if_inaccent_family/00-base.xml diff --git a/tests/dictionaries/80load_disabled_if_inaccent_family/__init__.py b/tests/dictionaries/80load_disabled_if_inaccent_family/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80load_disabled_if_inaccent_family/errno_76 b/tests/dictionaries/80load_disabled_if_inaccent_family/errno_76 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10load_leadership_normalize_family/00-base.xml b/tests/dictionaries/80load_leadership_normalize_family/00-base.xml similarity index 100% rename from tests/dictionaries/10load_leadership_normalize_family/00-base.xml rename to tests/dictionaries/80load_leadership_normalize_family/00-base.xml diff --git a/tests/dictionaries/10load_leadership_normalize_family/01-base.xml b/tests/dictionaries/80load_leadership_normalize_family/01-base.xml similarity index 100% rename from tests/dictionaries/10load_leadership_normalize_family/01-base.xml rename to tests/dictionaries/80load_leadership_normalize_family/01-base.xml diff --git a/tests/dictionaries/80load_leadership_normalize_family/__init__.py b/tests/dictionaries/80load_leadership_normalize_family/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80load_leadership_normalize_family/errno_76 b/tests/dictionaries/80load_leadership_normalize_family/errno_76 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80mode_conflict/00-base.xml b/tests/dictionaries/80mode_conflict/00-base.xml index 52f4562b..b13b1ea0 100644 --- a/tests/dictionaries/80mode_conflict/00-base.xml +++ b/tests/dictionaries/80mode_conflict/00-base.xml @@ -2,7 +2,7 @@ - + non diff --git a/tests/dictionaries/80variable_accent/00-base.xml b/tests/dictionaries/80variable_accent/00-base.xml new file mode 100644 index 00000000..ac4a4ffe --- /dev/null +++ b/tests/dictionaries/80variable_accent/00-base.xml @@ -0,0 +1,23 @@ + + + + + + non + + + + + + + + + non + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/80family_changeaccent/00-base.xml b/tests/dictionaries/80variable_accent/01-base.xml similarity index 62% rename from tests/dictionaries/80family_changeaccent/00-base.xml rename to tests/dictionaries/80variable_accent/01-base.xml index fad8e995..b31afe12 100644 --- a/tests/dictionaries/80family_changeaccent/00-base.xml +++ b/tests/dictionaries/80variable_accent/01-base.xml @@ -2,14 +2,9 @@ - - diff --git a/tests/dictionaries/80family_changeaccent/01-base.xml b/tests/dictionaries/80variable_accent/02-base.xml similarity index 57% rename from tests/dictionaries/80family_changeaccent/01-base.xml rename to tests/dictionaries/80variable_accent/02-base.xml index 5fb2b1f5..81155361 100644 --- a/tests/dictionaries/80family_changeaccent/01-base.xml +++ b/tests/dictionaries/80variable_accent/02-base.xml @@ -1,8 +1,8 @@ - - + + diff --git a/tests/dictionaries/80variable_accent/__init__.py b/tests/dictionaries/80variable_accent/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_accent/errno_76 b/tests/dictionaries/80variable_accent/errno_76 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_up/00-base.xml b/tests/dictionaries/80variable_up/00-base.xml new file mode 100644 index 00000000..443f4139 --- /dev/null +++ b/tests/dictionaries/80variable_up/00-base.xml @@ -0,0 +1,23 @@ + + + + + + non + + + + + + + + + non + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/80variable_up/__init__.py b/tests/dictionaries/80variable_up/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/80variable_up/errno_76 b/tests/dictionaries/80variable_up/errno_76 new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/81extra_externalspace/00-base.xml b/tests/dictionaries/81extra_externalspace/00-base.xml index 804dc25d..5249b01e 100644 --- a/tests/dictionaries/81extra_externalspace/00-base.xml +++ b/tests/dictionaries/81extra_externalspace/00-base.xml @@ -1,7 +1,7 @@ - + From db69df3b86b69474242001015587c6e192b7a6ac Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 27 Mar 2021 07:44:42 +0100 Subject: [PATCH 166/168] external function support in fill --- src/rougail/annotator/fill.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rougail/annotator/fill.py b/src/rougail/annotator/fill.py index 481979de..6d002767 100644 --- a/src/rougail/annotator/fill.py +++ b/src/rougail/annotator/fill.py @@ -47,6 +47,7 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator): not hasattr(self.objectspace.space.constraints, 'fill'): return self.functions = dir(load_modules(eosfunc_file)) + self.functions.extend(self.objectspace.rougailconfig['internal_functions']) self.target_is_uniq = True self.only_variable = True self.allow_function = False From 2a770931877ac47680c6ddc1750a47404e283396 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 27 Mar 2021 07:45:11 +0100 Subject: [PATCH 167/168] param with tiramisu3 library --- src/rougail/annotator/param.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rougail/annotator/param.py b/src/rougail/annotator/param.py index 1fc6090c..f93c0fc5 100644 --- a/src/rougail/annotator/param.py +++ b/src/rougail/annotator/param.py @@ -24,7 +24,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -import tiramisu +try: + import tiramisu3 as tiramisu +except ModuleNotFoundError: + import tiramisu from .variable import CONVERT_OPTION From 17e7f4caa06055bb0e17ca512734bda2f65c560a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 27 Mar 2021 07:45:45 +0100 Subject: [PATCH 168/168] update improvment --- src/rougail/update.py | 129 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 105 insertions(+), 24 deletions(-) diff --git a/src/rougail/update.py b/src/rougail/update.py index 6173b47e..19076048 100644 --- a/src/rougail/update.py +++ b/src/rougail/update.py @@ -25,10 +25,13 @@ from os.path import join, isfile, basename from os import listdir from lxml.etree import DTD, parse, XMLParser, XMLSyntaxError # pylint: disable=E0611 from lxml.etree import Element, SubElement, tostring +from ast import parse as ast_parse from .i18n import _ from .error import UpgradeError +from .utils import normalize_family + VERSIONS = {'creole': ['1'], 'rougail': ['0.9'], @@ -40,7 +43,7 @@ def get_function_name(root, version): return f'update_{root}_{version}' -FUNCTION_VERSIONS = [get_function_name(root, version) for root, versions in VERSIONS.items() for version in versions] +FUNCTION_VERSIONS = [(root, version, get_function_name(root, version)) for root, versions in VERSIONS.items() for version in versions] class RougailUpgrade: @@ -53,6 +56,7 @@ class RougailUpgrade: def load_xml_from_folders(self, srcfolder: str, dstfolder: str, + namespace: str, ): """Loads all the XML files located in the xmlfolders' list @@ -71,10 +75,13 @@ class RougailUpgrade: root = document.getroot() search_function_name = get_function_name(root.tag, root.attrib.get('version', '1')) function_found = False - for function_version in FUNCTION_VERSIONS: + for root_name, version, function_version in FUNCTION_VERSIONS: if function_found and hasattr(self, function_version): + print(f' - convert {filename} to version {version}') upgrade_help = self.upgrade_help.get(function_version, {}).get(filename, {}) - root = getattr(self, function_version)(root, upgrade_help) + if upgrade_help.get('remove') is True: + continue + root = getattr(self, function_version)(root, upgrade_help, namespace) if function_version == search_function_name: function_found = True with open(xmldst, 'wb') as xmlfh: @@ -90,6 +97,7 @@ class RougailUpgrade: def update_rougail_0_9(self, root: 'Element', upgrade_help: dict, + namespace: str, ) -> 'Element': # rename root root.tag = 'rougail' @@ -111,6 +119,9 @@ class RougailUpgrade: if not isinstance(subelement.tag, str): # XML comment continue + if subelement.tag == 'family_action': + root.remove(subelement) + continue for subsubelement in subelement: if not isinstance(subsubelement.tag, str): # XML comment @@ -130,16 +141,27 @@ class RougailUpgrade: if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('remove', []): self.remove(subsubsubelement, 'hidden', optional=True) if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('remove', []): - self.remove(subsubsubelement, 'mandatory', optional=True) - variables[subsubsubelement.attrib['name']] = subsubsubelement + self.remove(subsubsubelement, 'mandatory') + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('add', []): + subsubsubelement.attrib['mandatory'] = 'True' + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}): + subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {})[subsubsubelement.attrib['name']] + if namespace == 'configuration': + path = subsubsubelement.attrib['name'] + npath = normalize_family(subsubsubelement.attrib['name']) + else: + path = namespace + '.' + subsubelement.attrib['name'] + '.' + subsubsubelement.attrib['name'] + npath = normalize_family(namespace) + '.' + normalize_family(subsubelement.attrib['name']) + '.' + normalize_family(subsubsubelement.attrib['name']) + variables[path] = subsubsubelement + variables[npath] = subsubsubelement type = subsubsubelement.attrib.get('type') if type in ['oui/non', 'yes/no', 'on/off']: - variables_auto_valid_enum.setdefault(subsubsubelement.attrib['type'], []).append(subsubsubelement.attrib['name']) + variables_auto_valid_enum.setdefault(subsubsubelement.attrib['type'], []).append(path) del subsubsubelement.attrib['type'] elif type == 'hostname_strict': subsubsubelement.attrib['type'] = 'hostname' - elif type == 'domain_strict': - subsubsubelement.attrib['type'] = 'domain' + elif type in ['domain', 'domain_strict']: + subsubsubelement.attrib['type'] = 'domainname' elif type == 'string': del subsubsubelement.attrib['type'] if self.test and subsubsubelement.attrib.get('auto_freeze') == 'True': @@ -153,17 +175,36 @@ class RougailUpgrade: subsubsubelement.attrib['remove_check'] = 'True' if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mode', {}).get('modify', {}): subsubsubelement.attrib['mode'] = upgrade_help.get('variables', {}).get('mode', {}).get('modify', {})[subsubsubelement.attrib['name']] + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}).get('modify', {}): + subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {}).get('modify', {})[subsubsubelement.attrib['name']] + type = subsubsubelement.attrib['type'] if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('test', {}): subsubsubelement.attrib['test'] = upgrade_help.get('variables', {}).get('test', {})[subsubsubelement.attrib['name']] -# for value in subsubsubelement: -# if value.text is None: -# value.attrib['type'] = 'nil' + if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove_value', []): + for value in subsubsubelement: + subsubsubelement.remove(value) + if subsubsubelement.attrib['name'] != normalize_family(subsubsubelement.attrib['name']): + if "description" not in subsubsubelement.attrib: + subsubsubelement.attrib['description'] = subsubsubelement.attrib['name'] + subsubsubelement.attrib['name'] = normalize_family(subsubsubelement.attrib['name']) elif subsubsubelement.tag == 'param': + if subsubelement.tag == 'check' and subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('remove', []): + continue type = subsubsubelement.attrib.get('type') if type == 'eole': subsubsubelement.attrib['type'] = 'variable' type = 'variable' - elif type in ('container', 'context', 'python'): + if type == 'python': + subsubsubelement.attrib['type'] = 'function' + if subsubsubelement.text.startswith('range('): + func_ast = ast_parse(subsubsubelement.text) + subsubsubelement.text = 'range' + for arg in func_ast.body[0].value.args: + SubElement(subsubelement, 'param', type='number').text = str(arg.value) + else: + raise Exception(f'{subsubsubelement.text} is not a supported function') + type = 'function' + elif type in ('container', 'context'): raise UpgradeError(_(f'cannot convert param with type "{type}"')) if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib: subsubsubelement.attrib['type'] = 'number' @@ -172,10 +213,14 @@ class RougailUpgrade: continue if subsubelement.attrib['name'] == 'valid_enum' and not type: if subsubsubelement.attrib.get('name') == 'checkval': + if subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('valid_enums', {}).get('checkval', {}).get('remove', []): + subsubelement.remove(subsubsubelement) + continue raise UpgradeError(_('checkval in valid_enum is no more supported')) - for val in eval(subsubsubelement.text): - SubElement(subsubelement, 'param').text = str(val) - subsubelement.remove(subsubsubelement) + if subsubsubelement.text.startswith('['): + for val in eval(subsubsubelement.text): + SubElement(subsubelement, 'param').text = str(val) + subsubelement.remove(subsubsubelement) self.move(subsubsubelement, 'hidden', 'propertyerror', optional=True) if type == 'variable' and subsubsubelement.text in upgrade_help.get('variables', {}).get('rename', []): subsubsubelement.text = upgrade_help.get('variables', {}).get('rename', [])[subsubsubelement.text] @@ -189,16 +234,18 @@ class RougailUpgrade: type = subsubsubelement.attrib.get('type') if type in ['service_accesslist', 'service_restrictionlist', 'interfacelist', 'hostlist']: subsubelement.remove(subsubsubelement) -# elif self.test and type in ['filelist', 'variable', 'servicelist']: -# subsubsubelement.attrib['optional'] = "True" elif (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []): subsubelement.remove(subsubsubelement) elif type == 'family' and subsubsubelement.text in upgrade_help.get('families', {}).get('remove', []): subsubelement.remove(subsubsubelement) - up = upgrade_help.get('targets', {}).get(subsubsubelement.text) - if up: - if 'optional' in up: - subsubsubelement.attrib['optional'] = up['optional'] + elif type == 'actionlist': +# for family in root.find('variables'): +# family_list = SubElement(subsubelement, 'target') +# family_list.attrib['type'] = 'family' +# family_list.text = namespace + '.' + family.attrib['name'] + subsubelement.remove(subsubsubelement) + if upgrade_help.get('targets', {}).get(subsubsubelement.text, {}).get('optional'): + subsubsubelement.attrib['optional'] = upgrade_help.get('targets', {}).get(subsubsubelement.text, {}).get('optional') has_target = False for target in subsubelement: if target.tag == 'target': @@ -208,7 +255,11 @@ class RougailUpgrade: subelement.remove(subsubelement) continue elif subsubsubelement.tag == 'slave': + if subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []): + subsubelement.remove(subsubsubelement) + continue subsubsubelement.tag = 'follower' + subsubsubelement.text = normalize_family(subsubsubelement.text) if subelement.tag == 'containers': current_service = self.upgrade_container(subsubsubelement, current_service, files, ips, servicelists, upgrade_help) subsubelement.remove(subsubsubelement) @@ -283,6 +334,12 @@ class RougailUpgrade: subelement.remove(subsubelement) else: self.move(subsubelement, 'master', 'leader') + for follower in subsubelement: + if '.' in subsubelement.attrib['leader']: + path = subsubelement.attrib['leader'].rsplit('.', 1)[0] + '.' + follower.text + else: + path = follower.text + self.remove(variables[path], 'multi', optional=True) if subsubelement.attrib['leader'] in upgrade_help.get('groups', {}).get('reorder', {}): for follower in subsubelement: subsubelement.remove(follower) @@ -302,6 +359,10 @@ class RougailUpgrade: continue if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('hidden', {}).get('add', []): subsubelement.attrib['hidden'] = 'True' + if subsubelement.attrib['name'] != normalize_family(subsubelement.attrib['name']): + if "description" not in subsubelement.attrib: + subsubelement.attrib['description'] = subsubelement.attrib['name'] + subsubelement.attrib['name'] = normalize_family(subsubelement.attrib['name']) families[subsubelement.attrib['name']] = subsubelement # if empty, remove if is_empty(subelement) or subelement.tag in ['containers', 'files', 'help']: @@ -394,7 +455,9 @@ class RougailUpgrade: for name, text in variables_help.items(): variables[name].attrib['help'] = text for name, text in families_help.items(): - families[name].attrib['help'] = text + if name in upgrade_help.get('families', {}).get('rename', {}): + name = upgrade_help.get('families', {}).get('rename', {})[name] + families[normalize_family(name)].attrib['help'] = text for auto in autos: if auto in variables: variables[auto].attrib['hidden'] = 'True' @@ -436,6 +499,8 @@ class RougailUpgrade: service.attrib['name'] = service_name if service_name == 'unknown': service.attrib['manage'] = 'False' + if service_name in upgrade_help.get('services', {}).get('unmanage', []): + service.attrib['manage'] = 'False' service_elt[service_name] = service if upgrade_help.get('servicelists', {}).get(service_name): service.attrib['servicelist'] = upgrade_help.get('servicelists', {}).get(service_name) @@ -450,7 +515,15 @@ class RougailUpgrade: elt.attrib['engine'] = 'creole_legacy' if (not 'instance_mode' in elt.attrib or elt.attrib['instance_mode'] != 'when_container') and \ elt.text not in upgrade_help.get('files', {}).get('remove', {}): - files[current_service][elt.text] = elt + if elt.attrib.get('filelist') in upgrade_help.get('services', {}).get('filelist_service', {}): + elt_service = upgrade_help.get('services', {}).get('filelist_service', {})[elt.attrib['filelist']] + if elt_service in files: + service = elt_service + else: + service = current_service + else: + service = current_service + files[service][elt.text] = elt elif elt.tag in ['host', 'disknod', 'fstab', 'interface', 'package', 'service_access']: pass elif elt.tag == 'service_restriction': @@ -458,7 +531,15 @@ class RougailUpgrade: if restriction.tag == 'ip' and restriction.text != '0.0.0.0': self.remove(restriction, 'ip_type', optional=True) self.remove(restriction, 'netmask_type', optional=True) - ips[current_service].append(restriction) + if elt.attrib['service'] in upgrade_help.get('services', {}).get('rename', {}): + elt_service = upgrade_help.get('services', {}).get('rename', {})[elt.attrib['service']] + else: + elt_service = elt.attrib['service'] + if elt_service in ips: + service = elt_service + else: + service = current_service + ips[service].append(restriction) elif elt.tag == 'service': new_name = elt.text if current_service == 'unknown':