eole => variable

This commit is contained in:
Emmanuel Garette 2019-12-22 08:58:37 +01:00
parent 81028d1539
commit 3881cb7e98
30 changed files with 58 additions and 52 deletions

View file

@ -2,20 +2,20 @@
<!-- ===================================================================== -->
<!-- Definition de la DTD du fichier creole -->
<!-- Rougail's DTD -->
<!-- ===================================================================== -->
<!--
# Conception :
# Eole (http://eole.orion.education.fr)
# Created by:
# EOLE (http://eole.orion.education.fr)
# Copyright (C) 2005-2018
# distribue sous la licence GPL-2
# Forked by:
# Cadoles (http://www.cadoles.com)
# Copyright (C) 2019
# En attendant une traduction officielle de la GPL, la notice de
# copyright demeure en anglais.
# 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
@ -30,10 +30,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
# Se reporter a la documentation envoyee avec le programme pour la notice.
-->
<!--================ -->
<!-- root element -->
<!-- =============== -->
@ -218,7 +217,7 @@
<!ATTLIST group description CDATA #IMPLIED>
<!ELEMENT param (#PCDATA)>
<!ATTLIST param type (string|eole|number|container|context|python) "string">
<!ATTLIST param type (string|eole|variable|number|container|context|python) "string">
<!ATTLIST param name CDATA #IMPLIED>
<!ATTLIST param hidden (True|False) "True">
<!ATTLIST param optional (True|False) "False">

View file

@ -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

View file

@ -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

View file

@ -12,7 +12,7 @@
<property>mandatory</property>
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param>
<param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View file

@ -12,7 +12,7 @@
<property>basic</property>
<property expected="oui" inverse="True" source="creole.general.module_instancie" type="calculation">auto_frozen</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param>
<param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View file

@ -10,7 +10,7 @@
<property>mandatory</property>
<property>basic</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param>
<param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View file

@ -12,7 +12,7 @@
<property>mandatory</property>
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param>
<param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View file

@ -12,7 +12,7 @@
<property>mandatory</property>
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param>
<param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View file

@ -7,7 +7,7 @@
<property>mandatory</property>
<property>expert</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param>
<param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View file

@ -12,7 +12,7 @@
<property>mandatory</property>
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param>
<param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View file

@ -16,7 +16,7 @@
<variable doc="No change" multi="False" name="int" type="number">
<check name="valid_entier" warnings_only="False">
<param name="mini" type="string">0</param>
<param name="maxi" type="eole">creole.general.int2</param>
<param name="maxi" type="variable">creole.general.int2</param>
</check>
<property>normal</property>
</variable>

View file

@ -10,7 +10,7 @@
</variable>
<variable doc="No change" multi="False" name="int" type="number">
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.int2</param>
<param type="variable">creole.general.int2</param>
</check>
<check name="valid_not_equal" warnings_only="False"/>
<property>normal</property>

View file

@ -5,7 +5,7 @@
<property>normal</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param>
<param type="variable">creole.general.mode_conteneur_actif1</param>
</check>
<choice type="string">oui</choice>
<choice type="string">non</choice>

View file

@ -26,16 +26,16 @@
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string">
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param>
<param type="variable">creole.general.mode_conteneur_actif1</param>
</check>
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif2</param>
<param type="variable">creole.general.mode_conteneur_actif2</param>
</check>
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param>
<param type="variable">creole.general.mode_conteneur_actif1</param>
</check>
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif2</param>
<param type="variable">creole.general.mode_conteneur_actif2</param>
</check>
<property>mandatory</property>
<property>normal</property>

View file

@ -26,10 +26,10 @@
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string">
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param>
<param type="variable">creole.general.mode_conteneur_actif1</param>
</check>
<check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif2</param>
<param type="variable">creole.general.mode_conteneur_actif2</param>
</check>
<property>mandatory</property>
<property>normal</property>

View file

@ -16,7 +16,7 @@
</variable>
<variable doc="Masque de sous réseau de la carte" multi="False" name="adresse_netmask_eth0" type="netmask">
<check name="valid_ip_netmask" warnings_only="True">
<param type="eole">creole.general.adresse_ip_eth0</param>
<param type="variable">creole.general.adresse_ip_eth0</param>
</check>
<property>mandatory</property>
<property>basic</property>

View file

@ -25,7 +25,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general1.master.slave1</param>
<param transitive="False" type="variable">creole.general1.master.slave1</param>
</value>
</variable>
</leader>

View file

@ -25,7 +25,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general1.master.slave1</param>
<param transitive="False" type="variable">creole.general1.master.slave1</param>
</value>
</variable>
</leader>

View file

@ -22,7 +22,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>expert</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param>
<param transitive="False" type="variable">creole.general.master.slave1</param>
</value>
</variable>
</leader>

View file

@ -23,7 +23,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param>
<param transitive="False" type="variable">creole.general.master.slave1</param>
</value>
</variable>
</leader>

View file

@ -24,7 +24,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param>
<param transitive="False" type="variable">creole.general.master.slave1</param>
</value>
</variable>
</leader>

View file

@ -25,7 +25,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general1.master.slave1</param>
<param transitive="False" type="variable">creole.general1.master.slave1</param>
</value>
</variable>
</leader>

View file

@ -25,7 +25,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general1.master.slave1</param>
<param transitive="False" type="variable">creole.general1.master.slave1</param>
</value>
</variable>
<variable doc="slave3" multi="True" name="slave3" type="string">

View file

@ -28,7 +28,7 @@
<property>hidden</property>
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param>
<param transitive="False" type="variable">creole.general.master.slave1</param>
</value>
</variable>
<variable doc="slave3" multi="True" name="slave3" type="string">
@ -37,7 +37,7 @@
<property>hidden</property>
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.master</param>
<param transitive="False" type="variable">creole.general.master.master</param>
</value>
</variable>
</leader>

View file

@ -28,7 +28,7 @@
<property>hidden</property>
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.master</param>
<param transitive="False" type="variable">creole.general.master.master</param>
</value>
</variable>
</leader>

View file

@ -22,7 +22,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param>
<param transitive="False" type="variable">creole.general.master.slave1</param>
</value>
</variable>
</leader>

View file

@ -43,7 +43,7 @@
<property>normal</property>
<value name="calc_multi_condition" type="calculation">
<param transitive="False" type="string">non</param>
<param name="condition_1" type="eole">creole.general.activer_ejabberd</param>
<param name="condition_1" type="variable">creole.general.activer_ejabberd</param>
<param name="match" transitive="False" type="string">none</param>
<param name="mismatch" transitive="False" type="string">daily</param>
</value>

View file

@ -43,7 +43,7 @@
<property>normal</property>
<value name="calc_multi_condition" type="calculation">
<param transitive="False" type="string">non</param>
<param name="condition_1" type="eole">creole.general.activer_ejabberd</param>
<param name="condition_1" type="variable">creole.general.activer_ejabberd</param>
<param name="match" transitive="False" type="string">none</param>
<param name="mismatch" transitive="False" type="string">daily</param>
</value>

View file

@ -43,7 +43,7 @@
<property>normal</property>
<value name="calc_multi_condition" type="calculation">
<param transitive="False" type="string">non</param>
<param name="condition_1" type="eole">creole.general.activer_ejabberd</param>
<param name="condition_1" type="variable">creole.general.activer_ejabberd</param>
<param name="match" transitive="False" type="string">none</param>
<param name="mismatch" transitive="False" type="string">daily</param>
</value>

View file

@ -46,7 +46,7 @@
<property>normal</property>
<value name="calc_multi_condition" type="calculation">
<param transitive="False" type="string">non</param>
<param name="condition_1" type="eole">creole.general.activer_ejabberd</param>
<param name="condition_1" type="variable">creole.general.activer_ejabberd</param>
<param name="match" transitive="False" type="string">none</param>
<param name="mismatch" transitive="False" type="string">daily</param>
</value>