add certificate support

This commit is contained in:
egarette@silique.fr 2023-01-25 22:48:13 +01:00
parent 2fd3c22db9
commit ffdeafcc29
102 changed files with 1584 additions and 26 deletions

View file

@ -25,6 +25,7 @@ Rougail est un bibliothèque python3 qui permet de charger des dictionnaires (fi
### Les services ### Les services
- [La gestion d'un fichier](service/file.md) - [La gestion d'un fichier](service/file.md)
- [La gestion d'un certificat](service/certificate.md)
- [La gestion d'un fichier de service systemd](service/override.md) - [La gestion d'un fichier de service systemd](service/override.md)
- [La gestion d'une ip](service/ip.md) - [La gestion d'une ip](service/ip.md)

View file

@ -132,7 +132,7 @@ Le moteur de template est géré dans la clef "default_files_engine" et a comme
### Les droits par défaut des fichiers ### Les droits par défaut des fichiers
Les droits des fichiers générés est géré dans la clef "default_files_mode" et a comme valeur par défaut : "0644". Les droits des fichiers générés est géré dans la clef "default_files_mode" (valeur de type nombre) et a comme valeur par défaut : 644.
### Le propriétaire par défaut des fichiers ### Le propriétaire par défaut des fichiers

View file

@ -4,7 +4,7 @@
Un service est inclut dans un conteneur [services](../services.md). 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. Cette balise permet de définir tous les éléments ([fichier](file.md), [certificat](certificate.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 : Il faut, à la création du service, préciser son nom :
@ -122,7 +122,7 @@ En YAML :
disabled: true disabled: true
``` ```
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. Dans ce cas, le service et les éléments qu'il compose ([fichier](file.md), [certificat](certificate.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 : 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 :

163
doc/service/certificate.md Normal file
View file

@ -0,0 +1,163 @@
# La gestion d'un certificat
## La balise certificate
La gestion des certificats se fait dans un conteneur de [service](README.md).
La déclaration du certificat permet d'associer un certificat à un service. Attention, Rougail ne permet que de déclarer ces certificats. Il n'y a pas de gestion du certification dans la bibliothèque.
Pour déclarer un certificat :
```xml
<services>
<service name="squid">
<certificate private="/etc/pki/tls/private/squid.key" authority="/etc/pki/ca-trust/source/anchors/ca_squid.crt">/etc/pki/tls/certs/squid.crt</certificate>
</service>
</services>
```
En YAML :
```yml
services:
- service:
- name: squid
certificate:
- private: /etc/pki/tls/private/squid.key
authority: /etc/pki/ca-trust/source/anchors/ca_squid.crt
text: /etc/pki/tls/certs/squid.crt
```
Les trois informations a donner sont donc :
- le nom du certificat
- le nom de la clef privée
- le nom de certificat de l'autorité de certification
## Les noms de fichiers dynamique
Il est possible également de définir le nom des fichiers dans des variables :
```xml
<services>
<service name="squid">
<certificate private="private" private_type="variable" authority="authority" authority_type="variable" certificate_type="variable">certificate</certificate>
</service>
</services>
<variables>
<variable name="certificate" type="filename">
<value>/etc/pki/tls/certs/squid.crt</value>
</variable>
<variable name="private" type="filename">
<value>/etc/pki/tls/private/squid.key</value>
</variable>
<variable name="authority" type="filename">
<value>/etc/pki/ca-trust/source/anchors/ca_squid.crt</value>
</variable>
</variables>
```
En YAML :
```yml
services:
- service:
- name: squid
certificate:
- private: private
private_type: variable
authority: authority
authority_type: variable
certificate_type: variable
text: certificate
variables:
- variable:
- name: certificate
type: filename
value:
- text: /etc/pki/tls/certs/squid.crt
- name: private
type: filename
value:
- text: /etc/pki/tls/private/squid.key
- name: authority
type: filename
value:
- text: /etc/pki/ca-trust/source/anchors/ca_squid.crt
```
Attention, les variables doivent être de type "filename".
## Le propriétaire de la clef privée
Le certificat et le certificat de l'autorité de certification n'ont pas besoin d'être privés.
Par contre, seul le service qui doit avoir accès à la clef privée.
Par défaut seul utilisateur "root" et groupe "root" peuvent y accéder.
Il est possible de définir l'utilisateur ou le groupe de la clef privée générée :
```xml
<services>
<service name="squid">
<certificate private="/etc/pki/tls/private/squid.key" authority="/etc/pki/ca-trust/source/anchors/ca_squid.crt" owner="squid" group="squid">/etc/pki/tls/certs/squid.crt</certificate>
</service>
</services>
```
En YAML :
```yml
services:
- service:
- name: squid
certificate:
- private: /etc/pki/tls/private/squid.key
authority: /etc/pki/ca-trust/source/anchors/ca_squid.crt
owner: squid
group: squid
text: /etc/pki/tls/certs/squid.crt
```
L'utilisateur et le groupe peuvent être défini dans une variable :
```xml
<services>
<service name="squid">
<certificate private="/etc/pki/tls/private/squid.key" authority="/etc/pki/ca-trust/source/anchors/ca_squid.crt" owner="owner" owner_type="variable" group="group" group_type="variable">/etc/pki/tls/certs/squid.crt</certificate>
</service>
<variables>
<variable name="owner" type="unix_user">
<value>squid</value>
</variable>
<variable name="group" type="unix_user">
<value>squid</value>
</variable>
</services>
```
En YAML :
```yml
services:
- service:
- name: squid
certificate:
- private: /etc/pki/tls/private/squid.key
authority: /etc/pki/ca-trust/source/anchors/ca_squid.crt
owner: owner
owner_type: variable
group: group
group_type: variable
text: /etc/pki/tls/certs/squid.crt
variables:
- variable:
- name: owner
type: unix_user
value:
- text: squid
- name: group
type: unix_user
value:
- text: squid
```

View file

@ -33,11 +33,17 @@ from typing import Tuple
from rougail.i18n import _ from rougail.i18n import _
from rougail.utils import normalize_family from rougail.utils import normalize_family
from rougail.error import DictConsistencyError from rougail.error import DictConsistencyError
from rougail.annotator.variable import CONVERT_OPTION
try:
import tiramisu3 as tiramisu
except ModuleNotFoundError:
import tiramisu
# 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', 'disabled') ERASED_ATTRIBUTES2 = ('redefine', 'namespace', 'xmlfiles', 'disabled')
ALLOW_ATTRIBUT_NOT_MANAGE = ['file', 'engine', 'target'] ALLOW_ATTRIBUT_NOT_MANAGE = ['file', 'engine', 'target']
FORCE_INFORMATIONS = ['mode']
class Annotator: class Annotator:
@ -221,6 +227,12 @@ class Annotator:
dtd_key_type = key + '_type' dtd_key_type = key + '_type'
elt_type = getattr(elt, dtd_key_type, None) elt_type = getattr(elt, dtd_key_type, None)
if elt_type: if elt_type:
try:
value = CONVERT_OPTION.get(elt_type, {}).get('func', str)(value)
except ValueError as err:
msg = _(f'"{value}" is not a valid "{elttype}": {err}')
raise DictConsistencyError(msg, 93, elt.xmlfiles)
if key not in FORCE_INFORMATIONS and elt_type:
if elt_type == 'variable': if elt_type == 'variable':
elt_type = 'symlink' elt_type = 'symlink'
family.variable.append(self._generate_element(elt_type, family.variable.append(self._generate_element(elt_type,
@ -381,3 +393,78 @@ class Annotator:
if netmask.type != 'netmask': if netmask.type != 'netmask':
msg = _(f'netmask in ip must have type "netmask", not "{netmask.type}"') msg = _(f'netmask in ip must have type "netmask", not "{netmask.type}"')
raise DictConsistencyError(msg, 65, ip.xmlfiles) raise DictConsistencyError(msg, 65, ip.xmlfiles)
def _update_certificate(self,
certificate,
certificate_name,
path_prefix,
) -> None:
if hasattr(certificate, 'certificate_type') and certificate.certificate_type == 'variable':
variable = self.objectspace.paths.get_variable(certificate.name,
certificate.namespace,
xmlfiles=certificate.xmlfiles,
force_path_prefix=path_prefix,
add_path_prefix=True,
)
if variable.type != 'filename':
msg = _(f'certificate cannot be linked to "{variable.type}" variable "{certificate.name}"')
raise DictConsistencyError(msg, 90, certificate.xmlfiles)
else:
option = CONVERT_OPTION['filename']
value = certificate.name
try:
value = option.get('func', str)(value)
getattr(tiramisu, option['opttype'])('test',
'Object to valid value',
value,
**option.get('initkwargs', {}),
)
except ValueError as err:
msg = _(f'certificate "{value}" is not a valid "filename"')
raise DictConsistencyError(msg, 94, certificate.xmlfiles) from err
if hasattr(certificate, 'private_type') and certificate.private_type == 'variable':
variable = self.objectspace.paths.get_variable(certificate.private,
certificate.namespace,
xmlfiles=certificate.xmlfiles,
force_path_prefix=path_prefix,
add_path_prefix=True,
)
if variable.type != 'filename':
msg = _(f'private cannot be linked to "{variable.type}" variable "{certificate.private}" for certificate "{certificate.name}"')
raise DictConsistencyError(msg, 91, certificate.xmlfiles)
else:
option = CONVERT_OPTION['filename']
value = certificate.private
try:
value = option.get('func', str)(value)
getattr(tiramisu, option['opttype'])('test',
'Object to valid value',
value,
**option.get('initkwargs', {}),
)
except ValueError as err:
msg = _(f'authority "{value}" is not a valid "filename"')
raise DictConsistencyError(msg, 95, certificate.xmlfiles) from err
if hasattr(certificate, 'authority_type') and certificate.authority_type == 'variable':
variable = self.objectspace.paths.get_variable(certificate.authority,
certificate.namespace,
xmlfiles=certificate.xmlfiles,
force_path_prefix=path_prefix,
add_path_prefix=True,
)
if variable.type != 'filename':
msg = _(f'authority cannot be linked to "{variable.type}" variable "{certificate.authority}" for certificate "{certificate.name}"')
raise DictConsistencyError(msg, 92, certificate.xmlfiles)
else:
option = CONVERT_OPTION['filename']
value = certificate.authority
try:
value = option.get('func', str)(value)
getattr(tiramisu, option['opttype'])('test',
'Object to valid value',
value,
**option.get('initkwargs', {}),
)
except ValueError as err:
msg = _(f'private "{value}" is not a valid "filename"')
raise DictConsistencyError(msg, 96, certificate.xmlfiles) from err

View file

@ -63,7 +63,7 @@ RougailConfig = {'dictionaries_dir': [join(ROUGAILROOT, 'dictionaries')],
'default_family_mode': 'basic', 'default_family_mode': 'basic',
'default_variable_mode': 'normal', 'default_variable_mode': 'normal',
'default_files_engine': 'cheetah', 'default_files_engine': 'cheetah',
'default_files_mode': '0644', 'default_files_mode': 644,
'default_files_owner': 'root', 'default_files_owner': 'root',
'default_files_group': 'root', 'default_files_group': 'root',
'default_files_included': 'no', 'default_files_included': 'no',

View file

@ -49,7 +49,7 @@
<!ELEMENT services (service*)> <!ELEMENT services (service*)>
<!ELEMENT service ((ip*|file*|override*)*)> <!ELEMENT service ((ip*|file*|override*|certificate*)*)>
<!ATTLIST service name CDATA #REQUIRED> <!ATTLIST service name CDATA #REQUIRED>
<!ATTLIST service manage (True|False) "True"> <!ATTLIST service manage (True|False) "True">
<!ATTLIST service servicelist CDATA #IMPLIED> <!ATTLIST service servicelist CDATA #IMPLIED>
@ -71,6 +71,7 @@
<!ATTLIST file variable_type (variable) "variable"> <!ATTLIST file variable_type (variable) "variable">
<!ATTLIST file source CDATA #IMPLIED> <!ATTLIST file source CDATA #IMPLIED>
<!ATTLIST file source_type (string|variable) "string"> <!ATTLIST file source_type (string|variable) "string">
<!ATTLIST file mode_type (number) "number">
<!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 owner_type (unix_user|variable) "unix_user">
@ -86,6 +87,17 @@
<!ATTLIST override source CDATA #IMPLIED> <!ATTLIST override source CDATA #IMPLIED>
<!ATTLIST override engine (none|cheetah|jinja) #IMPLIED> <!ATTLIST override engine (none|cheetah|jinja) #IMPLIED>
<!ELEMENT certificate (#PCDATA)>
<!ATTLIST certificate certificate_type (filename|variable) "filename">
<!ATTLIST certificate private_type (filename|variable) "filename">
<!ATTLIST certificate private CDATA #REQUIRED>
<!ATTLIST certificate authority_type (filename|variable) "filename">
<!ATTLIST certificate authority CDATA #REQUIRED>
<!ATTLIST certificate owner CDATA #IMPLIED>
<!ATTLIST certificate owner_type (unix_user|variable) "unix_user">
<!ATTLIST certificate group CDATA #IMPLIED>
<!ATTLIST certificate group_type (unix_user|variable) "unix_user">
<!ELEMENT variables ((variable*|family*)*)> <!ELEMENT variables ((variable*|family*)*)>
<!ELEMENT family ((variable*|family*)*)> <!ELEMENT family ((variable*|family*)*)>

View file

@ -81,7 +81,7 @@ mapping:
owner: owner:
type: str type: str
mode: mode:
type: str type: int
source_type: source_type:
type: str type: str
enum: enum:
@ -109,6 +109,48 @@ mapping:
- "none" - "none"
- "cheetah" - "cheetah"
- "jinja" - "jinja"
certificate:
required: false
type: seq
sequence:
- type: map
mapping:
text:
required: false
type: str
certificate_type:
type: str
enum:
- "filename"
- "variable"
group_type:
type: str
enum:
- "unix_user"
- "variable"
group:
type: str
owner_type:
type: str
enum:
- "unix_user"
- "variable"
owner:
type: str
authority:
type: str
authority_type:
type: str
enum:
- "filename"
- "variable"
private:
type: str
private_type:
type: str
enum:
- "filename"
- "variable"
name: name:
type: str type: str
undisable: undisable:

View file

@ -633,11 +633,11 @@ class RougailBaseTemplate:
) )
variables[await option.option.name()] = subfamilies variables[await option.option.name()] = subfamilies
else: else:
name = await option.option.name()
value = await option.value.get()
if is_variable_namespace: if is_variable_namespace:
value = await option.value.get() self.rougail_variables_dict[name] = value
self.rougail_variables_dict[await option.option.name()] = value variables[name] = value
value = await option.value.get()
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', self.get_default(is_service_namespace + 's',
variables, variables,

View file

@ -59,7 +59,7 @@ class RougailSystemdTemplate(RougailBaseTemplate):
%if {self.rougailconfig['systemd_tmpfile_delete_before_create']} %if {self.rougailconfig['systemd_tmpfile_delete_before_create']}
r %%filename r %%filename
%end if %end if
C %%filename %%file.mode %%file.owner %%file.group - {self.rougailconfig['systemd_tmpfile_factory_dir']}%%filename C %%filename 0%%file.mode %%file.owner %%file.group - {self.rougailconfig['systemd_tmpfile_factory_dir']}%%filename
%end if %end if
%end def %end def
%for %%service in %%services %for %%service in %%services

View file

@ -0,0 +1,26 @@
{
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,8 @@
{
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": "/etc/pki/ca-trust/source/anchors/ca_example.crt",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": "/etc/pki/tls/certs/example.crt",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": "/etc/pki/tls/private/example.key",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": true,
"services.test_service.activate": true,
"services.test_service.manage": true
}

View file

@ -0,0 +1,26 @@
{
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,32 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_5 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_6 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_7 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_4 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_3 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_5, option_6, option_7, option_4])
optiondescription_2 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_3])
option_1 = BoolOption(name="activate", doc="activate", default=True)
option_8 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_10 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_2, option_1, option_8])
optiondescription_10.impl_set_information('type', "service")
optiondescription_9 = OptionDescription(name="services", doc="services", children=[optiondescription_10], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_9])

View file

@ -0,0 +1,45 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_5 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_6 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_7 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_4 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_3 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_5, option_6, option_7, option_4])
optiondescription_2 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_3])
option_1 = BoolOption(name="activate", doc="activate", default=True)
option_8 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_19 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_2, option_1, option_8])
optiondescription_19.impl_set_information('type', "service")
optiondescription_18 = OptionDescription(name="services", doc="services", children=[optiondescription_19], properties=frozenset({"hidden"}))
optiondescription_17 = OptionDescription(name="1", doc="1", children=[optiondescription_18])
option_13 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_14 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_15 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_12 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_11 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_13, option_14, option_15, option_12])
optiondescription_10 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_11])
option_9 = BoolOption(name="activate", doc="activate", default=True)
option_16 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_22 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_10, option_9, option_16])
optiondescription_22.impl_set_information('type', "service")
optiondescription_21 = OptionDescription(name="services", doc="services", children=[optiondescription_22], properties=frozenset({"hidden"}))
optiondescription_20 = OptionDescription(name="2", doc="2", children=[optiondescription_21])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_17, optiondescription_20])

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="/etc/pki/tls/private/example.key" authority="/etc/pki/ca-trust/source/anchors/ca_example.crt">/etc/pki/tls/certs/example.crt</certificate>
</service>
</services>
</rougail>

View file

@ -0,0 +1,8 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: /etc/pki/tls/private/example.key
authority: /etc/pki/ca-trust/source/anchors/ca_example.crt
text: /etc/pki/tls/certs/example.crt

View file

@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="/etc/pki/tls/private/example.key" authority="/etc/pki/ca-trust/source/anchors/ca_example.crt" owner="owner" owner_type="variable" group="group" group_type="variable">/etc/pki/tls/certs/example.crt</certificate>
</service>
</services>
<variables>
<variable name="owner" type="unix_user">
<value>example</value>
</variable>
<variable name="group">
<value>example</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,21 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: /etc/pki/tls/private/example.key
authority: /etc/pki/ca-trust/source/anchors/ca_example.crt
owner: owner
owner_type: variable
group: group
group_type: variable
text: /etc/pki/tls/certs/example.crt
variables:
- variable:
- name: owner
type: unix_user
value:
- text: example
- name: group
value:
- text: example

View file

@ -0,0 +1,34 @@
{
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.group": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.owner": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,10 @@
{
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": "/etc/pki/ca-trust/source/anchors/ca_example.crt",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.group": "example",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": "/etc/pki/tls/certs/example.crt",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.owner": "example",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": "/etc/pki/tls/private/example.key",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": true,
"services.test_service.activate": true,
"services.test_service.manage": true
}

View file

@ -0,0 +1,34 @@
{
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.group": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.owner": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,34 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_5 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_6 = UsernameOption(name="group", doc="group", default="example")
option_7 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_8 = UsernameOption(name="owner", doc="owner", default="example")
option_9 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_4 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_3 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_5, option_6, option_7, option_8, option_9, option_4])
optiondescription_2 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_3])
option_1 = BoolOption(name="activate", doc="activate", default=True)
option_10 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_12 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_2, option_1, option_10])
optiondescription_12.impl_set_information('type', "service")
optiondescription_11 = OptionDescription(name="services", doc="services", children=[optiondescription_12], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_11])

View file

@ -0,0 +1,49 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_5 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_6 = UsernameOption(name="group", doc="group", default="example")
option_7 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_8 = UsernameOption(name="owner", doc="owner", default="example")
option_9 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_4 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_3 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_5, option_6, option_7, option_8, option_9, option_4])
optiondescription_2 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_3])
option_1 = BoolOption(name="activate", doc="activate", default=True)
option_10 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_23 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_2, option_1, option_10])
optiondescription_23.impl_set_information('type', "service")
optiondescription_22 = OptionDescription(name="services", doc="services", children=[optiondescription_23], properties=frozenset({"hidden"}))
optiondescription_21 = OptionDescription(name="1", doc="1", children=[optiondescription_22])
option_15 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_16 = UsernameOption(name="group", doc="group", default="example")
option_17 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_18 = UsernameOption(name="owner", doc="owner", default="example")
option_19 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_14 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_13 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_15, option_16, option_17, option_18, option_19, option_14])
optiondescription_12 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_13])
option_11 = BoolOption(name="activate", doc="activate", default=True)
option_20 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_26 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_12, option_11, option_20])
optiondescription_26.impl_set_information('type', "service")
optiondescription_25 = OptionDescription(name="services", doc="services", children=[optiondescription_26], properties=frozenset({"hidden"}))
optiondescription_24 = OptionDescription(name="2", doc="2", children=[optiondescription_25])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_21, optiondescription_24])

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="/etc/pki/tls/private/example.key" authority="/etc/pki/ca-trust/source/anchors/ca_example.crt" owner="example" group="example">/etc/pki/tls/certs/example.crt</certificate>
</service>
</services>
</rougail>

