better support type in params

This commit is contained in:
Emmanuel Garette 2021-02-12 18:08:28 +01:00
parent ce507a84f9
commit 5f76065597
105 changed files with 615 additions and 216 deletions

View file

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

View file

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

View file

@ -8,3 +8,6 @@ FIXME
<!ATTLIST condition fallback (True|False) "False">
<!ATTLIST condition force_condition_on_fallback (True|False) "False">
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
on peut mettre plusieurs param (oui ou maybe)

View file

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

View file

@ -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) :
</variables>
```
Ou dans une autre famille :
```
<variables>
<family name="my_family">
<family name="second_family"/>
</family>
</variables>
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.

View file

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

View file

@ -1,9 +1,4 @@
# Les services
<!ELEMENT services (service*)>
<!ELEMENT service ((port* | ip* | file* | override*)*) >
<!ATTLIST service name CDATA #REQUIRED>
<!ATTLIST service manage (True|False) "True">

View file

@ -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).
<!ELEMENT file EMPTY>
<!ATTLIST file name CDATA #REQUIRED >
<!ATTLIST file file_type (UnicodeOption|variable) "UnicodeOption">
<!ATTLIST file variable CDATA #IMPLIED>
<!ATTLIST file variable_type (variable) "variable">
<!ATTLIST file source CDATA #IMPLIED>
<!ATTLIST file mode CDATA "0644">
<!ATTLIST file owner CDATA "root">
<!ATTLIST file group CDATA "root">
<!ATTLIST file filelist CDATA #IMPLIED >
<!ATTLIST file redefine (True|False) "False">
<!ATTLIST file templating (True|False) "True">
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 :
```
<services>
<service name="squid">
<file name="/etc/squid/squid.conf"/>
</service>
</services>
```
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 :
```
<file name="/etc/squid/squid.conf" source="template-squid.conf"/>
```
## Les noms de fichiers dynamique
Il est possible également de définir le nom du fichier dans une variable :
```
<services>
<service name="squid">
<file name="my_variable" file_type="variable" source="squid.conf"/>
</service>
</services>
<variables>
<variable name="my_variable">
<value>/etc/squid/squid.conf</value>
</variable>
</variables>
```
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 :
```
<services>
<service name="squid">
<file name="my_variable" file_type="variable" source="squid.conf"/>
</service>
</services>
<variables>
<variable name="my_variable" multi="True">
<value>/etc/squid1/squid.conf</value>
<value>/etc/squid2/squid.conf</value>
</variable>
</variables>
```
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 :
```
<services>
<service name="squid">
<file name="my_variable1" file_type="variable" source="squid.conf" variable="my_variable2"/>
</service>
</services>
<variables>
<variable name="my_variable1" multi="True">
<value>/etc/squid1/squid.conf</value>
<value>/etc/squid2/squid.conf</value>
</variable>
<variable name="my_variable2" multi="True">
<value>squid1</value>
<value>squid2</value>
</variable>
</variables>
```
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".
```
<file name="/etc/squid/squid.conf" mode="0640" owner="nobody" group="squid"/>
```
## 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 :
```
<services>
<service name="test">
<file name="/etc/squid/squid.conf" filelist="squid"/>
</service>
</services>
<variables>
<family name="general">
<variable name="condition" type="boolean"/>
</family>
</variables>
<constraints>
<condition name="disabled_if_in" source="condition">
<param>False</param>
<target type="filelist">squid</target>
</condition>
</constraints>
```
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 :
```
<file name="/etc/squid/squid.conf" source="template-squid.conf" redefine="True"/>
```
## 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é) :
```
<file name="/etc/squid/squid.conf" templating="none"/>
```

View file

@ -1,7 +1,35 @@
# Override
FIXME
## La balise override
<!ELEMENT override EMPTY>
<!ATTLIST override source CDATA #IMPLIED >
<!ATTLIST override templating (True|False) "True">
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 :
```
<services>
<service name="squid">
<override/>
</service>
</services>
```
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 :
```
<override source="test.service"/>
```
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é) :
```
<override templating="none"/>
```

View file

@ -1,7 +1,61 @@
# Port
<!ELEMENT port (#PCDATA)>
<!ATTLIST port port_type (PortOption|variable) "PortOption">
<!ATTLIST port portlist CDATA #IMPLIED >
<!ATTLIST port protocol (tcp|udp) "tcp">
## La balise port
La balise port permet d'associer un port à service :
```
<services>
<service name="squid">
<port>3128</port>
</service>
</services>
```
Il est possible de choisir le protocole TCP ou UDP (TCP par défaut) :
```
<port protocol="udp">123</port>
```
## Les numéros de port dynamique
Il est possible également de définir le port dans une variable :
```
<services>
<service name="squid">
<port port_type="variable">my_variable</port>
</service>
</services>
<variables>
<variable name="my_variable" type="port">
<value>123</value>
</variable>
</variables>
```
## 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 :
```
<services>
<service name="test">
<port portlist="squid">3128</port>
</service>
</services>
<variables>
<family name="general">
<variable name="condition" type="boolean"/>
</family>
</variables>
<constraints>
<condition name="disabled_if_in" source="condition">
<param>False</param>
<target type="portlist">squid</target>
</condition>
</constraints>
```
Dans ce cas, tous les ports avec un attribut portlist à "squid" seront désactivé si la variable "condition" est False.

View file

@ -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.
```
<variables>
<variable name="my_variable"/>
<family name="my_family">
<variable name="my_family_variable"/>
</variable>
</variables>
```
## 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) :
```

View file

@ -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 :
```
<?xml version='1.0' encoding='UTF-8'?>

View file

@ -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 <check>
"""
@ -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,
}

View file

@ -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 = []

View file

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

View file

@ -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"),

View file

@ -72,11 +72,11 @@
<!ATTLIST file group CDATA "root">
<!ATTLIST file filelist CDATA #IMPLIED>
<!ATTLIST file redefine (True|False) "False">
<!ATTLIST file templating (True|False) "True">
<!ATTLIST file templating (creole|none) "creole">
<!ELEMENT override EMPTY>
<!ATTLIST override source CDATA #IMPLIED>
<!ATTLIST override templating (True|False) "True">
<!ATTLIST override templating (creole|none) "creole">
<!ELEMENT variables ((variable*|family*)*)>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@
<constraints>
<check name="valid_lower">
<param name="mini">0</param>
<param name="mini" type="number">0</param>
<param name="maxi" type="variable">int2</param>
<target>int</target>
</check>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,24 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services>
<service name="test">
<file name="/tmp/file1" filelist="afilllist"/>
</service>
</services>
<variables>
<family name="general">
<variable name="condition" type="boolean">
<value>False</value>
</variable>
</family>
</variables>
<constraints>
<condition name="disabled_if_in" source="condition">
<param>True</param>
<target type="filelist">afilllist</target>
</condition>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
<services>
<service name="test">
<file name="/etc/file" templating="False"/>
<file name="/etc/file" templating="none"/>
</service>
</services>

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services>
<service name="test">
<override templating="none"/>
</service>
</services>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change">
<value>non</value>
</variable>
</family>
</variables>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View file

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

View file

@ -0,0 +1 @@
%%mode_conteneur_actif

View file

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

View file

@ -0,0 +1 @@
%%mode_conteneur_actif

View file

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services>
<service name="test">
<override source="test2.service"/>
</service>
</services>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change">
<value>non</value>
</variable>
</family>
</variables>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View file

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

View file

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

View file

@ -0,0 +1 @@
%%mode_conteneur_actif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

Some files were not shown because too many files have changed in this diff Show more