Compare commits
3 Commits
55c3021a5d
...
fc686e9b7f
Author | SHA1 | Date |
---|---|---|
Emmanuel Garette | fc686e9b7f | |
Emmanuel Garette | 6a12504e8c | |
Emmanuel Garette | e11105db32 |
|
@ -1,6 +1,8 @@
|
||||||
# Paramètre de type information
|
# 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 :
|
||||||
|
|
||||||
```
|
```
|
||||||
<param type="information">server_name</param>
|
<param type="information">server_name</param>
|
||||||
|
@ -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.
|
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".
|
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 :
|
||||||
|
|
||||||
|
```
|
||||||
|
<param type="target_information">test</param>
|
||||||
|
<param type="target_information">help</param>
|
||||||
|
```
|
||||||
|
|
||||||
|
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".
|
||||||
|
|
|
@ -29,6 +29,8 @@ En plus de la description, il est possible de préciser une aide complémentaire
|
||||||
<variable name="my_variable" help="This is a greate variable"/>
|
<variable name="my_variable" help="This is a greate variable"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Cette aide peut être utilisé à tout moment comme valeur [d'un paramètre](../param/information.md).
|
||||||
|
|
||||||
## Le type de la variable
|
## Le type de la variable
|
||||||
|
|
||||||
Une variable a un type. Ce type permet de définir les valeurs acceptées par cette 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 "|" :
|
||||||
<variable name="my_variable" test="yes|no"/>
|
<variable name="my_variable" test="yes|no"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Cette valeur peut être utilisé à tout moment comme valeur [d'un paramètre](../param/information.md).
|
||||||
|
|
||||||
## Mode de la variable
|
## 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).
|
Le [mode](../mode.md) par défaut d'une variable correspond au [mode](../mode.md) de la [famille](../family/README.md).
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT param (#PCDATA)>
|
<!ELEMENT param (#PCDATA)>
|
||||||
<!ATTLIST param type (string|number|nil|boolean|variable|information|suffix|index) "string">
|
<!ATTLIST param type (string|number|nil|boolean|variable|information|target_information|suffix|index) "string">
|
||||||
<!ATTLIST param name CDATA #IMPLIED>
|
<!ATTLIST param name CDATA #IMPLIED>
|
||||||
<!ATTLIST param propertyerror (True|False) "True">
|
<!ATTLIST param propertyerror (True|False) "True">
|
||||||
<!ATTLIST param optional (True|False) "False">
|
<!ATTLIST param optional (True|False) "False">
|
||||||
|
|
|
@ -241,7 +241,7 @@ class RougailBaseTemplate:
|
||||||
variable = filevar['variable']
|
variable = filevar['variable']
|
||||||
else:
|
else:
|
||||||
variable = None
|
variable = None
|
||||||
filenames = filevar['name']
|
filenames = filevar.get('name')
|
||||||
if not isinstance(filenames, list):
|
if not isinstance(filenames, list):
|
||||||
filenames = [filenames]
|
filenames = [filenames]
|
||||||
if variable and not isinstance(variable, list):
|
if variable and not isinstance(variable, list):
|
||||||
|
|
|
@ -252,6 +252,8 @@ class Common:
|
||||||
return self.build_option_param(param)
|
return self.build_option_param(param)
|
||||||
if param.type == 'information':
|
if param.type == 'information':
|
||||||
return f'ParamInformation("{param.text}", None)'
|
return f'ParamInformation("{param.text}", None)'
|
||||||
|
if param.type == 'target_information':
|
||||||
|
return f'ParamSelfInformation("{param.text}", None)'
|
||||||
if param.type == 'suffix':
|
if param.type == 'suffix':
|
||||||
return 'ParamSuffix()'
|
return 'ParamSuffix()'
|
||||||
if param.type == 'index':
|
if param.type == 'index':
|
||||||
|
|
|
@ -167,6 +167,9 @@ class RougailUpgrade:
|
||||||
raise UpgradeError(_(f'cannot convert param with type "{type}"'))
|
raise UpgradeError(_(f'cannot convert param with type "{type}"'))
|
||||||
if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib:
|
if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib:
|
||||||
subsubsubelement.attrib['type'] = 'number'
|
subsubsubelement.attrib['type'] = 'number'
|
||||||
|
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 subsubelement.attrib['name'] == 'valid_enum' and not type:
|
||||||
if subsubsubelement.attrib.get('name') == 'checkval':
|
if subsubsubelement.attrib.get('name') == 'checkval':
|
||||||
raise UpgradeError(_('checkval in valid_enum is no more supported'))
|
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', []):
|
if subsubelement.tag == 'fill' and subsubelement.attrib['target'] in upgrade_help.get('fills', {}).get('remove', []):
|
||||||
subelement.remove(subsubelement)
|
subelement.remove(subsubelement)
|
||||||
continue
|
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', []):
|
if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
subelement.remove(subsubelement)
|
subelement.remove(subsubelement)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<rougail version="0.9">
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service name='nut'>
|
||||||
|
<ip>nut_monitor_host</ip>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<variables>
|
||||||
|
<variable name="nut_monitor_host" type="ip" mandatory='True' disabled="True">
|
||||||
|
<value>192.168.0.1</value>
|
||||||
|
</variable>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"services.nut.ip.nut_monitor_host.activate": true,
|
||||||
|
"services.nut.activate": true,
|
||||||
|
"services.nut.manage": true
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
[Service]
|
||||||
|
IPAddressDeny=any
|
|
@ -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])
|
Loading…
Reference in New Issue