View file

@ -0,0 +1,10 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: /etc/pki/tls/private/example.key
authority: /etc/pki/ca-trust/source/anchors/ca_example.crt
owner: example
group: example
text: /etc/pki/tls/certs/example.crt

View file

@ -0,0 +1,42 @@
{
"rougail.owner": {
"owner": "default",
"value": "example"
},
"rougail.group": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.group": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.owner": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,12 @@
{
"rougail.owner": "example",
"rougail.group": "example",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": "/etc/pki/ca-trust/source/anchors/ca_example.crt",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.group": "example",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": "/etc/pki/tls/certs/example.crt",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.owner": "example",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": "/etc/pki/tls/private/example.key",
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": true,
"services.test_service.activate": true,
"services.test_service.manage": true
}

View file

@ -0,0 +1,42 @@
{
"rougail.owner": {
"owner": "default",
"value": "example"
},
"rougail.group": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.group": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.owner": {
"owner": "default",
"value": "example"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates./etc/pki/tls/certs/example_crt.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,37 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_1 = UsernameOption(name="owner", doc="owner", default="example", properties=frozenset({"mandatory", "normal"}))
option_2 = UsernameOption(name="group", doc="group", default="example", properties=frozenset({"mandatory", "normal"}))
optiondescription_13 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
option_7 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_8 = SymLinkOption(name="group", opt=option_2)
option_9 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_10 = SymLinkOption(name="owner", opt=option_1)
option_11 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_6 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_5 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_7, option_8, option_9, option_10, option_11, option_6])
optiondescription_4 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_5])
option_3 = BoolOption(name="activate", doc="activate", default=True)
option_12 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_15 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_4, option_3, option_12])
optiondescription_15.impl_set_information('type', "service")
optiondescription_14 = OptionDescription(name="services", doc="services", children=[optiondescription_15], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_13, optiondescription_14])

