Compare commits
3 Commits
e9b4bfb990
...
f9e2f48788
Author | SHA1 | Date |
---|---|---|
Emmanuel Garette | f9e2f48788 | |
Emmanuel Garette | 5f76065597 | |
Emmanuel Garette | ce507a84f9 |
|
@ -1,5 +1,10 @@
|
||||||
# Rougail
|
# Rougail
|
||||||
|
|
||||||
|
## Les dictionnaires
|
||||||
|
|
||||||
|
FIXME : explications
|
||||||
|
FIXME : extra
|
||||||
|
|
||||||
## Les variables
|
## Les variables
|
||||||
|
|
||||||
- [Les familles](family/README.md)
|
- [Les familles](family/README.md)
|
||||||
|
@ -7,8 +12,6 @@
|
||||||
|
|
||||||
## Les services
|
## 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](service/file.md)
|
||||||
- [La gestion d'un fichier de service systemd](service/override.md)
|
- [La gestion d'un fichier de service systemd](service/override.md)
|
||||||
- [La gestion d'un port](service/port.md)
|
- [La gestion d'un port](service/port.md)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Les vérifications des valeurs
|
# Les vérifications des valeurs
|
||||||
|
|
||||||
- [Fonction de vérification](function.md)
|
- [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)
|
- [Paramètre de la fonction](../param/README.md)
|
||||||
- [Réfinition](redefine.md)
|
- [Réfinition](redefine.md)
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,6 @@ FIXME
|
||||||
<!ATTLIST condition fallback (True|False) "False">
|
<!ATTLIST condition fallback (True|False) "False">
|
||||||
<!ATTLIST condition force_condition_on_fallback (True|False) "False">
|
<!ATTLIST condition force_condition_on_fallback (True|False) "False">
|
||||||
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
|
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
|
||||||
|
|
||||||
|
|
||||||
|
on peut mettre plusieurs param (oui ou maybe)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Famille crée dynamiquement
|
# 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.
|
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 :
|
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.
|
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.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Une famille
|
# 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 :
|
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>
|
</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
|
## 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 :
|
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
|
## 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) :
|
Pour définir le [mode](../mode.md) :
|
||||||
|
|
||||||
|
@ -44,7 +55,7 @@ Pour définir le [mode](../mode.md) :
|
||||||
|
|
||||||
## Famille invisible
|
## 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.
|
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.
|
Par contre ces variables sont accessibles lorsqu'on va utiliser ces variables.
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
Une variable calculée est une variable donc sa valeur est le résultat d'une fonction python.
|
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)
|
- [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)
|
- [Paramètre de la fonction](../param/README.md)
|
||||||
- [Réfinition](redefine.md)
|
- [Réfinition](redefine.md)
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
# Les services
|
# Les services
|
||||||
|
|
||||||
|
|
||||||
<!ELEMENT services (service*)>
|
|
||||||
|
|
||||||
<!ELEMENT service ((port* | ip* | file* | override*)*) >
|
|
||||||
<!ATTLIST service name CDATA #REQUIRED>
|
|
||||||
<!ATTLIST service manage (True|False) "True">
|
|
||||||
|
|
||||||
|
|
|
@ -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>
|
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.
|
||||||
<!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">
|
|
||||||
|
|
||||||
|
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"/>
|
||||||
|
```
|
||||||
|
|
|
@ -1,7 +1,35 @@
|
||||||
# Override
|
# Override
|
||||||
|
|
||||||
FIXME
|
## La balise override
|
||||||
|
|
||||||
<!ELEMENT override EMPTY>
|
La balise override permet de redéfinir facilement un service systemd.
|
||||||
<!ATTLIST override source CDATA #IMPLIED >
|
|
||||||
<!ATTLIST override templating (True|False) "True">
|
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"/>
|
||||||
|
```
|
||||||
|
|
|
@ -1,7 +1,61 @@
|
||||||
# Port
|
# Port
|
||||||
|
|
||||||
<!ELEMENT port (#PCDATA)>
|
## La balise port
|
||||||
<!ATTLIST port port_type (PortOption|variable) "PortOption">
|
|
||||||
<!ATTLIST port portlist CDATA #IMPLIED >
|
|
||||||
<!ATTLIST port protocol (tcp|udp) "tcp">
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
# La gestion d'un service
|
||||||
|
|
||||||
|
Un service est inclut dans un conteneur [services](../services.md).
|
||||||
|
|
||||||
|
Cette balise permet de définir tous les éléments (fichier, port, IP, ...) lié à un service ou à démon.
|
||||||
|
|
||||||
|
Il faut, à la création du service, préciser son nom :
|
||||||
|
|
||||||
|
```
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<services>
|
||||||
|
<service name="squid"/>
|
||||||
|
</services>
|
||||||
|
</rougail>
|
||||||
|
```
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Le conteneur des services
|
||||||
|
|
||||||
|
La balise "services" est le conteneur de l'ensemble des [services](service/service.md).
|
||||||
|
|
||||||
|
Il est placé à la racine du dictionnaire :
|
||||||
|
|
||||||
|
```
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<services/>
|
||||||
|
</rougail>
|
||||||
|
```
|
||||||
|
|
||||||
|
Attention, cette balise ne peut pas être placé dans un dictionnaire "extra".
|
|
@ -2,12 +2,17 @@
|
||||||
|
|
||||||
## Un variable
|
## 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.
|
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"/>
|
<variable name="my_variable"/>
|
||||||
|
<family name="my_family">
|
||||||
|
<variable name="my_family_variable"/>
|
||||||
|
</variable>
|
||||||
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Description et aide sur la variable
|
## 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).
|
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) :
|
Pour définir le [mode](../mode.md) :
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# Le conteneur des variables
|
# 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'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
|
|
@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
from typing import List, Any
|
from typing import List, Any
|
||||||
|
|
||||||
from .variable import CONVERT_OPTION
|
|
||||||
from .target import TargetAnnotator
|
from .target import TargetAnnotator
|
||||||
from .param import ParamAnnotator
|
from .param import ParamAnnotator
|
||||||
|
|
||||||
|
@ -61,6 +60,17 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
self.convert_check()
|
self.convert_check()
|
||||||
del objectspace.space.constraints.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
|
def check_check(self): # pylint: disable=R0912
|
||||||
"""valid and manage <check>
|
"""valid and manage <check>
|
||||||
"""
|
"""
|
||||||
|
@ -119,7 +129,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
variable.mandatory = True
|
variable.mandatory = True
|
||||||
# build choice
|
# build choice
|
||||||
variable.values = []
|
variable.values = []
|
||||||
variable_type = variable.type
|
variable.ori_type = variable.type
|
||||||
variable.type = 'choice'
|
variable.type = 'choice'
|
||||||
|
|
||||||
has_variable = False
|
has_variable = False
|
||||||
|
@ -129,7 +139,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
msg = _(f'only one "variable" parameter is allowed for valid_enum '
|
msg = _(f'only one "variable" parameter is allowed for valid_enum '
|
||||||
f'of variable "{variable.name}"')
|
f'of variable "{variable.name}"')
|
||||||
raise DictConsistencyError(msg, 5, param.xmlfiles)
|
raise DictConsistencyError(msg, 5, param.xmlfiles)
|
||||||
param_type = variable_type
|
param_type = variable.ori_type
|
||||||
if param.type == 'variable':
|
if param.type == 'variable':
|
||||||
has_variable = True
|
has_variable = True
|
||||||
if param.optional is True:
|
if param.optional is True:
|
||||||
|
@ -141,24 +151,9 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
f'of variable "{variable.name}"')
|
f'of variable "{variable.name}"')
|
||||||
raise DictConsistencyError(msg, 6, param.xmlfiles)
|
raise DictConsistencyError(msg, 6, param.xmlfiles)
|
||||||
param_type = 'calculation'
|
param_type = 'calculation'
|
||||||
value = param.text
|
values.append(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)
|
|
||||||
choice = self.objectspace.choice(variable.xmlfiles)
|
choice = self.objectspace.choice(variable.xmlfiles)
|
||||||
choice.name = value
|
choice.name = param.text
|
||||||
choice.type = param_type
|
choice.type = param_type
|
||||||
variable.values.append(choice)
|
variable.values.append(choice)
|
||||||
|
|
||||||
|
@ -166,7 +161,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
for target in check.target:
|
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,
|
'values': values,
|
||||||
'xmlfiles': check.xmlfiles,
|
'xmlfiles': check.xmlfiles,
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,12 @@ from ..config import Config
|
||||||
|
|
||||||
from .target import TargetAnnotator
|
from .target import TargetAnnotator
|
||||||
from .param import ParamAnnotator
|
from .param import ParamAnnotator
|
||||||
|
from .variable import Walk
|
||||||
|
|
||||||
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
||||||
|
|
||||||
|
|
||||||
class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
||||||
"""Annotate condition
|
"""Annotate condition
|
||||||
"""
|
"""
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
@ -53,28 +54,27 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
self.target_is_uniq = False
|
self.target_is_uniq = False
|
||||||
self.only_variable = False
|
self.only_variable = False
|
||||||
self.convert_target(self.objectspace.space.constraints.condition)
|
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.convert_param(self.objectspace.space.constraints.condition)
|
||||||
self.check_source_target()
|
self.check_source_target()
|
||||||
self.check_condition_fallback()
|
|
||||||
self.convert_xxxlist()
|
self.convert_xxxlist()
|
||||||
self.convert_condition_source()
|
|
||||||
self.check_choice_option_condition()
|
self.check_choice_option_condition()
|
||||||
self.remove_condition_with_empty_target()
|
self.remove_condition_with_empty_target()
|
||||||
self.convert_condition()
|
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):
|
def convert_auto_freeze(self):
|
||||||
"""convert auto_freeze
|
"""convert auto_freeze
|
||||||
only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen
|
only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen
|
||||||
"""
|
"""
|
||||||
for variables in self.objectspace.space.variables.values():
|
for variable in self.get_variables():
|
||||||
for family in variables.family.values():
|
|
||||||
if not hasattr(family, 'variable'):
|
|
||||||
continue
|
|
||||||
for variable in family.variable.values():
|
|
||||||
if isinstance(variable, self.objectspace.leadership):
|
|
||||||
for follower in variable.variable:
|
|
||||||
self._convert_auto_freeze(follower)
|
|
||||||
else:
|
|
||||||
self._convert_auto_freeze(variable)
|
self._convert_auto_freeze(variable)
|
||||||
|
|
||||||
def _convert_auto_freeze(self,
|
def _convert_auto_freeze(self,
|
||||||
|
@ -108,9 +108,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
for condition in self.objectspace.space.constraints.condition:
|
for condition in self.objectspace.space.constraints.condition:
|
||||||
for target in condition.target:
|
for target in condition.target:
|
||||||
if target.type == 'variable' and \
|
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: '
|
msg = _('target name and source name must be different: '
|
||||||
f'{condition.source}')
|
f'{condition.source.path}')
|
||||||
raise DictConsistencyError(msg, 11, condition.xmlfiles)
|
raise DictConsistencyError(msg, 11, condition.xmlfiles)
|
||||||
|
|
||||||
def check_condition_fallback(self):
|
def check_condition_fallback(self):
|
||||||
|
@ -249,11 +249,12 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
param3 = self.objectspace.param(target.xmlfiles)
|
param3 = self.objectspace.param(target.xmlfiles)
|
||||||
param3.name = f'condition_{fill.index}'
|
param3.name = f'condition_{fill.index}'
|
||||||
param3.type = 'variable'
|
param3.type = 'variable'
|
||||||
param3.text = condition.source
|
param3.text = condition.source.path
|
||||||
fill.param.append(param3)
|
fill.param.append(param3)
|
||||||
param4 = self.objectspace.param(target.xmlfiles)
|
param4 = self.objectspace.param(target.xmlfiles)
|
||||||
param4.name = f'expected_{fill.index}'
|
param4.name = f'expected_{fill.index}'
|
||||||
param4.text = values
|
param4.text = values
|
||||||
|
param4.type = condition.param[0].type
|
||||||
fill.param.append(param4)
|
fill.param.append(param4)
|
||||||
if condition.name != 'disabled_if_in':
|
if condition.name != 'disabled_if_in':
|
||||||
param5 = self.objectspace.param(target.xmlfiles)
|
param5 = self.objectspace.param(target.xmlfiles)
|
||||||
|
@ -321,7 +322,6 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
for condition in self.objectspace.space.constraints.condition:
|
for condition in self.objectspace.space.constraints.condition:
|
||||||
actions = self.get_actions_from_condition(condition.name)
|
actions = self.get_actions_from_condition(condition.name)
|
||||||
for param in condition.param:
|
for param in condition.param:
|
||||||
text = getattr(param, 'text', None)
|
|
||||||
for target in condition.target:
|
for target in condition.target:
|
||||||
leader_or_variable, variables = self._get_family_variables_from_target(target)
|
leader_or_variable, variables = self._get_family_variables_from_target(target)
|
||||||
# if option is already disable, do not apply disable_if_in
|
# if option is already disable, do not apply disable_if_in
|
||||||
|
@ -331,7 +331,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
if getattr(leader_or_variable, main_action, False) is True:
|
if getattr(leader_or_variable, main_action, False) is True:
|
||||||
continue
|
continue
|
||||||
self.build_property(leader_or_variable,
|
self.build_property(leader_or_variable,
|
||||||
text,
|
param,
|
||||||
condition,
|
condition,
|
||||||
main_action,
|
main_action,
|
||||||
)
|
)
|
||||||
|
@ -343,14 +343,14 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
# other actions are set to the variable or children of family
|
# other actions are set to the variable or children of family
|
||||||
for variable in variables:
|
for variable in variables:
|
||||||
self.build_property(variable,
|
self.build_property(variable,
|
||||||
text,
|
param,
|
||||||
condition,
|
condition,
|
||||||
action,
|
action,
|
||||||
)
|
)
|
||||||
|
|
||||||
def build_property(self,
|
def build_property(self,
|
||||||
obj,
|
obj,
|
||||||
text: Any,
|
param: 'self.objectspace.param',
|
||||||
condition: 'self.objectspace.condition',
|
condition: 'self.objectspace.condition',
|
||||||
action: str,
|
action: str,
|
||||||
) -> 'self.objectspace.property_':
|
) -> 'self.objectspace.property_':
|
||||||
|
@ -360,7 +360,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
prop.type = 'calculation'
|
prop.type = 'calculation'
|
||||||
prop.inverse = condition.name.endswith('_if_not_in')
|
prop.inverse = condition.name.endswith('_if_not_in')
|
||||||
prop.source = condition.source
|
prop.source = condition.source
|
||||||
prop.expected = text
|
prop.expected = param
|
||||||
prop.name = action
|
prop.name = action
|
||||||
if not hasattr(obj, 'properties'):
|
if not hasattr(obj, 'properties'):
|
||||||
obj.properties = []
|
obj.properties = []
|
||||||
|
|
|
@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
from ..utils import normalize_family
|
from ..utils import normalize_family
|
||||||
|
from .variable import Walk
|
||||||
|
|
||||||
|
|
||||||
#mode order is important
|
#mode order is important
|
||||||
|
@ -52,7 +53,7 @@ class Mode: # pylint: disable=R0903
|
||||||
modes = {name: Mode(name, idx) for idx, name in enumerate(modes_level)}
|
modes = {name: Mode(name, idx) for idx, name in enumerate(modes_level)}
|
||||||
|
|
||||||
|
|
||||||
class FamilyAnnotator:
|
class FamilyAnnotator(Walk):
|
||||||
"""Annotate family
|
"""Annotate family
|
||||||
"""
|
"""
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
@ -67,26 +68,39 @@ class FamilyAnnotator:
|
||||||
self.dynamic_families()
|
self.dynamic_families()
|
||||||
self.convert_help()
|
self.convert_help()
|
||||||
|
|
||||||
|
def _has_variable(self,
|
||||||
|
family: 'self.objectspace.family',
|
||||||
|
) -> bool:
|
||||||
|
if hasattr(family, 'variable'):
|
||||||
|
for variable in family.variable.values():
|
||||||
|
if isinstance(variable, self.objectspace.family):
|
||||||
|
if self._has_variable(variable):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
return False
|
||||||
|
|
||||||
def remove_empty_families(self) -> None:
|
def remove_empty_families(self) -> None:
|
||||||
"""Remove all families without any variable
|
"""Remove all families without any variable
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for families in self.objectspace.space.variables.values():
|
||||||
removed_families = []
|
removed_families = []
|
||||||
for family_name, family in families.family.items():
|
for family_name, family in families.variable.items():
|
||||||
if not hasattr(family, 'variable') or len(family.variable) == 0:
|
if isinstance(family, self.objectspace.family) and not self._has_variable(family):
|
||||||
removed_families.append(family_name)
|
removed_families.append(family_name)
|
||||||
for family_name in removed_families:
|
for family_name in removed_families:
|
||||||
del families.family[family_name]
|
del families.variable[family_name]
|
||||||
|
|
||||||
def family_names(self) -> None:
|
def family_names(self) -> None:
|
||||||
"""Set doc, path, ... to family
|
"""Set doc, path, ... to family
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for family in self.get_families():
|
||||||
families.doc = families.name
|
|
||||||
families.path = families.name
|
|
||||||
for family in families.family.values():
|
|
||||||
if not hasattr(family, 'description'):
|
if not hasattr(family, 'description'):
|
||||||
family.description = family.name
|
family.description = family.name
|
||||||
|
if not hasattr(family, 'path'):
|
||||||
|
family.path = family.name
|
||||||
family.doc = family.description
|
family.doc = family.description
|
||||||
del family.description
|
del family.description
|
||||||
family.name = normalize_family(family.name)
|
family.name = normalize_family(family.name)
|
||||||
|
@ -94,23 +108,46 @@ class FamilyAnnotator:
|
||||||
def change_modes(self):
|
def change_modes(self):
|
||||||
"""change the mode of variables
|
"""change the mode of variables
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
|
||||||
for family in families.family.values():
|
|
||||||
family_mode = family.mode
|
|
||||||
# default is high level
|
# default is high level
|
||||||
new_family_mode = modes_level[-1]
|
new_family_mode = modes_level[-1]
|
||||||
for variable in family.variable.values():
|
for family in self.objectspace.space.variables.values():
|
||||||
if not isinstance(variable, self.objectspace.leadership):
|
self.change_family_mode(family,
|
||||||
func = self._change_variabe_mode
|
new_family_mode,
|
||||||
|
first=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def change_family_mode(self,
|
||||||
|
family: 'self.objectspace.family',
|
||||||
|
new_family_mode: str,
|
||||||
|
first: bool=False,
|
||||||
|
) -> str:
|
||||||
|
if hasattr(family, 'mode'):
|
||||||
|
family_mode = family.mode
|
||||||
else:
|
else:
|
||||||
|
family_mode = new_family_mode
|
||||||
|
if hasattr(family, 'variable'):
|
||||||
|
# change variable mode, but not if variables are not in a family
|
||||||
|
for variable in family.variable.values():
|
||||||
|
if isinstance(variable, self.objectspace.family):
|
||||||
|
new_family_mode = self.change_family_mode(variable,
|
||||||
|
new_family_mode,
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
if first:
|
||||||
|
continue
|
||||||
|
if isinstance(variable, self.objectspace.leadership):
|
||||||
func = self._change_variable_mode_leader
|
func = self._change_variable_mode_leader
|
||||||
|
else:
|
||||||
|
func = self._change_variabe_mode
|
||||||
func(variable,
|
func(variable,
|
||||||
family_mode,
|
family_mode,
|
||||||
)
|
)
|
||||||
if modes[new_family_mode] > modes[variable.mode]:
|
if modes[new_family_mode] > modes[variable.mode]:
|
||||||
new_family_mode = variable.mode
|
new_family_mode = variable.mode
|
||||||
|
if not first:
|
||||||
# set the lower variable mode to family
|
# set the lower variable mode to family
|
||||||
family.mode = new_family_mode
|
family.mode = new_family_mode
|
||||||
|
return new_family_mode
|
||||||
|
|
||||||
def _change_variabe_mode(self,
|
def _change_variabe_mode(self,
|
||||||
variable,
|
variable,
|
||||||
|
@ -160,8 +197,7 @@ class FamilyAnnotator:
|
||||||
def dynamic_families(self):
|
def dynamic_families(self):
|
||||||
"""link dynamic families to object
|
"""link dynamic families to object
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for family in self.get_families():
|
||||||
for family in families.family.values():
|
|
||||||
if 'dynamic' not in vars(family):
|
if 'dynamic' not in vars(family):
|
||||||
continue
|
continue
|
||||||
family.suffixes = self.objectspace.paths.get_variable(family.dynamic)
|
family.suffixes = self.objectspace.paths.get_variable(family.dynamic)
|
||||||
|
@ -170,12 +206,15 @@ class FamilyAnnotator:
|
||||||
msg = _(f'dynamic family "{family.name}" must be linked '
|
msg = _(f'dynamic family "{family.name}" must be linked '
|
||||||
f'to multi variable')
|
f'to multi variable')
|
||||||
raise DictConsistencyError(msg, 16, family.xmlfiles)
|
raise DictConsistencyError(msg, 16, family.xmlfiles)
|
||||||
|
for variable in family.variable.values():
|
||||||
|
if isinstance(variable, self.objectspace.family):
|
||||||
|
msg = _(f'dynamic family "{family.name}" cannot contains another family')
|
||||||
|
raise DictConsistencyError(msg, 2, family.xmlfiles)
|
||||||
|
|
||||||
def convert_help(self):
|
def convert_help(self):
|
||||||
"""Convert variable help
|
"""Convert variable help
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for family in self.get_families():
|
||||||
for family in families.family.values():
|
|
||||||
if not hasattr(family, 'help'):
|
if not hasattr(family, 'help'):
|
||||||
continue
|
continue
|
||||||
if not hasattr(family, 'information'):
|
if not hasattr(family, 'information'):
|
||||||
|
|
|
@ -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
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
from .variable import CONVERT_OPTION
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
|
|
||||||
|
|
||||||
class ParamAnnotator:
|
class ParamAnnotator:
|
||||||
|
def valid_type_validation(self,
|
||||||
|
obj,
|
||||||
|
) -> None:
|
||||||
|
return None
|
||||||
|
|
||||||
def convert_param(self, objects) -> None:
|
def convert_param(self, objects) -> None:
|
||||||
""" valid and convert param
|
""" valid and convert param
|
||||||
"""
|
"""
|
||||||
|
@ -36,6 +43,7 @@ class ParamAnnotator:
|
||||||
if not hasattr(obj, 'param'):
|
if not hasattr(obj, 'param'):
|
||||||
continue
|
continue
|
||||||
param_to_delete = []
|
param_to_delete = []
|
||||||
|
variable_type = self.valid_type_validation(obj)
|
||||||
for param_idx, param in enumerate(obj.param):
|
for param_idx, param in enumerate(obj.param):
|
||||||
if param.type == 'suffix':
|
if param.type == 'suffix':
|
||||||
if hasattr(param, 'text'):
|
if hasattr(param, 'text'):
|
||||||
|
@ -50,15 +58,18 @@ class ParamAnnotator:
|
||||||
if not param.type == 'nil':
|
if not param.type == 'nil':
|
||||||
msg = _(f'"{param.type}" parameter must have a value')
|
msg = _(f'"{param.type}" parameter must have a value')
|
||||||
raise DictConsistencyError(msg, 27, obj.xmlfiles)
|
raise DictConsistencyError(msg, 27, obj.xmlfiles)
|
||||||
|
param.text = None
|
||||||
elif param.type == 'nil':
|
elif param.type == 'nil':
|
||||||
msg = _(f'"{param.type}" parameter must not have a value')
|
msg = _(f'"{param.type}" parameter must not have a value')
|
||||||
raise DictConsistencyError(msg, 40, obj.xmlfiles)
|
raise DictConsistencyError(msg, 40, obj.xmlfiles)
|
||||||
if param.type == 'variable':
|
elif param.type == 'variable':
|
||||||
try:
|
try:
|
||||||
path, suffix = self.objectspace.paths.get_variable_path(param.text,
|
path, suffix = self.objectspace.paths.get_variable_path(param.text,
|
||||||
obj.namespace,
|
obj.namespace,
|
||||||
)
|
)
|
||||||
param.text = self.objectspace.paths.get_variable(path)
|
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:
|
if suffix:
|
||||||
param.suffix = suffix
|
param.suffix = suffix
|
||||||
family_path = self.objectspace.paths.get_variable_family_path(path)
|
family_path = self.objectspace.paths.get_variable_family_path(path)
|
||||||
|
@ -69,6 +80,18 @@ class ParamAnnotator:
|
||||||
if err.errno != 42 or not param.optional:
|
if err.errno != 42 or not param.optional:
|
||||||
raise err
|
raise err
|
||||||
param_to_delete.append(param_idx)
|
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)
|
param_to_delete.sort(reverse=True)
|
||||||
for param_idx in param_to_delete:
|
for param_idx in param_to_delete:
|
||||||
obj.param.pop(param_idx)
|
obj.param.pop(param_idx)
|
||||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
|
from .variable import Walk
|
||||||
|
|
||||||
|
|
||||||
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
||||||
|
@ -35,7 +36,7 @@ CONVERT_PROPERTIES = {'auto_save': ['force_store_value'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class PropertyAnnotator:
|
class PropertyAnnotator(Walk):
|
||||||
"""Annotate properties
|
"""Annotate properties
|
||||||
"""
|
"""
|
||||||
def __init__(self, objectspace):
|
def __init__(self, objectspace):
|
||||||
|
@ -43,7 +44,8 @@ class PropertyAnnotator:
|
||||||
if hasattr(self.objectspace.space, 'services'):
|
if hasattr(self.objectspace.space, 'services'):
|
||||||
self.convert_services()
|
self.convert_services()
|
||||||
if hasattr(self.objectspace.space, 'variables'):
|
if hasattr(self.objectspace.space, 'variables'):
|
||||||
self.convert_variables()
|
self.convert_family()
|
||||||
|
self.convert_variable()
|
||||||
|
|
||||||
def convert_property(self,
|
def convert_property(self,
|
||||||
variable,
|
variable,
|
||||||
|
@ -92,15 +94,15 @@ class PropertyAnnotator:
|
||||||
for variable in family.variable:
|
for variable in family.variable:
|
||||||
self.convert_property(variable)
|
self.convert_property(variable)
|
||||||
|
|
||||||
def convert_variables(self) -> None:
|
def convert_family(self) -> None:
|
||||||
"""convert variables
|
"""convert variables
|
||||||
"""
|
"""
|
||||||
for variables in self.objectspace.space.variables.values():
|
for family in self.get_families():
|
||||||
for family in variables.family.values():
|
|
||||||
self.convert_property(family)
|
self.convert_property(family)
|
||||||
for variable in family.variable.values():
|
|
||||||
self.convert_property(variable)
|
def convert_variable(self) -> None:
|
||||||
if not isinstance(variable, self.objectspace.leadership):
|
for variable in self.get_variables(with_leadership=True):
|
||||||
continue
|
if isinstance(variable, self.objectspace.leadership):
|
||||||
for follower in variable.variable:
|
for follower in variable.variable:
|
||||||
self.convert_property(follower)
|
self.convert_property(follower)
|
||||||
|
self.convert_property(variable)
|
||||||
|
|
|
@ -35,7 +35,7 @@ from ..error import DictConsistencyError
|
||||||
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
||||||
'remove_condition', 'path', 'instance_mode', 'index',
|
'remove_condition', 'path', 'instance_mode', 'index',
|
||||||
'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name',
|
'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name',
|
||||||
'reflector_object', 'manage')
|
'reflector_object',)
|
||||||
|
|
||||||
|
|
||||||
KEY_TYPE = {'variable': 'symlink',
|
KEY_TYPE = {'variable': 'symlink',
|
||||||
|
@ -76,8 +76,6 @@ class ServiceAnnotator:
|
||||||
self.objectspace.space.services.path = 'services'
|
self.objectspace.space.services.path = 'services'
|
||||||
for service_name, service in self.objectspace.space.services.service.items():
|
for service_name, service in self.objectspace.space.services.service.items():
|
||||||
service.information = self.objectspace.information(service.xmlfiles)
|
service.information = self.objectspace.information(service.xmlfiles)
|
||||||
service.information.manage = service.manage
|
|
||||||
service.manage = None
|
|
||||||
for elttype, values in dict(vars(service)).items():
|
for elttype, values in dict(vars(service)).items():
|
||||||
if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES:
|
if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -24,8 +24,9 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
from .variable import Walk
|
||||||
|
|
||||||
class ValueAnnotator: # pylint: disable=R0903
|
class ValueAnnotator(Walk): # pylint: disable=R0903
|
||||||
"""Annotate value
|
"""Annotate value
|
||||||
"""
|
"""
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
@ -39,11 +40,7 @@ class ValueAnnotator: # pylint: disable=R0903
|
||||||
def convert_value(self) -> None:
|
def convert_value(self) -> None:
|
||||||
"""convert value
|
"""convert value
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for variable in self.get_variables(with_leadership=True):
|
||||||
for family in families.family.values():
|
|
||||||
if not hasattr(family, 'variable'):
|
|
||||||
continue
|
|
||||||
for variable in family.variable.values():
|
|
||||||
if isinstance(variable, self.objectspace.leadership):
|
if isinstance(variable, self.objectspace.leadership):
|
||||||
variable_type = 'leader'
|
variable_type = 'leader'
|
||||||
for follower in variable.variable:
|
for follower in variable.variable:
|
||||||
|
|
|
@ -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
|
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),
|
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
'float': dict(opttype="FloatOption", func=float),
|
'float': dict(opttype="FloatOption", func=float),
|
||||||
|
@ -32,7 +34,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
'string': dict(opttype="StrOption"),
|
'string': dict(opttype="StrOption"),
|
||||||
'password': dict(opttype="PasswordOption"),
|
'password': dict(opttype="PasswordOption"),
|
||||||
'mail': dict(opttype="EmailOption"),
|
'mail': dict(opttype="EmailOption"),
|
||||||
'boolean': dict(opttype="BoolOption"),
|
'boolean': dict(opttype="BoolOption", func=convert_boolean),
|
||||||
'symlink': dict(opttype="SymLinkOption"),
|
'symlink': dict(opttype="SymLinkOption"),
|
||||||
'filename': dict(opttype="FilenameOption"),
|
'filename': dict(opttype="FilenameOption"),
|
||||||
'date': dict(opttype="DateOption"),
|
'date': dict(opttype="DateOption"),
|
||||||
|
@ -63,7 +65,52 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class VariableAnnotator: # pylint: disable=R0903
|
class Walk:
|
||||||
|
"""Walk to objectspace to find variable or family
|
||||||
|
"""
|
||||||
|
def get_variables(self,
|
||||||
|
with_leadership: bool=False,
|
||||||
|
):
|
||||||
|
"""Iter all variables from the objectspace
|
||||||
|
"""
|
||||||
|
for family in self.objectspace.space.variables.values():
|
||||||
|
yield from self._get_variables(family, with_leadership)
|
||||||
|
|
||||||
|
def _get_variables(self,
|
||||||
|
family: 'self.objectspace.family',
|
||||||
|
with_leadership: bool
|
||||||
|
):
|
||||||
|
if hasattr(family, 'variable'):
|
||||||
|
for variable in family.variable.values():
|
||||||
|
if isinstance(variable, self.objectspace.family):
|
||||||
|
yield from self._get_variables(variable, with_leadership)
|
||||||
|
continue
|
||||||
|
if not with_leadership and isinstance(variable, self.objectspace.leadership):
|
||||||
|
for follower in variable.variable:
|
||||||
|
yield follower
|
||||||
|
continue
|
||||||
|
yield variable
|
||||||
|
# if hasattr(family, 'family'):
|
||||||
|
# for fam in family.family.values():
|
||||||
|
# yield from self._get_variables(fam, with_leadership)
|
||||||
|
|
||||||
|
def get_families(self):
|
||||||
|
"""Iter all families from the objectspace
|
||||||
|
"""
|
||||||
|
for family in self.objectspace.space.variables.values():
|
||||||
|
yield from self._get_families(family)
|
||||||
|
|
||||||
|
def _get_families(self,
|
||||||
|
family: 'self.objectspace.family',
|
||||||
|
):
|
||||||
|
yield family
|
||||||
|
if hasattr(family, 'variable'):
|
||||||
|
for fam in family.variable.values():
|
||||||
|
if isinstance(fam, self.objectspace.family):
|
||||||
|
yield from self._get_families(fam)
|
||||||
|
|
||||||
|
|
||||||
|
class VariableAnnotator(Walk): # pylint: disable=R0903
|
||||||
"""Annotate variable
|
"""Annotate variable
|
||||||
"""
|
"""
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
@ -79,28 +126,21 @@ class VariableAnnotator: # pylint: disable=R0903
|
||||||
def convert_variable(self):
|
def convert_variable(self):
|
||||||
"""convert variable
|
"""convert variable
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for variable in self.get_variables(with_leadership=True):
|
||||||
for family in families.family.values():
|
|
||||||
if not hasattr(family, 'variable'):
|
|
||||||
continue
|
|
||||||
for variable in family.variable.values():
|
|
||||||
if isinstance(variable, self.objectspace.leadership):
|
if isinstance(variable, self.objectspace.leadership):
|
||||||
# first variable is a leader, others are follower
|
# first variable is a leader, others are follower
|
||||||
variable_type = 'leader'
|
variable_type = 'leader'
|
||||||
for follower in variable.variable:
|
for follower in variable.variable:
|
||||||
self._convert_variable(families.name,
|
self._convert_variable(follower,
|
||||||
follower,
|
|
||||||
variable_type,
|
variable_type,
|
||||||
)
|
)
|
||||||
variable_type = 'follower'
|
variable_type = 'follower'
|
||||||
else:
|
else:
|
||||||
self._convert_variable(families.name,
|
self._convert_variable(variable,
|
||||||
variable,
|
|
||||||
'variable',
|
'variable',
|
||||||
)
|
)
|
||||||
|
|
||||||
def _convert_variable(self,
|
def _convert_variable(self,
|
||||||
namespace: str,
|
|
||||||
variable,
|
variable,
|
||||||
variable_type: str,
|
variable_type: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -127,12 +167,9 @@ class VariableAnnotator: # pylint: disable=R0903
|
||||||
variable.multi = 'submulti'
|
variable.multi = 'submulti'
|
||||||
else:
|
else:
|
||||||
variable.multi = True
|
variable.multi = True
|
||||||
self._convert_valid_enum(namespace,
|
self._convert_valid_enum(variable)
|
||||||
variable,
|
|
||||||
)
|
|
||||||
|
|
||||||
def _convert_valid_enum(self,
|
def _convert_valid_enum(self,
|
||||||
namespace,
|
|
||||||
variable,
|
variable,
|
||||||
):
|
):
|
||||||
"""some types are, in fact, choices
|
"""some types are, in fact, choices
|
||||||
|
@ -142,7 +179,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
||||||
if not hasattr(self.objectspace.space, 'constraints'):
|
if not hasattr(self.objectspace.space, 'constraints'):
|
||||||
xmlfiles = variable.xmlfiles
|
xmlfiles = variable.xmlfiles
|
||||||
self.objectspace.space.constraints = self.objectspace.constraints(xmlfiles)
|
self.objectspace.space.constraints = self.objectspace.constraints(xmlfiles)
|
||||||
self.objectspace.space.constraints.namespace = namespace
|
self.objectspace.space.constraints.namespace = variable.namespace
|
||||||
if not hasattr(self.objectspace.space.constraints, 'check'):
|
if not hasattr(self.objectspace.space.constraints, 'check'):
|
||||||
self.objectspace.space.constraints.check = []
|
self.objectspace.space.constraints.check = []
|
||||||
check = self.objectspace.check(variable.xmlfiles)
|
check = self.objectspace.check(variable.xmlfiles)
|
||||||
|
@ -150,7 +187,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
||||||
target = self.objectspace.target(variable.xmlfiles)
|
target = self.objectspace.target(variable.xmlfiles)
|
||||||
target.name = variable.path
|
target.name = variable.path
|
||||||
check.target = [target]
|
check.target = [target]
|
||||||
check.namespace = namespace
|
check.namespace = variable.namespace
|
||||||
check.param = []
|
check.param = []
|
||||||
for value in FORCE_CHOICE[variable.type]:
|
for value in FORCE_CHOICE[variable.type]:
|
||||||
param = self.objectspace.param(variable.xmlfiles)
|
param = self.objectspace.param(variable.xmlfiles)
|
||||||
|
@ -162,15 +199,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
||||||
def convert_test(self):
|
def convert_test(self):
|
||||||
"""Convert variable tests value
|
"""Convert variable tests value
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for variable in self.get_variables():
|
||||||
for family in families.family.values():
|
|
||||||
if not hasattr(family, 'variable'):
|
|
||||||
continue
|
|
||||||
for variable in family.variable.values():
|
|
||||||
if isinstance(variable, self.objectspace.leadership):
|
|
||||||
for follower in variable.variable:
|
|
||||||
self._convert_test(follower)
|
|
||||||
else:
|
|
||||||
self._convert_test(variable)
|
self._convert_test(variable)
|
||||||
|
|
||||||
def _convert_test(self,
|
def _convert_test(self,
|
||||||
|
@ -194,15 +223,7 @@ class VariableAnnotator: # pylint: disable=R0903
|
||||||
def convert_help(self):
|
def convert_help(self):
|
||||||
"""Convert variable help
|
"""Convert variable help
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for variable in self.get_variables():
|
||||||
for family in families.family.values():
|
|
||||||
if not hasattr(family, 'variable'):
|
|
||||||
continue
|
|
||||||
for variable in family.variable.values():
|
|
||||||
if isinstance(variable, self.objectspace.leadership):
|
|
||||||
for follower in variable.variable:
|
|
||||||
self._convert_help(follower)
|
|
||||||
else:
|
|
||||||
self._convert_help(variable)
|
self._convert_help(variable)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
|
|
||||||
<!ELEMENT service ((port*|ip*|file*|override*)*)>
|
<!ELEMENT service ((port*|ip*|file*|override*)*)>
|
||||||
<!ATTLIST service name CDATA #REQUIRED>
|
<!ATTLIST service name CDATA #REQUIRED>
|
||||||
<!ATTLIST service manage (True|False) "True">
|
|
||||||
|
|
||||||
<!ELEMENT port (#PCDATA)>
|
<!ELEMENT port (#PCDATA)>
|
||||||
<!ATTLIST port port_type (PortOption|variable) "PortOption">
|
<!ATTLIST port port_type (PortOption|variable) "PortOption">
|
||||||
|
@ -73,15 +72,15 @@
|
||||||
<!ATTLIST file group CDATA "root">
|
<!ATTLIST file group CDATA "root">
|
||||||
<!ATTLIST file filelist CDATA #IMPLIED>
|
<!ATTLIST file filelist CDATA #IMPLIED>
|
||||||
<!ATTLIST file redefine (True|False) "False">
|
<!ATTLIST file redefine (True|False) "False">
|
||||||
<!ATTLIST file templating (True|False) "True">
|
<!ATTLIST file templating (creole|none) "creole">
|
||||||
|
|
||||||
<!ELEMENT override EMPTY>
|
<!ELEMENT override EMPTY>
|
||||||
<!ATTLIST override source CDATA #IMPLIED>
|
<!ATTLIST override source CDATA #IMPLIED>
|
||||||
<!ATTLIST override templating (True|False) "True">
|
<!ATTLIST override templating (creole|none) "creole">
|
||||||
|
|
||||||
<!ELEMENT variables (family*)>
|
<!ELEMENT variables ((variable*|family*)*)>
|
||||||
|
|
||||||
<!ELEMENT family (variable*)>
|
<!ELEMENT family ((variable*|family*)*)>
|
||||||
<!ATTLIST family name CDATA #REQUIRED>
|
<!ATTLIST family name CDATA #REQUIRED>
|
||||||
<!ATTLIST family description CDATA #IMPLIED>
|
<!ATTLIST family description CDATA #IMPLIED>
|
||||||
<!ATTLIST family help CDATA #IMPLIED>
|
<!ATTLIST family help CDATA #IMPLIED>
|
||||||
|
@ -127,7 +126,7 @@
|
||||||
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
|
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
|
||||||
|
|
||||||
<!ELEMENT param (#PCDATA)>
|
<!ELEMENT param (#PCDATA)>
|
||||||
<!ATTLIST param type (string|number|nil|variable|information|suffix) "string">
|
<!ATTLIST param type (string|number|nil|boolean|variable|information|suffix) "string">
|
||||||
<!ATTLIST param name CDATA #IMPLIED>
|
<!ATTLIST param name CDATA #IMPLIED>
|
||||||
<!ATTLIST param propertyerror (True|False) "True">
|
<!ATTLIST param propertyerror (True|False) "True">
|
||||||
<!ATTLIST param optional (True|False) "False">
|
<!ATTLIST param optional (True|False) "False">
|
||||||
|
|
|
@ -43,7 +43,9 @@ UNREDEFINABLE = ('multi', 'type')
|
||||||
# RougailObjSpace's elements that did not created automaticly
|
# RougailObjSpace's elements that did not created automaticly
|
||||||
FORCE_ELEMENTS = ('choice', 'property_', 'leadership', 'information')
|
FORCE_ELEMENTS = ('choice', 'property_', 'leadership', 'information')
|
||||||
# XML text are convert has name
|
# XML text are convert has name
|
||||||
FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target')
|
FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value',)
|
||||||
|
|
||||||
|
FORCE_TAG = {'family': 'variable'}
|
||||||
|
|
||||||
|
|
||||||
# _____________________________________________________________________________
|
# _____________________________________________________________________________
|
||||||
|
@ -83,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:
|
class RougailObjSpace:
|
||||||
"""Rougail ObjectSpace is an object's reflexion of the XML elements
|
"""Rougail ObjectSpace is an object's reflexion of the XML elements
|
||||||
"""
|
"""
|
||||||
|
@ -125,7 +137,7 @@ class RougailObjSpace:
|
||||||
# set default value for this attribute
|
# set default value for this attribute
|
||||||
default_value = dtd_attr.default_value
|
default_value = dtd_attr.default_value
|
||||||
if dtd_attr.name in self.booleans_attributs:
|
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
|
attrs[dtd_attr.name] = default_value
|
||||||
if dtd_attr.name == 'redefine':
|
if dtd_attr.name == 'redefine':
|
||||||
# has a redefine attribute, so it's a Redefinable object
|
# has a redefine attribute, so it's a Redefinable object
|
||||||
|
@ -236,7 +248,8 @@ class RougailObjSpace:
|
||||||
"""
|
"""
|
||||||
retrieves or creates Rougail Object Subspace objects
|
retrieves or creates Rougail Object Subspace objects
|
||||||
"""
|
"""
|
||||||
obj = getattr(self, child.tag)
|
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||||
|
obj = getattr(self, tag)
|
||||||
name = self._get_name(child, namespace)
|
name = self._get_name(child, namespace)
|
||||||
if Redefinable in obj.__mro__:
|
if Redefinable in obj.__mro__:
|
||||||
return self.create_or_update_redefinable_object(xmlfile,
|
return self.create_or_update_redefinable_object(xmlfile,
|
||||||
|
@ -289,7 +302,7 @@ class RougailObjSpace:
|
||||||
# if redefine is set to object, default value is False
|
# if redefine is set to object, default value is False
|
||||||
# otherwise it's always a redefinable object
|
# otherwise it's always a redefinable object
|
||||||
default_redefine = child.tag in FORCE_REDEFINABLES
|
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 redefine is True:
|
||||||
if isinstance(existed_var, self.variable): # pylint: disable=E1101
|
if isinstance(existed_var, self.variable): # pylint: disable=E1101
|
||||||
if namespace == Config['variable_namespace']:
|
if namespace == Config['variable_namespace']:
|
||||||
|
@ -298,24 +311,25 @@ class RougailObjSpace:
|
||||||
redefine_variables.append(space.path + '.' + name)
|
redefine_variables.append(space.path + '.' + name)
|
||||||
existed_var.xmlfiles.append(xmlfile)
|
existed_var.xmlfiles.append(xmlfile)
|
||||||
return existed_var
|
return existed_var
|
||||||
exists = self.convert_boolean(subspace.get('exists', True))
|
exists = convert_boolean(subspace.get('exists', True))
|
||||||
if exists is False:
|
if exists is False:
|
||||||
raise SpaceObjShallNotBeUpdated()
|
raise SpaceObjShallNotBeUpdated()
|
||||||
msg = _(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", '
|
msg = _(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", '
|
||||||
f'already defined')
|
f'already defined')
|
||||||
raise DictConsistencyError(msg, 45, existed_var.xmlfiles)
|
raise DictConsistencyError(msg, 45, existed_var.xmlfiles)
|
||||||
# object deos not exists
|
# object deos not exists
|
||||||
exists = self.convert_boolean(subspace.get('exists', False))
|
exists = convert_boolean(subspace.get('exists', False))
|
||||||
if exists is True:
|
if exists is True:
|
||||||
# manage object only if already exists, so cancel
|
# manage object only if already exists, so cancel
|
||||||
raise SpaceObjShallNotBeUpdated()
|
raise SpaceObjShallNotBeUpdated()
|
||||||
redefine = self.convert_boolean(subspace.get('redefine', False))
|
redefine = convert_boolean(subspace.get('redefine', False))
|
||||||
if redefine is True:
|
if redefine is True:
|
||||||
# cannot redefine an inexistant object
|
# cannot redefine an inexistant object
|
||||||
msg = _(f'Redefined object: "{name}" does not exist yet')
|
msg = _(f'Redefined object: "{name}" does not exist yet')
|
||||||
raise DictConsistencyError(msg, 46, xmlfile)
|
raise DictConsistencyError(msg, 46, xmlfile)
|
||||||
if child.tag not in vars(space):
|
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||||
setattr(space, child.tag, {})
|
if tag not in vars(space):
|
||||||
|
setattr(space, tag, {})
|
||||||
return getattr(self, child.tag)(xmlfile, name)
|
return getattr(self, child.tag)(xmlfile, name)
|
||||||
|
|
||||||
def get_existed_obj(self,
|
def get_existed_obj(self,
|
||||||
|
@ -328,7 +342,7 @@ class RougailObjSpace:
|
||||||
"""
|
"""
|
||||||
if child.tag in ['variable', 'family']:
|
if child.tag in ['variable', 'family']:
|
||||||
name = normalize_family(name)
|
name = normalize_family(name)
|
||||||
if isinstance(space, self.family): # pylint: disable=E1101
|
if child.tag == 'variable': # pylint: disable=E1101
|
||||||
if namespace != Config['variable_namespace']:
|
if namespace != Config['variable_namespace']:
|
||||||
name = space.path + '.' + name
|
name = space.path + '.' + name
|
||||||
if not self.paths.path_is_defined(name):
|
if not self.paths.path_is_defined(name):
|
||||||
|
@ -340,21 +354,12 @@ class RougailObjSpace:
|
||||||
raise DictConsistencyError(msg, 47, space.xmlfiles)
|
raise DictConsistencyError(msg, 47, space.xmlfiles)
|
||||||
return self.paths.get_variable(name)
|
return self.paths.get_variable(name)
|
||||||
# it's not a family
|
# it's not a family
|
||||||
children = getattr(space, child.tag, {})
|
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||||
|
children = getattr(space, tag, {})
|
||||||
if name in children:
|
if name in children:
|
||||||
return children[name]
|
return children[name]
|
||||||
return None
|
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,
|
def set_text(self,
|
||||||
child,
|
child,
|
||||||
variableobj,
|
variableobj,
|
||||||
|
@ -374,7 +379,7 @@ class RougailObjSpace:
|
||||||
):
|
):
|
||||||
""" set attributes to an object
|
""" 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':
|
if redefine and child.tag == 'variable':
|
||||||
# delete old values
|
# delete old values
|
||||||
has_value = hasattr(variableobj, 'value')
|
has_value = hasattr(variableobj, 'value')
|
||||||
|
@ -386,7 +391,7 @@ class RougailObjSpace:
|
||||||
f' in "{xmlfile}", already defined')
|
f' in "{xmlfile}", already defined')
|
||||||
raise DictConsistencyError(msg, 48, variableobj.xmlfiles[:-1])
|
raise DictConsistencyError(msg, 48, variableobj.xmlfiles[:-1])
|
||||||
if attr in self.booleans_attributs:
|
if attr in self.booleans_attributs:
|
||||||
val = self.convert_boolean(val)
|
val = convert_boolean(val)
|
||||||
if attr == 'name' and getattr(variableobj, 'name', None):
|
if attr == 'name' and getattr(variableobj, 'name', None):
|
||||||
# do not redefine name
|
# do not redefine name
|
||||||
continue
|
continue
|
||||||
|
@ -458,7 +463,10 @@ class RougailObjSpace:
|
||||||
"""Fill self.paths attributes
|
"""Fill self.paths attributes
|
||||||
"""
|
"""
|
||||||
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
||||||
|
if 'name' in document.attrib:
|
||||||
family_name = normalize_family(document.attrib['name'])
|
family_name = normalize_family(document.attrib['name'])
|
||||||
|
else:
|
||||||
|
family_name = namespace
|
||||||
self.paths.add_variable(namespace,
|
self.paths.add_variable(namespace,
|
||||||
normalize_family(variableobj.name),
|
normalize_family(variableobj.name),
|
||||||
namespace + '.' + family_name,
|
namespace + '.' + family_name,
|
||||||
|
@ -485,9 +493,10 @@ class RougailObjSpace:
|
||||||
variableobj.namespace = namespace
|
variableobj.namespace = namespace
|
||||||
if isinstance(variableobj, Redefinable):
|
if isinstance(variableobj, Redefinable):
|
||||||
name = variableobj.name
|
name = variableobj.name
|
||||||
|
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||||
if child.tag in ['family', 'variable']:
|
if child.tag in ['family', 'variable']:
|
||||||
name = normalize_family(name)
|
name = normalize_family(name)
|
||||||
getattr(space, child.tag)[name] = variableobj
|
getattr(space, tag)[name] = variableobj
|
||||||
elif isinstance(variableobj, UnRedefinable):
|
elif isinstance(variableobj, UnRedefinable):
|
||||||
getattr(space, child.tag).append(variableobj)
|
getattr(space, child.tag).append(variableobj)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -332,7 +332,7 @@ class CreoleTemplateEngine:
|
||||||
else:
|
else:
|
||||||
var = None
|
var = None
|
||||||
source = join(tmp_dir, filevar['source'])
|
source = join(tmp_dir, filevar['source'])
|
||||||
if filevar['templating']:
|
if filevar['templating'] == 'creole':
|
||||||
self.process(source,
|
self.process(source,
|
||||||
filename,
|
filename,
|
||||||
destfilename,
|
destfilename,
|
||||||
|
|
|
@ -215,15 +215,8 @@ class Common:
|
||||||
"""Populate properties
|
"""Populate properties
|
||||||
"""
|
"""
|
||||||
option_name = child.source.reflector_object.get()
|
option_name = child.source.reflector_object.get()
|
||||||
kwargs = f"'condition': ParamOption({option_name}, todict=True), "
|
kwargs = (f"'condition': ParamOption({option_name}, todict=True), "
|
||||||
if child.expected is None or isinstance(child.expected, int):
|
f"'expected': {self.populate_param(child.expected)}")
|
||||||
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})"
|
|
||||||
if child.inverse:
|
if child.inverse:
|
||||||
kwargs += ", 'reverse_condition': ParamValue(True)"
|
kwargs += ", 'reverse_condition': ParamValue(True)"
|
||||||
return (f"Calculation(func.calc_value, Params(ParamValue('{child.name}'), "
|
return (f"Calculation(func.calc_value, Params(ParamValue('{child.name}'), "
|
||||||
|
@ -241,6 +234,40 @@ class Common:
|
||||||
value = self.convert_str(value)
|
value = self.convert_str(value)
|
||||||
self.text.append(f"{self.option_name}.impl_set_information('{key}', {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):
|
class Variable(Common):
|
||||||
"""Manage variable
|
"""Manage variable
|
||||||
|
@ -297,7 +324,7 @@ class Variable(Common):
|
||||||
function = child.name
|
function = child.name
|
||||||
if hasattr(child, 'param'):
|
if hasattr(child, 'param'):
|
||||||
for param in child.param:
|
for param in child.param:
|
||||||
value = self.populate_param(function, param)
|
value = self.populate_param(param)
|
||||||
if not hasattr(param, 'name'):
|
if not hasattr(param, 'name'):
|
||||||
args.append(str(value))
|
args.append(str(value))
|
||||||
else:
|
else:
|
||||||
|
@ -310,46 +337,6 @@ class Variable(Common):
|
||||||
ret += f', warnings_only={child.warnings_only}'
|
ret += f', warnings_only={child.warnings_only}'
|
||||||
return ret + ')'
|
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):
|
class Family(Common):
|
||||||
"""Manage family
|
"""Manage family
|
||||||
|
|
|
@ -62,11 +62,11 @@ class XMLReflector:
|
||||||
try:
|
try:
|
||||||
document = parse(xmlfile)
|
document = parse(xmlfile)
|
||||||
except XMLSyntaxError as err:
|
except XMLSyntaxError as err:
|
||||||
raise DictConsistencyError(_(f'not an XML file: {err}'), 52, xmlfile) from err
|
raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err
|
||||||
if not self.dtd.validate(document):
|
if not self.dtd.validate(document):
|
||||||
dtd_error = self.dtd.error_log.filter_from_errors()[0]
|
dtd_error = self.dtd.error_log.filter_from_errors()[0]
|
||||||
msg = _(f'not a valid XML file: {dtd_error}')
|
msg = _(f'not a valid XML file: {dtd_error}')
|
||||||
raise DictConsistencyError(msg, 43, xmlfile)
|
raise DictConsistencyError(msg, 43, [xmlfile])
|
||||||
return document.getroot()
|
return document.getroot()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -13,6 +13,5 @@ except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
option_2 = OptionDescription(name="tata", doc="tata", children=[])
|
option_2 = OptionDescription(name="tata", doc="tata", children=[])
|
||||||
option_2.impl_set_information('manage', True)
|
|
||||||
option_1 = OptionDescription(name="services", doc="services", children=[option_2], properties=frozenset({"hidden"}))
|
option_1 = OptionDescription(name="services", doc="services", children=[option_2], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -20,11 +20,10 @@ option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_10 = StrOption(name="name", doc="name", default="/etc/file")
|
option_10 = StrOption(name="name", doc="name", default="/etc/file")
|
||||||
option_11 = StrOption(name="owner", doc="owner", default="root")
|
option_11 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_12 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||||
option_5.impl_set_information('manage', True)
|
|
||||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
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])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -20,11 +20,10 @@ option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_10 = StrOption(name="name", doc="name", default="/etc/file")
|
option_10 = StrOption(name="name", doc="name", default="/etc/file")
|
||||||
option_11 = StrOption(name="owner", doc="owner", default="root")
|
option_11 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_12 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||||
option_5.impl_set_information('manage', True)
|
|
||||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
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])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -20,11 +20,10 @@ 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_10 = StrOption(name="name", doc="name", default="/etc/systemd-makefs@dev-disk-by\\x2dpartlabel")
|
||||||
option_11 = StrOption(name="owner", doc="owner", default="root")
|
option_11 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_12 = StrOption(name="source", doc="source", default="systemd-makefs@dev-disk-by\\x2dpartlabel")
|
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_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_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])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||||
option_5.impl_set_information('manage', True)
|
|
||||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
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])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<check name="valid_lower">
|
<check name="valid_lower">
|
||||||
<param name="mini">0</param>
|
<param name="mini" type="number">0</param>
|
||||||
<param name="maxi" type="variable">int2</param>
|
<param name="maxi" type="variable">int2</param>
|
||||||
<target>int</target>
|
<target>int</target>
|
||||||
</check>
|
</check>
|
||||||
|
|
|
@ -14,7 +14,7 @@ except:
|
||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
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_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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -21,11 +21,10 @@ option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_11 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_11 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_13 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_7 = OptionDescription(name="files", doc="files", children=[option_8])
|
||||||
option_6 = OptionDescription(name="test", doc="test", children=[option_7])
|
option_6 = OptionDescription(name="test", doc="test", children=[option_7])
|
||||||
option_6.impl_set_information('manage', True)
|
|
||||||
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/etc/file")
|
option_12 = StrOption(name="name", doc="name", default="/etc/file")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?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"/>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
|
||||||
|
<constraints>
|
||||||
|
<condition name="disabled_if_in" source="condition">
|
||||||
|
<param type="boolean">True</param>
|
||||||
|
<target type="filelist">afilllist</target>
|
||||||
|
</condition>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -0,0 +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": "creole", "services.test.files.file1.activate": false}
|
|
@ -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=True, 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])
|
|
@ -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
|
||||||
|
-->
|
|
@ -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}
|
|
@ -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])
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/etc/file")
|
option_12 = StrOption(name="name", doc="name", default="/etc/file")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,7 +22,7 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file1")
|
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_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_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")
|
option_18 = StrOption(name="group", doc="group", default="root")
|
||||||
|
@ -30,11 +30,10 @@ option_19 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_20 = StrOption(name="name", doc="name", default="/tmp/file2")
|
option_20 = StrOption(name="name", doc="name", default="/tmp/file2")
|
||||||
option_21 = StrOption(name="owner", doc="owner", default="root")
|
option_21 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_22 = StrOption(name="source", doc="source", default="file2")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_17])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -22,11 +22,10 @@ option_11 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
option_12 = StrOption(name="name", doc="name", default="/tmp/file")
|
||||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_14 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
option_7 = OptionDescription(name="test", doc="test", children=[option_8])
|
||||||
option_7.impl_set_information('manage', True)
|
|
||||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -21,11 +21,10 @@ option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_11 = StrOption(name="name", doc="name", default="/tmp/file1")
|
option_11 = StrOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_13 = StrOption(name="source", doc="source", default="file1")
|
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_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_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])
|
option_7 = OptionDescription(name="files", doc="files", children=[option_8])
|
||||||
option_6 = OptionDescription(name="test", doc="test", children=[option_7])
|
option_6 = OptionDescription(name="test", doc="test", children=[option_7])
|
||||||
option_6.impl_set_information('manage', True)
|
|
||||||
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5])
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<services>
|
<services>
|
||||||
<service name="test">
|
<service name="test">
|
||||||
<file name="/etc/file" templating="False"/>
|
<file name="/etc/file" templating="none"/>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
|
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -20,11 +20,10 @@ option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_10 = StrOption(name="name", doc="name", default="/etc/file")
|
option_10 = StrOption(name="name", doc="name", default="/etc/file")
|
||||||
option_11 = StrOption(name="owner", doc="owner", default="root")
|
option_11 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_12 = StrOption(name="source", doc="source", default="file")
|
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_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_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])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7])
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||||
option_5.impl_set_information('manage', True)
|
|
||||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
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])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -20,11 +20,10 @@ 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_10 = StrOption(name="name", doc="name", default="/systemd/system/test.service.d/rougail.conf")
|
||||||
option_11 = StrOption(name="owner", doc="owner", default="root")
|
option_11 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_12 = StrOption(name="source", doc="source", default="test.service")
|
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_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_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_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7])
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||||
option_5.impl_set_information('manage', True)
|
|
||||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
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])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
||||||
|
|
|
@ -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
|
||||||
|
-->
|
|
@ -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}
|
|
@ -0,0 +1 @@
|
||||||
|
%%mode_conteneur_actif
|
|
@ -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])
|
|
@ -0,0 +1 @@
|
||||||
|
%%mode_conteneur_actif
|
|
@ -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
|
||||||
|
-->
|
|
@ -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}
|
|
@ -0,0 +1 @@
|
||||||
|
non
|
|
@ -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])
|
|
@ -0,0 +1 @@
|
||||||
|
%%mode_conteneur_actif
|
|
@ -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}
|
||||||
|
|
|
@ -25,11 +25,10 @@ option_14 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_15 = StrOption(name="name", doc="name", default="/etc/mailname")
|
option_15 = StrOption(name="name", doc="name", default="/etc/mailname")
|
||||||
option_16 = StrOption(name="owner", doc="owner", default="root")
|
option_16 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_17 = StrOption(name="source", doc="source", default="mailname")
|
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_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_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])
|
option_11 = OptionDescription(name="files", doc="files", children=[option_12])
|
||||||
option_10 = OptionDescription(name="test", doc="test", children=[option_11])
|
option_10 = OptionDescription(name="test", doc="test", children=[option_11])
|
||||||
option_10.impl_set_information('manage', True)
|
|
||||||
option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"}))
|
option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9])
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -25,11 +25,10 @@ option_14 = StrOption(name="mode", doc="mode", default="0644")
|
||||||
option_15 = StrOption(name="name", doc="name", default="/etc/mailname")
|
option_15 = StrOption(name="name", doc="name", default="/etc/mailname")
|
||||||
option_16 = StrOption(name="owner", doc="owner", default="root")
|
option_16 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_17 = StrOption(name="source", doc="source", default="mailname")
|
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_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_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])
|
option_11 = OptionDescription(name="files", doc="files", children=[option_12])
|
||||||
option_10 = OptionDescription(name="test", doc="test", children=[option_11])
|
option_10 = OptionDescription(name="test", doc="test", children=[option_11])
|
||||||
option_10.impl_set_information('manage', True)
|
|
||||||
option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"}))
|
option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9])
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="base">
|
||||||
|
<family name="subfamily">
|
||||||
|
<variable name="variable"/>
|
||||||
|
</family>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.base.subfamily.variable": null}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue