Compare commits
36 Commits
pkg/dev/ri
...
develop
Author | SHA1 | Date | |
---|---|---|---|
0f4e49149d | |||
b610d66fcd | |||
9de06705e8 | |||
5c526cf2b4 | |||
d1d6a80fe7 | |||
fbc5f9374e | |||
4c011ee551 | |||
e8667848e9 | |||
cdfa065550 | |||
ce45f37d09 | |||
ec3bba0d03 | |||
db00e384e6 | |||
e6a69b8441 | |||
0f0caa6c09 | |||
3dca1349a8 | |||
8cf8c9b8eb | |||
757d9ec5c2 | |||
703250c34f | |||
8067baeb27 | |||
d41a879ed9 | |||
a1c3b2b19c | |||
c7de427475 | |||
56d0a610ff | |||
a1277bbbc7 | |||
ae8910830c | |||
f9acc7d6f8 | |||
e75965fad2 | |||
f18a53d61a | |||
6f6b761e3d | |||
904bc270bb | |||
38b30c12b4 | |||
ed1ee9e8a6 | |||
ddf33faf91 | |||
1fb0ed5918 | |||
b89eaaf805 | |||
21bee4715a |
@ -11,6 +11,7 @@ Rougail est un bibliothèque python3 qui permet de charger des dictionnaires (fi
|
|||||||
|
|
||||||
- [Les dictionnaires](dictionary/rougail.md)
|
- [Les dictionnaires](dictionary/rougail.md)
|
||||||
- [Les dictionnaires extra](dictionary/extra.md)
|
- [Les dictionnaires extra](dictionary/extra.md)
|
||||||
|
- [Convention d'écriture d'un dictionnaire](dictionary/convention.md)
|
||||||
|
|
||||||
### Les variables
|
### Les variables
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ Voici un exemple simple de validation des valeurs :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable"/>
|
<variable name="my_variable"/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<check name="islower">
|
<check name="islower">
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</check>
|
</check>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ Dans la contrainte, il est possible de spécifier le niveau d'erreur et le mettr
|
|||||||
|
|
||||||
```
|
```
|
||||||
<check name="islower" level="warning">
|
<check name="islower" level="warning">
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</check>
|
</check>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -6,12 +6,12 @@ Dans un premier dictionnaire déclarons notre variable et sa fonction de vérifi
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable"/>
|
<variable name="my_variable"/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<check name="islower">
|
<check name="islower">
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</check>
|
</check>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -19,12 +19,12 @@ Dans un second dictionnaire il est possible de redéfinir le calcul :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable" redefine="True"/>
|
<variable name="my_variable" redefine="True"/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<check name="isspace">
|
<check name="isspace">
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</check>
|
</check>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -40,12 +40,12 @@ Dans un premier dictionnaire déclarons notre variable et notre fonction de vér
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable"/>
|
<variable name="my_variable"/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<check name="islower">
|
<check name="islower">
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</check>
|
</check>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -53,9 +53,9 @@ Dans un second dictionnaire supprimer cette vérification :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="family">
|
<family name="family">
|
||||||
<variable name="my_variable" redefine="True" remove_check="True"/>
|
<variable name="my_variable" redefine="True" remove_check="True"/>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Un condition
|
## Un condition
|
||||||
|
|
||||||
Les conditions permettent d'ajouter ou de supprimer des propriétés à une [variable](../variable/README.md), une [famille](../family/README.md), un [service](../service/service.md), un [fichier](../service/file.md) ou une [ip](../service/ip.md) suivant le contexte.
|
Les conditions permettent d'ajouter ou de supprimer des propriétés à une [variable](../variable/README.md), une [famille](../family/README.md), un [service](../service/README.md), un [fichier](../service/file.md) ou une [ip](../service/ip.md) suivant le contexte.
|
||||||
|
|
||||||
Nous allons nous concentrer ici sur la condition hidden_if_in, mais [il existe d'autre conditions](conditions.md).
|
Nous allons nous concentrer ici sur la condition hidden_if_in, mais [il existe d'autre conditions](conditions.md).
|
||||||
|
|
||||||
@ -10,15 +10,15 @@ La condition hidden_if_in permet de cacher une variable où une famille à l'uti
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="condition" type="boolean"/>
|
<variable name="condition" type="boolean"/>
|
||||||
<variable name="my_variable"/>
|
<variable name="my_variable"/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<condition name="hidden_if_in" source="condition">
|
<condition name="hidden_if_in" source="condition">
|
||||||
<param>True</param>
|
<param>True</param>
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</condition>
|
</condition>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -34,16 +34,16 @@ Il est également possible de mettre plusieurs paramètre :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="condition"/>
|
<variable name="condition"/>
|
||||||
<variable name="my_variable"/>
|
<variable name="my_variable"/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<condition name="hidden_if_in" source="condition">
|
<condition name="hidden_if_in" source="condition">
|
||||||
<param>yes</param>
|
<param>yes</param>
|
||||||
<param>maybe</param>
|
<param>maybe</param>
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</condition>
|
</condition>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ Exemple :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<condition name="hidden_if_in" source="condition" optional="True", apply_on_fallback="False">
|
<condition name="hidden_if_in" source="condition" optional="True", apply_on_fallback="False">
|
||||||
<param>yes</param>
|
<param>yes</param>
|
||||||
<param>maybe</param>
|
<param>maybe</param>
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</condition>
|
</condition>
|
||||||
```
|
```
|
||||||
|
@ -16,7 +16,7 @@ Il est possible de désactiver une [variable](../variable/README.md) ou une [fam
|
|||||||
|
|
||||||
## Caché
|
## Caché
|
||||||
|
|
||||||
Il est possible de cacher une [variable](../variable/README.md), une [famille](../family/README.md), un [service](../service/service.md), un [fichier](../service/file.md) ou une [ip](../service/ip.md) avec les conditions :
|
Il est possible de cacher une [variable](../variable/README.md), une [famille](../family/README.md), un [service](../service/README.md), un [fichier](../service/file.md) ou une [ip](../service/ip.md) avec les conditions :
|
||||||
|
|
||||||
- hidden_if_in
|
- hidden_if_in
|
||||||
- hidden_if_not_in
|
- hidden_if_not_in
|
||||||
|
@ -8,15 +8,15 @@ Dans un premier dictionnaire déclarons notre variable et notre calcule :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="condition" type="boolean"/>
|
<variable name="condition" type="boolean"/>
|
||||||
<variable name="my_variable"/>
|
<variable name="my_variable"/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<condition name="hidden_if_in" source="condition">
|
<condition name="hidden_if_in" source="condition">
|
||||||
<param>True</param>
|
<param>True</param>
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</condition>
|
</condition>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -24,6 +24,6 @@ Dans un second dictionnaire supprimer ce calcul :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="condition" redefine="True" remove_condition="True"/>
|
<variable name="condition" redefine="True" remove_condition="True"/>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
@ -13,11 +13,11 @@ Voici un premier dictionnaire /srv/rougail/dictionaries/00-base.xml :
|
|||||||
```
|
```
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable">
|
<variable name="my_variable">
|
||||||
<value>my_value</value>
|
<value>my_value</value>
|
||||||
</variable>
|
</variable>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -39,11 +39,11 @@ En plus du dictionnaire précédent, créons un dictionnaire extra /srv/rougail/
|
|||||||
```
|
```
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable_extra">
|
<variable name="my_variable_extra">
|
||||||
<value>my_value_extra</value>
|
<value>my_value_extra</value>
|
||||||
</variable>
|
</variable>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -65,11 +65,11 @@ Nous créons un dictionnaire complémentaire pour ajouter notre template /srv/ro
|
|||||||
```
|
```
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
<services>
|
<services>
|
||||||
<service name="example">
|
<service name="example">
|
||||||
<file name="/etc/example.conf"/>
|
<file name="/etc/example.conf"/>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</rougail>
|
</rougail>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -163,11 +163,11 @@ Nous créons un dictionnaire complémentaire pour ajouter un calcul à la variab
|
|||||||
```
|
```
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="return_no">
|
<fill name="return_no">
|
||||||
<target>my_variable</target>
|
<target>my_variable</target>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
</rougail>
|
</rougail>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -14,6 +14,12 @@ Pour modifier il suffit de faire :
|
|||||||
RougailConfig[key] = value
|
RougailConfig[key] = value
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Ajout d'une fonction de conversion
|
||||||
|
|
||||||
|
Les fonctions de conversion fait parti du moteur de rougail. Il converti les informations des dictionnaires pour créer des variables Tiramisu.
|
||||||
|
|
||||||
|
La clef "extra_annotators" permet d'ajouter des fonctions complémentaires.
|
||||||
|
|
||||||
## Configuration de chargement des dictionnaires
|
## Configuration de chargement des dictionnaires
|
||||||
|
|
||||||
### Les répertoires des dictionnaires
|
### Les répertoires des dictionnaires
|
||||||
@ -48,7 +54,10 @@ Pour pouvez changer le répertoire de destination de la DTD et le nom du fichier
|
|||||||
|
|
||||||
### Le fichier de fonction
|
### Le fichier de fonction
|
||||||
|
|
||||||
Le fichier qui contient les fonctions personnalisés est géré dans la clef "functions_file" et a comme valeur par défaut "/srv/rougail/functions.py".
|
Le fichier qui contient les fonctions personnalisés est géré dans la clef "functions_file" et a comme valeur par défaut "/srv/rougail/functions.py". Cette clef peut contenir une liste s'il y a plusieurs fichiers.
|
||||||
|
|
||||||
|
Les fonctions doivent retourner une valeur, même si la variable que l'on calcul est une variable multiple.
|
||||||
|
Si la fonction peut retourner une valeur multiple (une liste), il faut mettre le nom de la fonction dans la clef "multi_functions".
|
||||||
|
|
||||||
### La variable auto_freeze
|
### La variable auto_freeze
|
||||||
|
|
||||||
@ -77,7 +86,7 @@ Il est possible d'ajouter des fonctions interne via la clef "internal_functions"
|
|||||||
|
|
||||||
### Le répertoire des templates
|
### Le répertoire des templates
|
||||||
|
|
||||||
Le répertoire des templates est géré dans la clef "templates_dir" et a comme valeur par défaut : "/srv/rougail/templates".
|
Le répertoire des templates est géré dans la clef "templates_dir" et a comme valeur par défaut : "/srv/rougail/templates". Cette clef peut contenir une liste s'il y a plusieurs répertoires.
|
||||||
|
|
||||||
### Le répertoire des patchs
|
### Le répertoire des patchs
|
||||||
|
|
||||||
@ -93,6 +102,11 @@ Le répertoire de temporaire est géré dans la clef "tmp_dir" et a comme valeur
|
|||||||
|
|
||||||
Le répertoire de destination des fichiers générés est géré dans la clef "destinations_dir" et a comme valeur par défaut : "/srv/rougail/destinations".
|
Le répertoire de destination des fichiers générés est géré dans la clef "destinations_dir" et a comme valeur par défaut : "/srv/rougail/destinations".
|
||||||
|
|
||||||
|
### Le nom du répertoire où se trouve les fichiers pour tmpfile.d
|
||||||
|
|
||||||
|
Le répertoire où se trouve les fichiers tmpfile.d sont par défaut dans "/usr/local/lib", il est possible de changer ce répertoire avec la clef "tmpfile_dest_dir".
|
||||||
|
|
||||||
|
|
||||||
## La configuration par défaut des fichiers
|
## La configuration par défaut des fichiers
|
||||||
|
|
||||||
### Le moteur de templates par défaut
|
### Le moteur de templates par défaut
|
||||||
@ -113,8 +127,6 @@ Le groupe propriétaire des fichiers générés est géré dans la clef "default
|
|||||||
La méthode d'inclusion des fichiers générés est géré dans la clef "default_files_included" et a comme valeur par défaut : "no". Les valeurs possible sont "no", "name" et "content".
|
La méthode d'inclusion des fichiers générés est géré dans la clef "default_files_included" et a comme valeur par défaut : "no". Les valeurs possible sont "no", "name" et "content".
|
||||||
'default_files_included': 'no',
|
'default_files_included': 'no',
|
||||||
|
|
||||||
## La configuration par défaut des overrides
|
## La configuration du moteur de templates
|
||||||
|
|
||||||
### Le moteur de templates par défaut
|
|
||||||
|
|
||||||
Le moteur de template est géré dans la clef "default_overrides_engine" et a comme valeur par défaut : "creole". Les valeurs possible sont "none", "creole" ou "jinja2".
|
Le moteur de template est géré dans la clef "default_overrides_engine" et a comme valeur par défaut : "creole". Les valeurs possible sont "none", "creole" ou "jinja2".
|
||||||
|
13
doc/dictionary/convention.md
Normal file
13
doc/dictionary/convention.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Convention de rédaction d'un dictionnaire
|
||||||
|
|
||||||
|
## Ordonnancement du dictionnaire
|
||||||
|
|
||||||
|
L'ordre des informations mise dans le dictionnaire est idéalement :
|
||||||
|
|
||||||
|
- services
|
||||||
|
- variables
|
||||||
|
- constraintes
|
||||||
|
|
||||||
|
## Le nom d'espace
|
||||||
|
|
||||||
|
Le nom d'espace dans un dictionnaire est de deux espaces.
|
@ -7,11 +7,11 @@ Par exemple :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name='varname' multi="True">
|
<variable name='varname' multi="True">
|
||||||
<value>val1</value>
|
<value>val1</value>
|
||||||
<value>val2</value>
|
<value>val2</value>
|
||||||
</variable>
|
</variable>
|
||||||
<family name="my_dyn_family_" dynamic="varname" description="Describe ">
|
<family name="my_dyn_family_" dynamic="varname" description="Describe ">
|
||||||
<variable name="my_dyn_var_"/>
|
<variable name="my_dyn_var_"/>
|
||||||
</family>
|
</family>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ Voici un exemple de définition d'une variable meneuse et de deux variables mene
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="family" leadership='True'>
|
<family name="family" leadership='True'>
|
||||||
<variable name="leader" multi='True'/>
|
<variable name="leader" multi='True'/>
|
||||||
<variable name="follower1"/>
|
<variable name="follower1"/>
|
||||||
<variable name="follower2" multi='True'/>
|
<variable name="follower2" multi='True'/>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -49,8 +49,8 @@ Pour ajouter, dans un nouveau dictionnaire, une variable suiveuse à notre group
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="family">
|
<family name="family">
|
||||||
<variable name="follower3"/>
|
<variable name="follower3"/>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
@ -12,7 +12,7 @@ Cette famille doit être placé dans une balise [variables](../variables.md) :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="my_family"/>
|
<family name="my_family"/>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -20,9 +20,9 @@ Ou dans une autre famille :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="my_family">
|
<family name="my_family">
|
||||||
<family name="second_family"/>
|
<family name="second_family"/>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -4,3 +4,4 @@ Une variable calculée est une variable donc sa valeur est le résultat d'une fo
|
|||||||
|
|
||||||
- [Valeur calculée de la variable](value.md)
|
- [Valeur calculée de la variable](value.md)
|
||||||
- [Réfinition](redefine.md)
|
- [Réfinition](redefine.md)
|
||||||
|
- [Exemples de calcule](examples.md)
|
||||||
|
48
doc/fill/examples.md
Normal file
48
doc/fill/examples.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# Exemples de calcule
|
||||||
|
|
||||||
|
## Calculer les noms de modèle à généré à partir d'une variable
|
||||||
|
|
||||||
|
Créeons deux variables multiples, une pour accueillir la liste des éléments du nom variable (ici `zones_list`), la seconde étant le nom du fichier calculé (ici `netwokd_configurations`) :
|
||||||
|
|
||||||
|
```
|
||||||
|
<variables>
|
||||||
|
<variable name="zones_list" type="string" multi="True">
|
||||||
|
<value>zone1</value>
|
||||||
|
<value>zone2</value>
|
||||||
|
<value>zone3</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="netwokd_configurations" type="filename" multi="True" hidden="True"/>
|
||||||
|
</variables>
|
||||||
|
```
|
||||||
|
|
||||||
|
Calculons la valeur de la seconde variable à partir de la première :
|
||||||
|
|
||||||
|
```
|
||||||
|
<constraints>
|
||||||
|
<fill name="calc_value">
|
||||||
|
<param>/systemd/network/10-</param>
|
||||||
|
<param type="variable">zones_list</param>
|
||||||
|
<param>-risotto.network</param>
|
||||||
|
<param name="join"></param>
|
||||||
|
<param name="multi" type="boolean">True</param>
|
||||||
|
<target>netwokd_configurations</target>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
```
|
||||||
|
|
||||||
|
Le contenu de la variable `netwokd_configurations` sera alors :
|
||||||
|
|
||||||
|
- /systemd/netword/10-zone1/risotto.network
|
||||||
|
- /systemd/netword/10-zone2/risotto.network
|
||||||
|
- /systemd/netword/10-zone3/risotto.network
|
||||||
|
|
||||||
|
Enfin déclarer une balise file en utilisant ces deux variables :
|
||||||
|
|
||||||
|
```
|
||||||
|
<services>
|
||||||
|
<service name="systemd-networkd">
|
||||||
|
<file file_type="variable" source="network" variable="zones_list">netwokd_configurations</file>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
```
|
||||||
|
|
@ -6,12 +6,12 @@ Créons une variable dont la valeur est retournée par la fonction "return_no" :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_calculated_variable"/>
|
<variable name="my_calculated_variable"/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="return_no">
|
<fill name="return_no">
|
||||||
<target>my_calculated_variable</target>
|
<target>my_calculated_variable</target>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ Attention, si une valeur par défaut est définit dans la variable "my_calculate
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_calculated_variable">
|
<variable name="my_calculated_variable">
|
||||||
<value>yes</value>
|
<value>yes</value>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
Cette valeur par défaut sera complètement ignorée. C'est le calcul qui en définira la valeur.
|
Cette valeur par défaut sera complètement ignorée. C'est le calcul qui en définira la valeur.
|
||||||
@ -59,24 +59,24 @@ Il est également possible de calculer [une variable d'une famille dynamique](..
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name='suffixes' type='string' description="Suffixes of dynamic family" multi="True">
|
<variable name='suffixes' type='string' description="Suffixes of dynamic family" multi="True">
|
||||||
<value>val1</value>
|
<value>val1</value>
|
||||||
<value>val2</value>
|
<value>val2</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="my_variable" type="string" description="My variable">
|
||||||
|
<value>val</value>
|
||||||
|
</variable>
|
||||||
|
<family name='dyn' dynamic="suffixes">
|
||||||
|
<variable name="my_calculated_variable_dyn\_" type="string" description="My calculated variable"/>
|
||||||
|
<value>val</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="my_variable" type="string" description="My variable">
|
</family>
|
||||||
<value>val</value>
|
|
||||||
</variable>
|
|
||||||
<family name='dyn' dynamic="suffixes">
|
|
||||||
<variable name="my_calculated_variable_dyn\_" type="string" description="My calculated variable"/>
|
|
||||||
<value>val</value>
|
|
||||||
</variable>
|
|
||||||
</family>
|
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="return_value">
|
<fill name="return_value">
|
||||||
<param type="variable">my_variable</param>
|
<param type="variable">my_variable</param>
|
||||||
<target>my_calculated_variable_dyn_</target>
|
<target>my_calculated_variable_dyn_</target>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -90,11 +90,11 @@ Dans ce cas, il faut explicitement demander la valeur du suffix dans la fonction
|
|||||||
|
|
||||||
```
|
```
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="return_value_suffix">
|
<fill name="return_value_suffix">
|
||||||
<param type="variable">my_variable</param>
|
<param type="variable">my_variable</param>
|
||||||
<param type="suffix"/>
|
<param type="suffix"/>
|
||||||
<target>my_calculated_variable_dyn_</target>
|
<target>my_calculated_variable_dyn_</target>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -42,3 +42,11 @@ Le paramètre peut être une valeur null (None en python) :
|
|||||||
```
|
```
|
||||||
<param type="nil"/>
|
<param type="nil"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Paramètre de type "space"
|
||||||
|
|
||||||
|
Les paramètres sont chargés en supprimer les espaces en début ou fin de chaîne. Ce qui rend impossible d'avoir un paramètre " ". Avec le type "space", le paramètre sera donc un simple espace :
|
||||||
|
|
||||||
|
```
|
||||||
|
<param type="space"/>
|
||||||
|
```
|
||||||
|
@ -1,4 +1,107 @@
|
|||||||
# Les services
|
# La gestion d'un service
|
||||||
|
|
||||||
|
## La base service
|
||||||
|
|
||||||
|
Un service est inclut dans un conteneur [services](../services.md).
|
||||||
|
|
||||||
|
Cette balise permet de définir tous les éléments ([fichier](file.md), [IP](ip.md) et [réécriture](override.md)) liés à 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>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Les types de service
|
||||||
|
|
||||||
|
Les services peuvent être de plusieurs type :
|
||||||
|
|
||||||
|
- service (valeur par défaut) : cela signifie que c'est un service systemd qui est activer au démarrage de la machine
|
||||||
|
- mount : fichier utilisé par systemd-mount
|
||||||
|
- swap : fichier utilisé par systemd-swap
|
||||||
|
- timer : tâche planifié pour systemd
|
||||||
|
|
||||||
|
```
|
||||||
|
<service name="dev-disk-by\x2dpartlabel-swap" type="swap"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Les targets de service
|
||||||
|
|
||||||
|
Active le service systemd pour une target systemd déterminé. Par défaut, l'activation du service n'est pas gérer par rougail.
|
||||||
|
|
||||||
|
```
|
||||||
|
<service name="squid" target="multi-user"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
## La génération du fichier service
|
||||||
|
|
||||||
|
Le fichier de description du service peut être fourni directement par la distribution GNU/Linux utilisé, mais il peut également être fournit par l'administrateur.
|
||||||
|
Dans ce cas, il est possible de créé un template, dont le nom est obligatoirement la valeur de la balise "name" + "." + la valeur de la base "type".
|
||||||
|
|
||||||
|
Deux types de template sont aujourd'hui disponible :
|
||||||
|
|
||||||
|
- creole
|
||||||
|
- jinja2
|
||||||
|
|
||||||
|
```
|
||||||
|
<service name="dev-disk-by\x2dpartlabel-swap" type="swap" engine="creole"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
Dans ce cas, rougail utilisera le template "dev-disk-by\x2dpartlabel-swap.swap" pour générer le fichier systemd de gestion de ce service.
|
||||||
|
|
||||||
|
## Le service factice
|
||||||
|
|
||||||
|
Un service peut être factice, donc non géré par le système de service du système :
|
||||||
|
|
||||||
|
```
|
||||||
|
<service name="ldap_client" manage="False"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
Un service factice est généralement une service qui n'existe pas réellement (par exemple si on configure un client). Il n'est là que pour contenir des fichiers.
|
||||||
|
|
||||||
|
## Désactiver le service
|
||||||
|
|
||||||
|
Il est possible de désactiver un service. Pour cela il faut rajouter l'attribut "disabled" à True :
|
||||||
|
|
||||||
|
```
|
||||||
|
<services>
|
||||||
|
<service name="test" disabled="True"/>
|
||||||
|
</services>
|
||||||
|
```
|
||||||
|
|
||||||
|
Dans ce cas, le service et les éléments qu'il compose ([fichier](file.md), [IP](ip.md) et [réécriture](override.md) seront désactivés.
|
||||||
|
|
||||||
|
Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise service :
|
||||||
|
|
||||||
|
```
|
||||||
|
<services>
|
||||||
|
<service name="test" servicelist="test">
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
<variables>
|
||||||
|
<variable name="condition" type="boolean"/>
|
||||||
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
<condition name="disabled_if_in" source="condition">
|
||||||
|
<param>False</param>
|
||||||
|
<target type="servicelist">test</target>
|
||||||
|
</condition>
|
||||||
|
</constraints>
|
||||||
|
```
|
||||||
|
|
||||||
|
Dans ce cas, tous les services et les éléments qu'il compose avec un attribut servicelist à "test" seront désactivés si la variable "condition" est False.
|
||||||
|
|
||||||
|
## Ne pas désactiver le service dans systemd
|
||||||
|
|
||||||
|
La désactivation du service va créé un lien symbolique vers /dev/null.
|
||||||
|
|
||||||
|
Si vous ne voulez juste pas créé le fichier de service et ne pas faire de lien symbolique, il faut utiliser l'attribut undisable :
|
||||||
|
|
||||||
|
```
|
||||||
|
<service name="test" disabled="True" undisable="True"/>
|
||||||
|
```
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## La balise file
|
## La balise file
|
||||||
|
|
||||||
La gestion des fichiers se fait dans un conteneur de [service](service.md).
|
La gestion des fichiers se fait dans un conteneur de [service](README.md).
|
||||||
|
|
||||||
La déclaration du fichier permet 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.
|
La déclaration du fichier permet 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.
|
||||||
|
|
||||||
@ -10,9 +10,9 @@ Il est nécessaire, au minimum, de spécifier le chemin complet du fichier :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<services>
|
<services>
|
||||||
<service name="squid">
|
<service name="squid">
|
||||||
<file>/etc/squid/squid.conf</file>
|
<file>/etc/squid/squid.conf</file>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -30,14 +30,14 @@ Il est possible également de définir le nom du fichier dans une variable :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<services>
|
<services>
|
||||||
<service name="squid">
|
<service name="squid">
|
||||||
<file file_type="variable" source="squid.conf">my_variable</file>
|
<file file_type="variable" source="squid.conf">my_variable</file>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable">
|
<variable name="my_variable">
|
||||||
<value>/etc/squid/squid.conf</value>
|
<value>/etc/squid/squid.conf</value>
|
||||||
</variable>
|
</variable>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -49,15 +49,15 @@ Il est même possible de définir une variable de type multiple, ce qui génère
|
|||||||
|
|
||||||
```
|
```
|
||||||
<services>
|
<services>
|
||||||
<service name="squid">
|
<service name="squid">
|
||||||
<file file_type="variable" source="squid.conf">my_variable</file>
|
<file file_type="variable" source="squid.conf">my_variable</file>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable" multi="True">
|
<variable name="my_variable" multi="True">
|
||||||
<value>/etc/squid1/squid.conf</value>
|
<value>/etc/squid1/squid.conf</value>
|
||||||
<value>/etc/squid2/squid.conf</value>
|
<value>/etc/squid2/squid.conf</value>
|
||||||
</variable>
|
</variable>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -73,23 +73,23 @@ En effet, il est possible de passer le contenu d'une variable au template :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<services>
|
<services>
|
||||||
<service name="squid">
|
<service name="squid">
|
||||||
<file file_type="variable" source="squid.conf" variable="my_variable2">my_variable1</file>
|
<file file_type="variable" source="squid.conf" variable="my_variable2">my_variable1</file>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable1" multi="True">
|
<variable name="my_variable1" multi="True">
|
||||||
<value>/etc/squid1/squid.conf</value>
|
<value>/etc/squid1/squid.conf</value>
|
||||||
<value>/etc/squid2/squid.conf</value>
|
<value>/etc/squid2/squid.conf</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="my_variable2" multi="True">
|
<variable name="my_variable2" multi="True">
|
||||||
<value>squid1</value>
|
<value>squid1</value>
|
||||||
<value>squid2</value>
|
<value>squid2</value>
|
||||||
</variable>
|
</variable>
|
||||||
</variables>
|
</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".
|
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 la variable "rougail_index" avec la valeur "0". Lors de la génération du fichier /etc/squid2/squid.conf on retrouvera la variable "rougail_variable" avec la valeur "squid2" et la variable "rougail_index" avec la valeur "1".
|
||||||
|
|
||||||
Attention : les deux variables "my_variable1" et "my_variable2" doivent être multiple et de même longueur.
|
Attention : les deux variables "my_variable1" et "my_variable2" doivent être multiple et de même longueur.
|
||||||
|
|
||||||
@ -107,22 +107,28 @@ Il est possible de personnaliser les droits par défaut dans la [configuration d
|
|||||||
|
|
||||||
## Désactiver la génération d'un fichier
|
## 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 :
|
Il est possible de désactiver la génération d'un fichier avec l'attribut "disabled" :
|
||||||
|
|
||||||
|
```
|
||||||
|
<file disabled="True">/etc/squid/squid.conf</file>
|
||||||
|
```
|
||||||
|
|
||||||
|
Il est aussi possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise fichier :
|
||||||
|
|
||||||
```
|
```
|
||||||
<services>
|
<services>
|
||||||
<service name="test">
|
<service name="test">
|
||||||
<file filelist="squid">/etc/squid/squid.conf</file>
|
<file filelist="squid">/etc/squid/squid.conf</file>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="condition" type="boolean"/>
|
<variable name="condition" type="boolean"/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<condition name="disabled_if_in" source="condition">
|
<condition name="disabled_if_in" source="condition">
|
||||||
<param>False</param>
|
<param>False</param>
|
||||||
<target type="filelist">squid</target>
|
<target type="filelist">squid</target>
|
||||||
</condition>
|
</condition>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -162,13 +168,82 @@ Un attribut "included" permet de définir la nature du fichier. Cet attribut peu
|
|||||||
- "name" : le répertoire de destination est listé dans un autre template, il faut que le fichier soit généré avant cet autre template
|
- "name" : le répertoire de destination est listé dans un autre template, il faut que le fichier soit généré avant cet autre template
|
||||||
- "content" : le contenu du fichier est copié dans un autre template, il faut que le fichier soit généré avant cet autre template et ce fichier n'a pas besoin d'être installé sur le serveur cible.
|
- "content" : le contenu du fichier est copié dans un autre template, il faut que le fichier soit généré avant cet autre template et ce fichier n'a pas besoin d'être installé sur le serveur cible.
|
||||||
|
|
||||||
Exemples :
|
|
||||||
|
|
||||||
```
|
|
||||||
<file included="name">/etc/squid/squid.conf</file>
|
|
||||||
<file included="content">/etc/squid/squid.conf</file>
|
|
||||||
```
|
|
||||||
|
|
||||||
Bien entendu, c'est au développeur de lister ou d'inclure le contenu de ce template dans le fichier de destination. Cet attribut permet juste de garantir que le fichier sera fait avant l'autre et de ne pas l'installer sur le serveur si ce n'est pas nécessaire.
|
Bien entendu, c'est au développeur de lister ou d'inclure le contenu de ce template dans le fichier de destination. Cet attribut permet juste de garantir que le fichier sera fait avant l'autre et de ne pas l'installer sur le serveur si ce n'est pas nécessaire.
|
||||||
|
|
||||||
Il est possible de personnaliser les methodes d'inclusion par défaut dans la [configuration de rougail](../dev/config.md)
|
Il est possible de personnaliser les methodes d'inclusion par défaut dans la [configuration de rougail](../dev/config.md)
|
||||||
|
|
||||||
|
Exemples :
|
||||||
|
|
||||||
|
- créons un template qui inclut des noms de fichiers :
|
||||||
|
|
||||||
|
Le contenu de ce template (squid.conf) est :
|
||||||
|
|
||||||
|
```
|
||||||
|
%import os
|
||||||
|
%set %%confdir = 'etc/squid/squid.d/'
|
||||||
|
%if %%os.path.exists(%%confdir)
|
||||||
|
%set %%files = %%os.listdir(%%confdir)
|
||||||
|
%%files.sort()
|
||||||
|
%for %%file in %%files
|
||||||
|
%if %%file.endswith('.cfg')
|
||||||
|
include '/' + %%confdir + file
|
||||||
|
%end if
|
||||||
|
%end for
|
||||||
|
%end if
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajoutons un second template (squid.included.conf) qui sera copié dans ce répertoire :
|
||||||
|
|
||||||
|
```
|
||||||
|
template content
|
||||||
|
```
|
||||||
|
|
||||||
|
Et déclaront ces deux templates :
|
||||||
|
|
||||||
|
```
|
||||||
|
<file>/etc/squid/squid.conf</file>
|
||||||
|
<file included="name" engine="none">/etc/squid/squid.d/squid.conf</file>
|
||||||
|
```
|
||||||
|
|
||||||
|
Le contenu du fichier généré (/etc/squid/squid.conf) sera donc :
|
||||||
|
|
||||||
|
```
|
||||||
|
include squid.d/squid.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
- créons un template qui inclut le contenu de fichiers :
|
||||||
|
|
||||||
|
Le contenu de ce template (squid.conf) est :
|
||||||
|
|
||||||
|
```
|
||||||
|
%import os
|
||||||
|
%set %%confdir = 'squid.d/'
|
||||||
|
%if %%os.path.exists(%%confdir)
|
||||||
|
%set %%files = %%os.listdir(%%confdir)
|
||||||
|
%%files.sort()
|
||||||
|
%for %%file in %%files
|
||||||
|
%if %%file.endswith('.cfg')
|
||||||
|
%include raw %%confdir + file
|
||||||
|
%end if
|
||||||
|
%end for
|
||||||
|
%end if
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajoutons un second template (squid.included.conf) qui sera copié dans ce répertoire :
|
||||||
|
|
||||||
|
```
|
||||||
|
template content
|
||||||
|
```
|
||||||
|
|
||||||
|
Et déclaront ces deux templates :
|
||||||
|
|
||||||
|
```
|
||||||
|
<file>/etc/squid/squid.conf</file>
|
||||||
|
<file included="content" engine="none">squid.d/squid.conf</file>
|
||||||
|
```
|
||||||
|
|
||||||
|
Le contenu du fichier généré (/etc/squid/squid.conf) sera donc maintenant :
|
||||||
|
|
||||||
|
```
|
||||||
|
template content
|
||||||
|
```
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## La balise IP
|
## La balise IP
|
||||||
|
|
||||||
La gestion des IP se fait dans un conteneur de [service](service.md).
|
La gestion des IP se fait dans un conteneur de [service](README.md).
|
||||||
|
|
||||||
La déclaration de l'attribut permet d'associer une IP autorisé à accéder au service.
|
La déclaration de l'attribut permet d'associer une IP autorisé à accéder au service.
|
||||||
|
|
||||||
@ -28,19 +28,19 @@ Il est possible de définir une [condition](../condition/README.md) de type "dis
|
|||||||
|
|
||||||
```
|
```
|
||||||
<services>
|
<services>
|
||||||
<service name="test">
|
<service name="test">
|
||||||
<ip iplist="test_ip">variable_ip</ip>
|
<ip iplist="test_ip">variable_ip</ip>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="condition" type="boolean"/>
|
<variable name="condition" type="boolean"/>
|
||||||
<variable name="variable_ip" type="ip"/>
|
<variable name="variable_ip" type="ip"/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<condition name="disabled_if_in" source="condition">
|
<condition name="disabled_if_in" source="condition">
|
||||||
<param>False</param>
|
<param>False</param>
|
||||||
<target type="iplist">test_ip</target>
|
<target type="iplist">test_ip</target>
|
||||||
</condition>
|
</condition>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Override
|
# Réécriture du service
|
||||||
|
|
||||||
## La balise override
|
## La balise override
|
||||||
|
|
||||||
La gestion des overrides se fait dans un conteneur de [service](service.md).
|
La gestion des overrides se fait dans un conteneur de [service](README.md).
|
||||||
|
|
||||||
La balise override permet de redéfinir facilement un service systemd.
|
La balise override permet de redéfinir facilement un service systemd.
|
||||||
|
|
||||||
@ -10,9 +10,9 @@ Il suffit d'avoir un template dont le nom est par défaut le nom du service avec
|
|||||||
|
|
||||||
```
|
```
|
||||||
<services>
|
<services>
|
||||||
<service name="squid">
|
<service name="squid">
|
||||||
<override/>
|
<override/>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
# La gestion d'un service
|
|
||||||
|
|
||||||
## La base service
|
|
||||||
|
|
||||||
Un service est inclut dans un conteneur [services](../services.md).
|
|
||||||
|
|
||||||
Cette balise permet de définir tous les éléments ([fichier](file.md), [IP](ip.md), ...) liés à 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>
|
|
||||||
```
|
|
||||||
|
|
||||||
Un service peut ne pas être géré :
|
|
||||||
|
|
||||||
```
|
|
||||||
<service name="squid" manage="True"/>
|
|
||||||
```
|
|
||||||
|
|
||||||
Un service non géré est généralement une service qui n'existe pas réellement (par exemple si on configure un client).
|
|
||||||
|
|
||||||
Un service non géré ne peut conteneur que des fichiers.
|
|
||||||
|
|
||||||
## Désactiver la génération d'un service
|
|
||||||
|
|
||||||
Il est possible de désactiver un service. Pour cela il faut rajouter l'attribut "disabled" à True :
|
|
||||||
|
|
||||||
```
|
|
||||||
<services>
|
|
||||||
<service name="test" disabled="True"/>
|
|
||||||
</services>
|
|
||||||
```
|
|
||||||
|
|
||||||
Dans ce cas, tous les services et les éléments qu'il compose ([fichier](file.md), ...) seront désactivés.
|
|
||||||
|
|
||||||
Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise service :
|
|
||||||
|
|
||||||
```
|
|
||||||
<services>
|
|
||||||
<service name="test">
|
|
||||||
</service>
|
|
||||||
</services>
|
|
||||||
<variables>
|
|
||||||
<variable name="condition" type="boolean"/>
|
|
||||||
</variables>
|
|
||||||
<constraints>
|
|
||||||
<condition name="disabled_if_in" source="condition">
|
|
||||||
<param>False</param>
|
|
||||||
<target type="servicelist">test</target>
|
|
||||||
</condition>
|
|
||||||
</constraints>
|
|
||||||
```
|
|
||||||
|
|
||||||
Dans ce cas, tous les services et les éléments qu'il compose ([fichier](file.md), ...) avec un attribut servicelist à "test" seront désactivés si la variable "condition" est False.
|
|
@ -1,13 +1,13 @@
|
|||||||
# Le conteneur des services
|
# Le conteneur des services
|
||||||
|
|
||||||
La balise "services" est le conteneur de l'ensemble des [services](service/service.md).
|
La balise "services" est le conteneur de l'ensemble des [services](service/README.md).
|
||||||
|
|
||||||
Il est placé à la racine du dictionnaire :
|
Il est placé à la racine du dictionnaire :
|
||||||
|
|
||||||
```
|
```
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
<services/>
|
<services/>
|
||||||
</rougail>
|
</rougail>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
### servicelist
|
### servicelist
|
||||||
|
|
||||||
Une cible peut être de type [service](../service/service.md) :
|
Une cible peut être de type [service](../service/README.md) :
|
||||||
|
|
||||||
```
|
```
|
||||||
<target type="servicelist">example</target>
|
<target type="servicelist">example</target>
|
||||||
|
@ -8,10 +8,10 @@ Une variable est déjà un nom. C'est à dire qu'on pourra utiliser plus tard la
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="my_variable"/>
|
<variable name="my_variable"/>
|
||||||
<family name="my_family">
|
<family name="my_family">
|
||||||
<variable name="my_family_variable"/>
|
<variable name="my_family_variable"/>
|
||||||
</variable>
|
</variable>
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ Une variable a un type. Ce type permet de définir les valeurs acceptées par ce
|
|||||||
- number : un nombre
|
- number : un nombre
|
||||||
- float : un chiffre flottant
|
- float : un chiffre flottant
|
||||||
- boolean : "True" ou "False", si aucune valeur n'est défini la valeur par défaut de cette variable sera "True", ces variables sont également obligatoire par défaut
|
- boolean : "True" ou "False", si aucune valeur n'est défini la valeur par défaut de cette variable sera "True", ces variables sont également obligatoire par défaut
|
||||||
- password : un mot de passe
|
- secret (ou password mais est obsolète) : un secret (comme un mot de passe, une clef privée, ...)
|
||||||
- mail : une adresse mail
|
- mail : une adresse mail
|
||||||
- filename : nom de fichier au sens Unix (exemple : "/etc/passwd")
|
- filename : nom de fichier au sens Unix (exemple : "/etc/passwd")
|
||||||
- date : une date au format "%Y-%m-%d" (exemple : "2021-01-30")
|
- date : une date au format "%Y-%m-%d" (exemple : "2021-01-30")
|
||||||
@ -123,7 +123,7 @@ Il est possible de fixer les valeurs par défaut d'une variable :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable">
|
<variable name="my_variable">
|
||||||
<value>value</value>
|
<value>value</value>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -131,8 +131,8 @@ Pour une variable multiple, il est possible de préciser plusieurs valeurs :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" multi="True">
|
<variable name="my_variable" multi="True">
|
||||||
<value>value 1</value>
|
<value>value 1</value>
|
||||||
<value>value 2</value>
|
<value>value 2</value>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -152,7 +152,9 @@ Attention trois attributs ne sont redéfinisable :
|
|||||||
|
|
||||||
Créons notre variable :
|
Créons notre variable :
|
||||||
|
|
||||||
<variable name="my_variable"/>
|
```
|
||||||
|
<variable name="my_variable"/>
|
||||||
|
```
|
||||||
|
|
||||||
Et redéfinisons là :
|
Et redéfinisons là :
|
||||||
|
|
||||||
@ -186,7 +188,7 @@ Voici une variable a valeur automatiquement modifiée :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" auto_save="True">
|
<variable name="my_variable" auto_save="True">
|
||||||
<value>my_value</value>
|
<value>my_value</value>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -205,7 +207,7 @@ Voici un variable à valeur en lecture seule automatique :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="server_deployed" type="boolean">
|
<variable name="server_deployed" type="boolean">
|
||||||
<value>False</value>
|
<value>False</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="my_variable" auto_freeze="True"/>
|
<variable name="my_variable" auto_freeze="True"/>
|
||||||
```
|
```
|
||||||
@ -252,3 +254,22 @@ Pour définir le [mode](../mode.md) :
|
|||||||
```
|
```
|
||||||
<variable name="my_variable" mode="expert"/>
|
<variable name="my_variable" mode="expert"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Les variables qui fournissent des valeurs
|
||||||
|
|
||||||
|
Il peut être intéressant de retrouver facilement des variables sans connaitre le chemin complet mais en utilisant le contenu du paramètre "provider".
|
||||||
|
C'est particulièrement utile si un service peut être fournit par plusieurs services. Les variables n'auront donc pas le même nom. Utiliser ce paramètre, permet donc de retrouver facilement la variable.
|
||||||
|
|
||||||
|
Pour déclarer :
|
||||||
|
|
||||||
|
```
|
||||||
|
<variable name="my_variable" provider="my_function"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
Dans le code de l'application, on pourra retrouver le chemin de la variable en faisant :
|
||||||
|
|
||||||
|
```
|
||||||
|
print(await config.information.get('provider:my_function'))
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour les variables inclusent dans une famille dynamique, le chemin de la variable sera un template comme ceci "rougail.family_{suffix}.my_variable_{suffix}". Il vous suffit de remplacer "{suffix}" par le suffix voulu de la famille dynamique.
|
||||||
|
@ -6,9 +6,9 @@ Il est possible d'imposer une liste de valeur pour une variable particulière :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" type="choice">
|
<variable name="my_variable" type="choice">
|
||||||
<choice>val1</choice>
|
<choice>val1</choice>
|
||||||
<choice>val2</choice>
|
<choice>val2</choice>
|
||||||
<choice>val3</choice>
|
<choice>val3</choice>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -19,10 +19,10 @@ Si la variable est obligatoire ou si une valeur est précisée (la variable pass
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" type="choice">
|
<variable name="my_variable" type="choice">
|
||||||
<choice>val1</choice>
|
<choice>val1</choice>
|
||||||
<choice>val2</choice>
|
<choice>val2</choice>
|
||||||
<choice>val3</choice>
|
<choice>val3</choice>
|
||||||
<value>val1</value>
|
<value>val1</value>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ Par défaut les choix sont de type "string". Il est possible de préciser des no
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" type="choice">
|
<variable name="my_variable" type="choice">
|
||||||
<choice>val1</choice>
|
<choice>val1</choice>
|
||||||
<choice type="string">val2</choice>
|
<choice type="string">val2</choice>
|
||||||
<choice type="number">3</choice>
|
<choice type="number">3</choice>
|
||||||
<choice type="boolean">True</choice>
|
<choice type="boolean">True</choice>
|
||||||
<choice type="nil"/>
|
<choice type="nil"/>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ Pour ajouter un choix à une variable à choix existante, rien de plus simple, j
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" redefine="True">
|
<variable name="my_variable" redefine="True">
|
||||||
<choice>val4</choice>
|
<choice>val4</choice>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -58,8 +58,8 @@ Si on veut supprimer un choix ou redéfinir complètement la liste, il faut red
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" redefine="True" remove_choice="True">
|
<variable name="my_variable" redefine="True" remove_choice="True">
|
||||||
<choice>val1</choice>
|
<choice>val1</choice>
|
||||||
<choice>val2</choice>
|
<choice>val2</choice>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ Une variable à valeur multiple peut servir de source des choix :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" type="choice">
|
<variable name="my_variable" type="choice">
|
||||||
<choice type="variable">other_variable</choice>
|
<choice type="variable">other_variable</choice>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -82,10 +82,10 @@ Seul un choice de type "variable" est possible par variable.
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variable name="my_variable" type="choice">
|
<variable name="my_variable" type="choice">
|
||||||
<choice type="function" name="trange">
|
<choice type="function" name="trange">
|
||||||
<param type="number">0</param>
|
<param type="number">0</param>
|
||||||
<param type="number">10</param>
|
<param type="number">10</param>
|
||||||
</choice>
|
</choice>
|
||||||
<value type="number">9</value>
|
<value type="number">9</value>
|
||||||
</variable>
|
</variable>
|
||||||
```
|
```
|
||||||
|
@ -33,17 +33,17 @@ Voici un exemple de définition d'une variable meneuse et de deux variables mene
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="family">
|
<family name="family">
|
||||||
<variable name="leader" multi='True'/>
|
<variable name="leader" multi='True'/>
|
||||||
<variable name="follower1"/>
|
<variable name="follower1"/>
|
||||||
<variable name="follower2" multi='True'/>
|
<variable name="follower2" multi='True'/>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<group leader="leader">
|
<group leader="leader">
|
||||||
<follower>follower1</follower>
|
<follower>follower1</follower>
|
||||||
<follower>follower2</follower>
|
<follower>follower2</follower>
|
||||||
</group>
|
</group>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -53,30 +53,41 @@ Il est possible d'en définit d'autres :
|
|||||||
|
|
||||||
```
|
```
|
||||||
<constraints>
|
<constraints>
|
||||||
<group leader="leader" name="leadership" description="My leadership">
|
<group leader="leader" name="leadership" description="My leadership">
|
||||||
<follower>follower1</follower>
|
<follower>follower1</follower>
|
||||||
<follower>follower2</follower>
|
<follower>follower2</follower>
|
||||||
</group>
|
</group>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Faire un calcul avec l'index de la variable meneuse
|
||||||
|
|
||||||
|
Dans un calcul sur un variable suiveuse il est possible de récupérer l'index de la variable meneuse :
|
||||||
|
|
||||||
|
```
|
||||||
|
<fill name="calc_val">
|
||||||
|
<param type="index"/>
|
||||||
|
<target>follower</target>
|
||||||
|
</fill>
|
||||||
|
```
|
||||||
|
|
||||||
## Définition des variables meneuse et suiveuse dans un dictionnaire extra
|
## Définition des variables meneuse et suiveuse dans un dictionnaire extra
|
||||||
|
|
||||||
Voici un exemple de définition d'une variable meneuse et de deux variables meneuses dans un espace de nom "example" :
|
Voici un exemple de définition d'une variable meneuse et de deux variables meneuses dans un espace de nom "example" :
|
||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="family">
|
<family name="family">
|
||||||
<variable name="leader" multi='True'/>
|
<variable name="leader" multi='True'/>
|
||||||
<variable name="follower1"/>
|
<variable name="follower1"/>
|
||||||
<variable name="follower2" multi='True'/>
|
<variable name="follower2" multi='True'/>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<group leader="example.family.leader">
|
<group leader="example.family.leader">
|
||||||
<follower>follower1</follower>
|
<follower>follower1</follower>
|
||||||
<follower>follower2</follower>
|
<follower>follower2</follower>
|
||||||
</group>
|
</group>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -90,13 +101,13 @@ Pour ajouter, dans un nouveau dictionnaire, une variable suiveuse à notre group
|
|||||||
|
|
||||||
```
|
```
|
||||||
<variables>
|
<variables>
|
||||||
<family name="family">
|
<family name="family">
|
||||||
<variable name="follower3"/>
|
<variable name="follower3"/>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<group leader="leader">
|
<group leader="leader">
|
||||||
<follower>follower3</follower>
|
<follower>follower3</follower>
|
||||||
</group>
|
</group>
|
||||||
</constraints>
|
</constraints>
|
||||||
```
|
```
|
||||||
|
@ -7,6 +7,6 @@ Il est placé à la racine du dictionnaire :
|
|||||||
```
|
```
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
<variables/>
|
<variables/>
|
||||||
</rougail>
|
</rougail>
|
||||||
```
|
```
|
||||||
|
@ -64,19 +64,30 @@ def get_annotators(annotators, module_name):
|
|||||||
class SpaceAnnotator: # pylint: disable=R0903
|
class SpaceAnnotator: # pylint: disable=R0903
|
||||||
"""Transformations applied on a object instance
|
"""Transformations applied on a object instance
|
||||||
"""
|
"""
|
||||||
def __init__(self, objectspace, eosfunc_file):
|
def __init__(self,
|
||||||
|
objectspace,
|
||||||
|
eosfunc_files,
|
||||||
|
):
|
||||||
global ANNOTATORS
|
global ANNOTATORS
|
||||||
if ANNOTATORS is None:
|
if ANNOTATORS is None:
|
||||||
ANNOTATORS = {}
|
ANNOTATORS = {}
|
||||||
get_annotators(ANNOTATORS, 'rougail.annotator')
|
get_annotators(ANNOTATORS, 'rougail.annotator')
|
||||||
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
||||||
get_annotators(ANNOTATORS, extra_annotator)
|
get_annotators(ANNOTATORS, extra_annotator)
|
||||||
|
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
||||||
|
if extra_annotator not in ANNOTATORS:
|
||||||
|
get_annotators(ANNOTATORS, extra_annotator)
|
||||||
annotators = ANNOTATORS['rougail.annotator'].copy()
|
annotators = ANNOTATORS['rougail.annotator'].copy()
|
||||||
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
||||||
annotators.extend(ANNOTATORS[extra_annotator])
|
annotators.extend(ANNOTATORS[extra_annotator])
|
||||||
annotators = sorted(annotators, key=get_level)
|
annotators = sorted(annotators, key=get_level)
|
||||||
|
functions = []
|
||||||
|
for eosfunc_file in eosfunc_files:
|
||||||
|
functions.extend(dir(load_modules(eosfunc_file)))
|
||||||
for annotator in annotators:
|
for annotator in annotators:
|
||||||
annotator(objectspace, eosfunc_file)
|
annotator(objectspace,
|
||||||
|
functions,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
__all__ = ('SpaceAnnotator', 'CONVERT_OPTION')
|
__all__ = ('SpaceAnnotator', 'CONVERT_OPTION')
|
||||||
|
@ -25,11 +25,11 @@ 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 typing import List, Any
|
from typing import List, Any
|
||||||
|
from copy import copy
|
||||||
|
|
||||||
from rougail.annotator.target import TargetAnnotator
|
from rougail.annotator.target import TargetAnnotator
|
||||||
from rougail.annotator.param import ParamAnnotator
|
from rougail.annotator.param import ParamAnnotator
|
||||||
|
|
||||||
from rougail.utils import load_modules
|
|
||||||
from rougail.i18n import _
|
from rougail.i18n import _
|
||||||
from rougail.error import DictConsistencyError, display_xmlfiles
|
from rougail.error import DictConsistencyError, display_xmlfiles
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||||||
level = 40
|
level = 40
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
objectspace,
|
objectspace,
|
||||||
eosfunc_file,
|
functions,
|
||||||
*args,
|
*args,
|
||||||
):
|
):
|
||||||
if not hasattr(objectspace.space, 'constraints') or \
|
if not hasattr(objectspace.space, 'constraints') or \
|
||||||
@ -50,7 +50,7 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
self.let_none = True
|
self.let_none = True
|
||||||
self.only_variable = True
|
self.only_variable = True
|
||||||
self.functions = dir(load_modules(eosfunc_file))
|
self.functions = copy(functions)
|
||||||
self.functions.extend(INTERNAL_FUNCTIONS)
|
self.functions.extend(INTERNAL_FUNCTIONS)
|
||||||
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
||||||
self.target_is_uniq = False
|
self.target_is_uniq = False
|
||||||
@ -99,6 +99,8 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||||||
if param.type != 'number':
|
if param.type != 'number':
|
||||||
msg = _(f'param in "valid_entier" must be an "integer", not "{param.type}"')
|
msg = _(f'param in "valid_entier" must be an "integer", not "{param.type}"')
|
||||||
raise DictConsistencyError(msg, 18, check.xmlfiles)
|
raise DictConsistencyError(msg, 18, check.xmlfiles)
|
||||||
|
if not hasattr(param, 'name'):
|
||||||
|
continue
|
||||||
for target in check.target:
|
for target in check.target:
|
||||||
if param.name == 'mini':
|
if param.name == 'mini':
|
||||||
target.name.min_number = int(param.text)
|
target.name.min_number = int(param.text)
|
||||||
|
@ -268,7 +268,7 @@ class Annotator(Walk):
|
|||||||
for family in self.get_families():
|
for family in self.get_families():
|
||||||
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, family.xmlfiles)
|
||||||
del family.dynamic
|
del family.dynamic
|
||||||
if not family.suffixes.multi:
|
if not family.suffixes.multi:
|
||||||
msg = _(f'dynamic family "{family.name}" must be linked '
|
msg = _(f'dynamic family "{family.name}" must be linked '
|
||||||
|
@ -24,7 +24,7 @@ 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 rougail.utils import load_modules
|
from copy import copy
|
||||||
from rougail.i18n import _
|
from rougail.i18n import _
|
||||||
from rougail.error import DictConsistencyError
|
from rougail.error import DictConsistencyError
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ from rougail.annotator.target import TargetAnnotator
|
|||||||
from rougail.annotator.param import ParamAnnotator
|
from rougail.annotator.param import ParamAnnotator
|
||||||
|
|
||||||
|
|
||||||
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename')
|
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename', 'zone_information', 'get_certificates', 'nsd_filename', 'get_linked_configuration', 'get_internal_zones', 'nsd_concat_lists', 'get_internal_info_in_zone')
|
||||||
|
|
||||||
|
|
||||||
class Annotator(TargetAnnotator, ParamAnnotator):
|
class Annotator(TargetAnnotator, ParamAnnotator):
|
||||||
@ -41,15 +41,17 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||||||
level = 60
|
level = 60
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
objectspace,
|
objectspace,
|
||||||
eosfunc_file,
|
functions,
|
||||||
*args,
|
*args,
|
||||||
):
|
):
|
||||||
if not hasattr(objectspace.space, 'constraints') or \
|
if not hasattr(objectspace.space, 'constraints') or \
|
||||||
not hasattr(objectspace.space.constraints, 'fill'):
|
not hasattr(objectspace.space.constraints, 'fill'):
|
||||||
return
|
return
|
||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
self.functions = dir(load_modules(eosfunc_file))
|
self.functions = copy(functions)
|
||||||
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
||||||
|
self.calc_multi = list(CALC_MULTI)
|
||||||
|
self.calc_multi.extend(self.objectspace.rougailconfig['multi_functions'])
|
||||||
self.target_is_uniq = True
|
self.target_is_uniq = True
|
||||||
self.only_variable = True
|
self.only_variable = True
|
||||||
self.allow_function = False
|
self.allow_function = False
|
||||||
@ -79,7 +81,7 @@ class Annotator(TargetAnnotator, ParamAnnotator):
|
|||||||
value = self.objectspace.value(fill.xmlfiles)
|
value = self.objectspace.value(fill.xmlfiles)
|
||||||
value.type = 'calculation'
|
value.type = 'calculation'
|
||||||
value.name = fill.name
|
value.name = fill.name
|
||||||
if fill.name not in CALC_MULTI:
|
if fill.name not in self.calc_multi:
|
||||||
is_calc_multi = self.calc_is_multi(target.name)
|
is_calc_multi = self.calc_is_multi(target.name)
|
||||||
else:
|
else:
|
||||||
is_calc_multi = False
|
is_calc_multi = False
|
||||||
|
@ -59,7 +59,7 @@ class ParamAnnotator:
|
|||||||
if param.type in ['suffix', 'index']:
|
if param.type in ['suffix', 'index']:
|
||||||
msg = _(f'"{param.type}" parameter must not have a value')
|
msg = _(f'"{param.type}" parameter must not have a value')
|
||||||
raise DictConsistencyError(msg, 28, obj.xmlfiles)
|
raise DictConsistencyError(msg, 28, obj.xmlfiles)
|
||||||
if param.type == 'nil':
|
if param.type in ['nil', 'space']:
|
||||||
if param.text is not None:
|
if param.text is not None:
|
||||||
msg = _(f'"{param.type}" parameter must not have a value')
|
msg = _(f'"{param.type}" parameter must not have a value')
|
||||||
raise DictConsistencyError(msg, 40, obj.xmlfiles)
|
raise DictConsistencyError(msg, 40, obj.xmlfiles)
|
||||||
@ -102,8 +102,11 @@ class ParamAnnotator:
|
|||||||
if param.type == 'suffix':
|
if param.type == 'suffix':
|
||||||
for target in obj.target:
|
for target in obj.target:
|
||||||
if not self.objectspace.paths.variable_is_dynamic(target.name.path):
|
if not self.objectspace.paths.variable_is_dynamic(target.name.path):
|
||||||
|
target_name = target.name
|
||||||
|
if isinstance(target_name, self.objectspace.variable):
|
||||||
|
target_name = target_name.name
|
||||||
msg = _(f'"{param.type}" parameter cannot be set with target '
|
msg = _(f'"{param.type}" parameter cannot be set with target '
|
||||||
f'"{target.name}" which is not a dynamic variable')
|
f'"{target_name}" which is not a dynamic variable')
|
||||||
raise DictConsistencyError(msg, 53, obj.xmlfiles)
|
raise DictConsistencyError(msg, 53, obj.xmlfiles)
|
||||||
elif param.type == 'index':
|
elif param.type == 'index':
|
||||||
for target in obj.target:
|
for target in obj.target:
|
||||||
@ -113,6 +116,9 @@ class ParamAnnotator:
|
|||||||
raise DictConsistencyError(msg, 60, obj.xmlfiles)
|
raise DictConsistencyError(msg, 60, obj.xmlfiles)
|
||||||
elif param.type == 'nil':
|
elif param.type == 'nil':
|
||||||
param.text = None
|
param.text = None
|
||||||
|
elif param.type == 'space':
|
||||||
|
param.type = 'string'
|
||||||
|
param.text = ' '
|
||||||
elif param.type == 'string':
|
elif param.type == 'string':
|
||||||
param.text = ''
|
param.text = ''
|
||||||
if variable_type:
|
if variable_type:
|
||||||
|
@ -56,11 +56,13 @@ class Annotator(Walk):
|
|||||||
# hidden variable is also frozen
|
# hidden variable is also frozen
|
||||||
if isinstance(variable, self.objectspace.variable) and variable.hidden is True and \
|
if isinstance(variable, self.objectspace.variable) and variable.hidden is True and \
|
||||||
variable.name != self.objectspace.rougailconfig['auto_freeze_variable']:
|
variable.name != self.objectspace.rougailconfig['auto_freeze_variable']:
|
||||||
if not variable.auto_freeze:
|
if not variable.auto_freeze and \
|
||||||
|
not hasattr(variable, 'provider'):
|
||||||
variable.frozen = True
|
variable.frozen = True
|
||||||
if not variable.auto_save and \
|
if not variable.auto_save and \
|
||||||
not variable.auto_freeze and \
|
not variable.auto_freeze and \
|
||||||
'force_default_on_freeze' not in vars(variable):
|
'force_default_on_freeze' not in vars(variable) and \
|
||||||
|
not hasattr(variable, 'provider'):
|
||||||
variable.force_default_on_freeze = True
|
variable.force_default_on_freeze = True
|
||||||
if not hasattr(variable, 'properties'):
|
if not hasattr(variable, 'properties'):
|
||||||
variable.properties = []
|
variable.properties = []
|
||||||
|
@ -33,7 +33,7 @@ from rougail.error import DictConsistencyError
|
|||||||
# a object's attribute has some annotations
|
# a object's attribute has some annotations
|
||||||
# that shall not be present in the exported (flatened) XML
|
# that shall not be present in the exported (flatened) XML
|
||||||
ERASED_ATTRIBUTES = ('redefine', 'namespace', 'xmlfiles', 'disabled', 'name', 'manage')
|
ERASED_ATTRIBUTES = ('redefine', 'namespace', 'xmlfiles', 'disabled', 'name', 'manage')
|
||||||
ERASED_ATTRIBUTES2 = ('redefine', 'namespace', 'xmlfiles')
|
ERASED_ATTRIBUTES2 = ('redefine', 'namespace', 'xmlfiles', 'disabled')
|
||||||
ALLOW_ATTRIBUT_NOT_MANAGE = ['file', 'engine', 'target']
|
ALLOW_ATTRIBUT_NOT_MANAGE = ['file', 'engine', 'target']
|
||||||
|
|
||||||
|
|
||||||
@ -115,6 +115,7 @@ class Annotator:
|
|||||||
if not hasattr(service, 'information'):
|
if not hasattr(service, 'information'):
|
||||||
service.information = self.objectspace.information(service.xmlfiles)
|
service.information = self.objectspace.information(service.xmlfiles)
|
||||||
setattr(service.information, elttype, values)
|
setattr(service.information, elttype, values)
|
||||||
|
service.path = '.'.join(['services', service.name])
|
||||||
manage = self._generate_element('boolean',
|
manage = self._generate_element('boolean',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
@ -152,11 +153,15 @@ class Annotator:
|
|||||||
elt.xmlfiles,
|
elt.xmlfiles,
|
||||||
)
|
)
|
||||||
family.variable = []
|
family.variable = []
|
||||||
|
if hasattr(elt, 'disabled'):
|
||||||
|
disabled = elt.disabled
|
||||||
|
else:
|
||||||
|
disabled = False
|
||||||
activate_obj = self._generate_element('boolean',
|
activate_obj = self._generate_element('boolean',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
'activate',
|
'activate',
|
||||||
True,
|
not disabled,
|
||||||
elt,
|
elt,
|
||||||
'.'.join([subpath, 'activate']),
|
'.'.join([subpath, 'activate']),
|
||||||
)
|
)
|
||||||
@ -248,7 +253,7 @@ class Annotator:
|
|||||||
variable.mode = None
|
variable.mode = None
|
||||||
variable.type = type_
|
variable.type = type_
|
||||||
if type_ == 'symlink':
|
if type_ == 'symlink':
|
||||||
variable.opt = self.objectspace.paths.get_variable(value)
|
variable.opt = self.objectspace.paths.get_variable(value, xmlfiles=elt.xmlfiles)
|
||||||
variable.multi = None
|
variable.multi = None
|
||||||
needed_type = self.objectspace.types[dtd_key_type]
|
needed_type = self.objectspace.types[dtd_key_type]
|
||||||
if needed_type not in ('variable', variable.opt.type):
|
if needed_type not in ('variable', variable.opt.type):
|
||||||
@ -280,7 +285,7 @@ class Annotator:
|
|||||||
self.uniq_overrides.append(service_name)
|
self.uniq_overrides.append(service_name)
|
||||||
override.name = service_name
|
override.name = service_name
|
||||||
if not hasattr(override, 'source'):
|
if not hasattr(override, 'source'):
|
||||||
override.source = f'{service_name}.service'
|
override.source = service_name
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _update_file(file_,
|
def _update_file(file_,
|
||||||
|
@ -35,6 +35,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
|||||||
'choice': dict(opttype="ChoiceOption"),
|
'choice': dict(opttype="ChoiceOption"),
|
||||||
'string': dict(opttype="StrOption"),
|
'string': dict(opttype="StrOption"),
|
||||||
'password': dict(opttype="PasswordOption"),
|
'password': dict(opttype="PasswordOption"),
|
||||||
|
'secret': dict(opttype="PasswordOption"),
|
||||||
'mail': dict(opttype="EmailOption"),
|
'mail': dict(opttype="EmailOption"),
|
||||||
'boolean': dict(opttype="BoolOption", func=convert_boolean),
|
'boolean': dict(opttype="BoolOption", func=convert_boolean),
|
||||||
'symlink': dict(opttype="SymLinkOption"),
|
'symlink': dict(opttype="SymLinkOption"),
|
||||||
@ -162,6 +163,8 @@ class Annotator(Walk): # pylint: disable=R0903
|
|||||||
raise DictConsistencyError(msg, 5, choice.xmlfiles)
|
raise DictConsistencyError(msg, 5, choice.xmlfiles)
|
||||||
if choice.type == 'nil':
|
if choice.type == 'nil':
|
||||||
choice.name = None
|
choice.name = None
|
||||||
|
elif choice.type == 'space':
|
||||||
|
choice.name = ' '
|
||||||
elif choice.type == 'variable':
|
elif choice.type == 'variable':
|
||||||
choice.name = self.objectspace.paths.get_variable(choice.name)
|
choice.name = self.objectspace.paths.get_variable(choice.name)
|
||||||
if not choice.name.multi:
|
if not choice.name.multi:
|
||||||
|
@ -40,9 +40,11 @@ RougailConfig = {'dictionaries_dir': [join(ROUGAILROOT, 'dictionaries')],
|
|||||||
'tmp_dir': join(ROUGAILROOT, 'tmp'),
|
'tmp_dir': join(ROUGAILROOT, 'tmp'),
|
||||||
'dtdfilename': join(DTDDIR, 'rougail.dtd'),
|
'dtdfilename': join(DTDDIR, 'rougail.dtd'),
|
||||||
'functions_file': join(ROUGAILROOT, 'functions.py'),
|
'functions_file': join(ROUGAILROOT, 'functions.py'),
|
||||||
|
'tmpfile_dest_dir': '/usr/local/lib',
|
||||||
'variable_namespace': 'rougail',
|
'variable_namespace': 'rougail',
|
||||||
'auto_freeze_variable': 'server_deployed',
|
'auto_freeze_variable': 'server_deployed',
|
||||||
'internal_functions': [],
|
'internal_functions': [],
|
||||||
|
'multi_functions': [],
|
||||||
'extra_annotators': [],
|
'extra_annotators': [],
|
||||||
'modes_level': ['basic', 'normal', 'expert'],
|
'modes_level': ['basic', 'normal', 'expert'],
|
||||||
'default_family_mode': 'basic',
|
'default_family_mode': 'basic',
|
||||||
|
@ -79,11 +79,14 @@ class RougailConvert:
|
|||||||
extra_dir,
|
extra_dir,
|
||||||
)
|
)
|
||||||
functions_file = rougailconfig['functions_file']
|
functions_file = rougailconfig['functions_file']
|
||||||
|
if not isinstance(functions_file, list):
|
||||||
|
functions_file = [functions_file]
|
||||||
SpaceAnnotator(rougailobjspace,
|
SpaceAnnotator(rougailobjspace,
|
||||||
functions_file,
|
functions_file,
|
||||||
)
|
)
|
||||||
self.output = TiramisuReflector(rougailobjspace,
|
self.output = TiramisuReflector(rougailobjspace,
|
||||||
functions_file,
|
functions_file,
|
||||||
|
rougailconfig['internal_functions'],
|
||||||
).get_text() + '\n'
|
).get_text() + '\n'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
<!ATTLIST service disabled (True|False) "False">
|
<!ATTLIST service disabled (True|False) "False">
|
||||||
<!ATTLIST service engine (none|creole|jinja2) #IMPLIED>
|
<!ATTLIST service engine (none|creole|jinja2) #IMPLIED>
|
||||||
<!ATTLIST service target CDATA #IMPLIED>
|
<!ATTLIST service target CDATA #IMPLIED>
|
||||||
<!ATTLIST service type (service|mount) "service">
|
<!ATTLIST service type (service|mount|swap|timer) "service">
|
||||||
|
<!ATTLIST service undisable (True|False) "False">
|
||||||
|
|
||||||
<!ELEMENT ip (#PCDATA)>
|
<!ELEMENT ip (#PCDATA)>
|
||||||
<!ATTLIST ip iplist CDATA #IMPLIED>
|
<!ATTLIST ip iplist CDATA #IMPLIED>
|
||||||
@ -68,11 +69,14 @@
|
|||||||
<!ATTLIST file source CDATA #IMPLIED>
|
<!ATTLIST file source CDATA #IMPLIED>
|
||||||
<!ATTLIST file mode CDATA #IMPLIED>
|
<!ATTLIST file mode CDATA #IMPLIED>
|
||||||
<!ATTLIST file owner CDATA #IMPLIED>
|
<!ATTLIST file owner CDATA #IMPLIED>
|
||||||
|
<!ATTLIST file owner_type (unix_user|variable) "unix_user">
|
||||||
<!ATTLIST file group CDATA #IMPLIED>
|
<!ATTLIST file group CDATA #IMPLIED>
|
||||||
|
<!ATTLIST file group_type (unix_user|variable) "unix_user">
|
||||||
<!ATTLIST file filelist CDATA #IMPLIED>
|
<!ATTLIST file filelist CDATA #IMPLIED>
|
||||||
<!ATTLIST file redefine (True|False) "False">
|
<!ATTLIST file redefine (True|False) "False">
|
||||||
<!ATTLIST file engine (none|creole|jinja2|creole_legacy) #IMPLIED>
|
<!ATTLIST file engine (none|creole|jinja2|creole_legacy) #IMPLIED>
|
||||||
<!ATTLIST file included (no|name|content) #IMPLIED>
|
<!ATTLIST file included (no|name|content) #IMPLIED>
|
||||||
|
<!ATTLIST file disabled (True|False) "False">
|
||||||
|
|
||||||
<!ELEMENT override EMPTY>
|
<!ELEMENT override EMPTY>
|
||||||
<!ATTLIST override source CDATA #IMPLIED>
|
<!ATTLIST override source CDATA #IMPLIED>
|
||||||
@ -88,11 +92,10 @@
|
|||||||
<!ATTLIST family hidden (True|False) "False">
|
<!ATTLIST family hidden (True|False) "False">
|
||||||
<!ATTLIST family dynamic CDATA #IMPLIED>
|
<!ATTLIST family dynamic CDATA #IMPLIED>
|
||||||
<!ATTLIST family leadership (True|False) "False">
|
<!ATTLIST family leadership (True|False) "False">
|
||||||
<!ATTLIST family provider CDATA #IMPLIED>
|
|
||||||
|
|
||||||
<!ELEMENT variable ((choice*|value*)*)>
|
<!ELEMENT variable ((choice*|value*)*)>
|
||||||
<!ATTLIST variable name CDATA #REQUIRED>
|
<!ATTLIST variable name CDATA #REQUIRED>
|
||||||
<!ATTLIST variable type (number|float|string|password|mail|boolean|filename|date|unix_user|ip|local_ip|netmask|network|broadcast|netbios|domainname|hostname|web_address|port|mac|cidr|network_cidr|choice) "string">
|
<!ATTLIST variable type (number|float|string|password|secret|mail|boolean|filename|date|unix_user|ip|local_ip|netmask|network|broadcast|netbios|domainname|hostname|web_address|port|mac|cidr|network_cidr|choice) "string">
|
||||||
<!ATTLIST variable description CDATA #IMPLIED>
|
<!ATTLIST variable description CDATA #IMPLIED>
|
||||||
<!ATTLIST variable help CDATA #IMPLIED>
|
<!ATTLIST variable help CDATA #IMPLIED>
|
||||||
<!ATTLIST variable hidden (True|False) "False">
|
<!ATTLIST variable hidden (True|False) "False">
|
||||||
@ -112,10 +115,10 @@
|
|||||||
<!ATTLIST variable test CDATA #IMPLIED>
|
<!ATTLIST variable test CDATA #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT value (#PCDATA)>
|
<!ELEMENT value (#PCDATA)>
|
||||||
<!ATTLIST value type (string|number|nil|boolean) #IMPLIED>
|
<!ATTLIST value type (string|number|nil|space|boolean) #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT choice (#PCDATA | param)*>
|
<!ELEMENT choice (#PCDATA | param)*>
|
||||||
<!ATTLIST choice type (string|number|nil|boolean|function|variable) "string">
|
<!ATTLIST choice type (string|number|nil|space|boolean|function|variable) "string">
|
||||||
<!ATTLIST choice name CDATA #IMPLIED>
|
<!ATTLIST choice name CDATA #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT constraints ((fill*|check*|condition*)*)>
|
<!ELEMENT constraints ((fill*|check*|condition*)*)>
|
||||||
@ -134,7 +137,7 @@
|
|||||||
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT param (#PCDATA)>
|
<!ELEMENT param (#PCDATA)>
|
||||||
<!ATTLIST param type (string|number|nil|boolean|variable|function|information|target_information|suffix|index) "string">
|
<!ATTLIST param type (string|number|nil|space|boolean|variable|function|information|target_information|suffix|index) "string">
|
||||||
<!ATTLIST param name CDATA #IMPLIED>
|
<!ATTLIST param name CDATA #IMPLIED>
|
||||||
<!ATTLIST param propertyerror (True|False) "True">
|
<!ATTLIST param propertyerror (True|False) "True">
|
||||||
<!ATTLIST param optional (True|False) "False">
|
<!ATTLIST param optional (True|False) "False">
|
||||||
|
@ -179,6 +179,7 @@ class RougailObjSpace:
|
|||||||
self.space,
|
self.space,
|
||||||
namespace,
|
namespace,
|
||||||
redefine_variables,
|
redefine_variables,
|
||||||
|
False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _xml_parse(self, # pylint: disable=R0913
|
def _xml_parse(self, # pylint: disable=R0913
|
||||||
@ -187,10 +188,15 @@ class RougailObjSpace:
|
|||||||
space,
|
space,
|
||||||
namespace,
|
namespace,
|
||||||
redefine_variables,
|
redefine_variables,
|
||||||
|
is_dynamic,
|
||||||
) -> None:
|
) -> None:
|
||||||
# var to check unique family name in a XML file
|
# var to check unique family name in a XML file
|
||||||
family_names = []
|
family_names = []
|
||||||
for child in document:
|
for child in document:
|
||||||
|
if is_dynamic:
|
||||||
|
is_sub_dynamic = True
|
||||||
|
else:
|
||||||
|
is_sub_dynamic = document.attrib.get('dynamic') is not None
|
||||||
if not isinstance(child.tag, str):
|
if not isinstance(child.tag, str):
|
||||||
# doesn't proceed the XML commentaries
|
# doesn't proceed the XML commentaries
|
||||||
continue
|
continue
|
||||||
@ -225,6 +231,7 @@ class RougailObjSpace:
|
|||||||
document,
|
document,
|
||||||
variableobj,
|
variableobj,
|
||||||
space,
|
space,
|
||||||
|
is_sub_dynamic,
|
||||||
)
|
)
|
||||||
self.add_to_tree_structure(variableobj,
|
self.add_to_tree_structure(variableobj,
|
||||||
space,
|
space,
|
||||||
@ -237,6 +244,7 @@ class RougailObjSpace:
|
|||||||
variableobj,
|
variableobj,
|
||||||
namespace,
|
namespace,
|
||||||
redefine_variables,
|
redefine_variables,
|
||||||
|
is_sub_dynamic,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_variableobj(self,
|
def get_variableobj(self,
|
||||||
@ -278,6 +286,8 @@ class RougailObjSpace:
|
|||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
if child.tag == 'variables':
|
if child.tag == 'variables':
|
||||||
return namespace
|
return namespace
|
||||||
|
if child.tag == 'service':
|
||||||
|
return child.attrib['name'] + '.' + child.attrib.get('type', 'service')
|
||||||
if 'name' in child.attrib:
|
if 'name' in child.attrib:
|
||||||
return child.attrib['name']
|
return child.attrib['name']
|
||||||
if child.text and child.tag in self.forced_text_elts_as_name:
|
if child.text and child.tag in self.forced_text_elts_as_name:
|
||||||
@ -472,6 +482,7 @@ class RougailObjSpace:
|
|||||||
document,
|
document,
|
||||||
variableobj,
|
variableobj,
|
||||||
space,
|
space,
|
||||||
|
is_dynamic,
|
||||||
):
|
):
|
||||||
"""Fill self.paths attributes
|
"""Fill self.paths attributes
|
||||||
"""
|
"""
|
||||||
@ -488,7 +499,7 @@ class RougailObjSpace:
|
|||||||
self.paths.add_variable(namespace,
|
self.paths.add_variable(namespace,
|
||||||
variableobj.name,
|
variableobj.name,
|
||||||
space.path,
|
space.path,
|
||||||
document.attrib.get('dynamic') is not None,
|
is_dynamic,
|
||||||
variableobj,
|
variableobj,
|
||||||
leader,
|
leader,
|
||||||
)
|
)
|
||||||
|
@ -125,6 +125,8 @@ class Path:
|
|||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""Add a new variable (with path)
|
"""Add a new variable (with path)
|
||||||
"""
|
"""
|
||||||
|
if name == 'hostname_' and not is_dynamic:
|
||||||
|
raise Exception('pffff')
|
||||||
if '.' not in name:
|
if '.' not in name:
|
||||||
full_path = '.'.join([family, name])
|
full_path = '.'.join([family, name])
|
||||||
if namespace == self.variable_namespace:
|
if namespace == self.variable_namespace:
|
||||||
@ -174,6 +176,7 @@ class Path:
|
|||||||
)
|
)
|
||||||
namespace = dico['variableobj'].namespace
|
namespace = dico['variableobj'].namespace
|
||||||
if namespace not in [self.variable_namespace, 'services'] and \
|
if namespace not in [self.variable_namespace, 'services'] and \
|
||||||
|
current_namespace != 'services' and \
|
||||||
current_namespace != namespace:
|
current_namespace != namespace:
|
||||||
msg = _(f'A variable located in the "{namespace}" namespace shall not be used '
|
msg = _(f'A variable located in the "{namespace}" namespace shall not be used '
|
||||||
f'in the "{current_namespace}" namespace')
|
f'in the "{current_namespace}" namespace')
|
||||||
|
@ -29,7 +29,7 @@ from shutil import copy
|
|||||||
import logging
|
import logging
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
from os import listdir, makedirs, getcwd, chdir
|
from os import listdir, makedirs, getcwd, chdir, unlink, rmdir
|
||||||
from os.path import dirname, join, isfile, isdir, abspath
|
from os.path import dirname, join, isfile, isdir, abspath
|
||||||
|
|
||||||
|
|
||||||
@ -55,9 +55,12 @@ log = logging.getLogger(__name__)
|
|||||||
log.addHandler(logging.NullHandler())
|
log.addHandler(logging.NullHandler())
|
||||||
|
|
||||||
|
|
||||||
INFORMATIONS = {'files': ['source', 'mode', 'owner', 'group', 'engine', 'included'],
|
INFORMATIONS = {'files': ['source', 'mode', 'engine', 'included'],
|
||||||
'overrides': ['name', 'source', 'engine'],
|
'overrides': ['name', 'source', 'engine'],
|
||||||
}
|
}
|
||||||
|
DEFAULT = {'files': ['owner', 'group'],
|
||||||
|
'overrides': [],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class RougailLeaderIndex:
|
class RougailLeaderIndex:
|
||||||
@ -184,6 +187,11 @@ class RougailExtra:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
raise AttributeError(f'unable to find extra "{key}"')
|
raise AttributeError(f'unable to find extra "{key}"')
|
||||||
|
|
||||||
|
def __getitem__(self,
|
||||||
|
key: str,
|
||||||
|
) -> Any:
|
||||||
|
return self.__getattr__(key)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self._suboption.values())
|
return iter(self._suboption.values())
|
||||||
|
|
||||||
@ -191,7 +199,10 @@ class RougailExtra:
|
|||||||
return self._suboption.items()
|
return self._suboption.items()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'<extra object with: {self._suboption}>'
|
suboptions = {}
|
||||||
|
for key, value in self._suboption.items():
|
||||||
|
suboptions[key] = str(value)
|
||||||
|
return f'<extra object with: {suboptions}>'
|
||||||
|
|
||||||
|
|
||||||
class RougailBaseTemplate:
|
class RougailBaseTemplate:
|
||||||
@ -206,15 +217,23 @@ class RougailBaseTemplate:
|
|||||||
self.config = config
|
self.config = config
|
||||||
self.destinations_dir = abspath(rougailconfig['destinations_dir'])
|
self.destinations_dir = abspath(rougailconfig['destinations_dir'])
|
||||||
self.tmp_dir = abspath(rougailconfig['tmp_dir'])
|
self.tmp_dir = abspath(rougailconfig['tmp_dir'])
|
||||||
self.templates_dir = abspath(rougailconfig['templates_dir'])
|
self.templates_dir = []
|
||||||
|
templates_dir = rougailconfig['templates_dir']
|
||||||
|
if not isinstance(templates_dir, list):
|
||||||
|
templates_dir = [templates_dir]
|
||||||
|
for templ_dir in templates_dir:
|
||||||
|
self.templates_dir.append(abspath(templ_dir))
|
||||||
self.patches_dir = abspath(rougailconfig['patches_dir'])
|
self.patches_dir = abspath(rougailconfig['patches_dir'])
|
||||||
eos = {}
|
eos = {}
|
||||||
functions_file = rougailconfig['functions_file']
|
functions_file = rougailconfig['functions_file']
|
||||||
if isfile(functions_file):
|
if not isinstance(functions_file, list):
|
||||||
eosfunc = load_modules(functions_file)
|
functions_file = [functions_file]
|
||||||
for func in dir(eosfunc):
|
for function in functions_file:
|
||||||
if not func.startswith('_'):
|
if isfile(function):
|
||||||
eos[func] = getattr(eosfunc, func)
|
eosfunc = load_modules(function)
|
||||||
|
for func in dir(eosfunc):
|
||||||
|
if not func.startswith('_'):
|
||||||
|
eos[func] = getattr(eosfunc, func)
|
||||||
self.eosfunc = eos
|
self.eosfunc = eos
|
||||||
self.rougail_variables_dict = {}
|
self.rougail_variables_dict = {}
|
||||||
self.rougailconfig = rougailconfig
|
self.rougailconfig = rougailconfig
|
||||||
@ -223,6 +242,7 @@ class RougailBaseTemplate:
|
|||||||
|
|
||||||
def patch_template(self,
|
def patch_template(self,
|
||||||
filename: str,
|
filename: str,
|
||||||
|
templates_dir: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Apply patch to a template
|
"""Apply patch to a template
|
||||||
"""
|
"""
|
||||||
@ -238,25 +258,25 @@ class RougailBaseTemplate:
|
|||||||
msg = _(f"Error applying patch: '{patch_file}'\n"
|
msg = _(f"Error applying patch: '{patch_file}'\n"
|
||||||
f"To reproduce and fix this error {patch_cmd_err}")
|
f"To reproduce and fix this error {patch_cmd_err}")
|
||||||
self.log.error(_(msg))
|
self.log.error(_(msg))
|
||||||
copy(join(self.templates_dir, filename), self.tmp_dir)
|
copy(join(templates_dir, filename), self.tmp_dir)
|
||||||
|
|
||||||
def prepare_template(self,
|
def prepare_template(self,
|
||||||
filename: str,
|
filename: str,
|
||||||
|
templates_dir: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Prepare template source file
|
"""Prepare template source file
|
||||||
"""
|
"""
|
||||||
self.log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
|
self.log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
|
||||||
if not isdir(self.tmp_dir):
|
if not isdir(self.tmp_dir):
|
||||||
raise TemplateError(_(f'cannot find tmp_dir {self.tmp_dir}'))
|
raise TemplateError(_(f'cannot find tmp_dir {self.tmp_dir}'))
|
||||||
copy(filename, self.tmp_dir)
|
copy(join(templates_dir, filename), self.tmp_dir)
|
||||||
self.patch_template(filename)
|
self.patch_template(filename, templates_dir)
|
||||||
|
|
||||||
def instance_file(self,
|
def instance_file(self,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
type_: str,
|
type_: str,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
service_type: str,
|
) -> str:
|
||||||
) -> None:
|
|
||||||
"""Run templatisation on one file
|
"""Run templatisation on one file
|
||||||
"""
|
"""
|
||||||
self.log.info(_("Instantiating file '{filename}'"))
|
self.log.info(_("Instantiating file '{filename}'"))
|
||||||
@ -271,6 +291,7 @@ class RougailBaseTemplate:
|
|||||||
variable = [variable]
|
variable = [variable]
|
||||||
if not isdir(self.destinations_dir):
|
if not isdir(self.destinations_dir):
|
||||||
raise TemplateError(_(f'cannot find destinations_dir {self.destinations_dir}'))
|
raise TemplateError(_(f'cannot find destinations_dir {self.destinations_dir}'))
|
||||||
|
destfilenames = []
|
||||||
for idx, filename, in enumerate(filenames):
|
for idx, filename, in enumerate(filenames):
|
||||||
if variable:
|
if variable:
|
||||||
var = variable[idx]
|
var = variable[idx]
|
||||||
@ -280,31 +301,42 @@ class RougailBaseTemplate:
|
|||||||
data = getattr(self, func)(filevar,
|
data = getattr(self, func)(filevar,
|
||||||
filename,
|
filename,
|
||||||
service_name,
|
service_name,
|
||||||
service_type,
|
|
||||||
variable,
|
variable,
|
||||||
idx,
|
idx,
|
||||||
)
|
)
|
||||||
if data is None:
|
if data is None:
|
||||||
continue
|
continue
|
||||||
filename, source, destfile, var = data
|
filename, source, true_destfilename, var = data
|
||||||
destfilename = join(self.destinations_dir, destfile[1:])
|
destfilename = join(self.destinations_dir, true_destfilename[1:])
|
||||||
makedirs(dirname(destfilename), exist_ok=True)
|
makedirs(dirname(destfilename), exist_ok=True)
|
||||||
self.log.info(_(f"{filevar['engine']} processing: '{destfilename}'"))
|
self.log.info(_(f"{filevar['engine']} processing: '{destfilename}'"))
|
||||||
self.engines[filevar['engine']].process(filename=filename,
|
self.engines[filevar['engine']].process(filename=filename,
|
||||||
source=source,
|
source=source,
|
||||||
true_destfilename=destfile,
|
true_destfilename=true_destfilename,
|
||||||
destfilename=destfilename,
|
destfilename=destfilename,
|
||||||
destdir=self.destinations_dir,
|
destdir=self.destinations_dir,
|
||||||
variable=var,
|
variable=var,
|
||||||
|
index=idx,
|
||||||
rougail_variables_dict=self.rougail_variables_dict,
|
rougail_variables_dict=self.rougail_variables_dict,
|
||||||
eosfunc=self.eosfunc,
|
eosfunc=self.eosfunc,
|
||||||
)
|
)
|
||||||
|
self.process(true_destfilename,
|
||||||
|
destfilename,
|
||||||
|
filevar.get('mode'),
|
||||||
|
filevar.get('owner'),
|
||||||
|
filevar.get('group'),
|
||||||
|
)
|
||||||
|
destfilenames.append(destfilename)
|
||||||
|
return destfilenames
|
||||||
|
|
||||||
async def instance_files(self) -> None:
|
async def instance_files(self) -> None:
|
||||||
"""Run templatisation on all files
|
"""Run templatisation on all files
|
||||||
"""
|
"""
|
||||||
ori_dir = getcwd()
|
try:
|
||||||
chdir(self.templates_dir)
|
ori_dir = getcwd()
|
||||||
|
except FileNotFoundError:
|
||||||
|
ori_dir = None
|
||||||
|
chdir(self.tmp_dir)
|
||||||
for option in await self.config.option.list(type='all'):
|
for option in await self.config.option.list(type='all'):
|
||||||
namespace = await option.option.name()
|
namespace = await option.option.name()
|
||||||
is_variable_namespace = namespace == self.rougailconfig['variable_namespace']
|
is_variable_namespace = namespace == self.rougailconfig['variable_namespace']
|
||||||
@ -316,15 +348,18 @@ class RougailBaseTemplate:
|
|||||||
is_variable_namespace,
|
is_variable_namespace,
|
||||||
is_service_namespace,
|
is_service_namespace,
|
||||||
)
|
)
|
||||||
for template in listdir('.'):
|
for templates_dir in self.templates_dir:
|
||||||
self.prepare_template(template)
|
for template in listdir(templates_dir):
|
||||||
|
self.prepare_template(template,
|
||||||
|
templates_dir,
|
||||||
|
)
|
||||||
|
files_to_delete = []
|
||||||
for included in (True, False):
|
for included in (True, False):
|
||||||
for service_obj in await self.config.option('services').list('all'):
|
for service_obj in await self.config.option('services').list('all'):
|
||||||
service_name = await service_obj.option.description()
|
service_name = await service_obj.option.description()
|
||||||
service_type = await service_obj.information.get('type', 'service')
|
|
||||||
if await service_obj.option('activate').value.get() is False:
|
if await service_obj.option('activate').value.get() is False:
|
||||||
if included is False:
|
if included is False and not await service_obj.information.get('undisable', False):
|
||||||
self.desactive_service(service_name, service_type)
|
self.desactive_service(service_name)
|
||||||
continue
|
continue
|
||||||
if not included:
|
if not included:
|
||||||
engine = await service_obj.information.get('engine', None)
|
engine = await service_obj.information.get('engine', None)
|
||||||
@ -332,19 +367,18 @@ class RougailBaseTemplate:
|
|||||||
self.instance_file({'engine': engine},
|
self.instance_file({'engine': engine},
|
||||||
'service',
|
'service',
|
||||||
service_name,
|
service_name,
|
||||||
service_type,
|
|
||||||
)
|
)
|
||||||
target_name = await service_obj.information.get('target', None)
|
target_name = await service_obj.information.get('target', None)
|
||||||
if target_name:
|
if target_name:
|
||||||
self.target_service(service_name,
|
self.target_service(service_name,
|
||||||
target_name,
|
target_name,
|
||||||
service_type,
|
|
||||||
engine is None,
|
engine is None,
|
||||||
)
|
)
|
||||||
for fills in await service_obj.list('optiondescription'):
|
for fills in await service_obj.list('optiondescription'):
|
||||||
type_ = await fills.option.name()
|
type_ = await fills.option.name()
|
||||||
for fill_obj in await fills.list('all'):
|
for fill_obj in await fills.list('all'):
|
||||||
fill = await fill_obj.value.dict()
|
fill = await fill_obj.value.dict()
|
||||||
|
self.get_default(type_, fill, fill_obj)
|
||||||
await self.get_informations(type_, fill, fill_obj)
|
await self.get_informations(type_, fill, fill_obj)
|
||||||
if 'included' in fill:
|
if 'included' in fill:
|
||||||
if (fill['included'] == 'no' and included is True) or \
|
if (fill['included'] == 'no' and included is True) or \
|
||||||
@ -353,16 +387,39 @@ class RougailBaseTemplate:
|
|||||||
elif included is True:
|
elif included is True:
|
||||||
continue
|
continue
|
||||||
if fill['activate']:
|
if fill['activate']:
|
||||||
self.instance_file(fill,
|
destfilenames = self.instance_file(fill,
|
||||||
type_,
|
type_,
|
||||||
service_name,
|
service_name,
|
||||||
service_type,
|
)
|
||||||
)
|
if included and fill.get('included', 'no') == 'content':
|
||||||
|
files_to_delete.extend(destfilenames)
|
||||||
else:
|
else:
|
||||||
self.log.debug(_("Instantiation of file '{filename}' disabled"))
|
self.log.debug(_(f"Instantiation of file '{fill['name']}' disabled"))
|
||||||
self.post_instance_service(service_name, service_type)
|
self.post_instance_service(service_name)
|
||||||
|
for filename in files_to_delete:
|
||||||
|
unlink(filename)
|
||||||
|
parent = filename
|
||||||
|
while True:
|
||||||
|
parent = dirname(parent)
|
||||||
|
if listdir(parent):
|
||||||
|
break
|
||||||
|
rmdir(parent)
|
||||||
self.post_instance()
|
self.post_instance()
|
||||||
chdir(ori_dir)
|
if ori_dir is not None:
|
||||||
|
chdir(ori_dir)
|
||||||
|
|
||||||
|
def get_default(self,
|
||||||
|
type_: str,
|
||||||
|
dico: dict,
|
||||||
|
obj: 'Option',
|
||||||
|
) -> None:
|
||||||
|
for key in DEFAULT.get(type_, []):
|
||||||
|
default_key = f'default_{type_}_{key}'
|
||||||
|
if default_key in RougailConfig:
|
||||||
|
default_value = RougailConfig[default_key]
|
||||||
|
else:
|
||||||
|
default_value = undefined
|
||||||
|
dico[key] = dico.get(key, default_value)
|
||||||
|
|
||||||
async def get_informations(self,
|
async def get_informations(self,
|
||||||
type_: str,
|
type_: str,
|
||||||
@ -393,6 +450,11 @@ class RougailBaseTemplate:
|
|||||||
): # pragma: no cover
|
): # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def process(self,
|
||||||
|
*args,
|
||||||
|
): # pragma: no cover
|
||||||
|
raise NotImplementedError(_('cannot processed'))
|
||||||
|
|
||||||
def post_instance(self): # pragma: no cover
|
def post_instance(self): # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -439,7 +501,7 @@ class RougailBaseTemplate:
|
|||||||
await suboption.option.name(),
|
await suboption.option.name(),
|
||||||
await suboption.option.path(),
|
await suboption.option.path(),
|
||||||
)
|
)
|
||||||
variables[leadership_name] = leader
|
variables[leadership_name] = RougailExtra({leader_name: leader})
|
||||||
else:
|
else:
|
||||||
if is_service_namespace == 'root':
|
if is_service_namespace == 'root':
|
||||||
new_is_service_namespace = 'service_name'
|
new_is_service_namespace = 'service_name'
|
||||||
@ -468,6 +530,10 @@ class RougailBaseTemplate:
|
|||||||
value = await option.value.get()
|
value = await option.value.get()
|
||||||
variables[await option.option.name()] = value
|
variables[await option.option.name()] = value
|
||||||
if isinstance(is_service_namespace, str) and is_service_namespace + 's' in INFORMATIONS:
|
if isinstance(is_service_namespace, str) and is_service_namespace + 's' in INFORMATIONS:
|
||||||
|
self.get_default(is_service_namespace + 's',
|
||||||
|
variables,
|
||||||
|
optiondescription,
|
||||||
|
)
|
||||||
await self.get_informations(is_service_namespace + 's',
|
await self.get_informations(is_service_namespace + 's',
|
||||||
variables,
|
variables,
|
||||||
optiondescription,
|
optiondescription,
|
||||||
|
@ -38,12 +38,12 @@ from ...error import TemplateError
|
|||||||
def cl_compile(kls, *args, **kwargs):
|
def cl_compile(kls, *args, **kwargs):
|
||||||
"""Rewrite compile methode to force some settings
|
"""Rewrite compile methode to force some settings
|
||||||
"""
|
"""
|
||||||
kwargs['compilerSettings'] = {'directiveStartToken' : '%',
|
kwargs['compilerSettings'] = {'directiveStartToken': '%',
|
||||||
'cheetahVarStartToken' : '%%',
|
'cheetahVarStartToken': '%%',
|
||||||
'EOLSlurpToken' : '%',
|
'EOLSlurpToken': '%',
|
||||||
'commentStartToken' : '#',
|
'commentStartToken': '#',
|
||||||
'multiLineCommentStartToken' : '#*',
|
'multiLineCommentStartToken': '#*',
|
||||||
'multiLineCommentEndToken' : '*#',
|
'multiLineCommentEndToken': '*#',
|
||||||
}
|
}
|
||||||
return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
|
return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
|
||||||
Template.old_compile = Template.compile
|
Template.old_compile = Template.compile
|
||||||
@ -97,6 +97,7 @@ def process(filename: str,
|
|||||||
destfilename: str,
|
destfilename: str,
|
||||||
destdir: str,
|
destdir: str,
|
||||||
variable: Any,
|
variable: Any,
|
||||||
|
index: int,
|
||||||
rougail_variables_dict: Dict,
|
rougail_variables_dict: Dict,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
):
|
):
|
||||||
@ -110,6 +111,8 @@ def process(filename: str,
|
|||||||
}
|
}
|
||||||
if variable is not None:
|
if variable is not None:
|
||||||
extra_context['rougail_variable'] = variable
|
extra_context['rougail_variable'] = variable
|
||||||
|
if index is not None:
|
||||||
|
extra_context['rougail_index'] = index
|
||||||
cheetah_template = CheetahTemplate(filename,
|
cheetah_template = CheetahTemplate(filename,
|
||||||
source,
|
source,
|
||||||
rougail_variables_dict,
|
rougail_variables_dict,
|
||||||
@ -118,7 +121,7 @@ def process(filename: str,
|
|||||||
)
|
)
|
||||||
data = str(cheetah_template)
|
data = str(cheetah_template)
|
||||||
except NotFound as err: # pragma: no cover
|
except NotFound as err: # pragma: no cover
|
||||||
varname = err.args[0][13:-1]
|
varname = err.args[0][13:].split(' ', 1)[0][:-1]
|
||||||
if filename:
|
if filename:
|
||||||
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
||||||
else:
|
else:
|
||||||
|
@ -49,7 +49,6 @@ def cl_compile(kls, *args, **kwargs):
|
|||||||
'multiLineCommentStartToken' : u'µ' * 10,
|
'multiLineCommentStartToken' : u'µ' * 10,
|
||||||
'multiLineCommentEndToken' : u'µ' * 10}
|
'multiLineCommentEndToken' : u'µ' * 10}
|
||||||
return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
|
return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
|
||||||
oriCheetahTemplate.compile = cl_compile
|
|
||||||
|
|
||||||
|
|
||||||
class IsDefined:
|
class IsDefined:
|
||||||
@ -119,12 +118,15 @@ def process(filename: str,
|
|||||||
destfilename: str,
|
destfilename: str,
|
||||||
destdir: str,
|
destdir: str,
|
||||||
variable: Any,
|
variable: Any,
|
||||||
|
index: int,
|
||||||
rougail_variables_dict: Dict,
|
rougail_variables_dict: Dict,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
):
|
):
|
||||||
"""Process a cheetah template
|
"""Process a cheetah template
|
||||||
"""
|
"""
|
||||||
# full path of the destination file
|
# full path of the destination file
|
||||||
|
ori_compile = oriCheetahTemplate.compile
|
||||||
|
oriCheetahTemplate.compile = cl_compile
|
||||||
try:
|
try:
|
||||||
extra_context = {'normalize_family': normalize_family,
|
extra_context = {'normalize_family': normalize_family,
|
||||||
'rougail_filename': true_destfilename,
|
'rougail_filename': true_destfilename,
|
||||||
@ -132,6 +134,8 @@ def process(filename: str,
|
|||||||
}
|
}
|
||||||
if variable is not None:
|
if variable is not None:
|
||||||
extra_context['rougail_variable'] = variable
|
extra_context['rougail_variable'] = variable
|
||||||
|
if index is not None:
|
||||||
|
extra_context['rougail_index'] = index
|
||||||
cheetah_template = CheetahTemplate(filename,
|
cheetah_template = CheetahTemplate(filename,
|
||||||
source,
|
source,
|
||||||
rougail_variables_dict,
|
rougail_variables_dict,
|
||||||
@ -145,13 +149,16 @@ def process(filename: str,
|
|||||||
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
||||||
else:
|
else:
|
||||||
msg = f"Error: unknown variable used in file {destfilename}: {varname}"
|
msg = f"Error: unknown variable used in file {destfilename}: {varname}"
|
||||||
|
oriCheetahTemplate.compile = ori_compile
|
||||||
raise TemplateError(_(msg)) from err
|
raise TemplateError(_(msg)) from err
|
||||||
except Exception as err: # pragma: no cover
|
except Exception as err: # pragma: no cover
|
||||||
if filename:
|
if filename:
|
||||||
msg = _(f"Error while instantiating template {filename} to {destfilename}: {err}")
|
msg = _(f"Error while instantiating template {filename} to {destfilename}: {err}")
|
||||||
else:
|
else:
|
||||||
msg = _(f"Error while instantiating filename {destfilename}: {err}")
|
msg = _(f"Error while instantiating filename {destfilename}: {err}")
|
||||||
|
oriCheetahTemplate.compile = ori_compile
|
||||||
raise TemplateError(msg) from err
|
raise TemplateError(msg) from err
|
||||||
|
|
||||||
with open(destfilename, 'w') as file_h:
|
with open(destfilename, 'w') as file_h:
|
||||||
file_h.write(data)
|
file_h.write(data)
|
||||||
|
oriCheetahTemplate.compile = ori_compile
|
||||||
|
@ -39,6 +39,7 @@ def process(filename: str,
|
|||||||
destfilename: str,
|
destfilename: str,
|
||||||
destdir: str,
|
destdir: str,
|
||||||
variable: Any,
|
variable: Any,
|
||||||
|
index: int,
|
||||||
rougail_variables_dict: Dict,
|
rougail_variables_dict: Dict,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
):
|
):
|
||||||
@ -48,11 +49,11 @@ def process(filename: str,
|
|||||||
dir_name, template_name = filename.rsplit('/', 1)
|
dir_name, template_name = filename.rsplit('/', 1)
|
||||||
if source is not None: # pragma: no cover
|
if source is not None: # pragma: no cover
|
||||||
raise TemplateError(_('source is not supported for jinja2'))
|
raise TemplateError(_('source is not supported for jinja2'))
|
||||||
rougail_variables_dict['rougail_variable'] = variable
|
var = {}
|
||||||
if variable is not None:
|
if variable is not None:
|
||||||
var = {'rougail_variable': variable}
|
var['rougail_variable'] = variable
|
||||||
else:
|
if index is not None:
|
||||||
var = {}
|
var['rougail_index'] = index
|
||||||
try:
|
try:
|
||||||
# extra_context = {'normalize_family': normalize_family,
|
# extra_context = {'normalize_family': normalize_family,
|
||||||
# eosfunc
|
# eosfunc
|
||||||
|
@ -21,13 +21,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
from os import makedirs, symlink
|
from os import makedirs, symlink, chmod
|
||||||
from os.path import dirname, isfile, join
|
from os.path import dirname, isfile, join
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
|
|
||||||
from .base import RougailBaseTemplate
|
from .base import RougailBaseTemplate
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import FileNotFound
|
from ..error import FileNotFound, TemplateError
|
||||||
|
|
||||||
|
|
||||||
ROUGAIL_IP_TEMPLATE = """[Service]
|
ROUGAIL_IP_TEMPLATE = """[Service]
|
||||||
@ -38,14 +38,24 @@ IPAddressDeny=any
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
ROUGAIL_DEST = '/usr/local/lib'
|
|
||||||
ROUGAIL_GLOBAL_SYSTEMD_FILE = '/usr/lib/systemd/system'
|
ROUGAIL_GLOBAL_SYSTEMD_FILE = '/usr/lib/systemd/system'
|
||||||
|
ROUGAIL_DEST_FILE = '/tmpfiles.d/0rougail.conf'
|
||||||
|
LOCAL_DIR = ('/etc/', '/var/', '/srv/')
|
||||||
|
|
||||||
|
|
||||||
ROUGAIL_TMPL_TEMPLATE = f"""%def display(%%file, %%filename)
|
class RougailSystemdTemplate(RougailBaseTemplate):
|
||||||
%if %%filename.startswith('/etc/') or %%filename.startswith('/var/') or %%filename.startswith('/srv/')
|
def __init__(self, # pylint: disable=R0913
|
||||||
C %%filename %%file.mode %%file.owner %%file.group - {ROUGAIL_DEST}%%filename
|
config: 'Config',
|
||||||
z %%filename - - - - -
|
rougailconfig: 'RougailConfig'=None,
|
||||||
|
) -> None:
|
||||||
|
self.ip_per_service = None
|
||||||
|
super().__init__(config, rougailconfig)
|
||||||
|
self.rougail_tmpl_template = f"""%def display(%%file, %%filename)
|
||||||
|
"""
|
||||||
|
tmp_local_dir = (f"%%filename.startswith('{local_dir}')" for local_dir in LOCAL_DIR)
|
||||||
|
self.rougail_tmpl_template += '%if ' + ' or '.join(tmp_local_dir)
|
||||||
|
self.rougail_tmpl_template += f"""
|
||||||
|
C %%filename %%file.mode %%file.owner %%file.group - {self.rougailconfig['tmpfile_dest_dir']}%%filename
|
||||||
%end if
|
%end if
|
||||||
%end def
|
%end def
|
||||||
%for %%service in %%services
|
%for %%service in %%services
|
||||||
@ -65,26 +75,16 @@ z %%filename - - - - -
|
|||||||
%end for
|
%end for
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class RougailSystemdTemplate(RougailBaseTemplate):
|
|
||||||
def __init__(self, # pylint: disable=R0913
|
|
||||||
config: 'Config',
|
|
||||||
rougailconfig: 'RougailConfig'=None,
|
|
||||||
) -> None:
|
|
||||||
self.ip_per_service = None
|
|
||||||
super().__init__(config, rougailconfig)
|
|
||||||
|
|
||||||
def get_data_files(self,
|
def get_data_files(self,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
destfile: str,
|
destfile: str,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
service_type: str,
|
|
||||||
variable,
|
variable,
|
||||||
idx: int,
|
idx: int,
|
||||||
) -> tuple:
|
) -> tuple:
|
||||||
source = filevar['source']
|
source = filevar['source']
|
||||||
if not isfile(source): # pragma: no cover
|
if not isfile(source): # pragma: no cover
|
||||||
raise FileNotFound(_(f"File {source} does not exist."))
|
raise FileNotFound(_(f'Source file "{source}" does not exist in {", ".join(self.templates_dir)}'))
|
||||||
tmp_file = join(self.tmp_dir, source)
|
tmp_file = join(self.tmp_dir, source)
|
||||||
#self.instance_file(fill, 'files')
|
#self.instance_file(fill, 'files')
|
||||||
if variable:
|
if variable:
|
||||||
@ -97,22 +97,20 @@ class RougailSystemdTemplate(RougailBaseTemplate):
|
|||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
destfile,
|
destfile,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
service_type: str,
|
|
||||||
*args,
|
*args,
|
||||||
) -> tuple:
|
) -> tuple:
|
||||||
source = filevar['source']
|
source = filevar['source']
|
||||||
if not isfile(source): # pragma: no cover
|
if not isfile(source): # pragma: no cover
|
||||||
raise FileNotFound(_(f"File {source} does not exist."))
|
raise FileNotFound(_(f'Override source file "{source}" does not exist in {", ".join(self.templates_dir)}'))
|
||||||
tmp_file = join(self.tmp_dir, source)
|
tmp_file = join(self.tmp_dir, source)
|
||||||
service_name = filevar['name']
|
service_name = filevar['name']
|
||||||
destfile = f'/systemd/system/{service_name}.{service_type}.d/rougail.conf'
|
destfile = f'/systemd/system/{service_name}.d/rougail.conf'
|
||||||
return tmp_file, None, destfile, None
|
return tmp_file, None, destfile, None
|
||||||
|
|
||||||
def get_data_ip(self,
|
def get_data_ip(self,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
ip,
|
ip,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
service_type: str,
|
|
||||||
var: Any,
|
var: Any,
|
||||||
idx: int,
|
idx: int,
|
||||||
*args,
|
*args,
|
||||||
@ -132,45 +130,40 @@ class RougailSystemdTemplate(RougailBaseTemplate):
|
|||||||
servicevar: Dict,
|
servicevar: Dict,
|
||||||
info,
|
info,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
service_type: str,
|
|
||||||
*args,
|
*args,
|
||||||
):
|
):
|
||||||
filename = f'{service_name}.{service_type}'
|
tmp_file = join(self.tmp_dir, service_name)
|
||||||
tmp_file = join(self.tmp_dir, filename)
|
|
||||||
var = None
|
var = None
|
||||||
destfile = f'/systemd/system/{filename}'
|
destfile = f'/systemd/system/{service_name}'
|
||||||
return tmp_file, None, destfile, var
|
return tmp_file, None, destfile, var
|
||||||
|
|
||||||
|
|
||||||
def desactive_service(self,
|
def desactive_service(self,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
service_type: str,
|
|
||||||
):
|
):
|
||||||
filename = f'{self.destinations_dir}/systemd/system/{service_name}.{service_type}'
|
filename = f'{self.destinations_dir}/systemd/system/{service_name}'
|
||||||
makedirs(dirname(filename), exist_ok=True)
|
makedirs(dirname(filename), exist_ok=True)
|
||||||
symlink('/dev/null', filename)
|
symlink('/dev/null', filename)
|
||||||
|
|
||||||
def target_service(self,
|
def target_service(self,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
target_name: str,
|
target_name: str,
|
||||||
service_type: str,
|
|
||||||
global_service: str,
|
global_service: str,
|
||||||
):
|
):
|
||||||
filename = f'{self.destinations_dir}/systemd/system/{target_name}.target.wants/{service_name}.{service_type}'
|
filename = f'{self.destinations_dir}/systemd/system/{target_name}.target.wants/{service_name}'
|
||||||
makedirs(dirname(filename), exist_ok=True)
|
makedirs(dirname(filename), exist_ok=True)
|
||||||
if global_service:
|
if global_service:
|
||||||
source_filename = f'{ROUGAIL_GLOBAL_SYSTEMD_FILE}/{service_name}.{service_type}'
|
source_filename = f'{ROUGAIL_GLOBAL_SYSTEMD_FILE}/{service_name}'
|
||||||
else:
|
else:
|
||||||
source_filename = f'{ROUGAIL_DEST}/systemd/system/{service_name}.{service_type}'
|
source_filename = f"{self.rougailconfig['tmpfile_dest_dir']}/systemd/system/{service_name}"
|
||||||
symlink(source_filename, filename)
|
symlink(source_filename, filename)
|
||||||
|
|
||||||
def post_instance_service(self,
|
def post_instance_service(self,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
service_type: str,
|
|
||||||
) -> None: # pragma: no cover
|
) -> None: # pragma: no cover
|
||||||
if self.ip_per_service is None:
|
if self.ip_per_service is None:
|
||||||
return
|
return
|
||||||
destfile = f'/systemd/system/{service_name}.{service_type}.d/rougail_ip.conf'
|
destfile = f'/systemd/system/{service_name}.d/rougail_ip.conf'
|
||||||
destfilename = join(self.destinations_dir, destfile[1:])
|
destfilename = join(self.destinations_dir, destfile[1:])
|
||||||
makedirs(dirname(destfilename), exist_ok=True)
|
makedirs(dirname(destfilename), exist_ok=True)
|
||||||
self.log.info(_(f"creole processing: '{destfilename}'"))
|
self.log.info(_(f"creole processing: '{destfilename}'"))
|
||||||
@ -180,22 +173,40 @@ class RougailSystemdTemplate(RougailBaseTemplate):
|
|||||||
destfilename=destfilename,
|
destfilename=destfilename,
|
||||||
destdir=self.destinations_dir,
|
destdir=self.destinations_dir,
|
||||||
variable=self.ip_per_service,
|
variable=self.ip_per_service,
|
||||||
|
index=None,
|
||||||
rougail_variables_dict=self.rougail_variables_dict,
|
rougail_variables_dict=self.rougail_variables_dict,
|
||||||
eosfunc=self.eosfunc,
|
eosfunc=self.eosfunc,
|
||||||
)
|
)
|
||||||
self.ip_per_service = None
|
self.ip_per_service = None
|
||||||
|
|
||||||
|
def process(self,
|
||||||
|
filename: str,
|
||||||
|
destfilename: str,
|
||||||
|
mode: str,
|
||||||
|
owner: str,
|
||||||
|
group: str,
|
||||||
|
) -> None:
|
||||||
|
for local_dir in LOCAL_DIR:
|
||||||
|
if filename.startswith(local_dir):
|
||||||
|
return
|
||||||
|
if owner not in [None, self.rougailconfig['default_files_owner']]:
|
||||||
|
raise TemplateError(_(f'cannot change owner of file {destfilename}'))
|
||||||
|
if group not in [None, self.rougailconfig['default_files_group']]:
|
||||||
|
raise TemplateError(_(f'cannot change group of file {destfilename}'))
|
||||||
|
if mode not in [None, self.rougailconfig['default_files_mode']]:
|
||||||
|
chmod(destfilename, eval(f'0o{mode}'))
|
||||||
|
|
||||||
def post_instance(self):
|
def post_instance(self):
|
||||||
destfile = '/tmpfiles.d/rougail.conf'
|
destfilename = join(self.destinations_dir, ROUGAIL_DEST_FILE[1:])
|
||||||
destfilename = join(self.destinations_dir, destfile[1:])
|
|
||||||
makedirs(dirname(destfilename), exist_ok=True)
|
makedirs(dirname(destfilename), exist_ok=True)
|
||||||
self.log.info(_(f"creole processing: '{destfilename}'"))
|
self.log.info(_(f"creole processing: '{destfilename}'"))
|
||||||
self.engines['creole'].process(filename=None,
|
self.engines['creole'].process(filename=None,
|
||||||
source=ROUGAIL_TMPL_TEMPLATE,
|
source=self.rougail_tmpl_template,
|
||||||
true_destfilename=destfile,
|
true_destfilename=ROUGAIL_DEST_FILE,
|
||||||
destfilename=destfilename,
|
destfilename=destfilename,
|
||||||
destdir=self.destinations_dir,
|
destdir=self.destinations_dir,
|
||||||
variable=None,
|
variable=None,
|
||||||
|
index=None,
|
||||||
rougail_variables_dict=self.rougail_variables_dict,
|
rougail_variables_dict=self.rougail_variables_dict,
|
||||||
eosfunc=self.eosfunc,
|
eosfunc=self.eosfunc,
|
||||||
)
|
)
|
||||||
|
@ -36,6 +36,8 @@ class ConvertDynOptionDescription(DynOptionDescription):
|
|||||||
Suffix could also contain invalid character, so we should "normalize" it
|
Suffix could also contain invalid character, so we should "normalize" it
|
||||||
"""
|
"""
|
||||||
def convert_suffix_to_path(self, suffix):
|
def convert_suffix_to_path(self, suffix):
|
||||||
|
if suffix is None:
|
||||||
|
return suffix
|
||||||
if not isinstance(suffix, str):
|
if not isinstance(suffix, str):
|
||||||
suffix = str(suffix)
|
suffix = str(suffix)
|
||||||
return normalize_family(suffix)
|
return normalize_family(suffix)
|
||||||
|
@ -28,14 +28,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
from json import dumps
|
from json import dumps
|
||||||
from os.path import isfile
|
from os.path import isfile
|
||||||
|
|
||||||
|
from .i18n import _
|
||||||
from .annotator import CONVERT_OPTION
|
from .annotator import CONVERT_OPTION
|
||||||
from .objspace import RootRougailObject
|
from .objspace import RootRougailObject
|
||||||
|
from .error import DictConsistencyError
|
||||||
|
|
||||||
class Root(): # pylint: disable=R0903
|
|
||||||
"""Root classes
|
|
||||||
"""
|
|
||||||
path = '.'
|
|
||||||
|
|
||||||
|
|
||||||
class BaseElt: # pylint: disable=R0903
|
class BaseElt: # pylint: disable=R0903
|
||||||
@ -51,20 +47,32 @@ class TiramisuReflector:
|
|||||||
"""
|
"""
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
objectspace,
|
objectspace,
|
||||||
funcs_path,
|
funcs_paths,
|
||||||
|
internal_functions,
|
||||||
):
|
):
|
||||||
self.index = 0
|
self.index = 0
|
||||||
self.text = []
|
self.text = []
|
||||||
if funcs_path and isfile(funcs_path):
|
if funcs_paths:
|
||||||
self.text.extend(["from importlib.machinery import SourceFileLoader",
|
self.text.extend(["from importlib.machinery import SourceFileLoader as _SourceFileLoader",
|
||||||
"from importlib.util import spec_from_loader, module_from_spec",
|
"from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec",
|
||||||
f"loader = SourceFileLoader('func', '{funcs_path}')",
|
"class func:",
|
||||||
"spec = spec_from_loader(loader.name, loader)",
|
" pass",
|
||||||
"func = module_from_spec(spec)",
|
])
|
||||||
"loader.exec_module(func)",
|
for funcs_path in funcs_paths:
|
||||||
"for key, value in dict(locals()).items():",
|
if not isfile(funcs_path):
|
||||||
" if key != ['SourceFileLoader', 'func']:",
|
continue
|
||||||
" setattr(func, key, value)"])
|
self.text.extend([f"_loader = _SourceFileLoader('func', '{funcs_path}')",
|
||||||
|
"_spec = _spec_from_loader(_loader.name, _loader)",
|
||||||
|
"_func = _module_from_spec(_spec)",
|
||||||
|
"_loader.exec_module(_func)",
|
||||||
|
"for function in dir(_func):",
|
||||||
|
" if function.startswith('_'):",
|
||||||
|
" continue",
|
||||||
|
" setattr(func, function, getattr(_func, function))",
|
||||||
|
])
|
||||||
|
if internal_functions:
|
||||||
|
for func in internal_functions:
|
||||||
|
self.text.append(f"setattr(func, '{func}', {func})")
|
||||||
self.text.extend(["try:",
|
self.text.extend(["try:",
|
||||||
" from tiramisu3 import *",
|
" from tiramisu3 import *",
|
||||||
"except:",
|
"except:",
|
||||||
@ -78,8 +86,11 @@ class TiramisuReflector:
|
|||||||
def make_tiramisu_objects(self) -> None:
|
def make_tiramisu_objects(self) -> None:
|
||||||
"""make tiramisu objects
|
"""make tiramisu objects
|
||||||
"""
|
"""
|
||||||
|
providers = {}
|
||||||
baseelt = BaseElt()
|
baseelt = BaseElt()
|
||||||
self.set_name(baseelt)
|
self.set_name(baseelt)
|
||||||
|
dynamic_path = ''
|
||||||
|
dynamic = False
|
||||||
basefamily = Family(baseelt,
|
basefamily = Family(baseelt,
|
||||||
self.text,
|
self.text,
|
||||||
self.objectspace,
|
self.objectspace,
|
||||||
@ -87,7 +98,12 @@ class TiramisuReflector:
|
|||||||
for elt in self.reorder_family():
|
for elt in self.reorder_family():
|
||||||
self.populate_family(basefamily,
|
self.populate_family(basefamily,
|
||||||
elt,
|
elt,
|
||||||
|
providers,
|
||||||
|
dynamic,
|
||||||
|
dynamic_path,
|
||||||
)
|
)
|
||||||
|
basefamily.elt.information = providers
|
||||||
|
basefamily.populate_informations()
|
||||||
self.baseelt = baseelt
|
self.baseelt = baseelt
|
||||||
|
|
||||||
def reorder_family(self):
|
def reorder_family(self):
|
||||||
@ -107,6 +123,9 @@ class TiramisuReflector:
|
|||||||
def populate_family(self,
|
def populate_family(self,
|
||||||
parent_family,
|
parent_family,
|
||||||
elt,
|
elt,
|
||||||
|
providers,
|
||||||
|
dynamic,
|
||||||
|
dynamic_path,
|
||||||
):
|
):
|
||||||
"""Populate family
|
"""Populate family
|
||||||
"""
|
"""
|
||||||
@ -115,11 +134,21 @@ class TiramisuReflector:
|
|||||||
self.text,
|
self.text,
|
||||||
self.objectspace,
|
self.objectspace,
|
||||||
)
|
)
|
||||||
|
if not dynamic_path:
|
||||||
|
dynamic_path = elt.name
|
||||||
|
else:
|
||||||
|
dynamic_path = dynamic_path + '.' + elt.name
|
||||||
|
if dynamic or hasattr(elt, 'suffixes'):
|
||||||
|
dynamic_path += '{suffix}'
|
||||||
|
dynamic = True
|
||||||
parent_family.add(family)
|
parent_family.add(family)
|
||||||
for children in vars(elt).values():
|
for children in vars(elt).values():
|
||||||
if isinstance(children, self.objectspace.family):
|
if isinstance(children, self.objectspace.family):
|
||||||
self.populate_family(family,
|
self.populate_family(family,
|
||||||
children,
|
children,
|
||||||
|
providers,
|
||||||
|
dynamic,
|
||||||
|
dynamic_path,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
if isinstance(children, dict):
|
if isinstance(children, dict):
|
||||||
@ -131,13 +160,21 @@ class TiramisuReflector:
|
|||||||
continue
|
continue
|
||||||
if isinstance(child, self.objectspace.variable):
|
if isinstance(child, self.objectspace.variable):
|
||||||
self.set_name(child)
|
self.set_name(child)
|
||||||
|
sub_dynamic_path = dynamic_path + '.' + child.name
|
||||||
|
if dynamic:
|
||||||
|
sub_dynamic_path += '{suffix}'
|
||||||
family.add(Variable(child,
|
family.add(Variable(child,
|
||||||
self.text,
|
self.text,
|
||||||
self.objectspace,
|
self.objectspace,
|
||||||
|
providers,
|
||||||
|
sub_dynamic_path,
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
self.populate_family(family,
|
self.populate_family(family,
|
||||||
child,
|
child,
|
||||||
|
providers,
|
||||||
|
dynamic,
|
||||||
|
dynamic_path,
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_name(self,
|
def set_name(self,
|
||||||
@ -151,7 +188,7 @@ class TiramisuReflector:
|
|||||||
def get_text(self):
|
def get_text(self):
|
||||||
"""Get text
|
"""Get text
|
||||||
"""
|
"""
|
||||||
self.baseelt.reflector_object.get() # pylint: disable=E1101
|
self.baseelt.reflector_object.get([]) # pylint: disable=E1101
|
||||||
return '\n'.join(self.text)
|
return '\n'.join(self.text)
|
||||||
|
|
||||||
|
|
||||||
@ -170,13 +207,25 @@ class Common:
|
|||||||
self.elt.reflector_object = self
|
self.elt.reflector_object = self
|
||||||
self.object_type = None
|
self.object_type = None
|
||||||
|
|
||||||
def get(self):
|
def get(self, calls):
|
||||||
"""Get tiramisu's object
|
"""Get tiramisu's object
|
||||||
"""
|
"""
|
||||||
|
self_calls = calls.copy()
|
||||||
|
if self.elt.path in self_calls:
|
||||||
|
msg = f'"{self.elt.path}" will make an infinite loop'
|
||||||
|
raise DictConsistencyError(msg, 80, self.elt.xmlfiles)
|
||||||
|
self_calls.append(self.elt.path)
|
||||||
|
self.calls = self_calls
|
||||||
if self.option_name is None:
|
if self.option_name is None:
|
||||||
self.option_name = self.elt.reflector_name
|
self.option_name = self.elt.reflector_name
|
||||||
self.populate_attrib()
|
self.populate_attrib()
|
||||||
self.populate_informations()
|
self.populate_informations()
|
||||||
|
if hasattr(self.elt, 'provider'):
|
||||||
|
name = 'provider:' + self.elt.provider
|
||||||
|
if name in self.providers:
|
||||||
|
msg = f'provider {name} declare multiple time'
|
||||||
|
raise DictConsistencyError(msg, 79, self.elt.xmlfiles)
|
||||||
|
self.providers[name] = self.dynamic_path
|
||||||
return self.option_name
|
return self.option_name
|
||||||
|
|
||||||
def populate_attrib(self):
|
def populate_attrib(self):
|
||||||
@ -218,7 +267,7 @@ class Common:
|
|||||||
) -> str:
|
) -> str:
|
||||||
"""Populate properties
|
"""Populate properties
|
||||||
"""
|
"""
|
||||||
option_name = child.source.reflector_object.get()
|
option_name = child.source.reflector_object.get(self.calls)
|
||||||
kwargs = (f"'condition': ParamOption({option_name}, todict=True, notraisepropertyerror=True), "
|
kwargs = (f"'condition': ParamOption({option_name}, todict=True, notraisepropertyerror=True), "
|
||||||
f"'expected': {self.populate_param(child.expected)}")
|
f"'expected': {self.populate_param(child.expected)}")
|
||||||
if child.inverse:
|
if child.inverse:
|
||||||
@ -231,7 +280,11 @@ class Common:
|
|||||||
"""
|
"""
|
||||||
if not hasattr(self.elt, 'information'):
|
if not hasattr(self.elt, 'information'):
|
||||||
return
|
return
|
||||||
for key, value in vars(self.elt.information).items():
|
if isinstance(self.elt.information, dict):
|
||||||
|
informations = self.elt.information
|
||||||
|
else:
|
||||||
|
informations = vars(self.elt.information)
|
||||||
|
for key, value in informations.items():
|
||||||
if key == 'xmlfiles':
|
if key == 'xmlfiles':
|
||||||
continue
|
continue
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
@ -243,7 +296,7 @@ class Common:
|
|||||||
):
|
):
|
||||||
"""Populate variable parameters
|
"""Populate variable parameters
|
||||||
"""
|
"""
|
||||||
if param.type in ['number', 'boolean', 'nil', 'string', 'port', 'choice']:
|
if param.type in ['number', 'boolean', 'nil', 'string', 'port', 'choice', 'space']:
|
||||||
value = param.text
|
value = param.text
|
||||||
if param.type == 'string' and value is not None:
|
if param.type == 'string' and value is not None:
|
||||||
value = self.convert_str(value)
|
value = self.convert_str(value)
|
||||||
@ -262,18 +315,18 @@ class Common:
|
|||||||
return 'ParamSuffix()'
|
return 'ParamSuffix()'
|
||||||
if param.type == 'index':
|
if param.type == 'index':
|
||||||
return 'ParamIndex()'
|
return 'ParamIndex()'
|
||||||
raise Exception(f'unknown type {param.type}') # pragma: no cover
|
raise Exception(_(f'unknown type {param.type}')) # pragma: no cover
|
||||||
|
|
||||||
@staticmethod
|
def build_option_param(self,
|
||||||
def build_option_param(param,
|
param,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""build variable parameters
|
"""build variable parameters
|
||||||
"""
|
"""
|
||||||
option_name = param.text.reflector_object.get()
|
option_name = param.text.reflector_object.get(self.calls)
|
||||||
params = [f'{option_name}']
|
params = [f'{option_name}']
|
||||||
if hasattr(param, 'suffix'):
|
if hasattr(param, 'suffix'):
|
||||||
param_type = 'ParamDynOption'
|
param_type = 'ParamDynOption'
|
||||||
family = param.family.reflector_object.get()
|
family = param.family.reflector_object.get(self.calls)
|
||||||
params.extend([f"'{param.suffix}'", f'{family}'])
|
params.extend([f"'{param.suffix}'", f'{family}'])
|
||||||
else:
|
else:
|
||||||
param_type = 'ParamOption'
|
param_type = 'ParamOption'
|
||||||
@ -289,7 +342,11 @@ class Variable(Common):
|
|||||||
elt,
|
elt,
|
||||||
text,
|
text,
|
||||||
objectspace,
|
objectspace,
|
||||||
|
providers,
|
||||||
|
dynamic_path,
|
||||||
):
|
):
|
||||||
|
self.providers = providers
|
||||||
|
self.dynamic_path = dynamic_path
|
||||||
super().__init__(elt, text, objectspace)
|
super().__init__(elt, text, objectspace)
|
||||||
self.object_type = CONVERT_OPTION[elt.type]['opttype']
|
self.object_type = CONVERT_OPTION[elt.type]['opttype']
|
||||||
|
|
||||||
@ -297,11 +354,11 @@ class Variable(Common):
|
|||||||
keys: dict,
|
keys: dict,
|
||||||
):
|
):
|
||||||
if hasattr(self.elt, 'opt'):
|
if hasattr(self.elt, 'opt'):
|
||||||
keys['opt'] = self.elt.opt.reflector_object.get()
|
keys['opt'] = self.elt.opt.reflector_object.get(self.calls)
|
||||||
if hasattr(self.elt, 'choice'):
|
if hasattr(self.elt, 'choice'):
|
||||||
values = self.elt.choice
|
values = self.elt.choice
|
||||||
if values[0].type == 'variable':
|
if values[0].type == 'variable':
|
||||||
value = values[0].name.reflector_object.get()
|
value = values[0].name.reflector_object.get(self.calls)
|
||||||
keys['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
keys['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
||||||
elif values[0].type == 'function':
|
elif values[0].type == 'function':
|
||||||
keys['values'] = self.calculation_value(values[0], [])
|
keys['values'] = self.calculation_value(values[0], [])
|
||||||
@ -390,6 +447,6 @@ class Family(Common):
|
|||||||
keys: list,
|
keys: list,
|
||||||
) -> None:
|
) -> None:
|
||||||
if hasattr(self.elt, 'suffixes'):
|
if hasattr(self.elt, 'suffixes'):
|
||||||
dyn = self.elt.suffixes.reflector_object.get()
|
dyn = self.elt.suffixes.reflector_object.get(self.calls)
|
||||||
keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}, notraisepropertyerror=True))))"
|
keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}, notraisepropertyerror=True))))"
|
||||||
keys['children'] = '[' + ', '.join([child.get() for child in self.children]) + ']'
|
keys['children'] = '[' + ', '.join([child.get(self.calls) for child in self.children]) + ']'
|
||||||
|
@ -116,7 +116,7 @@ class RougailUpgrade:
|
|||||||
if variables is None:
|
if variables is None:
|
||||||
return root
|
return root
|
||||||
paths = self._get_path_variables(variables,
|
paths = self._get_path_variables(variables,
|
||||||
namespace == self.rougailconfig['variable_namespace'],
|
namespace == 'configuration',
|
||||||
namespace,
|
namespace,
|
||||||
)
|
)
|
||||||
constraints = root.find('constraints')
|
constraints = root.find('constraints')
|
||||||
@ -235,7 +235,7 @@ class RougailUpgrade:
|
|||||||
function.append(param)
|
function.append(param)
|
||||||
else:
|
else:
|
||||||
choice = SubElement(target, 'choice')
|
choice = SubElement(target, 'choice')
|
||||||
if first_choice is None:
|
if first_choice is None and ('type' not in param.attrib or param.attrib['type'] != 'variable'):
|
||||||
first_choice = choice
|
first_choice = choice
|
||||||
choice.text = param.text
|
choice.text = param.text
|
||||||
if 'type' not in param.attrib and param.text is None:
|
if 'type' not in param.attrib and param.text is None:
|
||||||
@ -334,7 +334,7 @@ class RougailUpgrade:
|
|||||||
subsubsubelement.attrib['mandatory'] = 'True'
|
subsubsubelement.attrib['mandatory'] = 'True'
|
||||||
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}):
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}):
|
||||||
subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {})[subsubsubelement.attrib['name']]
|
subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {})[subsubsubelement.attrib['name']]
|
||||||
if namespace == self.rougailconfig['variable_namespace']:
|
if namespace == 'configuration':
|
||||||
path = subsubsubelement.attrib['name']
|
path = subsubsubelement.attrib['name']
|
||||||
npath = normalize_family(subsubsubelement.attrib['name'])
|
npath = normalize_family(subsubsubelement.attrib['name'])
|
||||||
else:
|
else:
|
||||||
|
@ -61,17 +61,26 @@ class XMLReflector:
|
|||||||
|
|
||||||
:param xmlfolders: list of full folder's name
|
:param xmlfolders: list of full folder's name
|
||||||
"""
|
"""
|
||||||
|
filenames = {}
|
||||||
for xmlfolder in xmlfolders:
|
for xmlfolder in xmlfolders:
|
||||||
filenames = [join(xmlfolder, filename) for filename in listdir(xmlfolder) if \
|
for filename in listdir(xmlfolder):
|
||||||
filename.endswith('.xml')]
|
if not filename.endswith('.xml'):
|
||||||
filenames.sort()
|
continue
|
||||||
for xmlfile in filenames:
|
if filename in filenames:
|
||||||
try:
|
raise DictConsistencyError(_(f'duplicate xml file name {filename}'), 78, [xmlfolder])
|
||||||
document = parse(xmlfile)
|
filenames[filename] = join(xmlfolder, filename)
|
||||||
except XMLSyntaxError as err:
|
if not filenames:
|
||||||
raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err
|
raise DictConsistencyError(_('there is no XML file'), 77, [xmlfolder])
|
||||||
if not self.dtd.validate(document):
|
file_names = list(filenames.keys())
|
||||||
dtd_error = self.dtd.error_log.filter_from_errors()[0]
|
file_names.sort()
|
||||||
msg = _(f'not a valid XML file: {dtd_error}')
|
for filename in file_names:
|
||||||
raise DictConsistencyError(msg, 43, [xmlfile])
|
xmlfile = filenames[filename]
|
||||||
yield xmlfile, document.getroot()
|
try:
|
||||||
|
document = parse(xmlfile)
|
||||||
|
except XMLSyntaxError as err:
|
||||||
|
raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err
|
||||||
|
if not self.dtd.validate(document):
|
||||||
|
dtd_error = self.dtd.error_log.filter_from_errors()[0]
|
||||||
|
msg = _(f'not a valid XML file: {dtd_error}')
|
||||||
|
raise DictConsistencyError(msg, 43, [xmlfile])
|
||||||
|
yield xmlfile, document.getroot()
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"services.tata.activate": {
|
"services.tata_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.tata.manage": {
|
"services.tata_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"services.tata.activate": true,
|
"services.tata_service.activate": true,
|
||||||
"services.tata.manage": true
|
"services.tata_service.manage": true
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"services.tata.activate": {
|
"services.tata_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.tata.manage": {
|
"services.tata_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = BoolOption(name="activate", doc="activate", default=True)
|
option_3 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
option_4 = BoolOption(name="manage", doc="manage", default=True)
|
option_4 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
option_2 = OptionDescription(name="tata", doc="tata", children=[option_3, option_4])
|
option_2 = OptionDescription(name="tata_service", doc="tata.service", children=[option_3, option_4])
|
||||||
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,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": {
|
"rougail.general.mode_conteneur_actif1": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"rougail.general.mode_conteneur_actif1": {
|
"rougail.general.mode_conteneur_actif": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
"rougail.general.mode_conteneur_actif1": "non",
|
||||||
"rougail.general.mode_conteneur_actif1": "non"
|
"rougail.general.mode_conteneur_actif": "non"
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": {
|
"rougail.general.mode_conteneur_actif1": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"rougail.general.mode_conteneur_actif1": {
|
"rougail.general.mode_conteneur_actif": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], 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,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
|
@ -3,27 +3,27 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
"services.test.files.file.name": "/etc/file",
|
"services.test_service.files.file.name": "/etc/file",
|
||||||
"services.test.files.file.activate": true,
|
"services.test_service.files.file.activate": true,
|
||||||
"services.test.files.file2.name": "/etc/file2",
|
"services.test_service.files.file2.name": "/etc/file2",
|
||||||
"services.test.files.file2.activate": true,
|
"services.test_service.files.file2.activate": true,
|
||||||
"services.test.activate": true,
|
"services.test_service.activate": true,
|
||||||
"services.test.manage": true
|
"services.test_service.manage": true
|
||||||
}
|
}
|
||||||
|
@ -3,27 +3,27 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||||
z /etc/file - - - - -
|
|
||||||
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
||||||
z /etc/file2 - - - - -
|
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
@ -26,6 +29,6 @@ option_10.impl_set_information('source', "file2")
|
|||||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10])
|
||||||
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
option_14 = BoolOption(name="manage", doc="manage", default=True)
|
option_14 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_13, option_14])
|
option_5 = OptionDescription(name="test_service", doc="test.service", children=[option_6, option_13, option_14])
|
||||||
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])
|
||||||
|
17
tests/dictionaries/01base_file_disabled/00-base.xml
Normal file
17
tests/dictionaries/01base_file_disabled/00-base.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file>/etc/file</file>
|
||||||
|
<file engine="jinja2">/etc/file2</file>
|
||||||
|
<file disabled='True'>/etc/file3</file>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
38
tests/dictionaries/01base_file_disabled/makedict/after.json
Normal file
38
tests/dictionaries/01base_file_disabled/makedict/after.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/file"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test_service.files.file2.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/file2"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file2.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test_service.files.file3.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/file3"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file3.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"services.test_service.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test_service.manage": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
11
tests/dictionaries/01base_file_disabled/makedict/base.json
Normal file
11
tests/dictionaries/01base_file_disabled/makedict/base.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
|
"services.test_service.files.file.name": "/etc/file",
|
||||||
|
"services.test_service.files.file.activate": true,
|
||||||
|
"services.test_service.files.file2.name": "/etc/file2",
|
||||||
|
"services.test_service.files.file2.activate": true,
|
||||||
|
"services.test_service.files.file3.name": "/etc/file3",
|
||||||
|
"services.test_service.files.file3.activate": false,
|
||||||
|
"services.test_service.activate": true,
|
||||||
|
"services.test_service.manage": true
|
||||||
|
}
|
38
tests/dictionaries/01base_file_disabled/makedict/before.json
Normal file
38
tests/dictionaries/01base_file_disabled/makedict/before.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/file"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test_service.files.file2.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/file2"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file2.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test_service.files.file3.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/file3"
|
||||||
|
},
|
||||||
|
"services.test_service.files.file3.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"services.test_service.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test_service.manage": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
2
tests/dictionaries/01base_file_disabled/result/etc/file
Normal file
2
tests/dictionaries/01base_file_disabled/result/etc/file
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
non
|
||||||
|
non
|
2
tests/dictionaries/01base_file_disabled/result/etc/file2
Normal file
2
tests/dictionaries/01base_file_disabled/result/etc/file2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
non
|
||||||
|
non
|
@ -1,4 +1,2 @@
|
|||||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||||
z /etc/file - - - - -
|
|
||||||
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
||||||
z /etc/file2 - - - - -
|
|
38
tests/dictionaries/01base_file_disabled/tiramisu/base.py
Normal file
38
tests/dictionaries/01base_file_disabled/tiramisu/base.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
|
class func:
|
||||||
|
pass
|
||||||
|
_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 function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
option_3 = StrOption(name="mode_conteneur_actif", doc="Description", 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 = FilenameOption(name="name", doc="name", default="/etc/file")
|
||||||
|
option_9 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9])
|
||||||
|
option_7.impl_set_information('source', "file")
|
||||||
|
option_11 = FilenameOption(name="name", doc="name", default="/etc/file2")
|
||||||
|
option_12 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
option_10 = OptionDescription(name="file2", doc="file2", children=[option_11, option_12])
|
||||||
|
option_10.impl_set_information('engine', "jinja2")
|
||||||
|
option_10.impl_set_information('source', "file2")
|
||||||
|
option_14 = FilenameOption(name="name", doc="name", default="/etc/file3")
|
||||||
|
option_15 = BoolOption(name="activate", doc="activate", default=False)
|
||||||
|
option_13 = OptionDescription(name="file3", doc="file3", children=[option_14, option_15])
|
||||||
|
option_13.impl_set_information('source', "file3")
|
||||||
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10, option_13])
|
||||||
|
option_16 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
option_17 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
|
option_5 = OptionDescription(name="test_service", doc="test.service", children=[option_6, option_16, option_17])
|
||||||
|
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])
|
2
tests/dictionaries/01base_file_disabled/tmpl/file
Normal file
2
tests/dictionaries/01base_file_disabled/tmpl/file
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
%%mode_conteneur_actif
|
||||||
|
%%rougail.general.mode_conteneur_actif
|
2
tests/dictionaries/01base_file_disabled/tmpl/file2
Normal file
2
tests/dictionaries/01base_file_disabled/tmpl/file2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{{ mode_conteneur_actif }}
|
||||||
|
{{ rougail.general.mode_conteneur_actif }}
|
@ -3,27 +3,27 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
"services.test.files.file.name": "/etc/file",
|
"services.test_service.files.file.name": "/etc/file",
|
||||||
"services.test.files.file.activate": true,
|
"services.test_service.files.file.activate": true,
|
||||||
"services.test.files.file2.name": "/etc/file2",
|
"services.test_service.files.file2.name": "/etc/file2",
|
||||||
"services.test.files.file2.activate": true,
|
"services.test_service.files.file2.activate": true,
|
||||||
"services.test.activate": true,
|
"services.test_service.activate": true,
|
||||||
"services.test.manage": true
|
"services.test_service.manage": true
|
||||||
}
|
}
|
||||||
|
@ -3,27 +3,27 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||||
z /etc/file - - - - -
|
|
||||||
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
||||||
z /etc/file2 - - - - -
|
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
@ -26,6 +29,6 @@ option_10.impl_set_information('source', "file2")
|
|||||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10])
|
||||||
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
option_14 = BoolOption(name="manage", doc="manage", default=True)
|
option_14 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_13, option_14])
|
option_5 = OptionDescription(name="test_service", doc="test.service", children=[option_6, option_13, option_14])
|
||||||
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])
|
||||||
|
@ -3,35 +3,35 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.name": {
|
"services.test_service.files.incfile.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/dir/incfile"
|
"value": "/etc/dir/incfile"
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.activate": {
|
"services.test_service.files.incfile.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
"services.test.files.file.name": "/etc/file",
|
"services.test_service.files.file.name": "/etc/file",
|
||||||
"services.test.files.file.activate": true,
|
"services.test_service.files.file.activate": true,
|
||||||
"services.test.files.file2.name": "/etc/file2",
|
"services.test_service.files.file2.name": "/etc/file2",
|
||||||
"services.test.files.file2.activate": true,
|
"services.test_service.files.file2.activate": true,
|
||||||
"services.test.files.incfile.name": "/etc/dir/incfile",
|
"services.test_service.files.incfile.name": "/etc/dir/incfile",
|
||||||
"services.test.files.incfile.activate": true,
|
"services.test_service.files.incfile.activate": true,
|
||||||
"services.test.activate": true,
|
"services.test_service.activate": true,
|
||||||
"services.test.manage": true
|
"services.test_service.manage": true
|
||||||
}
|
}
|
||||||
|
@ -3,35 +3,35 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.name": {
|
"services.test_service.files.incfile.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/dir/incfile"
|
"value": "/etc/dir/incfile"
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.activate": {
|
"services.test_service.files.incfile.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||||
z /etc/file - - - - -
|
|
||||||
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
||||||
z /etc/file2 - - - - -
|
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
@ -31,6 +34,6 @@ option_13.impl_set_information('source', "incfile")
|
|||||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10, option_13])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10, option_13])
|
||||||
option_16 = BoolOption(name="activate", doc="activate", default=True)
|
option_16 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
option_17 = BoolOption(name="manage", doc="manage", default=True)
|
option_17 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17])
|
option_5 = OptionDescription(name="test_service", doc="test.service", children=[option_6, option_16, option_17])
|
||||||
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])
|
||||||
|
@ -3,35 +3,35 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.name": {
|
"services.test_service.files.incfile.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/dir/incfile"
|
"value": "/etc/dir/incfile"
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.activate": {
|
"services.test_service.files.incfile.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
"services.test.files.file.name": "/etc/file",
|
"services.test_service.files.file.name": "/etc/file",
|
||||||
"services.test.files.file.activate": true,
|
"services.test_service.files.file.activate": true,
|
||||||
"services.test.files.file2.name": "/etc/file2",
|
"services.test_service.files.file2.name": "/etc/file2",
|
||||||
"services.test.files.file2.activate": true,
|
"services.test_service.files.file2.activate": true,
|
||||||
"services.test.files.incfile.name": "/etc/dir/incfile",
|
"services.test_service.files.incfile.name": "/etc/dir/incfile",
|
||||||
"services.test.files.incfile.activate": true,
|
"services.test_service.files.incfile.activate": true,
|
||||||
"services.test.activate": true,
|
"services.test_service.activate": true,
|
||||||
"services.test.manage": true
|
"services.test_service.manage": true
|
||||||
}
|
}
|
||||||
|
@ -3,35 +3,35 @@
|
|||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"services.test.files.file.name": {
|
"services.test_service.files.file.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file"
|
"value": "/etc/file"
|
||||||
},
|
},
|
||||||
"services.test.files.file.activate": {
|
"services.test_service.files.file.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.file2.name": {
|
"services.test_service.files.file2.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/file2"
|
"value": "/etc/file2"
|
||||||
},
|
},
|
||||||
"services.test.files.file2.activate": {
|
"services.test_service.files.file2.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.name": {
|
"services.test_service.files.incfile.name": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "/etc/dir/incfile"
|
"value": "/etc/dir/incfile"
|
||||||
},
|
},
|
||||||
"services.test.files.incfile.activate": {
|
"services.test_service.files.incfile.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.activate": {
|
"services.test_service.activate": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"services.test.manage": {
|
"services.test_service.manage": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||||
z /etc/file - - - - -
|
|
||||||
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
C /etc/file2 0644 root root - /usr/local/lib/etc/file2
|
||||||
z /etc/file2 - - - - -
|
|
||||||
C /etc/dir/incfile 0644 root root - /usr/local/lib/etc/dir/incfile
|
C /etc/dir/incfile 0644 root root - /usr/local/lib/etc/dir/incfile
|
||||||
z /etc/dir/incfile - - - - -
|
|
@ -1,12 +1,15 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader as _spec_from_loader, module_from_spec as _module_from_spec
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
class func:
|
||||||
spec = spec_from_loader(loader.name, loader)
|
pass
|
||||||
func = module_from_spec(spec)
|
_loader = _SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
loader.exec_module(func)
|
_spec = _spec_from_loader(_loader.name, _loader)
|
||||||
for key, value in dict(locals()).items():
|
_func = _module_from_spec(_spec)
|
||||||
if key != ['SourceFileLoader', 'func']:
|
_loader.exec_module(_func)
|
||||||
setattr(func, key, value)
|
for function in dir(_func):
|
||||||
|
if function.startswith('_'):
|
||||||
|
continue
|
||||||
|
setattr(func, function, getattr(_func, function))
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
except:
|
except:
|
||||||
@ -31,6 +34,6 @@ option_13.impl_set_information('source', "incfile")
|
|||||||
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10, option_13])
|
option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_10, option_13])
|
||||||
option_16 = BoolOption(name="activate", doc="activate", default=True)
|
option_16 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
option_17 = BoolOption(name="manage", doc="manage", default=True)
|
option_17 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17])
|
option_5 = OptionDescription(name="test_service", doc="test.service", children=[option_6, option_16, option_17])
|
||||||
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])
|
||||||
|
16
tests/dictionaries/01base_file_owner/00-base.xml
Normal file
16
tests/dictionaries/01base_file_owner/00-base.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file owner="nobody" group="nobody">/etc/file</file>
|
||||||
|
<file owner="nobody" group="nobody" engine="jinja2">/etc/file2</file>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user