View file

@ -0,0 +1,55 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_1 = UsernameOption(name="owner", doc="owner", default="example", properties=frozenset({"mandatory", "normal"}))
option_2 = UsernameOption(name="group", doc="group", default="example", properties=frozenset({"mandatory", "normal"}))
optiondescription_26 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2])
option_9 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_10 = SymLinkOption(name="group", opt=option_2)
option_11 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_12 = SymLinkOption(name="owner", opt=option_1)
option_13 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_8 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_7 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_9, option_10, option_11, option_12, option_13, option_8])
optiondescription_6 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_7])
option_5 = BoolOption(name="activate", doc="activate", default=True)
option_14 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_28 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_6, option_5, option_14])
optiondescription_28.impl_set_information('type', "service")
optiondescription_27 = OptionDescription(name="services", doc="services", children=[optiondescription_28], properties=frozenset({"hidden"}))
optiondescription_25 = OptionDescription(name="1", doc="1", children=[optiondescription_26, optiondescription_27])
option_3 = UsernameOption(name="owner", doc="owner", default="example", properties=frozenset({"mandatory", "normal"}))
option_4 = UsernameOption(name="group", doc="group", default="example", properties=frozenset({"mandatory", "normal"}))
optiondescription_30 = OptionDescription(name="rougail", doc="Rougail", children=[option_3, option_4])
option_19 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt")
option_20 = SymLinkOption(name="group", opt=option_4)
option_21 = FilenameOption(name="name", doc="name", default="/etc/pki/tls/certs/example.crt")
option_22 = SymLinkOption(name="owner", opt=option_3)
option_23 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key")
option_18 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_17 = OptionDescription(name="/etc/pki/tls/certs/example_crt", doc="/etc/pki/tls/certs/example.crt", children=[option_19, option_20, option_21, option_22, option_23, option_18])
optiondescription_16 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_17])
option_15 = BoolOption(name="activate", doc="activate", default=True)
option_24 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_32 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_16, option_15, option_24])
optiondescription_32.impl_set_information('type', "service")
optiondescription_31 = OptionDescription(name="services", doc="services", children=[optiondescription_32], properties=frozenset({"hidden"}))
optiondescription_29 = OptionDescription(name="2", doc="2", children=[optiondescription_30, optiondescription_31])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_25, optiondescription_29])

View file

@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="/etc/pki/tls/private/example.key" authority="/etc/pki/ca-trust/source/anchors/ca_example.crt" owner="owner" owner_type="variable" group="group" group_type="variable">/etc/pki/tls/certs/example.crt</certificate>
</service>
</services>
<variables>
<variable name="owner" type="unix_user">
<value>example</value>
</variable>
<variable name="group" type="unix_user">
<value>example</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,22 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: /etc/pki/tls/private/example.key
authority: /etc/pki/ca-trust/source/anchors/ca_example.crt
owner: owner
owner_type: variable
group: group
group_type: variable
text: /etc/pki/tls/certs/example.crt
variables:
- variable:
- name: owner
type: unix_user
value:
- text: example
- name: group
type: unix_user
value:
- text: example

View file

@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="/etc/pki/tls/private/example.key" authority="/etc/pki/ca-trust/source/anchors/ca_example.crt" owner="owner" owner_type="variable" group="group" group_type="variable">/etc/pki/tls/certs/example.crt</certificate>
</service>
</services>
<variables>
<variable name="owner">
<value>example</value>
</variable>
<variable name="group" type="unix_user">
<value>example</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,21 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: /etc/pki/tls/private/example.key
authority: /etc/pki/ca-trust/source/anchors/ca_example.crt
owner: owner
owner_type: variable
group: group
group_type: variable
text: /etc/pki/tls/certs/example.crt
variables:
- variable:
- name: owner
value:
- text: example
- name: group
type: unix_user
value:
- text: example

View file

