separate RougailTemplate to RougailSystemdTemplate
This commit is contained in:
parent
ba41b27dbf
commit
eb3720d6bf
@ -104,11 +104,11 @@ Générons le template :
|
||||
import asyncio
|
||||
from example import option_0
|
||||
from tiramisu import Config
|
||||
from rougail import RougailTemplate
|
||||
from rougail import RougailSystemdTemplate
|
||||
|
||||
async def template():
|
||||
config = await Config(option_0)
|
||||
engine = RougailTemplate(config)
|
||||
engine = RougailSystemdTemplate(config)
|
||||
await engine.instance_files()
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
|
@ -52,6 +52,10 @@ Le fichier qui contient les fonctions personnalisés est géré dans la clef "fu
|
||||
|
||||
Le répertoire des templates est géré dans la clef "templates_dir" et a comme valeur par défaut : "/srv/rougail/templates".
|
||||
|
||||
## Le moteur de templates par défaut
|
||||
|
||||
Le moteur de template est géré dans la clef "default_engine" et a comme valeur par défaut : "creole". Les valeurs possible sont "none" ou "creole".
|
||||
|
||||
## Le répertoire des patchs
|
||||
|
||||
Le répertoire des patches est géré dans la clef "patches_dir" et a comme valeur par défaut : "/srv/rougail/patches".
|
||||
|
@ -141,5 +141,5 @@ Par défaut, le moteur de templating est le moteur de templating compatible avec
|
||||
Aujourd'hui il est possible de désactiver la templatisation du fichier (il sera alors uniquement copié) :
|
||||
|
||||
```
|
||||
<file templating="none">/etc/squid/squid.conf</file>
|
||||
<file engine="none">/etc/squid/squid.conf</file>
|
||||
```
|
||||
|
@ -33,5 +33,5 @@ Par défaut, le moteur de templating est le moteur de templating compatible avec
|
||||
Aujourd'hui il est possible de désactiver la templatisation du fichier (il sera alors uniquement copié) :
|
||||
|
||||
```
|
||||
<override templating="none"/>
|
||||
<override engine="none"/>
|
||||
```
|
||||
|
@ -25,8 +25,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from .convert import RougailConvert
|
||||
from .template.base import RougailTemplate
|
||||
from .template.systemd import RougailSystemdTemplate
|
||||
from .config import RougailConfig
|
||||
from .annotator import modes
|
||||
|
||||
__ALL__ = ('RougailConvert', 'RougailTemplate', 'RougailConfig', 'modes')
|
||||
__ALL__ = ('RougailConvert', 'RougailSystemdTemplate', 'RougailConfig', 'modes')
|
||||
|
@ -46,7 +46,6 @@ class ServiceAnnotator:
|
||||
<services>
|
||||
<service name="test">
|
||||
<service_access service='ntp'>
|
||||
<port protocol='udp' service_accesslist='ntp_udp'>123</port>
|
||||
</service_access>
|
||||
</service>
|
||||
</services>
|
||||
@ -54,6 +53,7 @@ class ServiceAnnotator:
|
||||
def __init__(self, objectspace):
|
||||
self.objectspace = objectspace
|
||||
self.uniq_ip = []
|
||||
self.uniq_overrides = []
|
||||
if 'network_type' not in self.objectspace.types:
|
||||
self.objectspace.types['network_type'] = self.objectspace.types['ip_type']
|
||||
if hasattr(self.objectspace.space, 'services'):
|
||||
@ -234,18 +234,20 @@ class ServiceAnnotator:
|
||||
return variable
|
||||
|
||||
def _update_override(self,
|
||||
file_,
|
||||
override,
|
||||
service_name,
|
||||
):
|
||||
file_.name = f'/systemd/system/{service_name}.service.d/rougail.conf'
|
||||
# retrieve default value from File object
|
||||
for attr in ['owner', 'group', 'mode']:
|
||||
setattr(file_, attr, getattr(self.objectspace.file, attr))
|
||||
if not hasattr(file_, 'source'):
|
||||
file_.source = f'{service_name}.service'
|
||||
self._update_file(file_,
|
||||
service_name,
|
||||
)
|
||||
|
||||
if service_name in self.uniq_overrides:
|
||||
msg = _(f'only one override is allowed by service, '
|
||||
f'please use a variable multiple if you want have more than one IP')
|
||||
raise DictConsistencyError(msg, 69, ip.xmlfiles)
|
||||
self.uniq_overrides.append(service_name)
|
||||
override.name = service_name
|
||||
if not hasattr(override, 'engine'):
|
||||
override.engine = RougailConfig['default_engine']
|
||||
if not hasattr(override, 'source'):
|
||||
override.source = f'{service_name}.service'
|
||||
|
||||
@staticmethod
|
||||
def _update_file(file_,
|
||||
@ -268,7 +270,7 @@ class ServiceAnnotator:
|
||||
service_name,
|
||||
) -> None:
|
||||
if service_name in self.uniq_ip:
|
||||
msg = _(f'only one IP is allowed by IP, '
|
||||
msg = _(f'only one IP is allowed by service, '
|
||||
f'please use a variable multiple if you want have more than one IP')
|
||||
raise DictConsistencyError(msg, 67, ip.xmlfiles)
|
||||
self.uniq_ip.append(service_name)
|
||||
@ -284,16 +286,3 @@ class ServiceAnnotator:
|
||||
if netmask.type != 'netmask':
|
||||
msg = _(f'netmask in ip must have type "netmask", not "{netmask.type}"')
|
||||
raise DictConsistencyError(msg, 65, ip.xmlfiles)
|
||||
# Convert IP to file
|
||||
ip.network_type = ip.ip_type
|
||||
ip.network = ip.name
|
||||
ip.ip_type = 'filename'
|
||||
ip.name = f'/systemd/system/{service_name}.service.d/rougail_ip.conf'
|
||||
# retrieve default value from File object
|
||||
for attr in ['owner', 'group', 'mode']:
|
||||
setattr(ip, attr, getattr(self.objectspace.file, attr))
|
||||
ip.source = None
|
||||
ip.engine = 'creole'
|
||||
self._update_file(ip,
|
||||
service_name,
|
||||
)
|
||||
|
@ -46,15 +46,10 @@
|
||||
|
||||
<!ELEMENT services (service*)>
|
||||
|
||||
<!ELEMENT service ((port*|ip*|file*|override*)*)>
|
||||
<!ELEMENT service ((ip*|file*|override*)*)>
|
||||
<!ATTLIST service name CDATA #REQUIRED>
|
||||
<!ATTLIST service manage (True|False) "True">
|
||||
|
||||
<!ELEMENT port (#PCDATA)>
|
||||
<!ATTLIST port port_type (port|variable) "port">
|
||||
<!ATTLIST port portlist CDATA #IMPLIED>
|
||||
<!ATTLIST port protocol (tcp|udp) "tcp">
|
||||
|
||||
<!ELEMENT ip (#PCDATA)>
|
||||
<!ATTLIST ip iplist CDATA #IMPLIED>
|
||||
<!ATTLIST ip ip_type (variable) "variable">
|
||||
@ -130,7 +125,7 @@
|
||||
<!ATTLIST param optional (True|False) "False">
|
||||
|
||||
<!ELEMENT target (#PCDATA)>
|
||||
<!ATTLIST target type (variable|family|filelist|iplist|portlist) "variable">
|
||||
<!ATTLIST target type (variable|family|filelist|iplist) "variable">
|
||||
<!ATTLIST target optional (True|False) "False">
|
||||
|
||||
<!ELEMENT group (follower+)>
|
||||
|
@ -31,7 +31,7 @@ from typing import Dict, Any
|
||||
from subprocess import call
|
||||
from os import listdir, makedirs, getcwd, chdir
|
||||
from os.path import dirname, join, isfile, isdir, abspath
|
||||
from ipaddress import ip_network
|
||||
|
||||
|
||||
try:
|
||||
from tiramisu3 import Config
|
||||
@ -50,13 +50,6 @@ ENGINES = {}
|
||||
for engine in engines.__all__:
|
||||
ENGINES[engine] = getattr(engines, engine)
|
||||
|
||||
ROUGAIL_IP_TEMPLATE = """[Service]
|
||||
%for %%ip in %%rougail_variable
|
||||
IPAddressAllow=%%ip
|
||||
%end for
|
||||
IPAddressDeny=any
|
||||
"""
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.addHandler(logging.NullHandler())
|
||||
@ -170,13 +163,16 @@ class RougailExtra:
|
||||
def __getattr__(self,
|
||||
key: str,
|
||||
) -> Any:
|
||||
return self.suboption[key]
|
||||
try:
|
||||
return self.suboption[key]
|
||||
except KeyError:
|
||||
raise AttributeError
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.suboption.values())
|
||||
|
||||
|
||||
class RougailTemplate:
|
||||
class RougailBaseTemplate:
|
||||
"""Engine to process Creole cheetah template
|
||||
"""
|
||||
def __init__(self, # pylint: disable=R0913
|
||||
@ -200,6 +196,8 @@ class RougailTemplate:
|
||||
self.eosfunc = eos
|
||||
self.rougail_variables_dict = {}
|
||||
self.rougailconfig = rougailconfig
|
||||
self.log = log
|
||||
self.engines = ENGINES
|
||||
|
||||
def patch_template(self,
|
||||
filename: str,
|
||||
@ -211,13 +209,13 @@ class RougailTemplate:
|
||||
|
||||
patch_file = join(self.patches_dir, f'{filename}.patch')
|
||||
if isfile(patch_file):
|
||||
log.info(_("Patching template '{filename}' with '{patch_file}'"))
|
||||
self.log.info(_("Patching template '{filename}' with '{patch_file}'"))
|
||||
ret = call(patch_cmd + patch_no_debug + ['-i', patch_file])
|
||||
if ret: # pragma: no cover
|
||||
patch_cmd_err = ' '.join(patch_cmd + ['-i', patch_file])
|
||||
msg = _(f"Error applying patch: '{patch_file}'\n"
|
||||
f"To reproduce and fix this error {patch_cmd_err}")
|
||||
log.error(_(msg))
|
||||
self.log.error(_(msg))
|
||||
copy(join(self.templates_dir, filename), self.tmp_dir)
|
||||
|
||||
def prepare_template(self,
|
||||
@ -225,7 +223,7 @@ class RougailTemplate:
|
||||
) -> None:
|
||||
"""Prepare template source file
|
||||
"""
|
||||
log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
|
||||
self.log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
|
||||
if not isdir(self.tmp_dir):
|
||||
raise TemplateError(_(f'cannot find tmp_dir {self.tmp_dir}'))
|
||||
copy(filename, self.tmp_dir)
|
||||
@ -233,29 +231,16 @@ class RougailTemplate:
|
||||
|
||||
def instance_file(self,
|
||||
filevar: Dict,
|
||||
object_type: str,
|
||||
type: str,
|
||||
service_name: str,
|
||||
) -> None:
|
||||
"""Run templatisation on one file
|
||||
"""
|
||||
log.info(_("Instantiating file '{filename}'"))
|
||||
self.log.info(_("Instantiating file '{filename}'"))
|
||||
if 'variable' in filevar:
|
||||
variable = filevar['variable']
|
||||
else:
|
||||
variable = None
|
||||
if 'network' in filevar:
|
||||
if 'netmask' in filevar:
|
||||
if isinstance(filevar['network'], list):
|
||||
variable = [str(ip_network(f'{net}/{mask}'))
|
||||
for net, mask in zip(filevar['network'], filevar['netmask'])]
|
||||
else:
|
||||
variable = str(ip_network(f'{filevar["network"]}/{filevar["netmask"]}'))
|
||||
else:
|
||||
variable = filevar['network']
|
||||
if not isinstance(variable, list):
|
||||
if variable is None:
|
||||
variable = []
|
||||
else:
|
||||
variable = [variable]
|
||||
filenames = filevar['name']
|
||||
if not isinstance(filenames, list):
|
||||
filenames = [filenames]
|
||||
@ -263,30 +248,29 @@ class RougailTemplate:
|
||||
variable = [variable]
|
||||
if not isdir(self.destinations_dir):
|
||||
raise TemplateError(_(f'cannot find destinations_dir {self.destinations_dir}'))
|
||||
for idx, destfile in enumerate(filenames):
|
||||
destfilename = join(self.destinations_dir, destfile[1:])
|
||||
makedirs(dirname(destfilename), exist_ok=True)
|
||||
if object_type == 'ip':
|
||||
var = variable
|
||||
elif variable:
|
||||
for idx, filename, in enumerate(filenames):
|
||||
if variable:
|
||||
var = variable[idx]
|
||||
else:
|
||||
var = None
|
||||
if object_type == 'ip':
|
||||
filename = None
|
||||
source = ROUGAIL_IP_TEMPLATE
|
||||
else:
|
||||
filename = join(self.tmp_dir, filevar['source'])
|
||||
source = None
|
||||
log.info(_(f"{filevar['engine']} processing: '{destfilename}'"))
|
||||
ENGINES[filevar['engine']].process(filename=filename,
|
||||
source=source,
|
||||
true_destfilename=destfile,
|
||||
destfilename=destfilename,
|
||||
variable=var,
|
||||
rougail_variables_dict=self.rougail_variables_dict,
|
||||
eosfunc=self.eosfunc,
|
||||
)
|
||||
func = f'_instance_{type}'
|
||||
filename, source, destfile, var = getattr(self, func)(filevar,
|
||||
filename,
|
||||
service_name,
|
||||
variable,
|
||||
idx,
|
||||
)
|
||||
destfilename = join(self.destinations_dir, destfile[1:])
|
||||
makedirs(dirname(destfilename), exist_ok=True)
|
||||
self.log.info(_(f"{filevar['engine']} processing: '{destfilename}'"))
|
||||
self.engines[filevar['engine']].process(filename=filename,
|
||||
source=source,
|
||||
true_destfilename=destfile,
|
||||
destfilename=destfilename,
|
||||
variable=var,
|
||||
rougail_variables_dict=self.rougail_variables_dict,
|
||||
eosfunc=self.eosfunc,
|
||||
)
|
||||
|
||||
async def instance_files(self) -> None:
|
||||
"""Run templatisation on all files
|
||||
@ -302,21 +286,36 @@ class RougailTemplate:
|
||||
for template in listdir('.'):
|
||||
self.prepare_template(template)
|
||||
for service_obj in await self.config.option('services').list('all'):
|
||||
service_name = await service_obj.option.name()
|
||||
for fills in await service_obj.list('all'):
|
||||
type_ = await fills.option.name()
|
||||
if type_ in ['files', 'overrides', 'ip']:
|
||||
for fill_obj in await fills.list('all'):
|
||||
fill = await fill_obj.value.dict()
|
||||
if type_ != 'ip':
|
||||
filename = fill['source']
|
||||
if not isfile(filename): # pragma: no cover
|
||||
raise FileNotFound(_(f"File {filename} does not exist."))
|
||||
if fill['activate']:
|
||||
self.instance_file(fill, type_)
|
||||
else:
|
||||
log.debug(_("Instantiation of file '{filename}' disabled"))
|
||||
for fill_obj in await fills.list('all'):
|
||||
fill = await fill_obj.value.dict()
|
||||
if fill['activate']:
|
||||
self.instance_file(fill, type_, service_name)
|
||||
else:
|
||||
self.log.debug(_("Instantiation of file '{filename}' disabled"))
|
||||
self.post_instance()
|
||||
chdir(ori_dir)
|
||||
|
||||
def post_instance(self):
|
||||
pass
|
||||
|
||||
def _instance_ip(self,
|
||||
*args,
|
||||
) -> None:
|
||||
raise NotImplementedError(_('cannot instanciate this service type ip'))
|
||||
|
||||
def _instance_files(self,
|
||||
*args,
|
||||
) -> None:
|
||||
raise NotImplementedError(_('cannot instanciate this service type file'))
|
||||
|
||||
def _instance_overrides(self,
|
||||
*args,
|
||||
) -> None:
|
||||
raise NotImplementedError(_('cannot instanciate this service type override'))
|
||||
|
||||
async def load_variables(self,
|
||||
optiondescription,
|
||||
is_variable_namespace,
|
||||
|
@ -29,6 +29,7 @@ from Cheetah.Template import Template
|
||||
from Cheetah.NameMapper import NotFound
|
||||
from typing import Dict, Any
|
||||
|
||||
from ...i18n import _
|
||||
from ...utils import normalize_family
|
||||
from ...error import TemplateError
|
||||
|
||||
@ -117,10 +118,16 @@ def process(filename: str,
|
||||
data = str(cheetah_template)
|
||||
except NotFound as err: # pragma: no cover
|
||||
varname = err.args[0][13:-1]
|
||||
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
||||
if filename:
|
||||
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
||||
else:
|
||||
msg = f"Error: unknown variable used in file {destfilename}: {varname}"
|
||||
raise TemplateError(_(msg)) from err
|
||||
except Exception as err: # pragma: no cover
|
||||
msg = _(f"Error while instantiating template {filename} to {destfilename}: {err}")
|
||||
if filename:
|
||||
msg = _(f"Error while instantiating template {filename} to {destfilename}: {err}")
|
||||
else:
|
||||
msg = _(f"Error while instantiating filename {destfilename}: {err}")
|
||||
raise TemplateError(msg) from err
|
||||
|
||||
with open(destfilename, 'w') as file_h:
|
||||
|
131
src/rougail/template/systemd.py
Normal file
131
src/rougail/template/systemd.py
Normal file
@ -0,0 +1,131 @@
|
||||
"""Template langage for Rougail to create file and systemd file
|
||||
|
||||
Cadoles (http://www.cadoles.com)
|
||||
Copyright (C) 2021
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
|
||||
from typing import Dict
|
||||
from os import makedirs
|
||||
from os.path import dirname, isfile, join
|
||||
from ipaddress import ip_network
|
||||
|
||||
from .base import RougailBaseTemplate
|
||||
from ..i18n import _
|
||||
from ..error import FileNotFound
|
||||
|
||||
|
||||
ROUGAIL_IP_TEMPLATE = """[Service]
|
||||
%for %%ip in %%rougail_variable
|
||||
IPAddressAllow=%%ip
|
||||
%end for
|
||||
IPAddressDeny=any
|
||||
"""
|
||||
|
||||
|
||||
ROUGAIL_TMPL_TEMPLATE = """%def display(%%file, %%filename)
|
||||
%if %%filename.startswith('/etc/') or %%filename.startswith('/var/') or %%filename.startswith('/srv/')
|
||||
C %%filename %%file.mode %%file.owner %%file.group - /usr/local/lib%%filename
|
||||
z %%filename - - - - -
|
||||
%end if
|
||||
%end def
|
||||
%for %%service in %%services
|
||||
%if %%hasattr(%%service, 'files')
|
||||
%for %%file in %%service.files
|
||||
%if %%file.activate == True
|
||||
%if %%isinstance(%%file.name, list)
|
||||
%for %%filename in %%file.name
|
||||
%%display(%%file, %%filename)%slurp
|
||||
%end for
|
||||
%else
|
||||
%%display(%%file, %%file.name)%slurp
|
||||
%end if
|
||||
%end if
|
||||
%end for
|
||||
%end if
|
||||
%end for"""
|
||||
|
||||
|
||||
class RougailSystemdTemplate(RougailBaseTemplate):
|
||||
def _instance_files(self,
|
||||
filevar: Dict,
|
||||
destfile: str,
|
||||
service_name: str,
|
||||
variable,
|
||||
idx: int,
|
||||
) -> tuple:
|
||||
source = filevar['source']
|
||||
if not isfile(source): # pragma: no cover
|
||||
raise FileNotFound(_(f"File {source} does not exist."))
|
||||
tmp_file = join(self.tmp_dir, source)
|
||||
#self.instance_file(fill, 'files')
|
||||
if variable:
|
||||
var = variable[idx]
|
||||
else:
|
||||
var = None
|
||||
return tmp_file, None, destfile, var
|
||||
|
||||
def _instance_overrides(self,
|
||||
filevar: Dict,
|
||||
destfile,
|
||||
service_name: str,
|
||||
*args,
|
||||
) -> tuple:
|
||||
source = filevar['source']
|
||||
if not isfile(source): # pragma: no cover
|
||||
raise FileNotFound(_(f"File {source} does not exist."))
|
||||
tmp_file = join(self.tmp_dir, source)
|
||||
service_name = filevar['name']
|
||||
return tmp_file, None, f'/systemd/system/{service_name}.service.d/rougail.conf', None
|
||||
|
||||
|
||||
def _instance_ip(self,
|
||||
filevar: Dict,
|
||||
destfile,
|
||||
service_name: str,
|
||||
*args,
|
||||
) -> tuple:
|
||||
if 'netmask' in filevar:
|
||||
if isinstance(filevar['name'], list):
|
||||
variable = [str(ip_network(f'{net}/{mask}'))
|
||||
for net, mask in zip(filevar['name'], filevar['netmask'])]
|
||||
else:
|
||||
variable = str(ip_network(f'{filevar["name"]}/{filevar["netmask"]}'))
|
||||
else:
|
||||
variable = filevar['name']
|
||||
if not isinstance(variable, list):
|
||||
if variable is None:
|
||||
variable = []
|
||||
else:
|
||||
variable = [variable]
|
||||
filevar['engine'] = 'creole'
|
||||
return None, ROUGAIL_IP_TEMPLATE, f'/systemd/system/{service_name}.service.d/rougail_ip.conf', variable
|
||||
|
||||
def post_instance(self):
|
||||
destfile = '/tmpfiles.d/rougail.conf'
|
||||
destfilename = join(self.destinations_dir, destfile[1:])
|
||||
makedirs(dirname(destfilename), exist_ok=True)
|
||||
self.log.info(_(f"creole processing: '{destfilename}'"))
|
||||
self.engines['creole'].process(filename=None,
|
||||
source=ROUGAIL_TMPL_TEMPLATE,
|
||||
true_destfilename=destfile,
|
||||
destfilename=destfilename,
|
||||
variable=None,
|
||||
rougail_variables_dict=self.rougail_variables_dict,
|
||||
eosfunc=self.eosfunc,
|
||||
)
|
@ -0,0 +1,2 @@
|
||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||
z /etc/file - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||
z /etc/file - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||
z /etc/file - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/systemd-makefs@dev-disk-by\x2dpartlabel 0644 root root - /usr/local/lib/etc/systemd-makefs@dev-disk-by\x2dpartlabel
|
||||
z /etc/systemd-makefs@dev-disk-by\x2dpartlabel - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||
z /etc/file - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||
z /etc/file - - - - -
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "creole", "services.test.overrides.test_service.group": "root", "services.test.overrides.test_service.mode": "0644", "services.test.overrides.test_service.name": "/systemd/system/test.service.d/rougail.conf", "services.test.overrides.test_service.owner": "root", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "creole", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true}
|
||||
|
@ -15,13 +15,10 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non"
|
||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_8 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_9 = StrOption(name="group", doc="group", default="root")
|
||||
option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_11 = StrOption(name="name", doc="name", default="/systemd/system/test.service.d/rougail.conf")
|
||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_13 = StrOption(name="source", doc="source", default="test.service")
|
||||
option_14 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_9 = StrOption(name="name", doc="name", default="test")
|
||||
option_10 = StrOption(name="source", doc="source", default="test.service")
|
||||
option_11 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11])
|
||||
option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "none", "services.test.overrides.test_service.group": "root", "services.test.overrides.test_service.mode": "0644", "services.test.overrides.test_service.name": "/systemd/system/test.service.d/rougail.conf", "services.test.overrides.test_service.owner": "root", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test_service.engine": "none", "services.test.overrides.test_service.name": "test", "services.test.overrides.test_service.source": "test.service", "services.test.overrides.test_service.activate": true}
|
||||
|
@ -15,13 +15,10 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non"
|
||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_8 = StrOption(name="engine", doc="engine", default="none")
|
||||
option_9 = StrOption(name="group", doc="group", default="root")
|
||||
option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_11 = StrOption(name="name", doc="name", default="/systemd/system/test.service.d/rougail.conf")
|
||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_13 = StrOption(name="source", doc="source", default="test.service")
|
||||
option_14 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_9 = StrOption(name="name", doc="name", default="test")
|
||||
option_10 = StrOption(name="source", doc="source", default="test.service")
|
||||
option_11 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11])
|
||||
option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test2_service.engine": "creole", "services.test.overrides.test2_service.group": "root", "services.test.overrides.test2_service.mode": "0644", "services.test.overrides.test2_service.name": "/systemd/system/test.service.d/rougail.conf", "services.test.overrides.test2_service.owner": "root", "services.test.overrides.test2_service.source": "test2.service", "services.test.overrides.test2_service.activate": true}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "services.test.overrides.test2_service.engine": "creole", "services.test.overrides.test2_service.name": "test", "services.test.overrides.test2_service.source": "test2.service", "services.test.overrides.test2_service.activate": true}
|
||||
|
@ -15,13 +15,10 @@ option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non"
|
||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_8 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_9 = StrOption(name="group", doc="group", default="root")
|
||||
option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_11 = StrOption(name="name", doc="name", default="/systemd/system/test.service.d/rougail.conf")
|
||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_13 = StrOption(name="source", doc="source", default="test2.service")
|
||||
option_14 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="test2_service", doc="test2.service", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_9 = StrOption(name="name", doc="name", default="test")
|
||||
option_10 = StrOption(name="source", doc="source", default="test2.service")
|
||||
option_11 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="test2_service", doc="test2.service", children=[option_8, option_9, option_10, option_11])
|
||||
option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7])
|
||||
option_5 = OptionDescription(name="test", doc="test", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
|
@ -0,0 +1,2 @@
|
||||
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||
z /etc/mailname - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||
z /etc/mailname - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||
z /etc/file - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||
z /etc/mailname - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||
z /etc/mailname - - - - -
|
@ -0,0 +1,4 @@
|
||||
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||
z /etc/mailname - - - - -
|
||||
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
|
||||
z /etc/mailname2 - - - - -
|
@ -0,0 +1,4 @@
|
||||
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||
z /etc/mailname - - - - -
|
||||
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
|
||||
z /etc/mailname2 - - - - -
|
@ -0,0 +1,2 @@
|
||||
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||
z /etc/mailname - - - - -
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name='ntp'>
|
||||
<port protocol='udp'>123</port>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<family name='général'>
|
||||
<variable name='mode_conteneur_actif' type='string' description="No change" hidden="True">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
@ -1 +0,0 @@
|
||||
{"rougail.general.mode_conteneur_actif": "oui", "services.ntp.ports.123.name": "123", "services.ntp.ports.123.protocol": "udp", "services.ntp.ports.123.activate": true}
|
@ -1,24 +0,0 @@
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from importlib.util import spec_from_loader, module_from_spec
|
||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
spec = spec_from_loader(loader.name, loader)
|
||||
func = module_from_spec(spec)
|
||||
loader.exec_module(func)
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||
option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_8 = PortOption(name="name", doc="name", default="123", allow_private=True)
|
||||
option_9 = StrOption(name="protocol", doc="protocol", default="udp")
|
||||
option_10 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="123", doc="123", children=[option_8, option_9, option_10])
|
||||
option_6 = OptionDescription(name="ports", doc="ports", children=[option_7])
|
||||
option_5 = OptionDescription(name="ntp", doc="ntp", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name='ntp'>
|
||||
<port protocol='udp' port_type="variable" portlist="example">my_variable</port>
|
||||
<port protocol='tcp' port_type="variable" portlist="example">my_variable</port>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<variable name='my_variable' type='port'>
|
||||
<value>123</value>
|
||||
</variable>
|
||||
</variables>
|
||||
<constraints>
|
||||
<condition name="disabled_if_in" source="my_variable">
|
||||
<param type='nil'/>
|
||||
<target type="portlist">example</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
@ -1 +0,0 @@
|
||||
{"rougail.my_variable": "123", "services.ntp.ports.my_variable.name": "123", "services.ntp.ports.my_variable.protocol": "udp", "services.ntp.ports.my_variable.activate": true, "services.ntp.ports.my_variable_1.name": "123", "services.ntp.ports.my_variable_1.protocol": "tcp", "services.ntp.ports.my_variable_1.activate": true}
|
@ -1,27 +0,0 @@
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from importlib.util import spec_from_loader, module_from_spec
|
||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
spec = spec_from_loader(loader.name, loader)
|
||||
func = module_from_spec(spec)
|
||||
loader.exec_module(func)
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
option_2 = PortOption(name="my_variable", doc="my_variable", default="123", allow_private=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_7 = SymLinkOption(name="name", opt=option_2)
|
||||
option_8 = StrOption(name="protocol", doc="protocol", default="udp")
|
||||
option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue(None)})))
|
||||
option_6 = OptionDescription(name="my_variable", doc="my_variable", children=[option_7, option_8, option_9])
|
||||
option_11 = SymLinkOption(name="name", opt=option_2)
|
||||
option_12 = StrOption(name="protocol", doc="protocol", default="tcp")
|
||||
option_13 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue(None)})))
|
||||
option_10 = OptionDescription(name="my_variable_1", doc="my_variable_1", children=[option_11, option_12, option_13])
|
||||
option_5 = OptionDescription(name="ports", doc="ports", children=[option_6, option_10])
|
||||
option_4 = OptionDescription(name="ntp", doc="ntp", children=[option_5])
|
||||
option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3])
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
<variables>
|
||||
<variable name='my_variable' type='port'>
|
||||
<value>123</value>
|
||||
</variable>
|
||||
</variables>
|
||||
<constraints>
|
||||
<condition name="disabled_if_in" source="my_variable">
|
||||
<param type='nil'/>
|
||||
<target type="portlist" optional="True">example</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
@ -1 +0,0 @@
|
||||
{"rougail.my_variable": "123"}
|
@ -1,16 +0,0 @@
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from importlib.util import spec_from_loader, module_from_spec
|
||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
spec = spec_from_loader(loader.name, loader)
|
||||
func = module_from_spec(spec)
|
||||
loader.exec_module(func)
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
option_2 = PortOption(name="my_variable", doc="my_variable", default="123", allow_private=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name='ntp'>
|
||||
<port protocol='udp' port_type="variable">my_variable</port>
|
||||
<port protocol='tcp' port_type="variable">my_variable</port>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<variable name='my_variable' type='port'>
|
||||
<value>123</value>
|
||||
</variable>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
@ -1 +0,0 @@
|
||||
{"rougail.my_variable": "123", "services.ntp.ports.my_variable.name": "123", "services.ntp.ports.my_variable.protocol": "udp", "services.ntp.ports.my_variable.activate": true, "services.ntp.ports.my_variable_1.name": "123", "services.ntp.ports.my_variable_1.protocol": "tcp", "services.ntp.ports.my_variable_1.activate": true}
|
@ -1,27 +0,0 @@
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from importlib.util import spec_from_loader, module_from_spec
|
||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
spec = spec_from_loader(loader.name, loader)
|
||||
func = module_from_spec(spec)
|
||||
loader.exec_module(func)
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
option_2 = PortOption(name="my_variable", doc="my_variable", default="123", allow_private=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_7 = SymLinkOption(name="name", opt=option_2)
|
||||
option_8 = StrOption(name="protocol", doc="protocol", default="udp")
|
||||
option_9 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="my_variable", doc="my_variable", children=[option_7, option_8, option_9])
|
||||
option_11 = SymLinkOption(name="name", opt=option_2)
|
||||
option_12 = StrOption(name="protocol", doc="protocol", default="tcp")
|
||||
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_10 = OptionDescription(name="my_variable_1", doc="my_variable_1", children=[option_11, option_12, option_13])
|
||||
option_5 = OptionDescription(name="ports", doc="ports", children=[option_6, option_10])
|
||||
option_4 = OptionDescription(name="ntp", doc="ntp", children=[option_5])
|
||||
option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3])
|
@ -1 +1 @@
|
||||
{"rougail.nut_monitor_host": "192.168.0.1", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.engine": "creole", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.group": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.mode": "0644", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.name": "/systemd/system/nut.service.d/rougail_ip.conf", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.network": "192.168.0.1", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.owner": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.activate": true}
|
||||
{"rougail.nut_monitor_host": "192.168.0.1", "services.nut.ip.nut_monitor_host.name": "192.168.0.1", "services.nut.ip.nut_monitor_host.activate": true}
|
||||
|
@ -13,14 +13,9 @@ except:
|
||||
from tiramisu import *
|
||||
option_2 = IPOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.1", allow_reserved=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_7 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_8 = StrOption(name="group", doc="group", default="root")
|
||||
option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_10 = FilenameOption(name="name", doc="name", default="/systemd/system/nut.service.d/rougail_ip.conf")
|
||||
option_11 = SymLinkOption(name="network", opt=option_2)
|
||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="/systemd/system/nut_service_d/rougail_ip_conf", doc="/systemd/system/nut.service.d/rougail_ip.conf", children=[option_7, option_8, option_9, option_10, option_11, option_12, option_13])
|
||||
option_7 = SymLinkOption(name="name", opt=option_2)
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8])
|
||||
option_5 = OptionDescription(name="ip", doc="ip", children=[option_6])
|
||||
option_4 = OptionDescription(name="nut", doc="nut", children=[option_5])
|
||||
option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.engine": "creole", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.group": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.mode": "0644", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.name": "/systemd/system/nut.service.d/rougail_ip.conf", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.network": "192.168.0.0/24", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.owner": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.activate": true}
|
||||
{"rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true}
|
||||
|
@ -13,14 +13,9 @@ except:
|
||||
from tiramisu import *
|
||||
option_2 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0/24", cidr=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_7 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_8 = StrOption(name="group", doc="group", default="root")
|
||||
option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_10 = FilenameOption(name="name", doc="name", default="/systemd/system/nut.service.d/rougail_ip.conf")
|
||||
option_11 = SymLinkOption(name="network", opt=option_2)
|
||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="/systemd/system/nut_service_d/rougail_ip_conf", doc="/systemd/system/nut.service.d/rougail_ip.conf", children=[option_7, option_8, option_9, option_10, option_11, option_12, option_13])
|
||||
option_7 = SymLinkOption(name="name", opt=option_2)
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8])
|
||||
option_5 = OptionDescription(name="ip", doc="ip", children=[option_6])
|
||||
option_4 = OptionDescription(name="nut", doc="nut", children=[option_5])
|
||||
option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.engine": "creole", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.group": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.mode": "0644", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.name": "/systemd/system/nut.service.d/rougail_ip.conf", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.network": "192.168.0.0/24", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.owner": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.activate": true}
|
||||
{"rougail.condition": "no", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": true}
|
||||
|
@ -14,14 +14,9 @@ except:
|
||||
option_2 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0/24", cidr=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue("yes")}))}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||
option_8 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_9 = StrOption(name="group", doc="group", default="root")
|
||||
option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_11 = FilenameOption(name="name", doc="name", default="/systemd/system/nut.service.d/rougail_ip.conf")
|
||||
option_12 = SymLinkOption(name="network", opt=option_3)
|
||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_14 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")})))
|
||||
option_7 = OptionDescription(name="/systemd/system/nut_service_d/rougail_ip_conf", doc="/systemd/system/nut.service.d/rougail_ip.conf", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_8 = SymLinkOption(name="name", opt=option_3)
|
||||
option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")})))
|
||||
option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9])
|
||||
option_6 = OptionDescription(name="ip", doc="ip", children=[option_7])
|
||||
option_5 = OptionDescription(name="nut", doc="nut", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.condition": "yes", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.engine": "creole", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.group": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.mode": "0644", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.name": "/systemd/system/nut.service.d/rougail_ip.conf", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.network": "192.168.0.0/24", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.owner": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.activate": false}
|
||||
{"rougail.condition": "yes", "rougail.nut_monitor_host": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.name": "192.168.0.0/24", "services.nut.ip.nut_monitor_host.activate": false}
|
||||
|
@ -14,14 +14,9 @@ except:
|
||||
option_2 = StrOption(name="condition", doc="condition", default="yes", properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0/24", cidr=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||
option_8 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_9 = StrOption(name="group", doc="group", default="root")
|
||||
option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_11 = FilenameOption(name="name", doc="name", default="/systemd/system/nut.service.d/rougail_ip.conf")
|
||||
option_12 = SymLinkOption(name="network", opt=option_3)
|
||||
option_13 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_14 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")})))
|
||||
option_7 = OptionDescription(name="/systemd/system/nut_service_d/rougail_ip_conf", doc="/systemd/system/nut.service.d/rougail_ip.conf", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_8 = SymLinkOption(name="name", opt=option_3)
|
||||
option_9 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2), 'expected_0': ParamValue("yes")})))
|
||||
option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9])
|
||||
option_6 = OptionDescription(name="ip", doc="ip", children=[option_7])
|
||||
option_5 = OptionDescription(name="nut", doc="nut", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": [{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": "255.255.255.0", "rougail.general.nut_monitor_netmask.nut_monitor_host": "192.168.1.0"}], "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.engine": "creole", "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.group": "root", "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.mode": "0644", "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.name": "/systemd/system/ntp.service.d/rougail_ip.conf", "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.netmask": ["255.255.255.0"], "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.network": ["192.168.1.0"], "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.owner": "root", "services.ntp.ip./systemd/system/ntp_service_d/rougail_ip_conf.activate": true}
|
||||
{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": [{"rougail.general.nut_monitor_netmask.nut_monitor_netmask": "255.255.255.0", "rougail.general.nut_monitor_netmask.nut_monitor_host": "192.168.1.0"}], "services.ntp.ip.nut_monitor_host.name": ["192.168.1.0"], "services.ntp.ip.nut_monitor_host.netmask": ["255.255.255.0"], "services.ntp.ip.nut_monitor_host.activate": true}
|
||||
|
@ -16,15 +16,10 @@ option_5 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", multi=
|
||||
option_3 = Leadership(name="nut_monitor_netmask", doc="nut_monitor_netmask", children=[option_4, option_5], properties=frozenset({"normal"}))
|
||||
option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_11 = StrOption(name="group", doc="group", default="root")
|
||||
option_12 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_13 = FilenameOption(name="name", doc="name", default="/systemd/system/ntp.service.d/rougail_ip.conf")
|
||||
option_14 = SymLinkOption(name="netmask", opt=option_4)
|
||||
option_15 = SymLinkOption(name="network", opt=option_5)
|
||||
option_16 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_17 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_9 = OptionDescription(name="/systemd/system/ntp_service_d/rougail_ip_conf", doc="/systemd/system/ntp.service.d/rougail_ip.conf", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||
option_10 = SymLinkOption(name="name", opt=option_5)
|
||||
option_11 = SymLinkOption(name="netmask", opt=option_4)
|
||||
option_12 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_9 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_10, option_11, option_12])
|
||||
option_8 = OptionDescription(name="ip", doc="ip", children=[option_9])
|
||||
option_7 = OptionDescription(name="ntp", doc="ntp", children=[option_8])
|
||||
option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.nut_monitor_host": ["192.168.0.1", "192.168.0.2"], "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.engine": "creole", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.group": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.mode": "0644", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.name": "/systemd/system/nut.service.d/rougail_ip.conf", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.network": ["192.168.0.1", "192.168.0.2"], "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.owner": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.activate": true}
|
||||
{"rougail.nut_monitor_host": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.name": ["192.168.0.1", "192.168.0.2"], "services.nut.ip.nut_monitor_host.activate": true}
|
||||
|
@ -13,14 +13,9 @@ except:
|
||||
from tiramisu import *
|
||||
option_2 = IPOption(name="nut_monitor_host", doc="nut_monitor_host", multi=True, default=['192.168.0.1', '192.168.0.2'], default_multi="192.168.0.1", allow_reserved=True, properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_7 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_8 = StrOption(name="group", doc="group", default="root")
|
||||
option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_10 = FilenameOption(name="name", doc="name", default="/systemd/system/nut.service.d/rougail_ip.conf")
|
||||
option_11 = SymLinkOption(name="network", opt=option_2)
|
||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="/systemd/system/nut_service_d/rougail_ip_conf", doc="/systemd/system/nut.service.d/rougail_ip.conf", children=[option_7, option_8, option_9, option_10, option_11, option_12, option_13])
|
||||
option_7 = SymLinkOption(name="name", opt=option_2)
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8])
|
||||
option_5 = OptionDescription(name="ip", doc="ip", children=[option_6])
|
||||
option_4 = OptionDescription(name="nut", doc="nut", children=[option_5])
|
||||
option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.nut_monitor_netmask": "255.255.255.0", "rougail.nut_monitor_host": "192.168.0.0", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.engine": "creole", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.group": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.mode": "0644", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.name": "/systemd/system/nut.service.d/rougail_ip.conf", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.netmask": "255.255.255.0", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.network": "192.168.0.0", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.owner": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.activate": true}
|
||||
{"rougail.nut_monitor_netmask": "255.255.255.0", "rougail.nut_monitor_host": "192.168.0.0", "services.nut.ip.nut_monitor_host.name": "192.168.0.0", "services.nut.ip.nut_monitor_host.netmask": "255.255.255.0", "services.nut.ip.nut_monitor_host.activate": true}
|
||||
|
@ -14,15 +14,10 @@ except:
|
||||
option_2 = NetmaskOption(name="nut_monitor_netmask", doc="nut_monitor_netmask", default="255.255.255.0", properties=frozenset({"mandatory", "normal"}))
|
||||
option_3 = NetworkOption(name="nut_monitor_host", doc="nut_monitor_host", default="192.168.0.0", properties=frozenset({"mandatory", "normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||
option_8 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_9 = StrOption(name="group", doc="group", default="root")
|
||||
option_10 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_11 = FilenameOption(name="name", doc="name", default="/systemd/system/nut.service.d/rougail_ip.conf")
|
||||
option_12 = SymLinkOption(name="netmask", opt=option_2)
|
||||
option_13 = SymLinkOption(name="network", opt=option_3)
|
||||
option_14 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_15 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="/systemd/system/nut_service_d/rougail_ip_conf", doc="/systemd/system/nut.service.d/rougail_ip.conf", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15])
|
||||
option_8 = SymLinkOption(name="name", opt=option_3)
|
||||
option_9 = SymLinkOption(name="netmask", opt=option_2)
|
||||
option_10 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_7 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_8, option_9, option_10])
|
||||
option_6 = OptionDescription(name="ip", doc="ip", children=[option_7])
|
||||
option_5 = OptionDescription(name="nut", doc="nut", children=[option_6])
|
||||
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.nut_monitor_host": null, "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.engine": "creole", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.group": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.mode": "0644", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.name": "/systemd/system/nut.service.d/rougail_ip.conf", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.network": null, "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.owner": "root", "services.nut.ip./systemd/system/nut_service_d/rougail_ip_conf.activate": true}
|
||||
{"rougail.nut_monitor_host": null, "services.nut.ip.nut_monitor_host.name": null, "services.nut.ip.nut_monitor_host.activate": true}
|
||||
|
@ -13,14 +13,9 @@ except:
|
||||
from tiramisu import *
|
||||
option_2 = IPOption(name="nut_monitor_host", doc="nut_monitor_host", allow_reserved=True, properties=frozenset({"normal"}))
|
||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||
option_7 = StrOption(name="engine", doc="engine", default="creole")
|
||||
option_8 = StrOption(name="group", doc="group", default="root")
|
||||
option_9 = StrOption(name="mode", doc="mode", default="0644")
|
||||
option_10 = FilenameOption(name="name", doc="name", default="/systemd/system/nut.service.d/rougail_ip.conf")
|
||||
option_11 = SymLinkOption(name="network", opt=option_2)
|
||||
option_12 = StrOption(name="owner", doc="owner", default="root")
|
||||
option_13 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="/systemd/system/nut_service_d/rougail_ip_conf", doc="/systemd/system/nut.service.d/rougail_ip.conf", children=[option_7, option_8, option_9, option_10, option_11, option_12, option_13])
|
||||
option_7 = SymLinkOption(name="name", opt=option_2)
|
||||
option_8 = BoolOption(name="activate", doc="activate", default=True)
|
||||
option_6 = OptionDescription(name="nut_monitor_host", doc="nut_monitor_host", children=[option_7, option_8])
|
||||
option_5 = OptionDescription(name="ip", doc="ip", children=[option_6])
|
||||
option_4 = OptionDescription(name="nut", doc="nut", children=[option_5])
|
||||
option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"}))
|
||||
|
@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name='ntp'>
|
||||
<port protocol='udp' port_type="variable" portlist="example">my_variable</port>
|
||||
<port protocol='tcp' port_type="variable" portlist="example">my_variable</port>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<variable name='my_variable' type='port'>
|
||||
<value>123</value>
|
||||
</variable>
|
||||
</variables>
|
||||
<constraints>
|
||||
<condition name="disabled_if_in" source="my_variable">
|
||||
<param type='nil'/>
|
||||
<param>aaa</param>
|
||||
<target type="portlist">example</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name='ntp'>
|
||||
<port protocol='udp' port_type="variable">my_variable</port>
|
||||
<port protocol='tcp' port_type="variable">my_variable</port>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<variable name='my_variable' type='string'>
|
||||
<value>123</value>
|
||||
</variable>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
@ -2,7 +2,7 @@
|
||||
<rougail version="0.9">
|
||||
<services>
|
||||
<service name='test' manage="False">
|
||||
<port>10</port>
|
||||
<override/>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
@ -5,7 +5,7 @@ from pytest import fixture, mark
|
||||
from lxml.etree import parse
|
||||
from tiramisu import Config
|
||||
|
||||
from rougail import RougailConfig, RougailTemplate
|
||||
from rougail import RougailConfig, RougailSystemdTemplate
|
||||
|
||||
|
||||
template_dirs = 'tests/dictionaries'
|
||||
@ -13,7 +13,9 @@ excludes = set([])
|
||||
#excludes = set(['01base_file_utfchar'])
|
||||
test_ok = {f for f in listdir(template_dirs) if not f.startswith('_') and isdir(join(template_dirs, f, 'tmpl'))}
|
||||
test_ok -= excludes
|
||||
#test_ok = ['40ifin_leadershipauto']
|
||||
test_ok = list(test_ok)
|
||||
test_ok.sort()
|
||||
#test_ok = ['20override']
|
||||
|
||||
|
||||
@fixture(scope="module", params=test_ok)
|
||||
@ -63,7 +65,7 @@ async def test_dictionary(test_dir):
|
||||
RougailConfig['tmp_dir'] = tmp_dir
|
||||
RougailConfig['functions_file'] = funcs_file
|
||||
RougailConfig['destinations_dir'] = dest_dir
|
||||
engine = RougailTemplate(config)
|
||||
engine = RougailSystemdTemplate(config)
|
||||
await engine.instance_files()
|
||||
list_templates = set()
|
||||
if isdir(dest_dir):
|
||||
|
Loading…
Reference in New Issue
Block a user