variable is add to information target
This commit is contained in:
parent
764390d8ca
commit
a2c3a1bb3a
33 changed files with 329 additions and 35 deletions
|
@ -17,26 +17,52 @@ param:
|
||||||
```
|
```
|
||||||
|
|
||||||
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" ou [] pour une variable multiple.
|
||||||
|
|
||||||
## Les informations de la cible
|
## Les informations d'une variable
|
||||||
|
|
||||||
Le paramètre peut être la valeur est issue d'une information de la cible du calcul :
|
Le paramètre peut être la valeur est issue d'une information d'une variable :
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<param type="target_information">test</param>
|
<param type="information" variable="a_variable">test</param>
|
||||||
<param type="target_information">help</param>
|
<param type="information" variable="a_variable">help</param>
|
||||||
```
|
```
|
||||||
|
|
||||||
En YAML :
|
En YAML :
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
param:
|
param:
|
||||||
- type: target_information
|
- type: information
|
||||||
|
variable: a_variable
|
||||||
text: test
|
text: test
|
||||||
- type: target_information
|
- type: information
|
||||||
|
variable: a_variable
|
||||||
text: help
|
text: help
|
||||||
```
|
```
|
||||||
|
|
||||||
Dans ce cas, l'information de la configuration "test" ou "help" sera utilisé comme valeur du paramètre.
|
Dans ce cas, l'information de la variable "a_variable" "test" ou "help" sera utilisée 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" ou [] pour une variable multiple.
|
||||||
|
|
||||||
|
## Les informations de la cible
|
||||||
|
|
||||||
|
Le paramètre peut être la valeur est issue d'une information de la cible du calcul (la target) :
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<param type="information" variable="target_variable">test</param>
|
||||||
|
<param type="information" variable="target_variable">help</param>
|
||||||
|
```
|
||||||
|
|
||||||
|
En YAML :
|
||||||
|
|
||||||
|
```yml
|
||||||
|
param:
|
||||||
|
- type: information
|
||||||
|
variable: target_variable
|
||||||
|
text: test
|
||||||
|
- type: information
|
||||||
|
variable: target_variable
|
||||||
|
text: help
|
||||||
|
```
|
||||||
|
|
||||||
|
Dans ce cas, l'information de la variable de la cible (target_variable) "test" ou "help" sera utilisée comme valeur du paramètre.
|
||||||
|
Si l'information n'existe pas, la paramètre aura la valeur "None" ou [] pour une variable multiple.
|
||||||
|
|
|
@ -62,6 +62,9 @@ class ParamAnnotator:
|
||||||
if param.type in ['suffix', 'index']:
|
if param.type in ['suffix', 'index']:
|
||||||
msg = _(f'"{param.type}" parameter must not have a value')
|
msg = _(f'"{param.type}" parameter must not have a value')
|
||||||
raise DictConsistencyError(msg, 28, obj.xmlfiles)
|
raise DictConsistencyError(msg, 28, obj.xmlfiles)
|
||||||
|
if param.type != 'information' and hasattr(param, 'variable'):
|
||||||
|
msg = _(f'"{param.type}" parameter must not have variable attribut')
|
||||||
|
raise DictConsistencyError(msg, 90, obj.xmlfiles)
|
||||||
if param.type in ['nil', 'space']:
|
if param.type in ['nil', 'space']:
|
||||||
if param.text is not None:
|
if param.text is not None:
|
||||||
msg = _(f'"{param.type}" parameter must not have a value')
|
msg = _(f'"{param.type}" parameter must not have a value')
|
||||||
|
@ -103,6 +106,18 @@ class ParamAnnotator:
|
||||||
if param_idx != 0:
|
if param_idx != 0:
|
||||||
msg = _(f'function "{param.text}" must only set has first parameter')
|
msg = _(f'function "{param.text}" must only set has first parameter')
|
||||||
raise DictConsistencyError(msg, 75, param.xmlfiles)
|
raise DictConsistencyError(msg, 75, param.xmlfiles)
|
||||||
|
elif param.type == 'information':
|
||||||
|
if hasattr(param, 'variable'):
|
||||||
|
try:
|
||||||
|
param.variable = self.objectspace.paths.get_family(param.variable,
|
||||||
|
current_namespace=obj.namespace,
|
||||||
|
path_prefix=path_prefix,
|
||||||
|
)
|
||||||
|
except DictConsistencyError:
|
||||||
|
param.variable = self.objectspace.paths.get_variable(param.variable,
|
||||||
|
namespace=obj.namespace,
|
||||||
|
force_path_prefix=path_prefix,
|
||||||
|
)
|
||||||
elif variable_type:
|
elif variable_type:
|
||||||
self._convert_with_variable_type(variable_type, param)
|
self._convert_with_variable_type(variable_type, param)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -92,6 +92,8 @@
|
||||||
<!ATTLIST certificate authority CDATA #REQUIRED>
|
<!ATTLIST certificate authority CDATA #REQUIRED>
|
||||||
<!ATTLIST certificate owner CDATA #IMPLIED>
|
<!ATTLIST certificate owner CDATA #IMPLIED>
|
||||||
<!ATTLIST certificate owner_type (unix_user|variable) "unix_user">
|
<!ATTLIST certificate owner_type (unix_user|variable) "unix_user">
|
||||||
|
<!ATTLIST certificate group CDATA #IMPLIED>
|
||||||
|
<!ATTLIST certificate group_type (unix_user|variable) "unix_user">
|
||||||
<!ATTLIST certificate server CDATA #IMPLIED>
|
<!ATTLIST certificate server CDATA #IMPLIED>
|
||||||
<!ATTLIST certificate server_type (variable) "variable">
|
<!ATTLIST certificate server_type (variable) "variable">
|
||||||
<!ATTLIST certificate domain CDATA #IMPLIED>
|
<!ATTLIST certificate domain CDATA #IMPLIED>
|
||||||
|
@ -101,6 +103,7 @@
|
||||||
<!ATTLIST certificate format (cert_key|pem) "cert_key">
|
<!ATTLIST certificate format (cert_key|pem) "cert_key">
|
||||||
<!ATTLIST certificate type (client|server) "client">
|
<!ATTLIST certificate type (client|server) "client">
|
||||||
<!ATTLIST certificate redefine (True|False) "False">
|
<!ATTLIST certificate redefine (True|False) "False">
|
||||||
|
<!ATTLIST certificate certificatelist CDATA #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT variables ((variable*|family*)*)>
|
<!ELEMENT variables ((variable*|family*)*)>
|
||||||
|
|
||||||
|
@ -160,11 +163,12 @@
|
||||||
<!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|space|boolean|variable|function|information|target_information|suffix|index) "string">
|
<!ATTLIST param type (string|number|nil|space|boolean|variable|function|information|suffix|index) "string">
|
||||||
<!ATTLIST param name CDATA #IMPLIED>
|
<!ATTLIST param name CDATA #IMPLIED>
|
||||||
|
<!ATTLIST param variable 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">
|
||||||
|
|
||||||
<!ELEMENT target (#PCDATA)>
|
<!ELEMENT target (#PCDATA)>
|
||||||
<!ATTLIST target type (variable|family|servicelist|filelist|iplist) "variable">
|
<!ATTLIST target type (variable|family|servicelist|filelist|iplist|certificatelist) "variable">
|
||||||
<!ATTLIST target optional (True|False) "False">
|
<!ATTLIST target optional (True|False) "False">
|
||||||
|
|
|
@ -114,6 +114,8 @@ mapping:
|
||||||
enum:
|
enum:
|
||||||
- "string"
|
- "string"
|
||||||
- "variable"
|
- "variable"
|
||||||
|
certificatelist:
|
||||||
|
type: str
|
||||||
redefine:
|
redefine:
|
||||||
type: bool
|
type: bool
|
||||||
type:
|
type:
|
||||||
|
@ -144,6 +146,13 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
server:
|
server:
|
||||||
type: str
|
type: str
|
||||||
|
group_type:
|
||||||
|
type: str
|
||||||
|
enum:
|
||||||
|
- "unix_user"
|
||||||
|
- "variable"
|
||||||
|
group:
|
||||||
|
type: str
|
||||||
owner_type:
|
owner_type:
|
||||||
type: str
|
type: str
|
||||||
enum:
|
enum:
|
||||||
|
@ -215,13 +224,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -361,13 +371,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -508,13 +519,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -687,13 +699,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -833,13 +846,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -996,13 +1010,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -1142,13 +1157,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -1305,13 +1321,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
type:
|
type:
|
||||||
|
@ -1440,6 +1457,7 @@ mapping:
|
||||||
- "servicelist"
|
- "servicelist"
|
||||||
- "filelist"
|
- "filelist"
|
||||||
- "iplist"
|
- "iplist"
|
||||||
|
- "certificatelist"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
param:
|
param:
|
||||||
|
@ -1462,13 +1480,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
name:
|
name:
|
||||||
|
@ -1496,6 +1515,7 @@ mapping:
|
||||||
- "servicelist"
|
- "servicelist"
|
||||||
- "filelist"
|
- "filelist"
|
||||||
- "iplist"
|
- "iplist"
|
||||||
|
- "certificatelist"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
param:
|
param:
|
||||||
|
@ -1518,13 +1538,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
name:
|
name:
|
||||||
|
@ -1557,6 +1578,7 @@ mapping:
|
||||||
- "servicelist"
|
- "servicelist"
|
||||||
- "filelist"
|
- "filelist"
|
||||||
- "iplist"
|
- "iplist"
|
||||||
|
- "certificatelist"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
param:
|
param:
|
||||||
|
@ -1579,13 +1601,14 @@ mapping:
|
||||||
- "variable"
|
- "variable"
|
||||||
- "function"
|
- "function"
|
||||||
- "information"
|
- "information"
|
||||||
- "target_information"
|
|
||||||
- "suffix"
|
- "suffix"
|
||||||
- "index"
|
- "index"
|
||||||
optional:
|
optional:
|
||||||
type: bool
|
type: bool
|
||||||
propertyerror:
|
propertyerror:
|
||||||
type: bool
|
type: bool
|
||||||
|
variable:
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
name:
|
name:
|
||||||
|
|
0
tests/dictionaries/10fill_option_information/__init__.py
Normal file
0
tests/dictionaries/10fill_option_information/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.general.variable": "value"}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.general.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"rougail.general.variable": null,
|
||||||
|
"rougail.general.mode_conteneur_actif": "value"
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.general.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value"
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,11 +19,11 @@ try:
|
||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_2 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
option_2 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
||||||
option_5 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_2)))), properties=frozenset({"normal"}))
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_5)))), properties=frozenset({"normal"}))
|
|
||||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, option_3], properties=frozenset({"normal"}))
|
||||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||||
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
optiondescription_7 = OptionDescription(name="1", doc="1", children=[optiondescription_8])
|
||||||
|
option_5 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
||||||
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_5)))), properties=frozenset({"normal"}))
|
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_5)))), properties=frozenset({"normal"}))
|
||||||
optiondescription_4 = OptionDescription(name="general", doc="general", children=[option_5, option_6], properties=frozenset({"normal"}))
|
optiondescription_4 = OptionDescription(name="general", doc="general", children=[option_5, option_6], properties=frozenset({"normal"}))
|
||||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4])
|
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_4])
|
||||||
|
|
15
tests/dictionaries/10fill_option_information/xml/00-base.xml
Normal file
15
tests/dictionaries/10fill_option_information/xml/00-base.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="variable" type="string" description="No change"/>
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change"/>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
<fill name="calc_val">
|
||||||
|
<param type="information" variable="variable">test_information</param>
|
||||||
|
<target>mode_conteneur_actif</target>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
21
tests/dictionaries/10fill_option_information/yml/00-base.yml
Normal file
21
tests/dictionaries/10fill_option_information/yml/00-base.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
version: '0.10'
|
||||||
|
variables:
|
||||||
|
- family:
|
||||||
|
- name: general
|
||||||
|
variables:
|
||||||
|
- variable:
|
||||||
|
- name: variable
|
||||||
|
type: string
|
||||||
|
description: No change
|
||||||
|
- name: mode_conteneur_actif
|
||||||
|
type: string
|
||||||
|
description: No change
|
||||||
|
constraints:
|
||||||
|
- fill:
|
||||||
|
- name: calc_val
|
||||||
|
param:
|
||||||
|
- type: information
|
||||||
|
variable: variable
|
||||||
|
text: test_information
|
||||||
|
target:
|
||||||
|
- text: mode_conteneur_actif
|
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.general.od": "value"}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.general.od.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": null,
|
||||||
|
"rougail.general.od.variable": null
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.general.od.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,13 +18,13 @@ try:
|
||||||
from tiramisu4 import *
|
from tiramisu4 import *
|
||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_8 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
|
||||||
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_8)))), properties=frozenset({"normal"}))
|
|
||||||
option_4 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
option_4 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
||||||
|
option_2 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_4)))), properties=frozenset({"normal"}))
|
||||||
optiondescription_3 = OptionDescription(name="od", doc="od", children=[option_4], properties=frozenset({"normal"}))
|
optiondescription_3 = OptionDescription(name="od", doc="od", children=[option_4], properties=frozenset({"normal"}))
|
||||||
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, optiondescription_3], properties=frozenset({"normal"}))
|
optiondescription_1 = OptionDescription(name="general", doc="general", children=[option_2, optiondescription_3], properties=frozenset({"normal"}))
|
||||||
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_1])
|
||||||
optiondescription_9 = OptionDescription(name="1", doc="1", children=[optiondescription_10])
|
optiondescription_9 = OptionDescription(name="1", doc="1", children=[optiondescription_10])
|
||||||
|
option_8 = StrOption(name="variable", doc="No change", properties=frozenset({"normal"}))
|
||||||
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_8)))), properties=frozenset({"normal"}))
|
option_6 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamInformation("test_information", None, option=option_8)))), properties=frozenset({"normal"}))
|
||||||
optiondescription_7 = OptionDescription(name="od", doc="od", children=[option_8], properties=frozenset({"normal"}))
|
optiondescription_7 = OptionDescription(name="od", doc="od", children=[option_8], properties=frozenset({"normal"}))
|
||||||
optiondescription_5 = OptionDescription(name="general", doc="general", children=[option_6, optiondescription_7], properties=frozenset({"normal"}))
|
optiondescription_5 = OptionDescription(name="general", doc="general", children=[option_6, optiondescription_7], properties=frozenset({"normal"}))
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change"/>
|
||||||
|
<family name="od">
|
||||||
|
<variable name="variable" type="string" description="No change"/>
|
||||||
|
</family>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
<fill name="calc_val">
|
||||||
|
<param type="information" variable="variable">test_information</param>
|
||||||
|
<target>mode_conteneur_actif</target>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
|
@ -0,0 +1,25 @@
|
||||||
|
version: '0.10'
|
||||||
|
variables:
|
||||||
|
- family:
|
||||||
|
- name: general
|
||||||
|
variables:
|
||||||
|
- variable:
|
||||||
|
- name: mode_conteneur_actif
|
||||||
|
type: string
|
||||||
|
description: No change
|
||||||
|
- family:
|
||||||
|
- name: od
|
||||||
|
variables:
|
||||||
|
- variable:
|
||||||
|
- name: variable
|
||||||
|
type: string
|
||||||
|
description: No change
|
||||||
|
constraints:
|
||||||
|
- fill:
|
||||||
|
- name: calc_val
|
||||||
|
param:
|
||||||
|
- type: information
|
||||||
|
variable: variable
|
||||||
|
text: test_information
|
||||||
|
target:
|
||||||
|
- text: mode_conteneur_actif
|
0
tests/dictionaries/10fill_target_information/__init__.py
Normal file
0
tests/dictionaries/10fill_target_information/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.general.mode_conteneur_actif": "value"}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": "value"
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value"
|
||||||
|
}
|
||||||
|
}
|
14
tests/dictionaries/10fill_target_information/xml/00-base.xml
Normal file
14
tests/dictionaries/10fill_target_information/xml/00-base.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change"/>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
<fill name="calc_val">
|
||||||
|
<param type="information" variable="mode_conteneur_actif">test_information</param>
|
||||||
|
<target>mode_conteneur_actif</target>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
18
tests/dictionaries/10fill_target_information/yml/00-base.yml
Normal file
18
tests/dictionaries/10fill_target_information/yml/00-base.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
version: '0.10'
|
||||||
|
variables:
|
||||||
|
- family:
|
||||||
|
- name: general
|
||||||
|
variables:
|
||||||
|
- variable:
|
||||||
|
- name: mode_conteneur_actif
|
||||||
|
type: string
|
||||||
|
description: No change
|
||||||
|
constraints:
|
||||||
|
- fill:
|
||||||
|
- name: calc_val
|
||||||
|
param:
|
||||||
|
- type: information
|
||||||
|
variable: mode_conteneur_actif
|
||||||
|
text: test_information
|
||||||
|
target:
|
||||||
|
- text: mode_conteneur_actif
|
0
tests/dictionaries/80fill_option/__init__.py
Normal file
0
tests/dictionaries/80fill_option/__init__.py
Normal file
0
tests/dictionaries/80fill_option/errno_90
Normal file
0
tests/dictionaries/80fill_option/errno_90
Normal file
17
tests/dictionaries/80fill_option/xml/00-base.xml
Normal file
17
tests/dictionaries/80fill_option/xml/00-base.xml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change"/>
|
||||||
|
<variable name="mode_conteneur_actif1" type="string" description="No change">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
<fill name="calc_val">
|
||||||
|
<param type="variable" variable="mode_conteneur_actif1">mode_conteneur_actif1</param>
|
||||||
|
<target>mode_conteneur_actif</target>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
23
tests/dictionaries/80fill_option/yml/00-base.yml
Normal file
23
tests/dictionaries/80fill_option/yml/00-base.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
version: '0.10'
|
||||||
|
variables:
|
||||||
|
- family:
|
||||||
|
- name: general
|
||||||
|
variables:
|
||||||
|
- variable:
|
||||||
|
- name: mode_conteneur_actif
|
||||||
|
type: string
|
||||||
|
description: No change
|
||||||
|
- name: mode_conteneur_actif1
|
||||||
|
type: string
|
||||||
|
description: No change
|
||||||
|
value:
|
||||||
|
- text: non
|
||||||
|
constraints:
|
||||||
|
- fill:
|
||||||
|
- name: calc_val
|
||||||
|
param:
|
||||||
|
- type: variable
|
||||||
|
variable: mode_conteneur_actif1
|
||||||
|
text: mode_conteneur_actif1
|
||||||
|
target:
|
||||||
|
- text: mode_conteneur_actif
|
|
@ -44,6 +44,7 @@ def launch_flattener(test_dir,
|
||||||
makedict_file = join(makedict_dir, 'base.json')
|
makedict_file = join(makedict_dir, 'base.json')
|
||||||
makedict_before = join(makedict_dir, 'before.json')
|
makedict_before = join(makedict_dir, 'before.json')
|
||||||
makedict_after = join(makedict_dir, 'after.json')
|
makedict_after = join(makedict_dir, 'after.json')
|
||||||
|
informations_file = join(test_dir, 'informations.json')
|
||||||
|
|
||||||
modulepath = test_dir.replace('/', '.') + f'.tiramisu.{filename}'
|
modulepath = test_dir.replace('/', '.') + f'.tiramisu.{filename}'
|
||||||
mod = __import__(modulepath)
|
mod = __import__(modulepath)
|
||||||
|
@ -51,9 +52,9 @@ def launch_flattener(test_dir,
|
||||||
mod = getattr(mod, token)
|
mod = getattr(mod, token)
|
||||||
config = Config(mod.option_0)
|
config = Config(mod.option_0)
|
||||||
# change default rights
|
# change default rights
|
||||||
ro_origin = config.property.getdefault('read_only', 'append')
|
ro_origin = config.property.default('read_only', 'append')
|
||||||
ro_append = frozenset(ro_origin - {'force_store_value'})
|
ro_append = frozenset(ro_origin - {'force_store_value'})
|
||||||
rw_origin = config.property.getdefault('read_write', 'append')
|
rw_origin = config.property.default('read_write', 'append')
|
||||||
rw_append = frozenset(rw_origin - {'force_store_value'})
|
rw_append = frozenset(rw_origin - {'force_store_value'})
|
||||||
config.property.setdefault(ro_append, 'read_only', 'append')
|
config.property.setdefault(ro_append, 'read_only', 'append')
|
||||||
config.property.setdefault(rw_append, 'read_write', 'append')
|
config.property.setdefault(rw_append, 'read_write', 'append')
|
||||||
|
@ -62,6 +63,15 @@ def launch_flattener(test_dir,
|
||||||
config.property.read_only()
|
config.property.read_only()
|
||||||
config.property.remove('mandatory')
|
config.property.remove('mandatory')
|
||||||
config.information.set('info', 'value')
|
config.information.set('info', 'value')
|
||||||
|
if isfile(informations_file):
|
||||||
|
with open(informations_file) as informations:
|
||||||
|
for key, value in load(informations).items():
|
||||||
|
if filename == 'base':
|
||||||
|
config.option(key).information.set('test_information', value)
|
||||||
|
else:
|
||||||
|
for root in ['1', '2']:
|
||||||
|
config.option(f'{root}.{key}').information.set('test_information', value)
|
||||||
|
#
|
||||||
config_dict = config.value.dict()
|
config_dict = config.value.dict()
|
||||||
if filename == 'base':
|
if filename == 'base':
|
||||||
if not isdir(makedict_dir):
|
if not isdir(makedict_dir):
|
||||||
|
@ -93,10 +103,10 @@ def launch_flattener(test_dir,
|
||||||
#
|
#
|
||||||
value_owner(makedict_before, config, filename)
|
value_owner(makedict_before, config, filename)
|
||||||
# deploy
|
# deploy
|
||||||
ro = config.property.getdefault('read_only', 'append')
|
ro = config.property.default('read_only', 'append')
|
||||||
ro = frozenset(list(ro) + ['force_store_value'])
|
ro = frozenset(list(ro) + ['force_store_value'])
|
||||||
config.property.setdefault(ro, 'read_only', 'append')
|
config.property.setdefault(ro, 'read_only', 'append')
|
||||||
rw = config.property.getdefault('read_write', 'append')
|
rw = config.property.default('read_write', 'append')
|
||||||
rw = frozenset(list(rw) + ['force_store_value'])
|
rw = frozenset(list(rw) + ['force_store_value'])
|
||||||
config.property.setdefault(rw, 'read_write', 'append')
|
config.property.setdefault(rw, 'read_write', 'append')
|
||||||
config.property.add('force_store_value')
|
config.property.add('force_store_value')
|
||||||
|
@ -107,8 +117,8 @@ def launch_flattener(test_dir,
|
||||||
def value_owner(makedict_value_owner, config, filename):
|
def value_owner(makedict_value_owner, config, filename):
|
||||||
ret = {}
|
ret = {}
|
||||||
for key in config.option.list(recursive=True):
|
for key in config.option.list(recursive=True):
|
||||||
path = key.option.path()
|
path = key.path()
|
||||||
if not key.option.issymlinkoption() and key.option.isfollower():
|
if not key.issymlinkoption() and key.isfollower():
|
||||||
value = []
|
value = []
|
||||||
owner = []
|
owner = []
|
||||||
for idx in range(0, key.value.len()):
|
for idx in range(0, key.value.len()):
|
||||||
|
|
|
@ -103,7 +103,7 @@ def templates(test_dir, filename, root, engine_name, only_one=False):
|
||||||
included = False
|
included = False
|
||||||
activate = True
|
activate = True
|
||||||
for service in config.option('services').list('all'):
|
for service in config.option('services').list('all'):
|
||||||
names = [o.option.name() for o in service.list('optiondescription')]
|
names = [o.name() for o in service.list('optiondescription')]
|
||||||
if 'files' in names:
|
if 'files' in names:
|
||||||
for file in service.option('files').list('optiondescription'):
|
for file in service.option('files').list('optiondescription'):
|
||||||
if not file.option('source').value.get() == template:
|
if not file.option('source').value.get() == template:
|
||||||
|
@ -120,10 +120,10 @@ def templates(test_dir, filename, root, engine_name, only_one=False):
|
||||||
# if template is an overrides
|
# if template is an overrides
|
||||||
if not list_results and 'overrides' in names:
|
if not list_results and 'overrides' in names:
|
||||||
for override in service.option('overrides').list('optiondescription'):
|
for override in service.option('overrides').list('optiondescription'):
|
||||||
if override.option.description() == template:
|
if override.description() == template:
|
||||||
return
|
return
|
||||||
# if template is a service
|
# if template is a service
|
||||||
if not list_results and template == service.option.description() and service.information.get('engine', None):
|
if not list_results and template == service.description() and service.information.get('engine', None):
|
||||||
return
|
return
|
||||||
#this file is include and not declared
|
#this file is include and not declared
|
||||||
if template.startswith('inc') and not list_results:
|
if template.startswith('inc') and not list_results:
|
||||||
|
|
Loading…
Reference in a new issue