@ -0,0 +1,38 @@
{
"rougail.certificate": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"rougail.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"rougail.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates.certificate.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates.certificate.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates.certificate.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates.certificate.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,11 @@
{
"rougail.certificate": "/etc/pki/tls/certs/example.crt",
"rougail.private": "/etc/pki/tls/private/example.key",
"rougail.authority": "/etc/pki/ca-trust/source/anchors/ca_example.crt",
"services.test_service.certificates.certificate.authority": "/etc/pki/ca-trust/source/anchors/ca_example.crt",
"services.test_service.certificates.certificate.name": "/etc/pki/tls/certs/example.crt",
"services.test_service.certificates.certificate.private": "/etc/pki/tls/private/example.key",
"services.test_service.certificates.certificate.activate": true,
"services.test_service.activate": true,
"services.test_service.manage": true
}

View file

@ -0,0 +1,38 @@
{
"rougail.certificate": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"rougail.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"rougail.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates.certificate.authority": {
"owner": "default",
"value": "/etc/pki/ca-trust/source/anchors/ca_example.crt"
},
"services.test_service.certificates.certificate.name": {
"owner": "default",
"value": "/etc/pki/tls/certs/example.crt"
},
"services.test_service.certificates.certificate.private": {
"owner": "default",
"value": "/etc/pki/tls/private/example.key"
},
"services.test_service.certificates.certificate.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,36 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_1 = FilenameOption(name="certificate", doc="certificate", default="/etc/pki/tls/certs/example.crt", properties=frozenset({"mandatory", "normal"}))
option_2 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key", properties=frozenset({"mandatory", "normal"}))
option_3 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt", properties=frozenset({"mandatory", "normal"}))
optiondescription_12 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2, option_3])
option_8 = SymLinkOption(name="authority", opt=option_3)
option_9 = SymLinkOption(name="name", opt=option_1)
option_10 = SymLinkOption(name="private", opt=option_2)
option_7 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_6 = OptionDescription(name="certificate", doc="certificate", children=[option_8, option_9, option_10, option_7])
optiondescription_5 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_6])
option_4 = BoolOption(name="activate", doc="activate", default=True)
option_11 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_14 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_5, option_4, option_11])
optiondescription_14.impl_set_information('type', "service")
optiondescription_13 = OptionDescription(name="services", doc="services", children=[optiondescription_14], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_12, optiondescription_13])

View file

@ -0,0 +1,53 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_1 = FilenameOption(name="certificate", doc="certificate", default="/etc/pki/tls/certs/example.crt", properties=frozenset({"mandatory", "normal"}))
option_2 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key", properties=frozenset({"mandatory", "normal"}))
option_3 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt", properties=frozenset({"mandatory", "normal"}))
optiondescription_24 = OptionDescription(name="rougail", doc="Rougail", children=[option_1, option_2, option_3])
option_11 = SymLinkOption(name="authority", opt=option_3)
option_12 = SymLinkOption(name="name", opt=option_1)
option_13 = SymLinkOption(name="private", opt=option_2)
option_10 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_9 = OptionDescription(name="certificate", doc="certificate", children=[option_11, option_12, option_13, option_10])
optiondescription_8 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_9])
option_7 = BoolOption(name="activate", doc="activate", default=True)
option_14 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_26 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_8, option_7, option_14])
optiondescription_26.impl_set_information('type', "service")
optiondescription_25 = OptionDescription(name="services", doc="services", children=[optiondescription_26], properties=frozenset({"hidden"}))
optiondescription_23 = OptionDescription(name="1", doc="1", children=[optiondescription_24, optiondescription_25])
option_4 = FilenameOption(name="certificate", doc="certificate", default="/etc/pki/tls/certs/example.crt", properties=frozenset({"mandatory", "normal"}))
option_5 = FilenameOption(name="private", doc="private", default="/etc/pki/tls/private/example.key", properties=frozenset({"mandatory", "normal"}))
option_6 = FilenameOption(name="authority", doc="authority", default="/etc/pki/ca-trust/source/anchors/ca_example.crt", properties=frozenset({"mandatory", "normal"}))
optiondescription_28 = OptionDescription(name="rougail", doc="Rougail", children=[option_4, option_5, option_6])
option_19 = SymLinkOption(name="authority", opt=option_6)
option_20 = SymLinkOption(name="name", opt=option_4)
option_21 = SymLinkOption(name="private", opt=option_5)
option_18 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_17 = OptionDescription(name="certificate", doc="certificate", children=[option_19, option_20, option_21, option_18])
optiondescription_16 = OptionDescription(name="certificates", doc="certificates", children=[optiondescription_17])
option_15 = BoolOption(name="activate", doc="activate", default=True)
option_22 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_30 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_16, option_15, option_22])
optiondescription_30.impl_set_information('type', "service")
optiondescription_29 = OptionDescription(name="services", doc="services", children=[optiondescription_30], properties=frozenset({"hidden"}))
optiondescription_27 = OptionDescription(name="2", doc="2", children=[optiondescription_28, optiondescription_29])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_23, optiondescription_27])

View file

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="private" private_type="variable" authority="authority" authority_type="variable" certificate_type="variable">certificate</certificate>
</service>
</services>
<variables>
<variable name="certificate" type="filename">
<value>/etc/pki/tls/certs/example.crt</value>
</variable>
<variable name="private" type="filename">
<value>/etc/pki/tls/private/example.key</value>
</variable>
<variable name="authority" type="filename">
<value>/etc/pki/ca-trust/source/anchors/ca_example.crt</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,25 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: private
private_type: variable
authority: authority
authority_type: variable
certificate_type: variable
text: certificate
variables:
- variable:
- name: certificate
type: filename
value:
- text: /etc/pki/tls/certs/example.crt
- name: private
type: filename
value:
- text: /etc/pki/tls/private/example.key
- name: authority
type: filename
value:
- text: /etc/pki/ca-trust/source/anchors/ca_example.crt

