containers => services

This commit is contained in:
Emmanuel Garette 2020-02-14 17:59:39 +01:00
parent 963e93295a
commit 25d5307415
415 changed files with 749 additions and 2090 deletions

View file

@ -37,7 +37,7 @@
<!-- root element -->
<!-- =============== -->
<!ELEMENT creole (containers | family_action | variables | constraints | help)*>
<!ELEMENT creole (services | family_action | variables | constraints | help)*>
<!-- ============== -->
<!-- files element -->
@ -64,19 +64,11 @@
<!-- for form action -->
<!ATTLIST action save (True|False) "False">
<!ELEMENT containers ((container* | all*)*)>
<!ELEMENT services (service*)>
<!ELEMENT container ((service* | service_access* | service_restriction* | interface* | package* | file* | disknod* | host* | fstab*)*) >
<!ATTLIST container name CDATA #REQUIRED >
<!ATTLIST container id CDATA #IMPLIED >
<!ATTLIST container group CDATA #IMPLIED >
<!ELEMENT all ((service* | interface* | package* | file* | disknod* | host* | fstab*)*) >
<!ELEMENT service (#PCDATA)>
<!ATTLIST service servicelist CDATA #IMPLIED >
<!ELEMENT service ((port* | tcpwrapper* | ip* | interface* | package* | file*)*) >
<!ATTLIST service name CDATA #REQUIRED>
<!ATTLIST service method (systemd|upstart|apache|network) "systemd">
<!ATTLIST service redefine (True|False) "False">
<!ELEMENT input (#PCDATA)>
<!ELEMENT profile (#PCDATA)>
@ -84,9 +76,6 @@
<!ELEMENT tag (#PCDATA)>
<!ELEMENT saltaction (#PCDATA)>
<!ELEMENT service_access ((port | tcpwrapper)*)>
<!ATTLIST service_access service CDATA #REQUIRED >
<!ELEMENT port (#PCDATA)>
<!ATTLIST port port_type (PortOption|SymLinkOption|variable) "PortOption">
<!ATTLIST port service_accesslist CDATA #IMPLIED >
@ -96,9 +85,6 @@
<!ATTLIST tcpwrapper tcpwrapper_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
<!ATTLIST tcpwrapper service_accesslist CDATA #IMPLIED >
<!ELEMENT service_restriction (ip*)>
<!ATTLIST service_restriction service CDATA #REQUIRED >
<!ELEMENT ip (#PCDATA)>
<!ATTLIST ip service_restrictionlist CDATA #IMPLIED >
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption|variable) "NetworkOption">
@ -121,34 +107,12 @@
<!ATTLIST interface method (bridge|macvlan) "macvlan" >
<!ATTLIST interface redefine (True|False) "False">
<!ELEMENT host EMPTY >
<!ATTLIST host hostlist CDATA #IMPLIED >
<!ATTLIST host name CDATA #REQUIRED >
<!ATTLIST host name_type (SymLinkOption|variable) "variable">
<!ATTLIST host ip CDATA #REQUIRED >
<!ATTLIST host ip_type (SymLinkOption|variable) "variable">
<!ATTLIST host crossed (True|False) "True" >
<!ATTLIST host comment CDATA #IMPLIED >
<!ELEMENT fstab EMPTY >
<!ATTLIST fstab name CDATA #REQUIRED>
<!ATTLIST fstab name_type (FilenameOption|SymLinkOption|variable) "FilenameOption">
<!ATTLIST fstab type (bind|normal) "bind">
<!ATTLIST fstab fstype (auto|ext3|ext4|nfs|smb) "auto">
<!ATTLIST fstab mount_point CDATA #IMPLIED>
<!ATTLIST fstab mount_point_type (FilenameOption|SymLinkOption|variable) "FilenameOption">
<!ATTLIST fstab options CDATA #IMPLIED>
<!ATTLIST fstab checks CDATA #IMPLIED>
<!ATTLIST fstab fstablist CDATA #IMPLIED>
<!ELEMENT package (#PCDATA)>
<!ATTLIST package packagelist CDATA #IMPLIED>
<!ELEMENT disknod (#PCDATA)>
<!ELEMENT file EMPTY>
<!ATTLIST file name CDATA #REQUIRED >
<!ATTLIST file name_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
<!ATTLIST file file_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
<!ATTLIST file variable CDATA #IMPLIED>
<!ATTLIST file variable_type (variable) "variable">
<!ATTLIST file source CDATA #IMPLIED>
@ -219,7 +183,7 @@
<!ATTLIST group description CDATA #IMPLIED>
<!ELEMENT param (#PCDATA)>
<!ATTLIST param type (string|eole|variable|number|container|context|python) "string">
<!ATTLIST param type (string|eole|variable|number|python) "string">
<!ATTLIST param name CDATA #IMPLIED>
<!ATTLIST param hidden (True|False) "True">
<!ATTLIST param optional (True|False) "False">

View file

@ -56,8 +56,6 @@ ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check
'level', 'submulti') # , '_real_container')
ERASED_CONTAINER_ATTRIBUTES = ('id', 'container', 'group_id', 'group', 'container_group')
NOT_NEED_ACTIVATE = ('disknod',)
FORCE_CHOICE = {'oui/non': ['oui', 'non'],
'on/off': ['on', 'off'],
'yes/no': ['yes', 'no'],
@ -77,16 +75,13 @@ TYPE_PARAM_CHECK = ('string', 'python', 'eole', 'variable')
TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'eole', 'variable')
TYPE_PARAM_FILL = ('string', 'eole', 'number', 'context', 'variable')
DISKNOD_KEY_TYPE = {'major': 'number',
'minor': 'number'}
ERASED_FAMILY_ACTION_ATTRIBUTES = ('index', 'action')
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
class ContainerAnnotator:
"""Manage container's object
class ServiceAnnotator:
"""Manage service's object
"""
def __init__(self, objectspace):
self.space = objectspace.space
@ -99,79 +94,104 @@ class ContainerAnnotator:
</service_access>
"""
self.grouplist_conditions = {}
self.convert_containers()
self.convert_services()
def convert_containers(self):
if hasattr(self.space, 'containers'):
if hasattr(self.space.containers, 'container'):
self.convert_all()
def convert_services(self):
if hasattr(self.space, 'services'):
if hasattr(self.space.services, 'service'):
subelts = dict()
# self.space.containers.containers = self.objectspace.containers()
for idx, container in enumerate(self.space.containers.container.values()):
for idx, service in enumerate(self.space.services.service.values()):
family = self.objectspace.family()
family.name = 'container{}'.format(idx)
family.doc = container.name
family.name = 'service{}'.format(idx)
family.doc = service.name
family.family = OrderedDict()
self.convert_container_to_family(family.name, family.family, container)
setattr(self.space.containers, family.name, family)
del self.space.containers.container
self.convert_service_to_family(family.name, family.family, service)
setattr(self.space.services, family.name, family)
del self.space.services.service
else:
del self.space.containers
del self.space.services
def convert_all(self):
if hasattr(self.space.containers, 'all'):
# Remove "all" and dispatch informations in all containers
for type_, containers in vars(self.space.containers.all).items():
if type_ == 'index':
continue
if isinstance(containers, list):
for elt in containers:
for container in self.space.containers.container.values():
if container.name != 'all':
if not hasattr(container, type_):
setattr(container, type_, [])
new_elt = copy(elt)
new_elt.container = container
getattr(container, type_).append(new_elt)
else:
for name, elt in containers.items():
for container in self.space.containers.container.values():
if container.name != 'all':
if not hasattr(container, type_):
setattr(container, type_, OrderedDict())
old_container = getattr(container, type_)
if name in old_container:
raise CreoleDictConsistencyError('{}'.format(name))
new_elt = copy(elt)
new_elt.container = container
old_container[name] = new_elt
del self.space.containers.all
def convert_container_to_family(self, container_name, container_family, container):
# tranform container object to family object
def convert_service_to_family(self, service_name, service_family, service):
# tranform service object to family object
# add services, service_accesses, ...
for elttype in self.objectspace.container_elt_attr_list:
if hasattr(container, elttype):
for elttype in self.objectspace.service_elt_attr_list:
if hasattr(service, elttype):
family = self.objectspace.family()
key_type_name = elttype.upper() + '_KEY_TYPE'
if key_type_name in globals():
key_type = globals()[key_type_name]
else:
key_type = {}
if elttype.endswith('s'):
family.name = elttype + 'es'
else:
family.name = elttype + 's'
values = getattr(container, elttype)
values = getattr(service, elttype)
if isinstance(values, dict):
values = list(values.values())
family.family = self.make_group_from_elts(elttype,
values,
key_type,
'containers.{}.{}'.format(container_name, family.name),
True)
family.family = self.convert_subelement_service(elttype,
values,
'services.{}.{}'.format(service_name, family.name))
family.mode = None
container_family[family.name] = family
service_family[family.name] = family
def convert_subelement_service(self, name, elts, path):
families = []
new_elts = self._reorder_elts(name, elts, True)
for index, elt_info in enumerate(new_elts):
elt = elt_info['elt']
elt_name = elt_info['elt_name']
# try to launch _update_xxxx() function
update_elt = '_update_' + elt_name
if hasattr(self, update_elt):
getattr(self, update_elt)(elt, index, path)
variables = []
subpath = '{}.{}{}'.format(path, name, index)
listname = '{}list'.format(name)
activate_path = '.'.join([subpath, 'activate'])
if elt in self.grouplist_conditions:
# FIXME transformer le activate qui disparait en boolean
self.objectspace.list_conditions.setdefault(listname,
{}).setdefault(self.grouplist_conditions[elt],
[]).append(activate_path)
for key in dir(elt):
if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES:
continue
value = getattr(elt, key)
if isinstance(value, list):
continue
if key == 'service':
value = value.name
if key == listname:
self.objectspace.list_conditions.setdefault(listname,
{}).setdefault(
value,
[]).append(activate_path)
continue
if key == 'name':
true_key = elt_name
else:
true_key = key
if true_key in self.objectspace.booleans_attributs:
type_ = 'boolean'
else:
type_ = 'string'
dtd_key_type = true_key + '_type'
if hasattr(elt, dtd_key_type):
type_ = KEY_TYPE[getattr(elt, dtd_key_type)]
multi = isinstance(value, list)
variables.append(self._generate_element(elt_name,
key,
value,
type_,
subpath,
multi))
# FIXME ne devrait pas etre True par défaut
variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath))
family = self.objectspace.family()
family.name = '{}{}'.format(name, index)
family.variable = variables
family.mode = None
self.paths.append('family', subpath, 'services', creoleobj=family)
families.append(family)
return families
def _generate_element(self, eltname, name, value, type_, subpath, multi=False):
var_data = {'name': name, 'doc': '', 'value': value,
@ -216,103 +236,17 @@ class ContainerAnnotator:
choices.append(choice)
variable.choice = choices
path = '{}.{}'.format(subpath, name)
self.paths.append('variable', path, 'containers', 'containers', variable)
self.paths.append('variable', path, 'services', 'service', variable)
return variable
def _make_disknod_auto(self, type_, index, variable, container_path):
if not hasattr(self.space.constraints, 'auto'):
self.space.constraints.auto = []
auto = self.objectspace.auto()
self.objectspace.index += 1
auto.index = self.objectspace.index
auto.namespace = 'containers'
param1 = self.objectspace.param()
param1.text = type_
param2 = self.objectspace.param()
param2.text = variable.name
auto.param = [param1, param2]
auto.name = 'cdrom_minormajor'
family = 'disknod{}'.format(index)
auto.target = '{}.{}.{}'.format(container_path, family, type_)
if not hasattr(self.space, 'constraints'):
self.space.constraints = self.objectspace.constraints()
self.space.constraints.auto.append(auto)
def _make_disknod_type(self, index, variable, container_path):
auto = self.objectspace.auto()
self.objectspace.index += 1
auto.index = self.objectspace.index
auto.namespace = 'containers'
param = self.objectspace.param()
param.text = variable.name
auto.param = [param]
auto.name = 'device_type'
family = 'disknod{}'.format(index)
auto.target = '{}.{}.type'.format(container_path, family)
if not hasattr(self.space, 'constraints'):
self.space.constraints = self.objectspace.constraints()
if not hasattr(self.space.constraints, 'auto'):
self.space.constraints.auto = []
self.space.constraints.auto.append(auto)
def _update_disknod(self, disknod, index, container_path):
disknod.major = None
disknod.minor = None
disknod.type = None
self._make_disknod_auto('minor', index, disknod, container_path)
self._make_disknod_auto('major', index, disknod, container_path)
self._make_disknod_type(index, disknod, container_path)
disknod.mode = u'rwm'
disknod.permission = 'allow'
def _update_file(self, file_, index, container_path):
if file_.name_type == "UnicodeOption":
def _update_file(self, file_, index, service_path):
if file_.file_type == "UnicodeOption":
if not hasattr(file_, 'source'):
file_.source = basename(file_.name)
elif not hasattr(file_, 'source'):
raise CreoleDictConsistencyError(_('attribute source mandatory for file with SymLinkOption name '
raise CreoleDictConsistencyError(_('attribute source mandatory for file with variable name '
'for {}').format(file_.name))
def _split_elts(self, name, key, value, elt):
"""for example::
<service_access service='ntp'>
<port protocol='udp' service_accesslist='ntp_udp'>123</port>
<tcpwrapper>ntpd</tcpwrapper>
</service_access>
builds a `service_access` object, but we need **two** objects `service_access`,
for example one for the port and one for the tcpwrapper
"""
for subelt in value:
new_elt = copy(elt)
for subsubelt in dir(subelt):
if subsubelt.startswith('_') or subsubelt == 'index':
continue
if hasattr(new_elt, subsubelt):
if hasattr(elt, 'name'):
name_ = elt.name
else:
name_ = elt.service
raise CreoleDictConsistencyError(_('attribute {} already exists '
'for {}').format(subsubelt,
name_))
setattr(new_elt, subsubelt, getattr(subelt, subsubelt))
if hasattr(new_elt, 'node_name') or hasattr(new_elt, 'name_type'):
raise CreoleDictConsistencyError(_('attribute node_name or name_type '
'already exists for {}'
'').format(name))
if hasattr(subelt, key + '_type'):
type_ = getattr(subelt, key + '_type')
setattr(new_elt, 'name_type', type_)
setattr(new_elt, 'node_name', key)
if not hasattr(new_elt, name + 'list'):
setattr(new_elt, name + 'list', '___auto_{}'.format(elt.service))
else:
self.grouplist_conditions[new_elt] = '___auto_{}'.format(elt.service)
yield new_elt
def _reorder_elts(self, name, elts, duplicate_list):
"""Reorders by index the elts (the interface,
the hosts, actions...)
@ -338,11 +272,6 @@ class ContainerAnnotator:
if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES:
continue
value = getattr(elt, key)
if isinstance(value, list) and duplicate_list:
for new_elt in self._split_elts(name, key, value, elt):
dict_elts.setdefault(new_elt.name, []).append({'elt_name': key,
'elt': new_elt})
elt_added = True
if not elt_added:
if hasattr(elt, 'name'):
eltname = elt.name
@ -355,7 +284,7 @@ class ContainerAnnotator:
result_elts.extend(elt)
return result_elts
def make_group_from_elts(self, name, elts, key_type, path, duplicate_list):
def make_group_from_elts(self, name, elts, path, duplicate_list):
"""Splits each objects into a group (and `OptionDescription`, in tiramisu terms)
and build elements and its attributes (the `Options` in tiramisu terms)
"""
@ -373,7 +302,7 @@ class ContainerAnnotator:
subpath = '{}.{}{}'.format(path, name, index)
listname = '{}list'.format(name)
activate_path = '.'.join([subpath, 'activate'])
if name not in NOT_NEED_ACTIVATE and elt in self.grouplist_conditions:
if elt in self.grouplist_conditions:
# FIXME transformer le activate qui disparait en boolean
self.objectspace.list_conditions.setdefault(listname,
{}).setdefault(self.grouplist_conditions[elt],
@ -383,19 +312,18 @@ class ContainerAnnotator:
continue
value = getattr(elt, key)
if isinstance(value, list) and duplicate_list:
# FIXME plusieurs fichier si calculé !
continue
if key == 'container':
value = value.name
if name not in NOT_NEED_ACTIVATE and key == listname:
if key == listname:
self.objectspace.list_conditions.setdefault(listname,
{}).setdefault(
value,
[]).append(activate_path)
continue
default_type = 'string'
if key in self.objectspace.booleans_attributs:
default_type = 'boolean'
type_ = key_type.get(key, default_type)
type_ = 'boolean'
else:
type_ = 'string'
dtd_key_type = key + '_type'
if hasattr(elt, dtd_key_type):
type_ = KEY_TYPE[getattr(elt, dtd_key_type)]
@ -406,19 +334,18 @@ class ContainerAnnotator:
type_,
subpath,
multi))
if name not in NOT_NEED_ACTIVATE:
# FIXME ne devrait pas etre True par défaut
variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath))
# FIXME ne devrait pas etre True par défaut
variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath))
family = self.objectspace.family()
family.name = '{}{}'.format(name, index)
family.variable = variables
family.mode = None
self.paths.append('family', subpath, 'containers', creoleobj=family)
self.paths.append('family', subpath, 'services', creoleobj=family)
families.append(family)
return families
class ActionAnnotator(ContainerAnnotator):
class ActionAnnotator(ServiceAnnotator):
def __init__(self, objectspace):
self.space = objectspace.space
self.paths = objectspace.paths
@ -443,7 +370,7 @@ class ActionAnnotator(ContainerAnnotator):
'').format(namespace))
namespaces.append(namespace)
action.name = action.namespace
new_actions = self.make_group_from_elts('action', actions.action, {}, subpath, False)
new_actions = self.make_group_from_elts('action', actions.action, subpath, False)
family = self.objectspace.family()
family.name = actions.name
family.family = new_actions
@ -491,7 +418,7 @@ class SpaceAnnotator(object):
self.change_family_mode()
self.dynamic_families()
self.filter_separators()
self.absolute_path_for_symlink_in_containers()
self.absolute_path_for_symlink_in_services()
self.convert_helps()
if hasattr(self.space, 'constraints'):
del self.space.constraints.index
@ -499,10 +426,10 @@ class SpaceAnnotator(object):
raise Exception('constraints again?')
del self.space.constraints
def absolute_path_for_symlink_in_containers(self):
if not hasattr(self.space, 'containers'):
def absolute_path_for_symlink_in_services(self):
if not hasattr(self.space, 'services'):
return
families = vars(self.space.containers).values()
families = vars(self.space.services).values()
for family in families:
if hasattr(family, 'family'):
for fam in family.family.values():
@ -645,7 +572,7 @@ class SpaceAnnotator(object):
(not has_value or is_follower) and variable.type != 'choice'):
variable.mode = modes_level[0]
if has_value:
if not HIGH_COMPATIBILITY or (not path.startswith('creole.containers.') \
if not HIGH_COMPATIBILITY or (not path.startswith('creole.services.') \
and path not in self.force_no_value and path not in self.force_not_mandatory):
variable.mandatory = True
if variable.hidden is True:
@ -965,9 +892,9 @@ class SpaceAnnotator(object):
if param.type == 'eole':
param.type = 'variable'
if param.type == 'variable':
if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
if param.optional is True:
param_option_indexes.append(idx)
# if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
# if param.optional is True:
# param_option_indexes.append(idx)
try:
param.text = self.paths.get_variable_path(param.text, namespace)
except CreoleDictConsistencyError as err:
@ -1167,9 +1094,9 @@ class SpaceAnnotator(object):
# 'so cannot depends to an '
# 'other variable'
# ).format(fill.name, fill.target))
if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
if param.optional is True:
param_option_indexes.append(fill_idx)
# if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
# if param.optional is True:
# param_option_indexes.append(fill_idx)
try:
param.text = self.paths.get_variable_path(param.text, namespace)
except CreoleDictConsistencyError as err:

View file

@ -30,12 +30,12 @@ from json import dump
from .i18n import _
from .xmlreflector import XMLReflector, HIGH_COMPATIBILITY
from .annotator import ERASED_ATTRIBUTES, ActionAnnotator, ContainerAnnotator, SpaceAnnotator
from .annotator import ERASED_ATTRIBUTES, ActionAnnotator, ServiceAnnotator, SpaceAnnotator
from .utils import normalize_family
from .error import CreoleOperationError, SpaceObjShallNotBeUpdated, CreoleDictConsistencyError
# CreoleObjSpace's elements like 'family' or 'slave', that shall be forced to the Redefinable type
FORCE_REDEFINABLES = ('family', 'slave', 'container', 'disknod', 'variables', 'family_action')
FORCE_REDEFINABLES = ('family', 'slave', 'service', 'disknod', 'variables', 'family_action')
# CreoleObjSpace's elements that shall be forced to the UnRedefinable type
FORCE_UNREDEFINABLES = ('value', 'input', 'profile', 'ewtapp', 'tag', 'saltaction')
# CreoleObjSpace's elements that shall be set to the UnRedefinable type
@ -86,8 +86,8 @@ class CreoleObjSpace(object):
self.redefine_variables = None
self.probe_variables = []
# elt container's attrs list
self.container_elt_attr_list = [] #
# elt service's attrs list
self.service_elt_attr_list = [] #
# ['variable', 'separator', 'family']
self.forced_text_elts = set()
# ['disknod', 'follower', 'target', 'service', 'package', 'ip', 'value', 'tcpwrapper',
@ -106,8 +106,8 @@ class CreoleObjSpace(object):
forced_text_elt = False
if elt.type == 'mixed':
forced_text_elt = True
if elt.name == 'container':
self.container_elt_attr_list = [elt.content.left.name]
if elt.name == 'service':
self.service_elt_attr_list = [elt.content.left.name]
self.parse_dtd_right_left_elt(elt.content)
for attr in elt.iterattributes():
atomic = False
@ -152,10 +152,10 @@ class CreoleObjSpace(object):
def parse_dtd_right_left_elt(self, elt):
if elt.right.type == 'or':
self.container_elt_attr_list.append(elt.right.left.name)
self.service_elt_attr_list.append(elt.right.left.name)
self.parse_dtd_right_left_elt(elt.right)
else:
self.container_elt_attr_list.append(elt.right.name)
self.service_elt_attr_list.append(elt.right.name)
def _convert_boolean(self, value): # pylint: disable=R0201
"""Boolean coercion. The Creole XML may contain srings like `True` or `False`
@ -297,7 +297,7 @@ class CreoleObjSpace(object):
def create_tree_structure(self, space, child, creoleobj): # pylint: disable=R0201
"""
Builds the tree structure of the object space here
we set containers attributes in order to be populated later on
we set services attributes in order to be populated later on
for example::
space = Family()
@ -458,7 +458,7 @@ class CreoleObjSpace(object):
def space_visitor(self, eosfunc_file): # pylint: disable=C0111
ActionAnnotator(self)
ContainerAnnotator(self)
ServiceAnnotator(self)
SpaceAnnotator(self, eosfunc_file)
def save(self, filename, force_no_save=False):
@ -515,7 +515,7 @@ class CreoleObjSpace(object):
_name = 'leader'
else:
_name = name
if name in ['containers', 'variables', 'actions']:
if name in ['services', 'variables', 'actions']:
_name = 'family'
if HIGH_COMPATIBILITY and not hasattr(subspace, 'doc'):
subspace.doc = ''
@ -524,7 +524,7 @@ class CreoleObjSpace(object):
child_node = SubElement(node, _name)
self._xml_export(child_node, subspace, _name)
elif isinstance(space, self.Atom):
if name == 'containers':
if name == 'services':
child_node = SubElement(node, 'family')
child_node.attrib['name'] = name
else:
@ -652,7 +652,7 @@ class Path(object):
raise CreoleOperationError('current_namespace must not be None')
dico = self._get_variable(name)
if not allow_source:
if dico['namespace'] != 'creole' and current_namespace != dico['namespace']:
if dico['namespace'] not in ['creole', 'services'] and current_namespace != dico['namespace']:
raise CreoleDictConsistencyError(_('A variable located in the {} namespace '
'shall not be used in the {} namespace').format(
dico['namespace'], current_namespace))

View file

@ -465,7 +465,7 @@ class CreoleTemplateEngine:
"""
for option in await self.config.option.list(type='all'):
namespace = await option.option.name()
if namespace in ['containers', 'actions']:
if namespace in ['services', 'actions']:
continue
elif namespace == 'creole':
await self.load_eole_variables_creole(self.config,
@ -476,11 +476,11 @@ class CreoleTemplateEngine:
option)
for template in listdir(self.distrib_dir):
self.prepare_template(join(self.distrib_dir, template))
for container_obj in await self.config.option('containers').list('all'):
current_container = await container_obj.option.doc()
for service_obj in await self.config.option('services').list('all'):
current_container = await service_obj.option.doc()
if container is not None and container != current_container:
continue
for fills in await container_obj.list('all'):
for fills in await service_obj.list('all'):
if await fills.option.name() == 'files':
for fill_obj in await fills.list('all'):
fill = await fill_obj.value.dict()

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers>
<container name="tata">
</container>
</containers>
<services>
<service name="tata">
</service>
</services>
</creole>

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<family name="containers">
<family name="container0" doc="tata">
<family name="services">
<family name="service0" doc="tata">
<property>basic</property>
</family>
</family>

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non"}
{"creole.general.mode_conteneur_actif": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non"}
{"creole.general.mode_conteneur_actif": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1 +1 @@
{"creole.general.without_type": "non"}
{"creole.general.without_type": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -2,7 +2,7 @@
<creole>
<containers/>
<services/>
<variables>
<family name='général'>

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non", "creole.general.module_instancie": "non"}
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non", "creole.general.module_instancie": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="Général">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general" mode="basic">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="général">

View file

@ -1 +1 @@
{"creole.general.autosavevar": null}
{"creole.general.autosavevar": null}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null}
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "b", "creole.general.int2": 100, "creole.general.int": null}
{"creole.general.mode_conteneur_actif": "b", "creole.general.int2": 100, "creole.general.int": null}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null, "creole.general.int2": null}
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null, "creole.general.int2": null}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non"}
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "oui", "creole.general.adresse_ip_eth0": null, "creole.general.adresse_netmask_eth0": null}
{"creole.general.mode_conteneur_actif": "oui", "creole.general.adresse_ip_eth0": null, "creole.general.adresse_netmask_eth0": null}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="Général">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "tous"}
{"creole.general.condition": "tous"}

View file

@ -1 +1 @@
{"creole.general.condition": "tous"}
{"creole.general.condition": "tous"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general1.master.master": [], "creole.general1.master.slave1": [], "creole.general1.master.slave2": []}
{"creole.general.mode_conteneur_actif": "non", "creole.general1.master.master": [], "creole.general1.master.slave1": [], "creole.general1.master.slave2": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": ["non"], "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}
{"creole.general.mode_conteneur_actif": ["non"], "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": ["non"], "creole.general.master.master": ["value"], "creole.general.master.slave1": [null], "creole.general.master.slave2": [null]}
{"creole.general.mode_conteneur_actif": ["non"], "creole.general.master.master": ["value"], "creole.general.master.slave1": [null], "creole.general.master.slave2": [null]}

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general1.master.master": [], "creole.general1.master.slave1": [], "creole.general1.master.slave2": []}
{"creole.general.mode_conteneur_actif": "non", "creole.general1.master.master": [], "creole.general1.master.slave1": [], "creole.general1.master.slave2": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general-1">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general_1.master.master": [], "creole.general_1.master.slave1": [], "creole.general_1.master.slave2": []}
{"creole.general.mode_conteneur_actif": "non", "creole.general_1.master.master": [], "creole.general_1.master.slave1": [], "creole.general_1.master.slave2": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}
{"creole.general.mode_conteneur_actif": "non", "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}
{"creole.general.mode_conteneur_actif": "non", "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}

View file

@ -1 +1 @@
{"creole.general.nut_monitor_netmask.nut_monitor_netmask": [], "creole.general.nut_monitor_netmask.nut_monitor_host": []}
{"creole.general.nut_monitor_netmask.nut_monitor_netmask": [], "creole.general.nut_monitor_netmask.nut_monitor_host": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}
{"creole.general.mode_conteneur_actif": "non", "creole.general.master.master": [], "creole.general.master.slave1": [], "creole.general.master.slave2": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1 +1 @@
{"creole.general.mode_conteneur_actif": "non", "creole.general1.master.master": [], "creole.general1.master.slave1": [], "creole.general1.master.slave2": [], "creole.general1.master1.master1": [], "creole.general1.master1.slave11": [], "creole.general1.master1.slave21": []}
{"creole.general.mode_conteneur_actif": "non", "creole.general1.master.master": [], "creole.general1.master.slave1": [], "creole.general1.master.slave2": [], "creole.general1.master1.master1": [], "creole.general1.master1.slave11": [], "creole.general1.master1.slave21": []}

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general">

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<containers/>
<services/>
<variables>
<family name="general1">

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