Compare commits
8 Commits
pkg/dev/ri
...
11553e6f09
Author | SHA1 | Date | |
---|---|---|---|
11553e6f09 | |||
62bccfc352 | |||
0722e76fcc | |||
7db3e2c2a9 | |||
adaafde2e5 | |||
3ad1bf0604 | |||
19d9fdc705 | |||
d5129d6fe7 |
@ -34,6 +34,33 @@ def mode_factory():
|
|||||||
modes = mode_factory()
|
modes = mode_factory()
|
||||||
|
|
||||||
|
|
||||||
|
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
|
'float': dict(opttype="FloatOption", func=float),
|
||||||
|
'choice': dict(opttype="ChoiceOption"),
|
||||||
|
'string': dict(opttype="StrOption"),
|
||||||
|
'password': dict(opttype="PasswordOption"),
|
||||||
|
'mail': dict(opttype="EmailOption"),
|
||||||
|
'boolean': dict(opttype="BoolOption"),
|
||||||
|
'symlink': dict(opttype="SymLinkOption"),
|
||||||
|
'filename': dict(opttype="FilenameOption"),
|
||||||
|
'date': dict(opttype="DateOption"),
|
||||||
|
'unix_user': dict(opttype="UsernameOption"),
|
||||||
|
'ip': dict(opttype="IPOption", initkwargs={'allow_reserved': True}),
|
||||||
|
'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, 'warnings_only': True}),
|
||||||
|
'netmask': dict(opttype="NetmaskOption"),
|
||||||
|
'network': dict(opttype="NetworkOption"),
|
||||||
|
'broadcast': dict(opttype="BroadcastOption"),
|
||||||
|
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}),
|
||||||
|
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}),
|
||||||
|
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}),
|
||||||
|
'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}),
|
||||||
|
'port': dict(opttype="PortOption", initkwargs={'allow_private': True}),
|
||||||
|
'mac': dict(opttype="MACOption"),
|
||||||
|
'cidr': dict(opttype="IPOption", initkwargs={'cidr': True}),
|
||||||
|
'network_cidr': dict(opttype="NetworkOption", initkwargs={'cidr': True}),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# a CreoleObjSpace's attribute has some annotations
|
# a CreoleObjSpace'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', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
||||||
@ -56,8 +83,6 @@ KEY_TYPE = {'variable': 'symlink',
|
|||||||
'URLOption': 'web_address',
|
'URLOption': 'web_address',
|
||||||
'FilenameOption': 'filename'}
|
'FilenameOption': 'filename'}
|
||||||
|
|
||||||
CONVERSION = {'number': int}
|
|
||||||
|
|
||||||
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
||||||
|
|
||||||
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
||||||
@ -465,7 +490,7 @@ class VariableAnnotator:
|
|||||||
for value in variable.value:
|
for value in variable.value:
|
||||||
if not hasattr(value, 'type'):
|
if not hasattr(value, 'type'):
|
||||||
value.type = variable.type
|
value.type = variable.type
|
||||||
value.name = CONVERSION.get(value.type, str)(value.name)
|
value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name)
|
||||||
for key, value in RENAME_ATTIBUTES.items():
|
for key, value in RENAME_ATTIBUTES.items():
|
||||||
setattr(variable, value, getattr(variable, key))
|
setattr(variable, value, getattr(variable, key))
|
||||||
setattr(variable, key, None)
|
setattr(variable, key, None)
|
||||||
@ -497,6 +522,11 @@ class VariableAnnotator:
|
|||||||
self.objectspace.space.constraints.check.append(check)
|
self.objectspace.space.constraints.check.append(check)
|
||||||
variable.type = 'string'
|
variable.type = 'string'
|
||||||
|
|
||||||
|
def _valid_type(variable):
|
||||||
|
if variable.type not in CONVERT_OPTION:
|
||||||
|
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
||||||
|
raise DictConsistencyError(_(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlfiles}'))
|
||||||
|
|
||||||
if not hasattr(self.objectspace.space, 'variables'):
|
if not hasattr(self.objectspace.space, 'variables'):
|
||||||
return
|
return
|
||||||
for families in self.objectspace.space.variables.values():
|
for families in self.objectspace.space.variables.values():
|
||||||
@ -526,6 +556,7 @@ class VariableAnnotator:
|
|||||||
follower,
|
follower,
|
||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
|
_valid_type(follower)
|
||||||
else:
|
else:
|
||||||
path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name)
|
path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name)
|
||||||
_convert_variable(variable,
|
_convert_variable(variable,
|
||||||
@ -535,6 +566,7 @@ class VariableAnnotator:
|
|||||||
variable,
|
variable,
|
||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
|
_valid_type(variable)
|
||||||
|
|
||||||
def convert_helps(self):
|
def convert_helps(self):
|
||||||
if not hasattr(self.objectspace.space, 'help'):
|
if not hasattr(self.objectspace.space, 'help'):
|
||||||
@ -941,7 +973,7 @@ class ConstraintAnnotator:
|
|||||||
choice = self.objectspace.choice(variable.xmlfiles)
|
choice = self.objectspace.choice(variable.xmlfiles)
|
||||||
try:
|
try:
|
||||||
if value is not None:
|
if value is not None:
|
||||||
choice.name = CONVERSION.get(type_, str)(value)
|
choice.name = CONVERT_OPTION[type_].get('func', str)(value)
|
||||||
else:
|
else:
|
||||||
choice.name = value
|
choice.name = value
|
||||||
except:
|
except:
|
||||||
@ -956,7 +988,7 @@ class ConstraintAnnotator:
|
|||||||
for value in variable.value:
|
for value in variable.value:
|
||||||
value.type = type_
|
value.type = type_
|
||||||
try:
|
try:
|
||||||
cvalue = CONVERSION.get(type_, str)(value.name)
|
cvalue = CONVERT_OPTION[type_].get('func', str)(value.name)
|
||||||
except:
|
except:
|
||||||
raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'))
|
raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'))
|
||||||
if cvalue not in choices:
|
if cvalue not in choices:
|
||||||
|
@ -9,8 +9,8 @@ from shutil import copy
|
|||||||
import logging
|
import logging
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
from os import listdir, makedirs
|
from os import listdir, makedirs, getcwd, chdir
|
||||||
from os.path import dirname, join, isfile
|
from os.path import dirname, join, isfile, abspath, normpath, relpath
|
||||||
|
|
||||||
from Cheetah.Template import Template as ChtTemplate
|
from Cheetah.Template import Template as ChtTemplate
|
||||||
from Cheetah.NameMapper import NotFound as CheetahNotFound
|
from Cheetah.NameMapper import NotFound as CheetahNotFound
|
||||||
@ -79,7 +79,8 @@ class CheetahTemplate(ChtTemplate):
|
|||||||
context,
|
context,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
destfilename,
|
destfilename,
|
||||||
variable):
|
variable,
|
||||||
|
):
|
||||||
"""Initialize Creole CheetahTemplate
|
"""Initialize Creole CheetahTemplate
|
||||||
"""
|
"""
|
||||||
extra_context = {'is_defined' : IsDefined(context),
|
extra_context = {'is_defined' : IsDefined(context),
|
||||||
@ -92,6 +93,24 @@ class CheetahTemplate(ChtTemplate):
|
|||||||
file=filename,
|
file=filename,
|
||||||
searchList=[context, eosfunc, extra_context])
|
searchList=[context, eosfunc, extra_context])
|
||||||
|
|
||||||
|
# FORK of Cheetah fonction, do not replace '\\' by '/'
|
||||||
|
def serverSidePath(self,
|
||||||
|
path=None,
|
||||||
|
normpath=normpath,
|
||||||
|
abspath=abspath
|
||||||
|
):
|
||||||
|
|
||||||
|
# strange...
|
||||||
|
if path is None and isinstance(self, str):
|
||||||
|
path = self
|
||||||
|
if path:
|
||||||
|
return normpath(abspath(path))
|
||||||
|
# return normpath(abspath(path.replace("\\", '/')))
|
||||||
|
elif hasattr(self, '_filePath') and self._filePath:
|
||||||
|
return normpath(abspath(self._filePath))
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class CreoleLeader:
|
class CreoleLeader:
|
||||||
def __init__(self, value, follower=None, index=None):
|
def __init__(self, value, follower=None, index=None):
|
||||||
@ -287,37 +306,43 @@ class CreoleTemplateEngine:
|
|||||||
return CreoleExtra(families)
|
return CreoleExtra(families)
|
||||||
|
|
||||||
def patch_template(self,
|
def patch_template(self,
|
||||||
filename: str):
|
filename: str,
|
||||||
|
tmp_dir: str,
|
||||||
|
patch_dir: str,
|
||||||
|
) -> None:
|
||||||
"""Apply patch to a template
|
"""Apply patch to a template
|
||||||
"""
|
"""
|
||||||
patch_cmd = ['patch', '-d', self.tmp_dir, '-N', '-p1']
|
patch_cmd = ['patch', '-d', tmp_dir, '-N', '-p1']
|
||||||
patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch']
|
patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch']
|
||||||
|
|
||||||
# patches variante + locaux
|
patch_file = join(patch_dir, f'{filename}.patch')
|
||||||
for directory in [join(Config['patch_dir'], 'variante'), Config['patch_dir']]:
|
if isfile(patch_file):
|
||||||
patch_file = join(directory, f'{filename}.patch')
|
log.info(_("Patching template '{filename}' with '{patch_file}'"))
|
||||||
if isfile(patch_file):
|
rel_patch_file = relpath(patch_file, tmp_dir)
|
||||||
log.info(_("Patching template '{filename}' with '{patch_file}'"))
|
ret = call(patch_cmd + patch_no_debug + ['-i', rel_patch_file])
|
||||||
ret = call(patch_cmd + patch_no_debug + ['-i', patch_file])
|
if ret:
|
||||||
if ret:
|
patch_cmd_err = ' '.join(patch_cmd + ['-i', rel_patch_file])
|
||||||
patch_cmd_err = ' '.join(patch_cmd + ['-i', patch_file])
|
log.error(_(f"Error applying patch: '{rel_patch_file}'\nTo reproduce and fix this error {patch_cmd_err}"))
|
||||||
log.error(_(f"Error applying patch: '{patch_file}'\nTo reproduce and fix this error {patch_cmd_err}"))
|
copy(join(self.distrib_dir, filename), tmp_dir)
|
||||||
copy(filename, self.tmp_dir)
|
|
||||||
|
|
||||||
def prepare_template(self,
|
def prepare_template(self,
|
||||||
filename: str):
|
filename: str,
|
||||||
|
tmp_dir: str,
|
||||||
|
patch_dir: str,
|
||||||
|
) -> None:
|
||||||
"""Prepare template source file
|
"""Prepare template source file
|
||||||
"""
|
"""
|
||||||
log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
|
log.info(_("Copy template: '{filename}' -> '{tmp_dir}'"))
|
||||||
copy(filename, self.tmp_dir)
|
copy(filename, tmp_dir)
|
||||||
self.patch_template(filename)
|
self.patch_template(filename, tmp_dir, patch_dir)
|
||||||
|
|
||||||
def process(self,
|
def process(self,
|
||||||
source: str,
|
source: str,
|
||||||
true_destfilename: str,
|
true_destfilename: str,
|
||||||
destfilename: str,
|
destfilename: str,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
variable: Any):
|
variable: Any,
|
||||||
|
):
|
||||||
"""Process a cheetah template
|
"""Process a cheetah template
|
||||||
"""
|
"""
|
||||||
# full path of the destination file
|
# full path of the destination file
|
||||||
@ -341,7 +366,10 @@ class CreoleTemplateEngine:
|
|||||||
|
|
||||||
def instance_file(self,
|
def instance_file(self,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
service_name: str) -> None:
|
service_name: str,
|
||||||
|
tmp_dir: str,
|
||||||
|
dest_dir: str,
|
||||||
|
) -> None:
|
||||||
"""Run templatisation on one file
|
"""Run templatisation on one file
|
||||||
"""
|
"""
|
||||||
log.info(_("Instantiating file '{filename}'"))
|
log.info(_("Instantiating file '{filename}'"))
|
||||||
@ -355,13 +383,13 @@ class CreoleTemplateEngine:
|
|||||||
if variable:
|
if variable:
|
||||||
variable = [variable]
|
variable = [variable]
|
||||||
for idx, filename in enumerate(filenames):
|
for idx, filename in enumerate(filenames):
|
||||||
destfilename = join(self.dest_dir, filename[1:])
|
destfilename = join(dest_dir, filename[1:])
|
||||||
makedirs(dirname(destfilename), exist_ok=True)
|
makedirs(dirname(destfilename), exist_ok=True)
|
||||||
if variable:
|
if variable:
|
||||||
var = variable[idx]
|
var = variable[idx]
|
||||||
else:
|
else:
|
||||||
var = None
|
var = None
|
||||||
source = join(self.tmp_dir, filevar['source'])
|
source = join(tmp_dir, filevar['source'])
|
||||||
if filevar['templating']:
|
if filevar['templating']:
|
||||||
self.process(source,
|
self.process(source,
|
||||||
filename,
|
filename,
|
||||||
@ -374,6 +402,11 @@ class CreoleTemplateEngine:
|
|||||||
async def instance_files(self) -> None:
|
async def instance_files(self) -> None:
|
||||||
"""Run templatisation on all files
|
"""Run templatisation on all files
|
||||||
"""
|
"""
|
||||||
|
ori_dir = getcwd()
|
||||||
|
tmp_dir = relpath(self.tmp_dir, self.distrib_dir)
|
||||||
|
dest_dir = relpath(self.dest_dir, self.distrib_dir)
|
||||||
|
patch_dir = relpath(Config['patch_dir'], self.distrib_dir)
|
||||||
|
chdir(self.distrib_dir)
|
||||||
for option in await self.config.option.list(type='all'):
|
for option in await self.config.option.list(type='all'):
|
||||||
namespace = await option.option.name()
|
namespace = await option.option.name()
|
||||||
if namespace == Config['variable_namespace']:
|
if namespace == Config['variable_namespace']:
|
||||||
@ -382,8 +415,8 @@ class CreoleTemplateEngine:
|
|||||||
families = await self.load_eole_variables(namespace,
|
families = await self.load_eole_variables(namespace,
|
||||||
option)
|
option)
|
||||||
self.rougail_variables_dict[namespace] = families
|
self.rougail_variables_dict[namespace] = families
|
||||||
for template in listdir(self.distrib_dir):
|
for template in listdir('.'):
|
||||||
self.prepare_template(join(self.distrib_dir, template))
|
self.prepare_template(template, tmp_dir, patch_dir)
|
||||||
for service_obj in await self.config.option('services').list('all'):
|
for service_obj in await self.config.option('services').list('all'):
|
||||||
service_name = await service_obj.option.doc()
|
service_name = await service_obj.option.doc()
|
||||||
for fills in await service_obj.list('all'):
|
for fills in await service_obj.list('all'):
|
||||||
@ -391,15 +424,17 @@ class CreoleTemplateEngine:
|
|||||||
for fill_obj in await fills.list('all'):
|
for fill_obj in await fills.list('all'):
|
||||||
fill = await fill_obj.value.dict()
|
fill = await fill_obj.value.dict()
|
||||||
filename = fill['source']
|
filename = fill['source']
|
||||||
distib_file = join(self.distrib_dir, filename)
|
if not isfile(filename):
|
||||||
if not isfile(distib_file):
|
raise FileNotFound(_(f"File {filename} does not exist."))
|
||||||
raise FileNotFound(_(f"File {distib_file} does not exist."))
|
|
||||||
if fill.get('activate', False):
|
if fill.get('activate', False):
|
||||||
self.instance_file(fill,
|
self.instance_file(fill,
|
||||||
service_name,
|
service_name,
|
||||||
|
tmp_dir,
|
||||||
|
dest_dir,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
log.debug(_("Instantiation of file '{filename}' disabled"))
|
log.debug(_("Instantiation of file '{filename}' disabled"))
|
||||||
|
chdir(ori_dir)
|
||||||
|
|
||||||
|
|
||||||
async def generate(config: Config,
|
async def generate(config: Config,
|
||||||
|
@ -4,7 +4,7 @@ flattened XML specific
|
|||||||
from .config import Config
|
from .config import Config
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .error import LoaderError
|
from .error import LoaderError
|
||||||
from .annotator import ERASED_ATTRIBUTES
|
from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
|
||||||
|
|
||||||
|
|
||||||
FUNC_TO_DICT = ['valid_not_equal']
|
FUNC_TO_DICT = ['valid_not_equal']
|
||||||
@ -12,32 +12,6 @@ FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage']
|
|||||||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
||||||
|
|
||||||
|
|
||||||
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
|
||||||
'choice': dict(opttype="ChoiceOption"),
|
|
||||||
'string': dict(opttype="StrOption"),
|
|
||||||
'password': dict(opttype="PasswordOption"),
|
|
||||||
'mail': dict(opttype="EmailOption"),
|
|
||||||
'boolean': dict(opttype="BoolOption"),
|
|
||||||
'symlink': dict(opttype="SymLinkOption"),
|
|
||||||
'filename': dict(opttype="FilenameOption"),
|
|
||||||
'date': dict(opttype="DateOption"),
|
|
||||||
'unix_user': dict(opttype="UsernameOption"),
|
|
||||||
'ip': dict(opttype="IPOption", initkwargs={'allow_reserved': True}),
|
|
||||||
'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, 'warnings_only': True}),
|
|
||||||
'netmask': dict(opttype="NetmaskOption"),
|
|
||||||
'network': dict(opttype="NetworkOption"),
|
|
||||||
'broadcast': dict(opttype="BroadcastOption"),
|
|
||||||
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}),
|
|
||||||
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}),
|
|
||||||
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}),
|
|
||||||
'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}),
|
|
||||||
'port': dict(opttype="PortOption", initkwargs={'allow_private': True}),
|
|
||||||
'mac': dict(opttype="MACOption"),
|
|
||||||
'cidr': dict(opttype="IPOption", initkwargs={'cidr': True}),
|
|
||||||
'network_cidr': dict(opttype="NetworkOption", initkwargs={'cidr': True}),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class TiramisuReflector:
|
class TiramisuReflector:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
xmlroot,
|
xmlroot,
|
||||||
@ -344,6 +318,8 @@ class Variable(Common):
|
|||||||
value = value.split(',')
|
value = value.split(',')
|
||||||
if self.object_type == 'IntOption':
|
if self.object_type == 'IntOption':
|
||||||
value = [int(v) for v in value]
|
value = [int(v) for v in value]
|
||||||
|
elif self.object_type == 'FloatOption':
|
||||||
|
value = [float(v) for v in value]
|
||||||
self.informations[key] = value
|
self.informations[key] = value
|
||||||
else:
|
else:
|
||||||
self.attrib[key] = value
|
self.attrib[key] = value
|
||||||
@ -397,7 +373,7 @@ class Variable(Common):
|
|||||||
function = child.name
|
function = child.name
|
||||||
if hasattr(child, 'param'):
|
if hasattr(child, 'param'):
|
||||||
for param in child.param:
|
for param in child.param:
|
||||||
value = self.populate_param(param)
|
value = self.populate_param(function, param)
|
||||||
if not hasattr(param, 'name'):
|
if not hasattr(param, 'name'):
|
||||||
args.append(str(value))
|
args.append(str(value))
|
||||||
else:
|
else:
|
||||||
@ -411,6 +387,7 @@ class Variable(Common):
|
|||||||
return ret + ')'
|
return ret + ')'
|
||||||
|
|
||||||
def populate_param(self,
|
def populate_param(self,
|
||||||
|
function: str,
|
||||||
param,
|
param,
|
||||||
):
|
):
|
||||||
if param.type == 'string':
|
if param.type == 'string':
|
||||||
@ -420,7 +397,7 @@ class Variable(Common):
|
|||||||
elif param.type == 'variable':
|
elif param.type == 'variable':
|
||||||
value = {'option': param.text,
|
value = {'option': param.text,
|
||||||
'notraisepropertyerror': param.notraisepropertyerror,
|
'notraisepropertyerror': param.notraisepropertyerror,
|
||||||
'todict': param.text in FUNC_TO_DICT,
|
'todict': function in FUNC_TO_DICT,
|
||||||
}
|
}
|
||||||
if hasattr(param, 'suffix'):
|
if hasattr(param, 'suffix'):
|
||||||
value['suffix'] = param.suffix
|
value['suffix'] = param.suffix
|
||||||
@ -443,7 +420,7 @@ class Variable(Common):
|
|||||||
self.attrib['default'].append(value)
|
self.attrib['default'].append(value)
|
||||||
if not self.is_leader:
|
if not self.is_leader:
|
||||||
self.attrib['default_multi'] = value
|
self.attrib['default_multi'] = value
|
||||||
elif isinstance(value, int):
|
elif isinstance(value, (int, float)):
|
||||||
self.attrib['default'].append(value)
|
self.attrib['default'].append(value)
|
||||||
else:
|
else:
|
||||||
self.attrib['default'].append("'" + value + "'")
|
self.attrib['default'].append("'" + value + "'")
|
||||||
|
20
tests/dictionaries/01base_file_include/00-base.xml
Normal file
20
tests/dictionaries/01base_file_include/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file name="/etc/file"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="oui/non" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
0
tests/dictionaries/01base_file_include/__init__.py
Normal file
0
tests/dictionaries/01base_file_include/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": true}
|
1
tests/dictionaries/01base_file_include/result/etc/file
Normal file
1
tests/dictionaries/01base_file_include/result/etc/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
non
|
26
tests/dictionaries/01base_file_include/tiramisu/base.py
Normal file
26
tests/dictionaries/01base_file_include/tiramisu/base.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import imp
|
||||||
|
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['imp', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non'))
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_8 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||||
|
option_9 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||||
|
option_10 = StrOption(name='name', doc='name', multi=False, default='/etc/file')
|
||||||
|
option_11 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||||
|
option_12 = StrOption(name='source', doc='source', multi=False, default='file')
|
||||||
|
option_13 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||||
|
option_14 = BoolOption(name='activate', doc='activate', multi=False, default=True)
|
||||||
|
option_7 = OptionDescription(name='file', doc='file', children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||||
|
option_6 = OptionDescription(name='files', doc='files', children=[option_7])
|
||||||
|
option_5 = OptionDescription(name='test', doc='test', children=[option_6])
|
||||||
|
option_5.impl_set_information("manage", True)
|
||||||
|
option_4 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_5])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
1
tests/dictionaries/01base_file_include/tmpl/file
Normal file
1
tests/dictionaries/01base_file_include/tmpl/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
%include "incfile"
|
1
tests/dictionaries/01base_file_include/tmpl/incfile
Normal file
1
tests/dictionaries/01base_file_include/tmpl/incfile
Normal file
@ -0,0 +1 @@
|
|||||||
|
%%mode_conteneur_actif
|
20
tests/dictionaries/01base_file_patch/00-base.xml
Normal file
20
tests/dictionaries/01base_file_patch/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file name="/etc/file"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="oui/non" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
0
tests/dictionaries/01base_file_patch/__init__.py
Normal file
0
tests/dictionaries/01base_file_patch/__init__.py
Normal file
1
tests/dictionaries/01base_file_patch/makedict/base.json
Normal file
1
tests/dictionaries/01base_file_patch/makedict/base.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": true}
|
5
tests/dictionaries/01base_file_patch/patches/file.patch
Normal file
5
tests/dictionaries/01base_file_patch/patches/file.patch
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
--- tmpl/file 2020-11-20 07:44:38.588472784 +0100
|
||||||
|
+++ dest/file 2020-11-20 07:44:54.588536011 +0100
|
||||||
|
@@ -1 +1 @@
|
||||||
|
-unpatched
|
||||||
|
+patched
|
1
tests/dictionaries/01base_file_patch/result/etc/file
Normal file
1
tests/dictionaries/01base_file_patch/result/etc/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
patched
|
26
tests/dictionaries/01base_file_patch/tiramisu/base.py
Normal file
26
tests/dictionaries/01base_file_patch/tiramisu/base.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import imp
|
||||||
|
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['imp', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non'))
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_8 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||||
|
option_9 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||||
|
option_10 = StrOption(name='name', doc='name', multi=False, default='/etc/file')
|
||||||
|
option_11 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||||
|
option_12 = StrOption(name='source', doc='source', multi=False, default='file')
|
||||||
|
option_13 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||||
|
option_14 = BoolOption(name='activate', doc='activate', multi=False, default=True)
|
||||||
|
option_7 = OptionDescription(name='file', doc='file', children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||||
|
option_6 = OptionDescription(name='files', doc='files', children=[option_7])
|
||||||
|
option_5 = OptionDescription(name='test', doc='test', children=[option_6])
|
||||||
|
option_5.impl_set_information("manage", True)
|
||||||
|
option_4 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_5])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
1
tests/dictionaries/01base_file_patch/tmpl/file
Normal file
1
tests/dictionaries/01base_file_patch/tmpl/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
unpatched
|
20
tests/dictionaries/01base_file_utfchar/00-base.xml
Normal file
20
tests/dictionaries/01base_file_utfchar/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file name="/etc/systemd-makefs@dev-disk-by\\x2dpartlabel"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="oui/non" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
0
tests/dictionaries/01base_file_utfchar/__init__.py
Normal file
0
tests/dictionaries/01base_file_utfchar/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.templating": true, "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true}
|
@ -0,0 +1 @@
|
|||||||
|
non
|
26
tests/dictionaries/01base_file_utfchar/tiramisu/base.py
Normal file
26
tests/dictionaries/01base_file_utfchar/tiramisu/base.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import imp
|
||||||
|
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['imp', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non'))
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_8 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||||
|
option_9 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||||
|
option_10 = StrOption(name='name', doc='name', multi=False, default='/etc/systemd-makefs@dev-disk-by\\x2dpartlabel')
|
||||||
|
option_11 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||||
|
option_12 = StrOption(name='source', doc='source', multi=False, default='systemd-makefs@dev-disk-by\\x2dpartlabel')
|
||||||
|
option_13 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||||
|
option_14 = BoolOption(name='activate', doc='activate', multi=False, default=True)
|
||||||
|
option_7 = OptionDescription(name='systemd_makefs@dev_disk_by\\x2dpartlabel', doc='systemd-makefs@dev-disk-by\\x2dpartlabel', children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||||
|
option_6 = OptionDescription(name='files', doc='files', children=[option_7])
|
||||||
|
option_5 = OptionDescription(name='test', doc='test', children=[option_6])
|
||||||
|
option_5.impl_set_information("manage", True)
|
||||||
|
option_4 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_5])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
@ -0,0 +1 @@
|
|||||||
|
%%mode_conteneur_actif
|
16
tests/dictionaries/01base_float/00-base.xml
Normal file
16
tests/dictionaries/01base_float/00-base.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="float" type="float" description="Description">
|
||||||
|
<value>0.527</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="float_multi" type="float" description="Description" multi="True">
|
||||||
|
<value>0.527</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
0
tests/dictionaries/01base_float/__init__.py
Normal file
0
tests/dictionaries/01base_float/__init__.py
Normal file
1
tests/dictionaries/01base_float/makedict/base.json
Normal file
1
tests/dictionaries/01base_float/makedict/base.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.float": 0.527, "rougail.general.float_multi": [0.527]}
|
15
tests/dictionaries/01base_float/tiramisu/base.py
Normal file
15
tests/dictionaries/01base_float/tiramisu/base.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import imp
|
||||||
|
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['imp', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = FloatOption(properties=frozenset({'mandatory', 'normal'}), name='float', doc='Description', multi=False, default=0.527)
|
||||||
|
option_4 = FloatOption(properties=frozenset({'mandatory', 'normal'}), name='float_multi', doc='Description', multi=True, default=[0.527], default_multi=0.527)
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
@ -10,7 +10,7 @@ except:
|
|||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='b')
|
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='b')
|
||||||
option_5 = IntOption(properties=frozenset({'normal'}), name='int2', doc='No change', multi=False)
|
option_5 = IntOption(properties=frozenset({'normal'}), name='int2', doc='No change', multi=False)
|
||||||
option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False)
|
option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False)
|
||||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||||
|
@ -9,7 +9,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||||
|
@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
|
|||||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||||
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||||
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
||||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6])
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6])
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||||
|
@ -11,7 +11,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
|
|||||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non'))
|
||||||
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||||
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||||
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
option_6 = StrOption(properties=frozenset({'mandatory', 'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_4, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False), Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='mode_conteneur_actif3', doc='No change', multi=False, default='oui')
|
||||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6])
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6])
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||||
|
@ -1,2 +1 @@
|
|||||||
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
||||||
|
|
||||||
|
@ -1,2 +1 @@
|
|||||||
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
||||||
|
|
||||||
|
10
tests/dictionaries/80unknown_type/00-base.xml
Normal file
10
tests/dictionaries/80unknown_type/00-base.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="unknown" description="Description"/>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
0
tests/dictionaries/80unknown_type/__init__.py
Normal file
0
tests/dictionaries/80unknown_type/__init__.py
Normal file
@ -1,4 +1,5 @@
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
from os import getcwd
|
||||||
from os.path import isfile, join, isdir
|
from os.path import isfile, join, isdir
|
||||||
from pytest import fixture, raises
|
from pytest import fixture, raises
|
||||||
from os import listdir
|
from os import listdir
|
||||||
@ -25,11 +26,14 @@ for test in listdir(dico_dirs):
|
|||||||
test_raise.add(test)
|
test_raise.add(test)
|
||||||
|
|
||||||
excludes = set([])
|
excludes = set([])
|
||||||
|
#excludes = set(['01base_file_utfchar'])
|
||||||
test_ok -= excludes
|
test_ok -= excludes
|
||||||
test_raise -= excludes
|
test_raise -= excludes
|
||||||
#test_ok = ['10leadership_autoleader']
|
#test_ok = ['10leadership_autoleader']
|
||||||
#test_raise = []
|
#test_raise = []
|
||||||
|
|
||||||
|
ORI_DIR = getcwd()
|
||||||
|
|
||||||
debug = False
|
debug = False
|
||||||
#debug = True
|
#debug = True
|
||||||
|
|
||||||
@ -80,6 +84,7 @@ def launch_flattener(test_dir, test_ok=False):
|
|||||||
if isdir(subfolder):
|
if isdir(subfolder):
|
||||||
eolobj.create_or_populate_from_xml('extra1', [subfolder])
|
eolobj.create_or_populate_from_xml('extra1', [subfolder])
|
||||||
eosfunc = join(dico_dirs, '../eosfunc/test.py')
|
eosfunc = join(dico_dirs, '../eosfunc/test.py')
|
||||||
|
Config['patch_dir'] = join(test_dir, 'patches')
|
||||||
eolobj.space_visitor(eosfunc)
|
eolobj.space_visitor(eosfunc)
|
||||||
tiramisu_objects = eolobj.save()
|
tiramisu_objects = eolobj.save()
|
||||||
tiramisu_dir = join(test_dir, 'tiramisu')
|
tiramisu_dir = join(test_dir, 'tiramisu')
|
||||||
@ -109,14 +114,18 @@ def teardown_module(module):
|
|||||||
|
|
||||||
|
|
||||||
def test_dictionary(test_dir):
|
def test_dictionary(test_dir):
|
||||||
|
assert getcwd() == ORI_DIR
|
||||||
test_dir = join(dico_dirs, test_dir)
|
test_dir = join(dico_dirs, test_dir)
|
||||||
launch_flattener(test_dir, True)
|
launch_flattener(test_dir, True)
|
||||||
|
assert getcwd() == ORI_DIR
|
||||||
|
|
||||||
|
|
||||||
def test_error_dictionary(test_dir_error):
|
def test_error_dictionary(test_dir_error):
|
||||||
|
assert getcwd() == ORI_DIR
|
||||||
test_dir = join(dico_dirs, test_dir_error)
|
test_dir = join(dico_dirs, test_dir_error)
|
||||||
with raises(DictConsistencyError):
|
with raises(DictConsistencyError):
|
||||||
launch_flattener(test_dir)
|
launch_flattener(test_dir)
|
||||||
|
assert getcwd() == ORI_DIR
|
||||||
|
|
||||||
|
|
||||||
def test_no_dtd():
|
def test_no_dtd():
|
||||||
|
@ -17,8 +17,10 @@ for test in listdir(dico_dirs):
|
|||||||
if isdir(join(dico_dirs, test, 'tiramisu')):
|
if isdir(join(dico_dirs, test, 'tiramisu')):
|
||||||
test_ok.add(test)
|
test_ok.add(test)
|
||||||
|
|
||||||
|
debug = False
|
||||||
|
#debug = True
|
||||||
excludes = set([])
|
excludes = set([])
|
||||||
#excludes = set(['70container_services'])
|
#excludes = set(['01base_file_utfchar'])
|
||||||
test_ok -= excludes
|
test_ok -= excludes
|
||||||
#test_ok = ['10check_valid_ipnetmask']
|
#test_ok = ['10check_valid_ipnetmask']
|
||||||
|
|
||||||
@ -33,8 +35,6 @@ def test_dir(request):
|
|||||||
|
|
||||||
|
|
||||||
async def launch_flattener(test_dir):
|
async def launch_flattener(test_dir):
|
||||||
debug = False
|
|
||||||
#debug = True
|
|
||||||
makedict_dir = join(test_dir, 'makedict')
|
makedict_dir = join(test_dir, 'makedict')
|
||||||
makedict_file = join(makedict_dir, 'base.json')
|
makedict_file = join(makedict_dir, 'base.json')
|
||||||
|
|
||||||
|
@ -9,7 +9,10 @@ from rougail import template
|
|||||||
|
|
||||||
|
|
||||||
template_dirs = 'tests/dictionaries'
|
template_dirs = 'tests/dictionaries'
|
||||||
test_ok = [f for f in listdir(template_dirs) if not f.startswith('_') and isdir(join(template_dirs, f, 'tmpl'))]
|
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 = ['60extra_group']
|
#test_ok = ['60extra_group']
|
||||||
|
|
||||||
|
|
||||||
@ -55,6 +58,7 @@ async def test_dictionary(test_dir):
|
|||||||
if isdir(dest_dir):
|
if isdir(dest_dir):
|
||||||
rmtree(dest_dir)
|
rmtree(dest_dir)
|
||||||
mkdir(dest_dir)
|
mkdir(dest_dir)
|
||||||
|
template.Config['patch_dir'] = join(test_dir, 'patches')
|
||||||
await template.generate(config,
|
await template.generate(config,
|
||||||
funcs_file,
|
funcs_file,
|
||||||
distrib_dir,
|
distrib_dir,
|
||||||
|
Reference in New Issue
Block a user