View file

@ -0,0 +1,22 @@
{
"services.test_service.files.file.name": {
"owner": "default",
"value": "/etc/file"
},
"services.test_service.files.file.source": {
"owner": "default",
"value": "file"
},
"services.test_service.files.file.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,7 @@
{
"services.test_service.files.file.name": "/etc/file",
"services.test_service.files.file.source": "file",
"services.test_service.files.file.activate": true,
"services.test_service.activate": true,
"services.test_service.manage": true
}

View file

@ -0,0 +1,22 @@
{
"services.test_service.files.file.name": {
"owner": "default",
"value": "/etc/file"
},
"services.test_service.files.file.source": {
"owner": "default",
"value": "file"
},
"services.test_service.files.file.activate": {
"owner": "default",
"value": true
},
"services.test_service.activate": {
"owner": "default",
"value": true
},
"services.test_service.manage": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1 @@
test

View file

@ -0,0 +1 @@
C /etc/file 0755 root root - /usr/local/lib/etc/file

View file

@ -0,0 +1,32 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_5 = FilenameOption(name="name", doc="name", default="/etc/file")
option_6 = StrOption(name="source", doc="source", default="file")
option_4 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_3 = OptionDescription(name="file", doc="file", children=[option_5, option_6, option_4])
optiondescription_3.impl_set_information('mode', 755)
optiondescription_2 = OptionDescription(name="files", doc="files", children=[optiondescription_3])
option_1 = BoolOption(name="activate", doc="activate", default=True)
option_7 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_9 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_2, option_1, option_7])
optiondescription_9.impl_set_information('type', "service")
optiondescription_8 = OptionDescription(name="services", doc="services", children=[optiondescription_9], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_8])

View file

@ -0,0 +1,45 @@
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
def _load_functions(path):
global _SourceFileLoader, _spec_from_loader, _module_from_spec, func
loader = _SourceFileLoader('func', 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))
_load_functions('tests/dictionaries/../eosfunc/test.py')
try:
from tiramisu3 import *
except:
from tiramisu import *
option_5 = FilenameOption(name="name", doc="name", default="/etc/file")
option_6 = StrOption(name="source", doc="source", default="file")
option_4 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_3 = OptionDescription(name="file", doc="file", children=[option_5, option_6, option_4])
optiondescription_3.impl_set_information('mode', 755)
optiondescription_2 = OptionDescription(name="files", doc="files", children=[optiondescription_3])
option_1 = BoolOption(name="activate", doc="activate", default=True)
option_7 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_17 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_2, option_1, option_7])
optiondescription_17.impl_set_information('type', "service")
optiondescription_16 = OptionDescription(name="services", doc="services", children=[optiondescription_17], properties=frozenset({"hidden"}))
optiondescription_15 = OptionDescription(name="1", doc="1", children=[optiondescription_16])
option_12 = FilenameOption(name="name", doc="name", default="/etc/file")
option_13 = StrOption(name="source", doc="source", default="file")
option_11 = BoolOption(name="activate", doc="activate", default=True)
optiondescription_10 = OptionDescription(name="file", doc="file", children=[option_12, option_13, option_11])
optiondescription_10.impl_set_information('mode', 755)
optiondescription_9 = OptionDescription(name="files", doc="files", children=[optiondescription_10])
option_8 = BoolOption(name="activate", doc="activate", default=True)
option_14 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_20 = OptionDescription(name="test_service", doc="test.service", children=[optiondescription_9, option_8, option_14])
optiondescription_20.impl_set_information('type', "service")
optiondescription_19 = OptionDescription(name="services", doc="services", children=[optiondescription_20], properties=frozenset({"hidden"}))
optiondescription_18 = OptionDescription(name="2", doc="2", children=[optiondescription_19])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_15, optiondescription_18])

View file

@ -0,0 +1 @@
test

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<file mode="755">/etc/file</file>
</service>
</services>
</rougail>

View file

@ -0,0 +1,7 @@
version: '0.10'
services:
- service:
- name: test
file:
- mode: 755
text: /etc/file

View file

@ -2,7 +2,7 @@
%if %%hasattr(%%service, 'files') %if %%hasattr(%%service, 'files')
%for %%file in %%service.files %for %%file in %%service.files
%if %%file.name != %%rougail_filename and %%hasattr(%%file, 'activate') and %%file.activate == True %if %%file.name != %%rougail_filename and %%hasattr(%%file, 'activate') and %%file.activate == True
C %%file.name %%file.mode %%file.owner %%file.group - /usr/local/share/factory%%file.name C %%file.name 0%%file.mode %%file.owner %%file.group - /usr/local/share/factory%%file.name
z %%file.name - - - - - z %%file.name - - - - -
%end if %end if
%end for %end for

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="/example.key" authority="ca_example.crt">/example.crt</certificate>
</service>
</services>
</rougail>

View file

@ -0,0 +1,8 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: /example.key
authority: ca_example.crt
text: /example.crt

View file

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="private" private_type="variable" authority="authority" authority_type="variable" certificate_type="variable">certificate</certificate>
</service>
</services>
<variables>
<variable name="certificate" type="filename">
<value>/etc/pki/tls/certs/example.crt</value>
</variable>
<variable name="private" type="filename">
<value>/etc/pki/tls/private/example.key</value>
</variable>
<variable name="authority">
<value>/etc/pki/ca-trust/source/anchors/ca_example.crt</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,24 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: private
private_type: variable
authority: authority
authority_type: variable
certificate_type: variable
text: certificate
variables:
- variable:
- name: certificate
type: filename
value:
- text: /etc/pki/tls/certs/example.crt
- name: private
type: filename
value:
- text: /etc/pki/tls/private/example.key
- name: authority
value:
- text: /etc/pki/ca-trust/source/anchors/ca_example.crt

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="/example.key" authority="/ca_example.crt">example.crt</certificate>
</service>
</services>
</rougail>

