diff --git a/data/creole.dtd b/data/creole.dtd index e512273e..1f403384 100644 --- a/data/creole.dtd +++ b/data/creole.dtd @@ -2,20 +2,20 @@ - + + + @@ -218,7 +217,7 @@ - + diff --git a/src/rougail/annotator.py b/src/rougail/annotator.py index cae9122a..8b6fb2af 100644 --- a/src/rougail/annotator.py +++ b/src/rougail/annotator.py @@ -73,9 +73,9 @@ KEY_TYPE = {'variable': 'symlink', 'URLOption': 'web_address', 'FilenameOption': 'filename'} -TYPE_PARAM_CHECK = ('string', 'python', 'eole') -TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'eole') -TYPE_PARAM_FILL = ('string', 'eole', 'number', 'context') +TYPE_PARAM_CHECK = ('string', 'python', 'eole', 'variable') +TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'eole', 'variable') +TYPE_PARAM_FILL = ('string', 'eole', 'number', 'context', 'variable') DISKNOD_KEY_TYPE = {'major': 'number', 'minor': 'number'} @@ -963,6 +963,8 @@ class SpaceAnnotator(object): if param.type not in TYPE_PARAM_CHECK: raise CreoleDictConsistencyError(_('cannot use {} type as a param in check for {}').format(param.type, check.target)) if param.type == 'eole': + param.type = 'variable' + if param.type == 'variable': if HIGH_COMPATIBILITY and param.text.startswith('container_ip'): if param.optional is True: param_option_indexes.append(idx) @@ -1043,7 +1045,9 @@ class SpaceAnnotator(object): '').format(check.target)) param = check.param[0] if proposed_value_type: - if param.type != 'eole': + if param.type == 'eole': + raise Exception('hu?') + if param.type == 'variable': try: values = self.load_params_in_validenum(param) except NameError as err: @@ -1142,12 +1146,13 @@ class SpaceAnnotator(object): if param.type not in TYPE_PARAM_FILL: raise CreoleDictConsistencyError(_('cannot use {} type as a param ' 'in a fill/auto').format(param.type)) + if param.type == 'eole': + param.type = 'variable' param_option_indexes = [] for fill_idx, param in enumerate(fill.param): if not hasattr(param, 'text') and \ - (param.type == 'eole' or param.type == 'number' or \ - #param.type == 'container' or param.type == 'python'): - param.type == 'python'): + (param.type == 'variable' or param.type == 'number' or \ + param.type == 'python'): raise CreoleDictConsistencyError(_("All '{}' variables shall be set in " "order to calculate {}").format( param.type, @@ -1155,7 +1160,7 @@ class SpaceAnnotator(object): # if param.type == 'container': # param.type = 'eole' # param.text = 'container_ip_{}'.format(param.text) - if param.type == 'eole': + if param.type == 'variable': #if is_probe: # raise CreoleDictConsistencyError(_('Function {0} used to calculate {1} ' # 'is executed on remote server, ' @@ -1347,6 +1352,8 @@ class SpaceAnnotator(object): if param.type not in TYPE_PARAM_CONDITION: raise CreoleDictConsistencyError(_('cannot use {} type as a param ' 'in a condition').format(param.type)) + if param.type == 'eole': + param.type = 'variable' def check_choice_option_condition(self, force_remove_targets): # remove condition for ChoiceOption that don't have param diff --git a/src/rougail/loader.py b/src/rougail/loader.py index 39541fc7..3e1201d6 100644 --- a/src/rougail/loader.py +++ b/src/rougail/loader.py @@ -404,7 +404,7 @@ class Variable(Common): name = param.attrib.get('name', '') if param.attrib['type'] == 'string': value = param.text - elif param.attrib['type'] == 'eole': + elif param.attrib['type'] == 'variable': transitive = param.attrib.get('transitive', 'False') if transitive == 'True': transitive = True diff --git a/tests/flattener_dicos/01auto_base/result/00-base.xml b/tests/flattener_dicos/01auto_base/result/00-base.xml index 432fdac4..e76c5ccd 100644 --- a/tests/flattener_dicos/01auto_base/result/00-base.xml +++ b/tests/flattener_dicos/01auto_base/result/00-base.xml @@ -12,7 +12,7 @@ mandatory normal - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 diff --git a/tests/flattener_dicos/01fill_autofreeze/result/00-base.xml b/tests/flattener_dicos/01fill_autofreeze/result/00-base.xml index 88651580..7b53c763 100644 --- a/tests/flattener_dicos/01fill_autofreeze/result/00-base.xml +++ b/tests/flattener_dicos/01fill_autofreeze/result/00-base.xml @@ -12,7 +12,7 @@ basic auto_frozen - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 diff --git a/tests/flattener_dicos/01fill_autosave/result/00-base.xml b/tests/flattener_dicos/01fill_autosave/result/00-base.xml index 7febc100..a55ea99b 100644 --- a/tests/flattener_dicos/01fill_autosave/result/00-base.xml +++ b/tests/flattener_dicos/01fill_autosave/result/00-base.xml @@ -10,7 +10,7 @@ mandatory basic - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 diff --git a/tests/flattener_dicos/01fill_base/result/00-base.xml b/tests/flattener_dicos/01fill_base/result/00-base.xml index 432fdac4..e76c5ccd 100644 --- a/tests/flattener_dicos/01fill_base/result/00-base.xml +++ b/tests/flattener_dicos/01fill_base/result/00-base.xml @@ -12,7 +12,7 @@ mandatory normal - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 diff --git a/tests/flattener_dicos/01fill_baseaccent/result/00-base.xml b/tests/flattener_dicos/01fill_baseaccent/result/00-base.xml index b8db1c50..b9bb3da1 100644 --- a/tests/flattener_dicos/01fill_baseaccent/result/00-base.xml +++ b/tests/flattener_dicos/01fill_baseaccent/result/00-base.xml @@ -12,7 +12,7 @@ mandatory normal - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 diff --git a/tests/flattener_dicos/01fill_mandatory/result/00-base.xml b/tests/flattener_dicos/01fill_mandatory/result/00-base.xml index da02f1a6..5d713d37 100644 --- a/tests/flattener_dicos/01fill_mandatory/result/00-base.xml +++ b/tests/flattener_dicos/01fill_mandatory/result/00-base.xml @@ -7,7 +7,7 @@ mandatory expert - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 diff --git a/tests/flattener_dicos/01fill_optional/result/00-base.xml b/tests/flattener_dicos/01fill_optional/result/00-base.xml index 432fdac4..e76c5ccd 100644 --- a/tests/flattener_dicos/01fill_optional/result/00-base.xml +++ b/tests/flattener_dicos/01fill_optional/result/00-base.xml @@ -12,7 +12,7 @@ mandatory normal - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 diff --git a/tests/flattener_dicos/10check_option/result/00-base.xml b/tests/flattener_dicos/10check_option/result/00-base.xml index f65ebd92..ab96be9f 100644 --- a/tests/flattener_dicos/10check_option/result/00-base.xml +++ b/tests/flattener_dicos/10check_option/result/00-base.xml @@ -16,7 +16,7 @@ 0 - creole.general.int2 + creole.general.int2 normal diff --git a/tests/flattener_dicos/10check_optional/result/00-base.xml b/tests/flattener_dicos/10check_optional/result/00-base.xml index e664e46e..88b10e62 100644 --- a/tests/flattener_dicos/10check_optional/result/00-base.xml +++ b/tests/flattener_dicos/10check_optional/result/00-base.xml @@ -10,7 +10,7 @@ - creole.general.int2 + creole.general.int2 normal diff --git a/tests/flattener_dicos/10check_valid_differ/result/00-base.xml b/tests/flattener_dicos/10check_valid_differ/result/00-base.xml index 0e3d62bf..0d40273b 100644 --- a/tests/flattener_dicos/10check_valid_differ/result/00-base.xml +++ b/tests/flattener_dicos/10check_valid_differ/result/00-base.xml @@ -5,7 +5,7 @@ normal - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 oui non diff --git a/tests/flattener_dicos/10check_valid_differ_add/result/00-base.xml b/tests/flattener_dicos/10check_valid_differ_add/result/00-base.xml index 5ef78af3..fc596149 100644 --- a/tests/flattener_dicos/10check_valid_differ_add/result/00-base.xml +++ b/tests/flattener_dicos/10check_valid_differ_add/result/00-base.xml @@ -26,16 +26,16 @@ - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 - creole.general.mode_conteneur_actif2 + creole.general.mode_conteneur_actif2 - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 - creole.general.mode_conteneur_actif2 + creole.general.mode_conteneur_actif2 mandatory normal diff --git a/tests/flattener_dicos/10check_valid_differ_removecheck/result/00-base.xml b/tests/flattener_dicos/10check_valid_differ_removecheck/result/00-base.xml index 4c012269..d3646abd 100644 --- a/tests/flattener_dicos/10check_valid_differ_removecheck/result/00-base.xml +++ b/tests/flattener_dicos/10check_valid_differ_removecheck/result/00-base.xml @@ -26,10 +26,10 @@ - creole.general.mode_conteneur_actif1 + creole.general.mode_conteneur_actif1 - creole.general.mode_conteneur_actif2 + creole.general.mode_conteneur_actif2 mandatory normal diff --git a/tests/flattener_dicos/10check_valid_ipnetmask/result/00-base.xml b/tests/flattener_dicos/10check_valid_ipnetmask/result/00-base.xml index 3479a38f..73b07ef5 100644 --- a/tests/flattener_dicos/10check_valid_ipnetmask/result/00-base.xml +++ b/tests/flattener_dicos/10check_valid_ipnetmask/result/00-base.xml @@ -16,7 +16,7 @@ - creole.general.adresse_ip_eth0 + creole.general.adresse_ip_eth0 mandatory basic diff --git a/tests/flattener_dicos/10load_masterslaves/result/00-base.xml b/tests/flattener_dicos/10load_masterslaves/result/00-base.xml index 49f9a7d6..ae3075fe 100644 --- a/tests/flattener_dicos/10load_masterslaves/result/00-base.xml +++ b/tests/flattener_dicos/10load_masterslaves/result/00-base.xml @@ -25,7 +25,7 @@ normal - creole.general1.master.slave1 + creole.general1.master.slave1 diff --git a/tests/flattener_dicos/10load_masterslaves_description/result/00-base.xml b/tests/flattener_dicos/10load_masterslaves_description/result/00-base.xml index 2197054a..b17a5b5a 100644 --- a/tests/flattener_dicos/10load_masterslaves_description/result/00-base.xml +++ b/tests/flattener_dicos/10load_masterslaves_description/result/00-base.xml @@ -25,7 +25,7 @@ normal - creole.general1.master.slave1 + creole.general1.master.slave1 diff --git a/tests/flattener_dicos/10masterslave_autosaveexpert/result/00-base.xml b/tests/flattener_dicos/10masterslave_autosaveexpert/result/00-base.xml index de99fb93..ffbe7a70 100644 --- a/tests/flattener_dicos/10masterslave_autosaveexpert/result/00-base.xml +++ b/tests/flattener_dicos/10masterslave_autosaveexpert/result/00-base.xml @@ -22,7 +22,7 @@ expert - creole.general.master.slave1 + creole.general.master.slave1 diff --git a/tests/flattener_dicos/10masterslave_mandatory/result/00-base.xml b/tests/flattener_dicos/10masterslave_mandatory/result/00-base.xml index 869457e8..629553e6 100644 --- a/tests/flattener_dicos/10masterslave_mandatory/result/00-base.xml +++ b/tests/flattener_dicos/10masterslave_mandatory/result/00-base.xml @@ -23,7 +23,7 @@ normal - creole.general.master.slave1 + creole.general.master.slave1 diff --git a/tests/flattener_dicos/10masterslave_mastermandatory/result/00-base.xml b/tests/flattener_dicos/10masterslave_mastermandatory/result/00-base.xml index 30386779..7f4c6051 100644 --- a/tests/flattener_dicos/10masterslave_mastermandatory/result/00-base.xml +++ b/tests/flattener_dicos/10masterslave_mastermandatory/result/00-base.xml @@ -24,7 +24,7 @@ normal - creole.general.master.slave1 + creole.general.master.slave1 diff --git a/tests/flattener_dicos/10masterslave_multi/result/00-base.xml b/tests/flattener_dicos/10masterslave_multi/result/00-base.xml index 13890768..3ecf24f1 100644 --- a/tests/flattener_dicos/10masterslave_multi/result/00-base.xml +++ b/tests/flattener_dicos/10masterslave_multi/result/00-base.xml @@ -25,7 +25,7 @@ normal - creole.general1.master.slave1 + creole.general1.master.slave1 diff --git a/tests/flattener_dicos/10masterslaves_append/result/00-base.xml b/tests/flattener_dicos/10masterslaves_append/result/00-base.xml index 0600edfb..d30e3b74 100644 --- a/tests/flattener_dicos/10masterslaves_append/result/00-base.xml +++ b/tests/flattener_dicos/10masterslaves_append/result/00-base.xml @@ -25,7 +25,7 @@ normal - creole.general1.master.slave1 + creole.general1.master.slave1 diff --git a/tests/flattener_dicos/10masterslaves_auto/result/00-base.xml b/tests/flattener_dicos/10masterslaves_auto/result/00-base.xml index 8b5f0721..93c36e41 100644 --- a/tests/flattener_dicos/10masterslaves_auto/result/00-base.xml +++ b/tests/flattener_dicos/10masterslaves_auto/result/00-base.xml @@ -28,7 +28,7 @@ hidden normal - creole.general.master.slave1 + creole.general.master.slave1 @@ -37,7 +37,7 @@ hidden normal - creole.general.master.master + creole.general.master.master diff --git a/tests/flattener_dicos/10masterslaves_automaster/result/00-base.xml b/tests/flattener_dicos/10masterslaves_automaster/result/00-base.xml index 3040e55f..a7fa7d42 100644 --- a/tests/flattener_dicos/10masterslaves_automaster/result/00-base.xml +++ b/tests/flattener_dicos/10masterslaves_automaster/result/00-base.xml @@ -28,7 +28,7 @@ hidden normal - creole.general.master.master + creole.general.master.master diff --git a/tests/flattener_dicos/10masterslaves_familyaccent/result/00-base.xml b/tests/flattener_dicos/10masterslaves_familyaccent/result/00-base.xml index f462f371..190353f9 100644 --- a/tests/flattener_dicos/10masterslaves_familyaccent/result/00-base.xml +++ b/tests/flattener_dicos/10masterslaves_familyaccent/result/00-base.xml @@ -22,7 +22,7 @@ normal - creole.general.master.slave1 + creole.general.master.slave1 diff --git a/tests/flattener_dicos/60extra_help/result/00-base.xml b/tests/flattener_dicos/60extra_help/result/00-base.xml index 0f9edc13..18f33cc1 100644 --- a/tests/flattener_dicos/60extra_help/result/00-base.xml +++ b/tests/flattener_dicos/60extra_help/result/00-base.xml @@ -43,7 +43,7 @@ normal non - creole.general.activer_ejabberd + creole.general.activer_ejabberd none daily diff --git a/tests/flattener_dicos/60extra_load/result/00-base.xml b/tests/flattener_dicos/60extra_load/result/00-base.xml index 36df5d3a..4345e6b2 100644 --- a/tests/flattener_dicos/60extra_load/result/00-base.xml +++ b/tests/flattener_dicos/60extra_load/result/00-base.xml @@ -43,7 +43,7 @@ normal non - creole.general.activer_ejabberd + creole.general.activer_ejabberd none daily diff --git a/tests/flattener_dicos/60extra_mandatory/result/00-base.xml b/tests/flattener_dicos/60extra_mandatory/result/00-base.xml index fef7a21d..3deb5be8 100644 --- a/tests/flattener_dicos/60extra_mandatory/result/00-base.xml +++ b/tests/flattener_dicos/60extra_mandatory/result/00-base.xml @@ -43,7 +43,7 @@ normal non - creole.general.activer_ejabberd + creole.general.activer_ejabberd none daily diff --git a/tests/flattener_dicos/60extra_redefine/result/00-base.xml b/tests/flattener_dicos/60extra_redefine/result/00-base.xml index 05bb6f41..735e8138 100644 --- a/tests/flattener_dicos/60extra_redefine/result/00-base.xml +++ b/tests/flattener_dicos/60extra_redefine/result/00-base.xml @@ -46,7 +46,7 @@ normal non - creole.general.activer_ejabberd + creole.general.activer_ejabberd none daily