View file

@ -0,0 +1,8 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: /example.key
authority: /ca_example.crt
text: example.crt

View file

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="private" private_type="variable" authority="authority" authority_type="variable" certificate_type="variable">certificate</certificate>
</service>
</services>
<variables>
<variable name="certificate">
<value>/etc/pki/tls/certs/example.crt</value>
</variable>
<variable name="private" type="filename">
<value>/etc/pki/tls/private/example.key</value>
</variable>
<variable name="authority" type="filename">
<value>/etc/pki/ca-trust/source/anchors/ca_example.crt</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,24 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: private
private_type: variable
authority: authority
authority_type: variable
certificate_type: variable
text: certificate
variables:
- variable:
- name: certificate
value:
- text: /etc/pki/tls/certs/example.crt
- name: private
type: filename
value:
- text: /etc/pki/tls/private/example.key
- name: authority
type: filename
value:
- text: /etc/pki/ca-trust/source/anchors/ca_example.crt

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="example.key" authority="/ca_example.crt">/example.crt</certificate>
</service>
</services>
</rougail>

View file

@ -0,0 +1,8 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: example.key
authority: /ca_example.crt
text: /example.crt

View file

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<certificate private="private" private_type="variable" authority="authority" authority_type="variable" certificate_type="variable">certificate</certificate>
</service>
</services>
<variables>
<variable name="certificate" type="filename">
<value>/etc/pki/tls/certs/example.crt</value>
</variable>
<variable name="private">
<value>/etc/pki/tls/private/example.key</value>
</variable>
<variable name="authority" type="filename">
<value>/etc/pki/ca-trust/source/anchors/ca_example.crt</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,24 @@
version: '0.10'
services:
- service:
- name: test
certificate:
- private: private
private_type: variable
authority: authority
authority_type: variable
certificate_type: variable
text: certificate
variables:
- variable:
- name: certificate
type: filename
value:
- text: /etc/pki/tls/certs/example.crt
- name: private
value:
- text: /etc/pki/tls/private/example.key
- name: authority
type: filename
value:
- text: /etc/pki/ca-trust/source/anchors/ca_example.crt

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<file mode="wrong_mode">/etc/file</file>
</service>
</services>
</rougail>

View file

@ -0,0 +1,7 @@
version: '0.10'
services:
- service:
- name: test
file:
- mode: "wrong_mode"
text: /etc/file

View file

@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<file group_type='variable' group="group">/etc/file</file>
</service>
</services>
<variables>
<variable name="group" type="string">
<value>nobody</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1,14 @@
version: '0.10'
services:
- service:
- name: test
file:
- group_type: variable
group: group
text: /etc/file
variables:
- variable:
- name: group
type: string
value:
- text: nobody

View file

@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test">
<file owner_type='variable' owner="owner">/etc/file</file>
</service>
</services>
<variables>
<family name="general">
<variable name="owner" type="string">
<value>nobody</value>
</variable>
</family>
</variables>
</rougail>

View file

@ -0,0 +1,17 @@
version: '0.10'
services:
- service:
- name: test
file:
- owner_type: variable
owner: owner
text: /etc/file
variables:
- family:
- name: general
variables:
- variable:
- name: owner
type: string
value:
- text: nobody

View file

@ -35,7 +35,7 @@ excludes = set([])
#excludes = set(['45multi_family_order']) #excludes = set(['45multi_family_order'])
test_ok -= excludes test_ok -= excludes
test_raise -= excludes test_raise -= excludes
#test_ok = ['01base_multi_notuniq'] #test_ok = ['01base_file_mode']
#test_ok = [] #test_ok = []
#test_raise = ['80auto_autofreeze'] #test_raise = ['80auto_autofreeze']
#test_raise = [] #test_raise = []
@ -264,20 +264,18 @@ def test_error_dictionary(test_dir_error):
ext, test_dir = test_dir_error ext, test_dir = test_dir_error
assert getcwd() == ORI_DIR assert getcwd() == ORI_DIR
test_dir = join(dico_dirs, test_dir) test_dir = join(dico_dirs, test_dir)
errno = 0 errno = []
eolobj = load_rougail_object(test_dir, ext) eolobj = load_rougail_object(test_dir, ext)
if eolobj is None: if eolobj is None:
return return
for i in listdir(test_dir): for i in listdir(test_dir):
if i.startswith('errno_'): if i.startswith('errno_'):
if errno: errno.append(int(i.split('_')[1]))
raise Exception('multiple errno') if not errno:
errno = int(i.split('_')[1]) errno.append(0)
with raises(DictConsistencyError) as err: with raises(DictConsistencyError) as err:
launch_flattener(eolobj) launch_flattener(eolobj)
save(test_dir, eolobj) save(test_dir, eolobj)
if err.value.errno != errno: msg = str(err)
print(f'expected errno: {errno}, errno: {err.value.errno}') assert err.value.errno in errno, f'expected errno: {errno}, errno: {err.value.errno}, msg: {err}'
launch_flattener(eolobj)
save(test_dir, eolobj)
assert getcwd() == ORI_DIR assert getcwd() == ORI_DIR

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