Compare commits

...

34 Commits

Author SHA1 Message Date
534b5f4413 Do not include debian folder in code branch 2020-07-29 09:54:48 +02:00
5a1c39e8a1 Fixes also syntax error 2020-04-08 18:14:57 +02:00
8d09b90d26 Fixes typo 2020-04-08 17:38:35 +02:00
a97c17a615 Create folder for external data 2020-04-08 16:42:25 +02:00
8e22886938 First package 2020-04-08 16:17:25 +02:00
0b98f2ff6f Empaquetage minimal de rougail 2020-03-31 10:35:02 +02:00
5c3ab2ae17 family name could containe an integer 2020-03-04 15:37:08 +01:00
d139862568 todict in valid_not_equal 2020-02-18 22:12:55 +01:00
9bb1a8c26a simplify and creole => rougail 2020-02-16 21:27:42 +01:00
d8e99fef54 remove servcice_elt_attr_list 2020-02-14 21:34:47 +01:00
25d5307415 containers => services 2020-02-14 17:59:39 +01:00
963e93295a tiramisu is now async 2020-01-13 19:44:24 +01:00
1c5ab706ed ParamContext no more usable 2019-12-26 11:23:22 +01:00
a542b2bfdc remove actions in variables 2019-12-22 15:54:41 +01:00
2207537b64 group in extra 2019-12-22 15:49:21 +01:00
509bf21d08 can access to extra variables 2019-12-22 15:35:50 +01:00
3eb208b2c1 can add rougail_variable to template 2019-12-22 14:46:16 +01:00
5952a8d759 add function normalize_family to templates 2019-12-22 11:30:13 +01:00
d86744d1cf adjust tests 2019-12-22 11:29:57 +01:00
1ce16ad05d support of variables's file_name 2019-12-22 11:04:39 +01:00
3881cb7e98 eole => variable 2019-12-22 08:58:37 +01:00
81028d1539 normalize_family can allow dot 2019-12-22 08:45:03 +01:00
2f8fc054d0 Replace SymLinkOption type name to variable 2019-12-22 08:42:16 +01:00
f19a427f46 convert path for DynOptionDescription to valid path 2019-12-22 08:38:08 +01:00
f062d9f30a dot is not valid in family name 2019-12-22 08:37:30 +01:00
881b551f47 description in group 2019-12-21 13:28:18 +01:00
9ec8f881ab add cidr and network_cidr variable type 2019-12-21 12:45:50 +01:00
cbf107cbdc add submulti support 2019-12-21 12:45:01 +01:00
024fecddbb dynamic option description and filename with calculation 2019-12-21 12:21:42 +01:00
729b35d372 leader/follower in template 2019-12-20 11:02:26 +01:00
1b65d22eaa valid_enum is a valid function 2019-12-19 15:00:46 +01:00
1a3632f577 add CreoleObjSpace in __init__.py 2019-12-19 09:50:33 +01:00
06535b42b8 personalise directories 2019-12-02 14:23:02 +01:00
79a7950b0b a desactivate service means that activate not exists 2019-12-02 11:14:54 +01:00
532 changed files with 3078 additions and 10791 deletions

View File

@ -1,24 +0,0 @@
################################
# Makefile pour creole
################################
SOURCE=creole
EOLE_VERSION=2.7
EOLE_RELEASE=2.7.0
################################
# Début de zone à ne pas éditer
################################
include eole.mk
include apps.mk
################################
# Fin de zone à ne pas éditer
################################
# Makefile rules dedicated to application
# if exists
ifneq (, $(strip $(wildcard $(SOURCE).mk)))
include $(SOURCE).mk
endif

64
apps.mk
View File

@ -1,64 +0,0 @@
#
# NE PAS EDITER CE FICHIER
#
# Voir Makefile
##########################
# Application web envole #
##########################
ifneq (, $(filter oui web, $(PKGAPPS)))
#
# Sanity check
#
ifeq (, $(filter-out X.X, $(strip $(VERSION))))
$(error $$(VERSION) variable has incorrect value '$(VERSION)')
endif
# Where to store web application files
WEB_PATH := $(DESTDIR)/var/www/html
# Envole
sharenvole_PROG_DIR := $(DESTDIR)/usr/share/envole/$(SOURCE)
src_$(SOURCE)-$(VERSION)_REC_DIR := $(WEB_PATH)/$(SOURCE)
src_plugins-$(VERSION)_REC_DIR := $(WEB_PATH)/$(SOURCE)/plugin
src_lang-$(VERSION)_REC_DIR := $(WEB_PATH)/$(SOURCE)/lang
endif
##########################
# Application EOLE flask #
##########################
ifneq (, $(filter flask, $(PKGAPPS)))
#
# Sanity check
#
ifeq (, $(filter-out XXX, $(strip $(FLASK_MODULE))))
$(error $$(FLASK_MODULE) variable has incorrect value '$(FLASK_MODULE)')
endif
ifeq (, $(strip $(wildcard src/$(FLASK_MODULE).conf)))
$(error missing eoleflask configuration file 'src/$(FLASK_MODULE).conf')
endif
# Everything is related to mount point
APPS_MOUNT_POINT := $(shell sed -ne 's|^"MOUNT_POINT"[[:space:]]*:[[:space:]]*"/\([^"]*\)",|\1|p' \
src/$(FLASK_MODULE).conf)
ifeq (, $(strip $(APPS_MOUNT_POINT)))
$(error no "MOUNT_POINT" in eoleflask configuration file 'src/$(FLASK_MODULE).conf')
endif
# eole-flask configuration
src_DATA_DIR := $(DESTDIR)/etc/eole/flask/available
# Where to store flask application files
FLASK_PATH := $(eole_DIR)/flask/$(APPS_MOUNT_POINT)
# static files
src_$(FLASK_MODULE)_static_REC_DIR := $(FLASK_PATH)/static
src_$(FLASK_MODULE)_templates_REC_DIR := $(FLASK_PATH)/templates
src_$(FLASK_MODULE)_instance_REC_DIR := $(FLASK_PATH)/resources
endif

View File

@ -1,15 +0,0 @@
# creole specific rules
schedule_PROG_DIR := $(eole_DIR)/schedule
upgrade_REC_DIR := $(eole_DIR)/upgrade
bin_PROG_DIR := $(DESTDIR)/usr/bin
sbin_PROG_DIR := $(DESTDIR)/usr/sbin
data_REC_DIR := $(DESTDIR)/usr/share/creole
fr.man8_DATA_DIR := $(DESTDIR)/usr/share/man/fr.UTF-8/man8
en.man8_DATA_DIR := $(DESTDIR)/usr/share/man/man8
motd_PROG_DIR := $(DESTDIR)/etc/update-motd.d
local_DATA_DIR := $(DESTDIR)/usr/share/eole/creole/dicos/local
install-files::
# To inform user about coding changes
$(INSTALL_DATA) deprecated/FonctionsEoleNg $(eole_DIR)

200
eole.mk
View File

@ -1,200 +0,0 @@
#
# NE PAS EDITER CE FICHIER
#
# Utiliser <appli>.mk à inclure à la fin de Makefile
#################
# Sanity checks #
#################
ifeq (, $(DESTDIR))
$(warning $$(DESTDIR) is empty, installation will be done in /)
endif
ifeq (, $(filter-out XXX-XXX, $(strip $(SOURCE))))
$(error $$(SOURCE) variable has incorrect value '$(SOURCE)')
endif
#########################
# Variables definitions #
#########################
INSTALL := install
INSTALL_DATA := install -m 644
INSTALL_PROGRAM := install -m 755
INSTALL_DIRECTORY := install -m 755 -d
INSTALL_RECURSIVE := cp -dr --no-preserve=ownership
# Base
eole_DIR := $(DESTDIR)/usr/share/eole
ifeq ($(strip $(EOLE_VERSION)), 2.3)
diagnose_PROG_DIR := $(eole_DIR)/diagnose/module
else
diagnose_PROG_DIR := $(eole_DIR)/diagnose/
endif
# Creole
creole_DIR := $(eole_DIR)/creole
dicos_DATA_DIR := $(creole_DIR)/dicos
tmpl_DATA_DIR := $(creole_DIR)/distrib
pretemplate_PROG_DIR := $(eole_DIR)/pretemplate
posttemplate_PROG_DIR := $(eole_DIR)/posttemplate
postservice_PROG_DIR := $(eole_DIR)/postservice
firewall_DATA_DIR := $(eole_DIR)/firewall
bareos_restore_DATA_DIR := $(eole_DIR)/bareos/restore
bareos_fichier_DATA_DIR := $(DESTDIR)/etc/bareos/bareosfichiers.d
schedule_scripts_PROG_DIR := $(eole_DIR)/schedule/scripts
extra_REC_DIR := $(creole_DIR)/extra
# Zéphir
zephir_DATA_DIR := $(DESTDIR)/usr/share/zephir
zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs
zephir_srv_DATA_DIR := $(zephir_configs_DATA_DIR)/services
# SSO
sso_DATA_DIR := $(DESTDIR)/usr/share/sso
sso_filtres_DATA_DIR := $(sso_DATA_DIR)/app_filters
sso_user-info_DATA_DIR := $(sso_DATA_DIR)/user_infos
# EAD
ead_DATA_DIR := $(DESTDIR)/usr/share/ead2/backend/config
ead_actions_DATA_DIR := $(ead_DATA_DIR)/actions
ead_perms_DATA_DIR := $(ead_DATA_DIR)/perms
ead_roles_DATA_DIR := $(ead_DATA_DIR)/roles
# Program libraries goes under /usr/lib/<PROGRAM>/
lib_$(SOURCE)_DATA_DIR := $(DESTDIR)/usr/lib/$(SOURCE)
# Scripts Eole
scripts_PROG_DIR := $(eole_DIR)/sbin
lib_eole_DATA_DIR := $(DESTDIR)/usr/lib/eole
# LDAP
ldap_passwords_DATA_DIR := $(eole_DIR)/annuaire/password_files
# LXC
lxc_DATA_DIR := $(eole_DIR)/lxc
lxc_fstab_DATA_DIR := $(lxc_DATA_DIR)/fstab
lxc_hosts_DATA_DIR := $(lxc_DATA_DIR)/hosts
# SQL
sql_DATA_DIR := $(eole_DIR)/mysql/$(SOURCE)
sql_gen_DATA_DIR := $(sql_DATA_DIR)/gen
sql_updates_DATA_DIR := $(sql_DATA_DIR)/updates
sql_conf_gen_DATA_DIR := $(eole_DIR)/applications/gen
sql_conf_passwords_DATA_DIR := $(eole_DIR)/applications/passwords
sql_conf_updates_DATA_DIR := $(eole_DIR)/applications/updates/$(SOURCE)
# Certifs
certs_DATA_DIR := $(eole_DIR)/certs
# Logrotate
logrotate_DATA_DIR := $(DESTDIR)/etc/logrotate.d
# Python modules
ifneq ($(DESTDIR),)
PYTHON_OPTS := --root $(DESTDIR)
endif
# Translation
TRANSLATION_SRC := translation
TRANSLATION_DEST := $(DESTDIR)/usr/share/locale
PO_FILES = $(wildcard $(TRANSLATION_SRC)/*/*.po)
MO_FOLDERS = $(addprefix $(TRANSLATION_DEST), $(addsuffix LC_MESSAGES,$(subst $(TRANSLATION_SRC),,$(dir $(PO_FILES)))))
#############################################
# Common directories and files installation #
#############################################
all:
$(MO_FOLDERS):
$(INSTALL_DIRECTORY) $@
$(PO_FILES): $(MO_FOLDERS)
msgfmt -o $(TRANSLATION_DEST)$(subst $(TRANSLATION_SRC),,$(addsuffix LC_MESSAGES,$(dir $@)))/$(notdir $(@:.po=.mo)) $@
install-lang: $(PO_FILES)
install:: install-dirs install-files install-lang
# $1 = command to run
# $2 = source directory
# $3 = destination directory
define fc_install_file
if [ -d $2 ]; then \
for file in `ls -1 $2/`; do \
$1 $2/$$file $3 || true; \
done; \
fi
endef
##
## Directory creation
##
# use % to catch local name in $*
# data, program and recursive directory require a corresponding
# directory in local sources
%_DATA_DIR %_PROG_DIR %REC_DIR:
test ! -d $(subst _,/,$*) || $(INSTALL_DIRECTORY) $($@)
# Create the directory referenced by the variable without a local one.
%_DIR:
$(INSTALL_DIRECTORY) $($@)
##
## Install files present directly under data, program and recursive directories
##
# $* : name of variable
# $($*): value of variable
%-instdata:
$(call fc_install_file, $(INSTALL_DATA), $(subst _,/,$(subst _DATA_DIR,,$*)), $($*))
%-instprog:
$(call fc_install_file, $(INSTALL_PROGRAM), $(subst _,/,$(subst _PROG_DIR,,$*)), $($*))
%-instrec:
$(call fc_install_file, $(INSTALL_RECURSIVE), $(subst _,/,$(subst _REC_DIR,,$*)), $($*))
# Use second expansion as variables may be created in included
# Makefiles
.SECONDEXPANSION:
# List of all directories
installdirs_LIST = $(foreach V, $(filter %_DIR, $(.VARIABLES)), \
$(if $(filter file, $(origin $(V))), \
$(V)))
# List of data directories
installdata_LIST = $(filter %_DATA_DIR, $(installdirs_LIST))
# List of program directories
installprog_LIST = $(filter %_PROG_DIR, $(installdirs_LIST))
# List of recursive directories
installrec_LIST = $(filter %_REC_DIR, $(installdirs_LIST))
# Expand directories to create as dependency
# Use double-colon to permit user to define additionnal install-dirs
install-dirs:: $$(installdirs_LIST)
# Expand files to install as dependency
# Use double-colon to permit user to define additionnal install-files
install-files:: install-data-files install-prog-files install-rec-dirs
install-data-files: $$(patsubst %,%-instdata,$$(installdata_LIST))
install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST))
install-rec-dirs: $$(patsubst %,%-instrec,$$(installrec_LIST))
# Installation of python modules
ifeq ($(shell test -f setup.py && echo 0), 0)
install-files::
python3 setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS)
endif
.PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs

View File

@ -1,44 +0,0 @@
#!/bin/bash
# Création du fichier .pot et mise à jour des fichiers .po à partir des informations du fichier po_list
if [[ -e po_list ]]; then
while read p; do
project=$(echo $p |awk '{print $1}')
files=$(echo $p |cut -f 1 -d " " --complement)
if [[ ! -d translation/fr ]]; then
mkdir -p translation/fr
fi
if [[ ! -d translation/en ]]; then
mkdir -p translation/en
fi
# Création des fichiers po minimum (fr et en) si nécessaire.
xgettext -L Python --keyword=_:1,2 --from-code=UTF-8 --force-po -F --copyright-holder="projet EOLE" --package-name=$project --msgid-bugs-address=eole@ac-dijon.fr --foreign-user -d $project -o translation/$project.pot $files
sed -i -e 's/\("Content-Type: text\/plain; charset=\).*\(\\n"\)/\1UTF-8\2/g' translation/$project.pot
# Mise à jour des fichiers po présents sous ./translation
for po_file in $(find translation -name $project.po); do
msgmerge -U $po_file translation/$project.pot
done
if [[ ! -e translation/fr/${project}.po ]]; then
msginit -i translation/${project}.pot -o translation/fr/${project}.po -l fr_FR
sed -i -e "s/\\(\"PO-Revision-Date: \\).*\\(\\\\n\"\\)/\\1$(date '+%Y-%m-%d %H:%M%z')\\2/g" \
-e 's/\("Language-Team: \).*\(\\n"\)/\1Équipe EOLE <eole@ac-dijon.fr>\2/g' \
-e 's/\("Content-Type: text\/plain; charset=\).*\(\\n"\)/\1UTF-8\2/g' \
translation/fr/${project}.po
fi
# Le fichier po "en" est écrasé.
msgen -o translation/en/$project.po translation/$project.pot
sed -i -e 's/\("Last-Translator: \).*\(\\n"\)/\1Équipe EOLE <eole@ac-dijon.fr>\2/g' \
-e "s/\\(\"PO-Revision-Date: \\).*\\(\\\\n\"\\)/\\1$(date '+%Y-%m-%d %H:%M%z')\\2/g" \
-e 's/\("Language-Team: \).*\(\\n"\)/\1Équipe EOLE <eole@ac-dijon.fr>\2/g' \
-e 's/\("Language: \).*\(\\n"\)/\1en\2/g' \
-e 's/\("Content-Type: text\/plain; charset=\).*\(\\n"\)/\1UTF-8\2/g' \
-e 's/\("Plural-Forms: \).*/\1nplurals=2; plural=(n > 1);\\n"/' \
-e '1,5 d' \
translation/en/${project}.po
done < po_list
fi

View File

@ -1,24 +1,17 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from setuptools import setup from setuptools import setup, find_packages
import os, glob
BASE_DIR = 'share/'
DOC_DIR = os.path.join(BASE_DIR, 'doc/creole')
# documentation
doc = [(DOC_DIR, glob.glob('doc/*.html') + glob.glob('doc/*.txt')),
(os.path.join(DOC_DIR, 'api'), glob.glob('doc/api/*.html') + glob.glob('doc/api/*.css')),
]
setup( setup(
author='Équipe EOLE', author='Cadoles',
author_email='eole@ac-dijon.fr', author_email='contact@cadoles.com',
name='creole', name='rougail',
version='2.7.0', version='0.1',
description='Eole configuration tools', description='Configuration templating engine',
url='http://www.eole.orion.education.fr', url='https://forge.cadoles.com/Infra/rougail',
packages=['creole', 'creole.lint', 'creole.valid'], packages=find_packages('src'),
data_files=doc package_dir={"": "src"},
include_package_data=True,
package_data={"": ["data/*.dtd"]}
) )

View File

@ -1,4 +1,5 @@
from .loader import load from .loader import load
from .objspace import CreoleObjSpace
from .annotator import modes from .annotator import modes
__ALL__ = ('load', 'modes') __ALL__ = ('load', 'CreoleObjSpace', 'modes')

View File

@ -53,18 +53,17 @@ modes = mode_factory()
# 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',
'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership', 'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership',
'level') # , '_real_container') 'level', 'submulti') # , '_real_container')
ERASED_CONTAINER_ATTRIBUTES = ('id', 'container', 'group_id', 'group', 'container_group') ERASED_CONTAINER_ATTRIBUTES = ('id', 'container', 'group_id', 'group', 'container_group')
NOT_NEED_ACTIVATE = ('disknod',)
FORCE_CHOICE = {'oui/non': ['oui', 'non'], FORCE_CHOICE = {'oui/non': ['oui', 'non'],
'on/off': ['on', 'off'], 'on/off': ['on', 'off'],
'yes/no': ['yes', 'no'], 'yes/no': ['yes', 'no'],
'schedule': ['none', 'daily', 'weekly', 'monthly'], 'schedule': ['none', 'daily', 'weekly', 'monthly'],
'schedulemod': ['pre', 'post']} 'schedulemod': ['pre', 'post']}
KEY_TYPE = {'SymLinkOption': 'symlink', KEY_TYPE = {'variable': 'symlink',
'SymLinkOption': 'symlink',
'PortOption': 'port', 'PortOption': 'port',
'UnicodeOption': 'string', 'UnicodeOption': 'string',
'NetworkOption': 'network', 'NetworkOption': 'network',
@ -72,20 +71,17 @@ KEY_TYPE = {'SymLinkOption': 'symlink',
'URLOption': 'web_address', 'URLOption': 'web_address',
'FilenameOption': 'filename'} 'FilenameOption': 'filename'}
TYPE_PARAM_CHECK = ('string', 'python', 'eole') TYPE_PARAM_CHECK = ('string', 'python', 'eole', 'variable')
TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'eole') TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'eole', 'variable')
TYPE_PARAM_FILL = ('string', 'eole', 'number', 'context') TYPE_PARAM_FILL = ('string', 'eole', 'number', 'context', 'variable')
DISKNOD_KEY_TYPE = {'major': 'number',
'minor': 'number'}
ERASED_FAMILY_ACTION_ATTRIBUTES = ('index', 'action') ERASED_FAMILY_ACTION_ATTRIBUTES = ('index', 'action')
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
class ContainerAnnotator: class ServiceAnnotator:
"""Manage container's object """Manage service's object
""" """
def __init__(self, objectspace): def __init__(self, objectspace):
self.space = objectspace.space self.space = objectspace.space
@ -98,79 +94,99 @@ class ContainerAnnotator:
</service_access> </service_access>
""" """
self.grouplist_conditions = {} self.grouplist_conditions = {}
self.convert_containers() self.convert_services()
def convert_containers(self): def convert_services(self):
if hasattr(self.space, 'containers'): if hasattr(self.space, 'services'):
if hasattr(self.space.containers, 'container'): if hasattr(self.space.services, 'service'):
self.convert_all()
subelts = dict() subelts = dict()
# self.space.containers.containers = self.objectspace.containers() for idx, service in enumerate(self.space.services.service.values()):
for idx, container in enumerate(self.space.containers.container.values()):
family = self.objectspace.family() family = self.objectspace.family()
family.name = 'container{}'.format(idx) family.name = 'service{}'.format(idx)
family.doc = container.name family.doc = service.name
family.family = OrderedDict() family.family = OrderedDict()
self.convert_container_to_family(family.name, family.family, container) self.convert_service_to_family(family.name, family.family, service)
setattr(self.space.containers, family.name, family) setattr(self.space.services, family.name, family)
del self.space.containers.container del self.space.services.service
else: else:
del self.space.containers del self.space.services
def convert_all(self): def convert_service_to_family(self, service_name, service_family, service):
if hasattr(self.space.containers, 'all'): for elttype, values in vars(service).items():
# Remove "all" and dispatch informations in all containers if elttype in ['name', 'index']:
for type_, containers in vars(self.space.containers.all).items():
if type_ == 'index':
continue 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
# add services, service_accesses, ...
for elttype in self.objectspace.container_elt_attr_list:
if hasattr(container, elttype):
family = self.objectspace.family() 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' family.name = elttype + 's'
values = getattr(container, elttype)
if isinstance(values, dict): if isinstance(values, dict):
values = list(values.values()) values = list(values.values())
family.family = self.make_group_from_elts(elttype, family.family = self.convert_subelement_service(elttype,
values, values,
key_type, 'services.{}.{}'.format(service_name, family.name))
'containers.{}.{}'.format(container_name, family.name),
True)
family.mode = None 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): def _generate_element(self, eltname, name, value, type_, subpath, multi=False):
var_data = {'name': name, 'doc': '', 'value': value, var_data = {'name': name, 'doc': '', 'value': value,
@ -183,7 +199,6 @@ class ContainerAnnotator:
var_data['type'] = type_ var_data['type'] = type_
variable = self.objectspace.variable() variable = self.objectspace.variable()
if not HIGH_COMPATIBILITY:
variable.mandatory = True variable.mandatory = True
for key, value in var_data.items(): for key, value in var_data.items():
if key == 'value': if key == 'value':
@ -215,111 +230,25 @@ class ContainerAnnotator:
choices.append(choice) choices.append(choice)
variable.choice = choices variable.choice = choices
path = '{}.{}'.format(subpath, name) path = '{}.{}'.format(subpath, name)
self.paths.append('variable', path, 'containers', 'containers', variable) self.paths.append('variable', path, 'services', 'service', variable)
return variable return variable
def _make_disknod_auto(self, type_, index, variable, container_path): def _update_file(self, file_, index, service_path):
if not hasattr(self.space.constraints, 'auto'): if file_.file_type == "UnicodeOption":
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 not hasattr(file_, 'source'): if not hasattr(file_, 'source'):
file_.source = basename(file_.name) file_.source = basename(file_.name)
elif not hasattr(file_, 'source'):
def _split_elts(self, name, key, value, elt): raise CreoleDictConsistencyError(_('attribute source mandatory for file with variable name '
"""for example:: 'for {}').format(file_.name))
<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): def _reorder_elts(self, name, elts, duplicate_list):
"""Reorders by index the elts (the interface, """Reorders by index the elts
the hosts, actions...)
""" """
dict_elts = OrderedDict() dict_elts = OrderedDict()
# reorder elts by index # reorder elts by index
new_elts = {} new_elts = {}
not_indexed = [] not_indexed = []
for elt in elts: for elt in elts:
if not hasattr(elt, 'index'):
not_indexed.append(elt)
else:
idx = elt.index idx = elt.index
new_elts.setdefault(idx, []).append(elt) new_elts.setdefault(idx, []).append(elt)
idxes = list(new_elts.keys()) idxes = list(new_elts.keys())
@ -333,16 +262,8 @@ class ContainerAnnotator:
if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES: if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES:
continue continue
value = getattr(elt, key) 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 not elt_added:
if hasattr(elt, 'name'):
eltname = elt.name eltname = elt.name
else:
eltname = idx
dict_elts.setdefault(eltname, []).append({'elt_name': name, 'elt': elt}) dict_elts.setdefault(eltname, []).append({'elt_name': name, 'elt': elt})
result_elts = [] result_elts = []
@ -350,7 +271,7 @@ class ContainerAnnotator:
result_elts.extend(elt) result_elts.extend(elt)
return result_elts 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) """Splits each objects into a group (and `OptionDescription`, in tiramisu terms)
and build elements and its attributes (the `Options` in tiramisu terms) and build elements and its attributes (the `Options` in tiramisu terms)
""" """
@ -368,7 +289,7 @@ class ContainerAnnotator:
subpath = '{}.{}{}'.format(path, name, index) subpath = '{}.{}{}'.format(path, name, index)
listname = '{}list'.format(name) listname = '{}list'.format(name)
activate_path = '.'.join([subpath, 'activate']) 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 # FIXME transformer le activate qui disparait en boolean
self.objectspace.list_conditions.setdefault(listname, self.objectspace.list_conditions.setdefault(listname,
{}).setdefault(self.grouplist_conditions[elt], {}).setdefault(self.grouplist_conditions[elt],
@ -378,19 +299,18 @@ class ContainerAnnotator:
continue continue
value = getattr(elt, key) value = getattr(elt, key)
if isinstance(value, list) and duplicate_list: if isinstance(value, list) and duplicate_list:
# FIXME plusieurs fichier si calculé !
continue continue
if key == 'container': if key == listname:
value = value.name
if name not in NOT_NEED_ACTIVATE and key == listname:
self.objectspace.list_conditions.setdefault(listname, self.objectspace.list_conditions.setdefault(listname,
{}).setdefault( {}).setdefault(
value, value,
[]).append(activate_path) []).append(activate_path)
continue continue
default_type = 'string'
if key in self.objectspace.booleans_attributs: if key in self.objectspace.booleans_attributs:
default_type = 'boolean' type_ = 'boolean'
type_ = key_type.get(key, default_type) else:
type_ = 'string'
dtd_key_type = key + '_type' dtd_key_type = key + '_type'
if hasattr(elt, dtd_key_type): if hasattr(elt, dtd_key_type):
type_ = KEY_TYPE[getattr(elt, dtd_key_type)] type_ = KEY_TYPE[getattr(elt, dtd_key_type)]
@ -401,19 +321,18 @@ class ContainerAnnotator:
type_, type_,
subpath, subpath,
multi)) multi))
if name not in NOT_NEED_ACTIVATE:
# FIXME ne devrait pas etre True par défaut # FIXME ne devrait pas etre True par défaut
variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath)) variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath))
family = self.objectspace.family() family = self.objectspace.family()
family.name = '{}{}'.format(name, index) family.name = '{}{}'.format(name, index)
family.variable = variables family.variable = variables
family.mode = None family.mode = None
self.paths.append('family', subpath, 'containers', creoleobj=family) self.paths.append('family', subpath, 'services', creoleobj=family)
families.append(family) families.append(family)
return families return families
class ActionAnnotator(ContainerAnnotator): class ActionAnnotator(ServiceAnnotator):
def __init__(self, objectspace): def __init__(self, objectspace):
self.space = objectspace.space self.space = objectspace.space
self.paths = objectspace.paths self.paths = objectspace.paths
@ -438,7 +357,7 @@ class ActionAnnotator(ContainerAnnotator):
'').format(namespace)) '').format(namespace))
namespaces.append(namespace) namespaces.append(namespace)
action.name = action.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 = self.objectspace.family()
family.name = actions.name family.name = actions.name
family.family = new_actions family.family = new_actions
@ -465,7 +384,7 @@ class SpaceAnnotator(object):
self.has_calc = [] self.has_calc = []
self.force_no_value = [] self.force_no_value = []
self.force_not_mandatory = [] self.force_not_mandatory = []
if eosfunc_file is not None: if eosfunc_file:
self.eosfunc = imp.load_source('eosfunc', eosfunc_file) self.eosfunc = imp.load_source('eosfunc', eosfunc_file)
else: else:
self.eosfunc = None self.eosfunc = None
@ -473,6 +392,7 @@ class SpaceAnnotator(object):
self.default_has_no_value = [] self.default_has_no_value = []
self.has_frozen_if_in_condition = [] self.has_frozen_if_in_condition = []
self.default_variable_options() self.default_variable_options()
self.variable_submulti()
self.convert_auto_freeze() self.convert_auto_freeze()
self.convert_groups() self.convert_groups()
self.filter_check() self.filter_check()
@ -483,8 +403,9 @@ class SpaceAnnotator(object):
self.remove_empty_families() self.remove_empty_families()
self.change_variable_mode() self.change_variable_mode()
self.change_family_mode() self.change_family_mode()
self.dynamic_families()
self.filter_separators() self.filter_separators()
self.absolute_path_for_symlink_in_containers() self.absolute_path_for_symlink_in_services()
self.convert_helps() self.convert_helps()
if hasattr(self.space, 'constraints'): if hasattr(self.space, 'constraints'):
del self.space.constraints.index del self.space.constraints.index
@ -492,10 +413,10 @@ class SpaceAnnotator(object):
raise Exception('constraints again?') raise Exception('constraints again?')
del self.space.constraints del self.space.constraints
def absolute_path_for_symlink_in_containers(self): def absolute_path_for_symlink_in_services(self):
if not hasattr(self.space, 'containers'): if not hasattr(self.space, 'services'):
return return
families = vars(self.space.containers).values() families = vars(self.space.services).values()
for family in families: for family in families:
if hasattr(family, 'family'): if hasattr(family, 'family'):
for fam in family.family.values(): for fam in family.family.values():
@ -541,8 +462,8 @@ class SpaceAnnotator(object):
if is_leader: if is_leader:
if variable.name == follower_names[0]: if variable.name == follower_names[0]:
# followers are multi # followers are multi
if not variable.multi is True: if not variable.multi:
raise CreoleDictConsistencyError(_('the variable {} in a group must be multi').format(variable.name)) raise CreoleDictConsistencyError(_('the variable {} in a group must be multi or submulti').format(variable.name))
follower_names.remove(variable.name) follower_names.remove(variable.name)
leader_family.variable.pop(variable.name) leader_family.variable.pop(variable.name)
leader_space.variable.append(variable) # pylint: disable=E1101 leader_space.variable.append(variable) # pylint: disable=E1101
@ -560,6 +481,10 @@ class SpaceAnnotator(object):
leader_space.variable = [] leader_space.variable = []
leader_space.name = leader_name leader_space.name = leader_name
leader_space.hidden = variable.hidden leader_space.hidden = variable.hidden
if hasattr(group, 'description'):
leader_space.doc = group.description
else:
leader_space.doc = variable.description
variable.hidden = None variable.hidden = None
self.paths.append('family', leader_path + '.' + leader_name, namespace, creoleobj=leader_space) self.paths.append('family', leader_path + '.' + leader_name, namespace, creoleobj=leader_space)
# manage leader's variable # manage leader's variable
@ -606,11 +531,19 @@ class SpaceAnnotator(object):
variable_mode = variable.mode variable_mode = variable.mode
if variable_mode is not None and modes[mode] > modes[variable_mode]: if variable_mode is not None and modes[mode] > modes[variable_mode]:
mode = variable_mode mode = variable_mode
if family.name == 'Containers':
family.mode = 'normal'
else:
family.mode = mode family.mode = mode
def dynamic_families(self): # pylint: disable=C0111
if not hasattr(self.space, 'variables'):
return
for family in self.space.variables.values():
if hasattr(family, 'family'):
for family in family.family.values():
if 'dynamic' in vars(family):
namespace = self.paths.get_variable_namespace(family.dynamic)
varpath = self.paths.get_variable_path(family.dynamic, namespace)
family.dynamic = varpath
def _annotate_variable(self, variable, family_mode, path, is_follower=False): def _annotate_variable(self, variable, family_mode, path, is_follower=False):
if (HIGH_COMPATIBILITY and variable.type == 'choice' and variable.mode != modes_level[-1] and variable.mandatory is True and path in self.default_has_no_value): if (HIGH_COMPATIBILITY and variable.type == 'choice' and variable.mode != modes_level[-1] and variable.mandatory is True and path in self.default_has_no_value):
variable.mode = modes_level[0] variable.mode = modes_level[0]
@ -623,7 +556,7 @@ class SpaceAnnotator(object):
(not has_value or is_follower) and variable.type != 'choice'): (not has_value or is_follower) and variable.type != 'choice'):
variable.mode = modes_level[0] variable.mode = modes_level[0]
if has_value: 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): and path not in self.force_no_value and path not in self.force_not_mandatory):
variable.mandatory = True variable.mandatory = True
if variable.hidden is True: if variable.hidden is True:
@ -636,8 +569,6 @@ class SpaceAnnotator(object):
variable.mode = family_mode variable.mode = family_mode
if variable.mode != None and variable.mode != modes_level[0] and modes[variable.mode] < modes[family_mode]: if variable.mode != None and variable.mode != modes_level[0] and modes[variable.mode] < modes[family_mode]:
variable.mode = family_mode variable.mode = family_mode
if variable.name == "available_probes":
variable.force_default_on_freeze = False
def default_variable_options(self): def default_variable_options(self):
if hasattr(self.space, 'variables'): if hasattr(self.space, 'variables'):
@ -651,6 +582,16 @@ class SpaceAnnotator(object):
if variable.type != 'symlink' and not hasattr(variable, 'description'): if variable.type != 'symlink' and not hasattr(variable, 'description'):
variable.description = variable.name variable.description = variable.name
def variable_submulti(self):
if hasattr(self.space, 'variables'):
for families in self.space.variables.values():
if hasattr(families, 'family'):
for family in families.family.values():
if hasattr(family, 'variable'):
for variable in family.variable.values():
if variable.submulti:
variable.multi = 'submulti'
def convert_auto_freeze(self): # pylint: disable=C0111 def convert_auto_freeze(self): # pylint: disable=C0111
if hasattr(self.space, 'variables'): if hasattr(self.space, 'variables'):
for variables in self.space.variables.values(): for variables in self.space.variables.values():
@ -768,19 +709,9 @@ class SpaceAnnotator(object):
is_follower = False is_follower = False
path = '{}.{}.{}'.format(family.path, variable.name, follower.name) path = '{}.{}.{}'.format(family.path, variable.name, follower.name)
self._annotate_variable(follower, family_mode, path, is_follower) self._annotate_variable(follower, family_mode, path, is_follower)
if HIGH_COMPATIBILITY: # leader's mode is minimum level
# leader's variable are right
if modes[variable.variable[0].mode] > modes[follower.mode]: if modes[variable.variable[0].mode] > modes[follower.mode]:
follower.mode = variable.variable[0].mode follower.mode = variable.variable[0].mode
else:
# auto_save's variable is set in 'basic' mode if its mode is 'normal'
if follower.auto_save is True and follower.mode != modes_level[-1]:
follower.mode = modes_level[0]
if modes[mode] > modes[follower.mode]:
mode = follower.mode
if not HIGH_COMPATIBILITY:
# the leader's mode is the lowest
variable.variable[0].mode = mode
variable.mode = variable.variable[0].mode variable.mode = variable.variable[0].mode
else: else:
# auto_save's variable is set in 'basic' mode if its mode is 'normal' # auto_save's variable is set in 'basic' mode if its mode is 'normal'
@ -811,13 +742,9 @@ class SpaceAnnotator(object):
# sort fill/auto by index # sort fill/auto by index
if 'fill' in vars(constraints): if 'fill' in vars(constraints):
for idx, fill in enumerate(constraints.fill): for idx, fill in enumerate(constraints.fill):
if fill.index in fills:
raise Exception('hu?')
fills[fill.index] = {'idx': idx, 'fill': fill, 'type': 'fill'} fills[fill.index] = {'idx': idx, 'fill': fill, 'type': 'fill'}
if 'auto' in vars(constraints): if 'auto' in vars(constraints):
for idx, fill in enumerate(constraints.auto): for idx, fill in enumerate(constraints.auto):
if fill.index in fills:
raise Exception('hu?')
fills[fill.index] = {'idx': idx, 'fill': fill, 'type': 'auto'} fills[fill.index] = {'idx': idx, 'fill': fill, 'type': 'auto'}
indexes = list(fills.keys()) indexes = list(fills.keys())
indexes.sort() indexes.sort()
@ -826,10 +753,7 @@ class SpaceAnnotator(object):
remove_fills = [] remove_fills = []
for idx in indexes: for idx in indexes:
fill = fills[idx]['fill'] fill = fills[idx]['fill']
if hasattr(fill, 'redefine'):
redefine = bool(fill.redefine) redefine = bool(fill.redefine)
else:
redefine = False
if fill.target in targets: if fill.target in targets:
if redefine: if redefine:
if targets[fill.target][1] == 'auto': if targets[fill.target][1] == 'auto':
@ -931,9 +855,11 @@ class SpaceAnnotator(object):
if param.type not in TYPE_PARAM_CHECK: if param.type not in TYPE_PARAM_CHECK:
raise CreoleDictConsistencyError(_('cannot use {} type as a param in check for {}').format(param.type, check.target)) raise CreoleDictConsistencyError(_('cannot use {} type as a param in check for {}').format(param.type, check.target))
if param.type == 'eole': if param.type == 'eole':
if HIGH_COMPATIBILITY and param.text.startswith('container_ip'): param.type = 'variable'
if param.optional is True: if param.type == 'variable':
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: try:
param.text = self.paths.get_variable_path(param.text, namespace) param.text = self.paths.get_variable_path(param.text, namespace)
except CreoleDictConsistencyError as err: except CreoleDictConsistencyError as err:
@ -981,8 +907,10 @@ class SpaceAnnotator(object):
for idx in remove_indexes: for idx in remove_indexes:
del space[idx] del space[idx]
remove_indexes = [] remove_indexes = []
functions = dir(self.eosfunc)
functions.extend(['valid_enum', 'valid_in_network', 'valid_differ'])
for idx, check in enumerate(space): for idx, check in enumerate(space):
if not check.name in dir(self.eosfunc): if not check.name in functions:
raise CreoleDictConsistencyError(_('cannot find check function {}').format(check.name)) raise CreoleDictConsistencyError(_('cannot find check function {}').format(check.name))
#is_probe = not check.name in self.eosfunc.func_on_zephir_context #is_probe = not check.name in self.eosfunc.func_on_zephir_context
#if is_probe: #if is_probe:
@ -1009,7 +937,7 @@ class SpaceAnnotator(object):
'').format(check.target)) '').format(check.target))
param = check.param[0] param = check.param[0]
if proposed_value_type: if proposed_value_type:
if param.type != 'eole': if param.type == 'variable':
try: try:
values = self.load_params_in_validenum(param) values = self.load_params_in_validenum(param)
except NameError as err: except NameError as err:
@ -1059,20 +987,20 @@ class SpaceAnnotator(object):
elif name == 'valid_network_netmask': elif name == 'valid_network_netmask':
params_len = 1 params_len = 1
if len(check.param) != params_len: if len(check.param) != params_len:
raise CreoleLoaderError(_('{} must have {} param').format(name, params_len)) raise CreoleDictConsistencyError(_('{} must have {} param').format(name, params_len))
elif name == 'valid_ipnetmask': elif name == 'valid_ipnetmask':
params_len = 1 params_len = 1
if len(check.param) != params_len: if len(check.param) != params_len:
raise CreoleLoaderError(_('{} must have {} param').format(name, params_len)) raise CreoleDictConsistencyError(_('{} must have {} param').format(name, params_len))
name = 'valid_ip_netmask' name = 'valid_ip_netmask'
elif name == 'valid_broadcast': elif name == 'valid_broadcast':
params_len = 2 params_len = 2
if len(check.param) != params_len: if len(check.param) != params_len:
raise CreoleLoaderError(_('{} must have {} param').format(name, params_len)) raise CreoleDictConsistencyError(_('{} must have {} param').format(name, params_len))
elif name == 'valid_in_network': elif name == 'valid_in_network':
params_len = 2 params_len = 2
if len(check.param) != params_len: if len(check.param) != params_len:
raise CreoleLoaderError(_('{} must have {} param').format(name, params_len)) raise CreoleDictConsistencyError(_('{} must have {} param').format(name, params_len))
check_.name = name check_.name = name
check_.warnings_only = check.warnings_only check_.warnings_only = check.warnings_only
if hasattr(check, 'param'): if hasattr(check, 'param'):
@ -1108,11 +1036,12 @@ class SpaceAnnotator(object):
if param.type not in TYPE_PARAM_FILL: if param.type not in TYPE_PARAM_FILL:
raise CreoleDictConsistencyError(_('cannot use {} type as a param ' raise CreoleDictConsistencyError(_('cannot use {} type as a param '
'in a fill/auto').format(param.type)) 'in a fill/auto').format(param.type))
if param.type == 'eole':
param.type = 'variable'
param_option_indexes = [] param_option_indexes = []
for fill_idx, param in enumerate(fill.param): for fill_idx, param in enumerate(fill.param):
if not hasattr(param, 'text') and \ if not hasattr(param, 'text') and \
(param.type == 'eole' or param.type == 'number' or \ (param.type == 'variable' or param.type == 'number' or \
#param.type == 'container' or param.type == 'python'):
param.type == 'python'): param.type == 'python'):
raise CreoleDictConsistencyError(_("All '{}' variables shall be set in " raise CreoleDictConsistencyError(_("All '{}' variables shall be set in "
"order to calculate {}").format( "order to calculate {}").format(
@ -1121,16 +1050,16 @@ class SpaceAnnotator(object):
# if param.type == 'container': # if param.type == 'container':
# param.type = 'eole' # param.type = 'eole'
# param.text = 'container_ip_{}'.format(param.text) # param.text = 'container_ip_{}'.format(param.text)
if param.type == 'eole': if param.type == 'variable':
#if is_probe: #if is_probe:
# raise CreoleDictConsistencyError(_('Function {0} used to calculate {1} ' # raise CreoleDictConsistencyError(_('Function {0} used to calculate {1} '
# 'is executed on remote server, ' # 'is executed on remote server, '
# 'so cannot depends to an ' # 'so cannot depends to an '
# 'other variable' # 'other variable'
# ).format(fill.name, fill.target)) # ).format(fill.name, fill.target))
if HIGH_COMPATIBILITY and param.text.startswith('container_ip'): # if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
if param.optional is True: # if param.optional is True:
param_option_indexes.append(fill_idx) # param_option_indexes.append(fill_idx)
try: try:
param.text = self.paths.get_variable_path(param.text, namespace) param.text = self.paths.get_variable_path(param.text, namespace)
except CreoleDictConsistencyError as err: except CreoleDictConsistencyError as err:
@ -1313,6 +1242,8 @@ class SpaceAnnotator(object):
if param.type not in TYPE_PARAM_CONDITION: if param.type not in TYPE_PARAM_CONDITION:
raise CreoleDictConsistencyError(_('cannot use {} type as a param ' raise CreoleDictConsistencyError(_('cannot use {} type as a param '
'in a condition').format(param.type)) 'in a condition').format(param.type))
if param.type == 'eole':
param.type = 'variable'
def check_choice_option_condition(self, force_remove_targets): def check_choice_option_condition(self, force_remove_targets):
# remove condition for ChoiceOption that don't have param # remove condition for ChoiceOption that don't have param

View File

@ -1,25 +1,17 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
fichier de configuration pour créole fichier de configuration pour rougail
""" """
from os.path import join, isfile from os.path import join, isfile, abspath, dirname
from pathlib import Path
eoledir = '/usr/share/eole' rougailroot = '/var/rougail'
patch_dir = join(rougailroot, 'patches')
eoleroot = join(eoledir, 'creole') manifests_dir = join(rougailroot, 'manifests')
templates_dir = join(rougailroot, 'templates')
dtddir = join(dirname(abspath(__file__)), 'data')
dtdfilename = join(dtddir, 'rougail.dtd')
# chemin du répertoire source des fichiers templates # chemin du répertoire source des fichiers templates
templatedir = '/var/lib/creole' patch_dir = '/srv/rougail/patch'
distrib_dir = join(eoleroot, 'distrib')
patch_dir = join(eoleroot, 'patch')
# repertoire de la dtd
dtddir = '/usr/share/creole'
if isfile('data/creole.dtd'):
dtdfilename = 'data/creole.dtd'
elif isfile('../creole/data/creole.dtd'):
dtdfilename = '../creole/data/creole.dtd'
else:
dtdfilename = join(dtddir, 'creole.dtd')

View File

@ -2,20 +2,20 @@
<!-- ===================================================================== --> <!-- ===================================================================== -->
<!-- Definition de la DTD du fichier creole --> <!-- Rougail's DTD -->
<!-- ===================================================================== --> <!-- ===================================================================== -->
<!-- <!--
# Conception : # Created by:
# Eole (http://eole.orion.education.fr) # EOLE (http://eole.orion.education.fr)
# Copyright (C) 2005-2018 # Copyright (C) 2005-2018
# distribue sous la licence GPL-2 # Forked by:
# Cadoles (http://www.cadoles.com)
# Copyright (C) 2019
# En attendant une traduction officielle de la GPL, la notice de # distribued with GPL-2 or later license
# copyright demeure en anglais.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -30,15 +30,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Se reporter a la documentation envoyee avec le programme pour la notice.
--> -->
<!--================ --> <!--================ -->
<!-- root element --> <!-- root element -->
<!-- =============== --> <!-- =============== -->
<!ELEMENT creole (containers | family_action | variables | constraints | help)*> <!ELEMENT rougail (services | family_action | variables | constraints | help)*>
<!-- ============== --> <!-- ============== -->
<!-- files element --> <!-- files element -->
@ -58,26 +57,18 @@
<!ATTLIST action actionlist CDATA #IMPLIED> <!ATTLIST action actionlist CDATA #IMPLIED>
<!-- for apache action --> <!-- for apache action -->
<!ATTLIST action apache_path CDATA #IMPLIED> <!ATTLIST action apache_path CDATA #IMPLIED>
<!ATTLIST action apache_path_type (FilenameOption|SymLinkOption) "FilenameOption"> <!ATTLIST action apache_path_type (FilenameOption|SymLinkOption|variable) "FilenameOption">
<!-- for external action --> <!-- for external action -->
<!ATTLIST action url CDATA #IMPLIED> <!ATTLIST action url CDATA #IMPLIED>
<!ATTLIST action url_type (URLOption|SymLinkOption) "URLOption"> <!ATTLIST action url_type (URLOption|SymLinkOption|variable) "URLOption">
<!-- for form action --> <!-- for form action -->
<!ATTLIST action save (True|False) "False"> <!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*)*) > <!ELEMENT service ((port* | tcpwrapper* | ip* | interface* | package* | file* | digitalcertificate*)*) >
<!ATTLIST container name CDATA #REQUIRED > <!ATTLIST service 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 >
<!ATTLIST service method (systemd|upstart|apache|network) "systemd"> <!ATTLIST service method (systemd|upstart|apache|network) "systemd">
<!ATTLIST service redefine (True|False) "False">
<!ELEMENT input (#PCDATA)> <!ELEMENT input (#PCDATA)>
<!ELEMENT profile (#PCDATA)> <!ELEMENT profile (#PCDATA)>
@ -85,80 +76,48 @@
<!ELEMENT tag (#PCDATA)> <!ELEMENT tag (#PCDATA)>
<!ELEMENT saltaction (#PCDATA)> <!ELEMENT saltaction (#PCDATA)>
<!ELEMENT service_access ((port | tcpwrapper)*)> <!ELEMENT port (#PCDATA)>
<!ATTLIST service_access service CDATA #REQUIRED > <!ATTLIST port port_type (PortOption|SymLinkOption|variable) "PortOption">
<!ATTLIST port portlist CDATA #IMPLIED >
<!ELEMENT port (#PCDATA)> <!--port_type-->
<!ATTLIST port port_type (PortOption|SymLinkOption) "PortOption">
<!ATTLIST port service_accesslist CDATA #IMPLIED >
<!ATTLIST port protocol (tcp|udp) "tcp"> <!ATTLIST port protocol (tcp|udp) "tcp">
<!ELEMENT tcpwrapper (#PCDATA)> <!--tcpwrapper_type--> <!ELEMENT tcpwrapper (#PCDATA)>
<!ATTLIST tcpwrapper tcpwrapper_type (UnicodeOption|SymLinkOption) "UnicodeOption"> <!ATTLIST tcpwrapper tcpwrapper_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
<!ATTLIST tcpwrapper service_accesslist CDATA #IMPLIED > <!ATTLIST tcpwrapper tcpwrapperlist CDATA #IMPLIED >
<!ELEMENT service_restriction (ip*)> <!ELEMENT ip (#PCDATA)>
<!ATTLIST service_restriction service CDATA #REQUIRED > <!ATTLIST ip iplist CDATA #IMPLIED >
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption|variable) "NetworkOption">
<!ELEMENT ip (#PCDATA)> <!--ip_type--> <!ATTLIST ip interface_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
<!ATTLIST ip service_restrictionlist CDATA #IMPLIED > <!ATTLIST ip interface CDATA #REQUIRED>
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption) "NetworkOption"> <!ATTLIST ip netmask_type (NetmaskOption|SymLinkOption|variable) "NetmaskOption">
<!ATTLIST ip interface_type (UnicodeOption|SymLinkOption) "UnicodeOption"> <!ATTLIST ip netmask CDATA "255.255.255.255">
<!ATTLIST ip interface CDATA #REQUIRED> <!--interface_type-->
<!ATTLIST ip netmask_type (NetmaskOption|SymLinkOption) "NetmaskOption">
<!ATTLIST ip netmask CDATA "255.255.255.255"> <!--netmask_type-->
<!ELEMENT interface (#PCDATA)>
<!ATTLIST interface interfacelist CDATA #IMPLIED >
<!ATTLIST interface linkto CDATA #REQUIRED >
<!ATTLIST interface ip CDATA #REQUIRED> <!--SymLinkOption-->
<!ATTLIST interface ip_type (SymLinkOption) "SymLinkOption">
<!ATTLIST interface mask CDATA #REQUIRED> <!--SymLinkOption-->
<!ATTLIST interface mask_type (SymLinkOption) "SymLinkOption">
<!ATTLIST interface bcast CDATA #IMPLIED> <!--SymLinkOption-->
<!ATTLIST interface bcast_type (SymLinkOption) "SymLinkOption">
<!ATTLIST interface gateway CDATA #IMPLIED> <!--SymLinkOption-->
<!ATTLIST interface gateway_type (SymLinkOption) "SymLinkOption">
<!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 > <!--SymLinkOption-->
<!ATTLIST host name_type (SymLinkOption) "SymLinkOption">
<!ATTLIST host ip CDATA #REQUIRED > <!--SymLinkOption-->
<!ATTLIST host ip_type (SymLinkOption) "SymLinkOption">
<!ATTLIST host crossed (True|False) "True" >
<!ATTLIST host comment CDATA #IMPLIED >
<!ELEMENT fstab EMPTY >
<!ATTLIST fstab name CDATA #REQUIRED> <!--name_type-->
<!ATTLIST fstab name_type (FilenameOption|SymLinkOption) "FilenameOption">
<!ATTLIST fstab type (bind|normal) "bind">
<!ATTLIST fstab fstype (auto|ext3|ext4|nfs|smb) "auto">
<!ATTLIST fstab mount_point CDATA #IMPLIED> <!--mount_point_type-->
<!ATTLIST fstab mount_point_type (FilenameOption|SymLinkOption) "FilenameOption">
<!ATTLIST fstab options CDATA #IMPLIED>
<!ATTLIST fstab checks CDATA #IMPLIED>
<!ATTLIST fstab fstablist CDATA #IMPLIED>
<!ELEMENT package (#PCDATA)> <!ELEMENT package (#PCDATA)>
<!ATTLIST package packagelist CDATA #IMPLIED > <!ATTLIST package packagelist CDATA #IMPLIED >
<!ELEMENT disknod (#PCDATA)>
<!ELEMENT file EMPTY> <!ELEMENT file EMPTY>
<!ATTLIST file name CDATA #REQUIRED > <!ATTLIST file name CDATA #REQUIRED >
<!ATTLIST file file_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
<!ATTLIST file variable CDATA #IMPLIED>
<!ATTLIST file variable_type (variable) "variable">
<!ATTLIST file source CDATA #IMPLIED> <!ATTLIST file source CDATA #IMPLIED>
<!ATTLIST file mode CDATA #IMPLIED > <!ATTLIST file mode CDATA "0644">
<!ATTLIST file owner CDATA #IMPLIED > <!ATTLIST file owner CDATA "root">
<!ATTLIST file group CDATA #IMPLIED > <!ATTLIST file group CDATA "root">
<!ATTLIST file filelist CDATA #IMPLIED > <!ATTLIST file filelist CDATA #IMPLIED >
<!ATTLIST file mkdir (True|False) "False"> <!ATTLIST file mkdir (True|False) "False">
<!ATTLIST file rm (True|False) "False"> <!ATTLIST file rm (True|False) "False">
<!ATTLIST file del_comment CDATA #IMPLIED >
<!ATTLIST file redefine (True|False) "False"> <!ATTLIST file redefine (True|False) "False">
<!ELEMENT digitalcertificate EMPTY>
<!ATTLIST digitalcertificate name CDATA #REQUIRED >
<!ATTLIST digitalcertificate digitalcertificate_type (variable) "variable">
<!ATTLIST digitalcertificate certificate CDATA #REQUIRED >
<!ATTLIST digitalcertificate certificate_type (variable) "variable">
<!ATTLIST digitalcertificate type CDATA #REQUIRED >
<!ATTLIST digitalcertificate ca CDATA #REQUIRED >
<!ELEMENT variables (family*, separators*)> <!ELEMENT variables (family*, separators*)>
<!ELEMENT family (#PCDATA | variable)*> <!ELEMENT family (#PCDATA | variable)*>
<!ATTLIST family name CDATA #REQUIRED> <!ATTLIST family name CDATA #REQUIRED>
@ -166,6 +125,7 @@
<!ATTLIST family mode (basic|normal|expert) "basic"> <!ATTLIST family mode (basic|normal|expert) "basic">
<!ATTLIST family icon CDATA #IMPLIED> <!ATTLIST family icon CDATA #IMPLIED>
<!ATTLIST family hidden (True|False) "False"> <!ATTLIST family hidden (True|False) "False">
<!ATTLIST family dynamic CDATA #IMPLIED>
<!ELEMENT variable (#PCDATA | value)*> <!ELEMENT variable (#PCDATA | value)*>
<!ATTLIST variable name CDATA #REQUIRED> <!ATTLIST variable name CDATA #REQUIRED>
@ -174,6 +134,7 @@
<!ATTLIST variable hidden (True|False) "False"> <!ATTLIST variable hidden (True|False) "False">
<!ATTLIST variable disabled (True|False) "False"> <!ATTLIST variable disabled (True|False) "False">
<!ATTLIST variable multi (True|False) "False"> <!ATTLIST variable multi (True|False) "False">
<!ATTLIST variable submulti (True|False) "False">
<!ATTLIST variable redefine (True|False) "False"> <!ATTLIST variable redefine (True|False) "False">
<!ATTLIST variable exists (True|False) "True"> <!ATTLIST variable exists (True|False) "True">
<!ATTLIST variable mandatory (True|False) "False"> <!ATTLIST variable mandatory (True|False) "False">
@ -182,6 +143,7 @@
<!ATTLIST variable mode (basic|normal|expert) "normal"> <!ATTLIST variable mode (basic|normal|expert) "normal">
<!ATTLIST variable remove_check (True|False) "False"> <!ATTLIST variable remove_check (True|False) "False">
<!ATTLIST variable remove_condition (True|False) "False"> <!ATTLIST variable remove_condition (True|False) "False">
<!ATTLIST variable test CDATA #IMPLIED>
<!ELEMENT separators (separator*)> <!ELEMENT separators (separator*)>
@ -212,18 +174,18 @@
<!ELEMENT group (slave+)> <!ELEMENT group (slave+)>
<!ATTLIST group master CDATA #REQUIRED> <!ATTLIST group master CDATA #REQUIRED>
<!ATTLIST group description CDATA #IMPLIED>
<!ELEMENT param (#PCDATA)> <!ELEMENT param (#PCDATA)>
<!ATTLIST param type (string|eole|number|container|context|python) "string"> <!ATTLIST param type (string|variable|number|python) "string">
<!ATTLIST param name CDATA #IMPLIED> <!ATTLIST param name CDATA #IMPLIED>
<!ATTLIST param hidden (True|False) "True"> <!ATTLIST param hidden (True|False) "True">
<!ATTLIST param optional (True|False) "False"> <!ATTLIST param optional (True|False) "False">
<!ELEMENT target (#PCDATA)> <!ELEMENT target (#PCDATA)>
<!ATTLIST target type (family|filelist|servicelist|interfacelist|variable|service_accesslist|service_restrictionlist|hostlist|fstablist|actionlist) "variable"> <!ATTLIST target type (family|variable|filelist|iplist|portlist|tcpwrapperlist|packagelist|actionlist) "variable">
<!ATTLIST target optional (True|False) "False"> <!ATTLIST target optional (True|False) "False">
<!ELEMENT slave (#PCDATA)> <!ELEMENT slave (#PCDATA)>
<!ELEMENT help ((variable* | family*)*)> <!ELEMENT help ((variable* | family*)*)>

View File

@ -6,16 +6,14 @@ from os import listdir
#from ast import literal_eval #from ast import literal_eval
from lxml.etree import parse, DTD from lxml.etree import parse, DTD
from tiramisu.option import (StrOption, OptionDescription, PortOption, from tiramisu import (StrOption, OptionDescription, DynOptionDescription, PortOption,
IntOption, ChoiceOption, BoolOption, SymLinkOption, IPOption, IntOption, ChoiceOption, BoolOption, SymLinkOption, IPOption,
NetworkOption, NetmaskOption, DomainnameOption, BroadcastOption, NetworkOption, NetmaskOption, DomainnameOption, BroadcastOption,
URLOption, EmailOption, FilenameOption, UsernameOption, DateOption, URLOption, EmailOption, FilenameOption, UsernameOption, DateOption,
PasswordOption, BoolOption, MACOption, Leadership) PasswordOption, BoolOption, MACOption, Leadership, submulti,
from tiramisu import Config, MetaConfig, MixConfig Params, ParamSelfOption, ParamOption, ParamValue, Calculation, calc_value,
from tiramisu.setting import groups groups, owners)
from tiramisu.error import ConfigError from tiramisu.error import ConfigError
from tiramisu.setting import owners
from tiramisu import Params, ParamOption, ParamValue, ParamContext, Calculation, calc_value
from .config import dtdfilename from .config import dtdfilename
from .i18n import _ from .i18n import _
@ -23,9 +21,21 @@ from .i18n import _
from .xmlreflector import HIGH_COMPATIBILITY from .xmlreflector import HIGH_COMPATIBILITY
#from . import eosfunc #from . import eosfunc
from .objspace import CreoleObjSpace from .objspace import CreoleObjSpace
from .utils import normalize_family
import imp import imp
FUNC_TO_DICT = ['valid_not_equal']
class ConvertDynOptionDescription(DynOptionDescription):
def convert_suffix_to_path(self, suffix):
if not isinstance(suffix, str):
suffix = str(suffix)
return normalize_family(suffix,
check_name=False)
class CreoleLoaderError(Exception): class CreoleLoaderError(Exception):
pass pass
@ -81,7 +91,9 @@ CONVERT_OPTION = {'number': dict(opttype=IntOption),
'hostname_strict': dict(opttype=DomainnameOption, initkwargs={'type': 'hostname', 'allow_ip': False}), 'hostname_strict': dict(opttype=DomainnameOption, initkwargs={'type': 'hostname', 'allow_ip': False}),
'web_address': dict(opttype=URLOption, initkwargs={'allow_ip': True, 'allow_without_dot': True}), 'web_address': dict(opttype=URLOption, initkwargs={'allow_ip': True, 'allow_without_dot': True}),
'port': dict(opttype=PortOption, initkwargs={'allow_private': True}), 'port': dict(opttype=PortOption, initkwargs={'allow_private': True}),
'mac': dict(opttype=MACOption) 'mac': dict(opttype=MACOption),
'cidr': dict(opttype=IPOption, initkwargs={'cidr': True}),
'network_cidr': dict(opttype=NetworkOption, initkwargs={'cidr': True}),
} }
@ -117,9 +129,12 @@ class PopulateTiramisuObjects(object):
def make_tiramisu_objects(self, xmlroot, creolefunc_file): def make_tiramisu_objects(self, xmlroot, creolefunc_file):
elt = Elt({'name': 'baseoption'}) elt = Elt({'name': 'baseoption'})
family = Family(elt, self.booleans, self.storage) if creolefunc_file is None:
self.storage.add('.', family) self.eosfunc = None
else:
self.eosfunc = imp.load_source('eosfunc', creolefunc_file) self.eosfunc = imp.load_source('eosfunc', creolefunc_file)
family = Family(elt, self.booleans, self.storage, self.eosfunc)
self.storage.add('.', family)
elts = {} elts = {}
for elt in xmlroot: for elt in xmlroot:
@ -167,7 +182,7 @@ class PopulateTiramisuObjects(object):
force_icon = False force_icon = False
else: else:
force_icon = not subpath.startswith('containers') and not subpath.startswith('actions') force_icon = not subpath.startswith('containers') and not subpath.startswith('actions')
family = Family(elt, self.booleans, self.storage, force_icon) family = Family(elt, self.booleans, self.storage, self.eosfunc, force_icon)
path = self._build_path(subpath, elt) path = self._build_path(subpath, elt)
self.storage.add(path, family) self.storage.add(path, family)
return family return family
@ -181,7 +196,7 @@ class PopulateTiramisuObjects(object):
def _iter_leader(self, leader, subpath): def _iter_leader(self, leader, subpath):
subpath = self._build_path(subpath, leader) subpath = self._build_path(subpath, leader)
family = Family(leader, self.booleans, self.storage) family = Family(leader, self.booleans, self.storage, self.eosfunc)
family.set_leader() family.set_leader()
self.storage.add(subpath, family) self.storage.add(subpath, family)
leader_name = None leader_name = None
@ -301,15 +316,19 @@ class Variable(Common):
self.attrib['validators'] = [] self.attrib['validators'] = []
self.eosfunc = eosfunc self.eosfunc = eosfunc
self.storage = storage self.storage = storage
is_submulti = False
for key, value in elt.attrib.items(): for key, value in elt.attrib.items():
if key in booleans: if key in booleans:
if value == 'True': if value == 'True':
value = True value = True
elif value == 'False': elif value == 'False':
value = False value = False
elif key == 'multi' and value == 'submulti':
is_submulti = True
value = submulti
else: else:
raise CreoleLoaderError(_('unknown value {} for {}').format(value, key)) raise CreoleLoaderError(_('unknown value {} for {}').format(value, key))
if key == 'help': if key in ['help', 'test']:
self.add_information(key, value) self.add_information(key, value)
elif key == 'type': elif key == 'type':
pass pass
@ -343,7 +362,7 @@ class Variable(Common):
self.attrib['properties'].append(child.text) self.attrib['properties'].append(child.text)
elif child.tag == 'value': elif child.tag == 'value':
if child.attrib.get('type') == 'calculation': if child.attrib.get('type') == 'calculation':
if child.text.strip(): if child.text is not None and child.text.strip():
self.attrib['default'] = (child.text.strip(),) self.attrib['default'] = (child.text.strip(),)
else: else:
params = [] params = []
@ -355,13 +374,22 @@ class Variable(Common):
type_ = CONVERT_OPTION[child.attrib['type']]['opttype'] type_ = CONVERT_OPTION[child.attrib['type']]['opttype']
else: else:
type_ = self.object_type type_ = self.object_type
if self.attrib['multi'] and not is_follower: if self.attrib['multi'] is True and not is_follower:
if 'default' not in self.attrib: if 'default' not in self.attrib:
self.attrib['default'] = [] self.attrib['default'] = []
value = convert_tiramisu_value(child.text, type_) value = convert_tiramisu_value(child.text, type_)
self.attrib['default'].append(value) self.attrib['default'].append(value)
if 'default_multi' not in self.attrib and not is_leader: if 'default_multi' not in self.attrib and not is_leader:
self.attrib['default_multi'] = value self.attrib['default_multi'] = value
elif self.attrib['multi'] == submulti:
if 'default' not in self.attrib:
self.attrib['default'] = []
value = convert_tiramisu_value(child.text, type_)
if not isinstance(value, list) and not is_follower:
value = [value]
self.attrib['default'].append(value)
if 'default_multi' not in self.attrib and not is_leader:
self.attrib['default_multi'] = value
else: else:
if 'default' in self.attrib: if 'default' in self.attrib:
raise CreoleLoaderError(_('default value already set for {}' raise CreoleLoaderError(_('default value already set for {}'
@ -395,7 +423,7 @@ class Variable(Common):
name = param.attrib.get('name', '') name = param.attrib.get('name', '')
if param.attrib['type'] == 'string': if param.attrib['type'] == 'string':
value = param.text value = param.text
elif param.attrib['type'] == 'eole': elif param.attrib['type'] == 'variable':
transitive = param.attrib.get('transitive', 'False') transitive = param.attrib.get('transitive', 'False')
if transitive == 'True': if transitive == 'True':
transitive = True transitive = True
@ -426,11 +454,17 @@ class Variable(Common):
ret = [] ret = []
for value in values: for value in values:
if isinstance(value, tuple): if isinstance(value, tuple):
if key == 'validators':
args = [ParamSelfOption()]
else:
args = [] args = []
kwargs = {} kwargs = {}
if len(value) == 3: if len(value) == 3:
for param in value[1]: for param in value[1]:
if isinstance(param[1], list): if isinstance(param[1], list):
if value[0] in FUNC_TO_DICT:
param_value = ParamOption(self.storage.get(param[1][0]).get(), notraisepropertyerror=param[1][1], todict=True)
else:
param_value = ParamOption(self.storage.get(param[1][0]).get(), notraisepropertyerror=param[1][1]) param_value = ParamOption(self.storage.get(param[1][0]).get(), notraisepropertyerror=param[1][1])
else: else:
param_value = ParamValue(param[1]) param_value = ParamValue(param[1])
@ -474,7 +508,7 @@ class Variable(Common):
class Family(Common): class Family(Common):
def __init__(self, elt, booleans, storage, force_icon=False): def __init__(self, elt, booleans, storage, eosfunc, force_icon=False):
self.option = None self.option = None
self.attrib = {} self.attrib = {}
self.is_leader = False self.is_leader = False
@ -484,6 +518,7 @@ class Family(Common):
self.informations = {} self.informations = {}
self.children = [] self.children = []
self.storage = storage self.storage = storage
self.eosfunc = eosfunc
self.attrib['properties'] = [] self.attrib['properties'] = []
for key, value in elt.attrib.items(): for key, value in elt.attrib.items():
if key in booleans: if key in booleans:
@ -528,11 +563,16 @@ class Family(Common):
self.attrib['children'].append(child.get()) self.attrib['children'].append(child.get())
self.build_properties() self.build_properties()
try: try:
if not self.is_leader: if 'dynamic' in self.attrib:
dynamic = self.storage.get(self.attrib['dynamic']).get()
del self.attrib['dynamic']
self.attrib['suffixes'] = Calculation(self.eosfunc.calc_value,
Params((ParamOption(dynamic),)))
option = ConvertDynOptionDescription(**self.attrib)
elif not self.is_leader:
option = OptionDescription(**self.attrib) option = OptionDescription(**self.attrib)
else: else:
option = Leadership(**self.attrib) option = Leadership(**self.attrib)
#option = OptionDescription(**self.attrib)
except Exception as err: except Exception as err:
raise CreoleLoaderError(_('cannot create optiondescription {}: {}').format(self.attrib['name'], err)) raise CreoleLoaderError(_('cannot create optiondescription {}: {}').format(self.attrib['name'], err))
for key, value in self.informations.items(): for key, value in self.informations.items():

View File

@ -30,16 +30,16 @@ from json import dump
from .i18n import _ from .i18n import _
from .xmlreflector import XMLReflector, HIGH_COMPATIBILITY 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 .utils import normalize_family
from .error import CreoleOperationError, SpaceObjShallNotBeUpdated, CreoleDictConsistencyError from .error import CreoleOperationError, SpaceObjShallNotBeUpdated, CreoleDictConsistencyError
# CreoleObjSpace's elements like 'family' or 'slave', that shall be forced to the Redefinable type # 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 # CreoleObjSpace's elements that shall be forced to the UnRedefinable type
FORCE_UNREDEFINABLES = ('value', 'input', 'profile', 'ewtapp', 'tag', 'saltaction') FORCE_UNREDEFINABLES = ('value', 'input', 'profile', 'ewtapp', 'tag', 'saltaction')
# CreoleObjSpace's elements that shall be set to the UnRedefinable type # CreoleObjSpace's elements that shall be set to the UnRedefinable type
UNREDEFINABLE = ('multi', 'type') UNREDEFINABLE = ('submulti', 'multi', 'type')
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze', PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
'force_store_value', 'disabled', 'mandatory') 'force_store_value', 'disabled', 'mandatory')
@ -47,6 +47,8 @@ CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force
RENAME_ATTIBUTES = {'description': 'doc'} RENAME_ATTIBUTES = {'description': 'doc'}
INCOMPATIBLE_ATTRIBUTES = [['multi', 'submulti']]
#TYPE_TARGET_CONDITION = ('variable', 'family') #TYPE_TARGET_CONDITION = ('variable', 'family')
# _____________________________________________________________________________ # _____________________________________________________________________________
@ -86,12 +88,8 @@ class CreoleObjSpace(object):
self.redefine_variables = None self.redefine_variables = None
self.probe_variables = [] self.probe_variables = []
# elt container's attrs list
self.container_elt_attr_list = [] #
# ['variable', 'separator', 'family'] # ['variable', 'separator', 'family']
self.forced_text_elts = set() self.forced_text_elts = set()
# ['disknod', 'follower', 'target', 'service', 'package', 'ip', 'value', 'tcpwrapper',
# 'interface', 'input', 'port']
self.forced_text_elts_as_name = set(['choice', 'property']) self.forced_text_elts_as_name = set(['choice', 'property'])
self.forced_choice_option = {} self.forced_choice_option = {}
self.paths = Path() self.paths = Path()
@ -106,8 +104,7 @@ class CreoleObjSpace(object):
forced_text_elt = False forced_text_elt = False
if elt.type == 'mixed': if elt.type == 'mixed':
forced_text_elt = True forced_text_elt = True
if elt.name == 'container': if elt.name == 'service':
self.container_elt_attr_list = [elt.content.left.name]
self.parse_dtd_right_left_elt(elt.content) self.parse_dtd_right_left_elt(elt.content)
for attr in elt.iterattributes(): for attr in elt.iterattributes():
atomic = False atomic = False
@ -152,10 +149,7 @@ class CreoleObjSpace(object):
def parse_dtd_right_left_elt(self, elt): def parse_dtd_right_left_elt(self, elt):
if elt.right.type == 'or': if elt.right.type == 'or':
self.container_elt_attr_list.append(elt.right.left.name)
self.parse_dtd_right_left_elt(elt.right) self.parse_dtd_right_left_elt(elt.right)
else:
self.container_elt_attr_list.append(elt.right.name)
def _convert_boolean(self, value): # pylint: disable=R0201 def _convert_boolean(self, value): # pylint: disable=R0201
"""Boolean coercion. The Creole XML may contain srings like `True` or `False` """Boolean coercion. The Creole XML may contain srings like `True` or `False`
@ -297,7 +291,7 @@ class CreoleObjSpace(object):
def create_tree_structure(self, space, child, creoleobj): # pylint: disable=R0201 def create_tree_structure(self, space, child, creoleobj): # pylint: disable=R0201
""" """
Builds the tree structure of the object space here 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:: for example::
space = Family() space = Family()
@ -363,6 +357,15 @@ class CreoleObjSpace(object):
'not {}').format(attr, val)) 'not {}').format(attr, val))
if not (attr == 'name' and getattr(creoleobj, 'name', None) != None): if not (attr == 'name' and getattr(creoleobj, 'name', None) != None):
setattr(creoleobj, attr, val) setattr(creoleobj, attr, val)
keys = list(vars(creoleobj).keys())
for incompatible in INCOMPATIBLE_ATTRIBUTES:
found = False
for inc in incompatible:
if inc in keys:
if found:
raise CreoleDictConsistencyError(_('those attributes are incompatible {}').format(incompatible))
found = True
def _creoleobj_tree_visitor(self, child, creoleobj, namespace): def _creoleobj_tree_visitor(self, child, creoleobj, namespace):
"""Creole object tree manipulations """Creole object tree manipulations
@ -458,7 +461,7 @@ class CreoleObjSpace(object):
def space_visitor(self, eosfunc_file): # pylint: disable=C0111 def space_visitor(self, eosfunc_file): # pylint: disable=C0111
ActionAnnotator(self) ActionAnnotator(self)
ContainerAnnotator(self) ServiceAnnotator(self)
SpaceAnnotator(self, eosfunc_file) SpaceAnnotator(self, eosfunc_file)
def save(self, filename, force_no_save=False): def save(self, filename, force_no_save=False):
@ -513,11 +516,9 @@ class CreoleObjSpace(object):
for subspace in space: for subspace in space:
if isinstance(subspace, self.Leadership): if isinstance(subspace, self.Leadership):
_name = 'leader' _name = 'leader'
subspace.doc = subspace.variable[0].description
#subspace.doc = 'Leadership {}'.format(subspace.name)
else: else:
_name = name _name = name
if name in ['containers', 'variables', 'actions']: if name in ['services', 'variables', 'actions']:
_name = 'family' _name = 'family'
if HIGH_COMPATIBILITY and not hasattr(subspace, 'doc'): if HIGH_COMPATIBILITY and not hasattr(subspace, 'doc'):
subspace.doc = '' subspace.doc = ''
@ -526,7 +527,7 @@ class CreoleObjSpace(object):
child_node = SubElement(node, _name) child_node = SubElement(node, _name)
self._xml_export(child_node, subspace, _name) self._xml_export(child_node, subspace, _name)
elif isinstance(space, self.Atom): elif isinstance(space, self.Atom):
if name == 'containers': if name == 'services':
child_node = SubElement(node, 'family') child_node = SubElement(node, 'family')
child_node.attrib['name'] = name child_node.attrib['name'] = name
else: else:
@ -603,7 +604,9 @@ class Path(object):
def get_family_path(self, name, current_namespace): # pylint: disable=C0111 def get_family_path(self, name, current_namespace): # pylint: disable=C0111
if current_namespace is None: # pragma: no cover if current_namespace is None: # pragma: no cover
raise CreoleOperationError('current_namespace must not be None') raise CreoleOperationError('current_namespace must not be None')
dico = self.families[normalize_family(name, check_name=False)] dico = self.families[normalize_family(name,
check_name=False,
allow_dot=True)]
if dico['namespace'] != 'creole' and current_namespace != dico['namespace']: if dico['namespace'] != 'creole' and current_namespace != dico['namespace']:
raise CreoleDictConsistencyError(_('A family located in the {} namespace ' raise CreoleDictConsistencyError(_('A family located in the {} namespace '
'shall not be used in the {} namespace').format( 'shall not be used in the {} namespace').format(
@ -652,7 +655,7 @@ class Path(object):
raise CreoleOperationError('current_namespace must not be None') raise CreoleOperationError('current_namespace must not be None')
dico = self._get_variable(name) dico = self._get_variable(name)
if not allow_source: 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 ' raise CreoleDictConsistencyError(_('A variable located in the {} namespace '
'shall not be used in the {} namespace').format( 'shall not be used in the {} namespace').format(
dico['namespace'], current_namespace)) dico['namespace'], current_namespace))

View File

@ -8,20 +8,22 @@ import imp
import sys import sys
from shutil import copy from shutil import copy
import logging import logging
from typing import Dict from typing import Dict, Any
from subprocess import call from subprocess import call
from os import listdir, unlink from os import listdir, unlink, makedirs
from os.path import basename, join, split, isfile from os.path import dirname, basename, join, split, isfile, isdir
from tempfile import mktemp from tempfile import mktemp
from Cheetah import Parser from Cheetah import Parser
# l'encoding du template est déterminé par une regexp (encodingDirectiveRE dans Parser.py) # l'encoding du template est déterminé par une regexp (encodingDirectiveRE dans Parser.py)
# il cherche un ligne qui ressemble à '#encoding: utf-8 # il cherche un ligne qui ressemble à '#encoding: utf-8
# cette classe simule le module 're' et retourne toujours l'encoding utf-8 # cette classe simule le module 're' et retourne toujours l'encoding utf-8
# 6224 # 6224
class FakeEncoding(): class FakeEncoding:
def groups(self): def groups(self):
return ('utf-8',) return ('utf-8',)
@ -29,20 +31,23 @@ class FakeEncoding():
return self return self
Parser.encodingDirectiveRE = FakeEncoding() Parser.encodingDirectiveRE = FakeEncoding()
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
from tiramisu import Config from tiramisu import Config
from tiramisu.error import PropertiesOptionError
from .config import patch_dir, templatedir, distrib_dir from .config import patch_dir
from .error import FileNotFound, TemplateError, TemplateDisabled from .error import FileNotFound, TemplateError, TemplateDisabled
from .i18n import _ from .i18n import _
from .utils import normalize_family
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler()) log.addHandler(logging.NullHandler())
class IsDefined(object): class IsDefined:
""" """
filtre permettant de ne pas lever d'exception au cas où filtre permettant de ne pas lever d'exception au cas où
la variable Creole n'est pas définie la variable Creole n'est pas définie
@ -64,7 +69,7 @@ class IsDefined(object):
return varname in self.context return varname in self.context
class CreoleGet(object): class CreoleGet:
def __init__(self, context): def __init__(self, context):
self.context = context self.context = context
@ -112,25 +117,29 @@ class CheetahTemplate(ChtTemplate):
filename: str, filename: str,
context, context,
eosfunc: Dict, eosfunc: Dict,
config: Config, destfilename,
current_container: str): variable):
"""Initialize Creole CheetahTemplate """Initialize Creole CheetahTemplate
""" """
ChtTemplate.__init__(self, file=filename, extra_context = {'is_defined' : IsDefined(context),
searchList=[context, eosfunc, {'is_defined' : IsDefined(context), 'normalize_family': normalize_family,
'creole_client' : CreoleClient(config), 'rougail_filename': destfilename
'current_container':CreoleGet(current_container), }
}]) if variable:
extra_context['rougail_variable'] = variable
ChtTemplate.__init__(self,
file=filename,
searchList=[context, eosfunc, extra_context])
class CreoleMaster(object): class CreoleLeader:
def __init__(self, value, slave=None, index=None): def __init__(self, value, slave=None, index=None):
""" """
On rend la variable itérable pour pouvoir faire: On rend la variable itérable pour pouvoir faire:
for ip in iplist: for ip in iplist:
print ip.network print(ip.network)
print ip.netmask print(ip.netmask)
print ip print(ip)
index is used for CreoleLint index is used for CreoleLint
""" """
self._value = value self._value = value
@ -148,8 +157,8 @@ class CreoleMaster(object):
""" """
if name in self.slave: if name in self.slave:
value = self.slave[name] value = self.slave[name]
if isinstance(value, Exception): if isinstance(value, PropertiesOptionError):
raise value raise AttributeError()
return value return value
else: else:
return getattr(self._value, name) return getattr(self._value, name)
@ -160,7 +169,7 @@ class CreoleMaster(object):
ret = {} ret = {}
for key, values in self.slave.items(): for key, values in self.slave.items():
ret[key] = values[index] ret[key] = values[index]
return CreoleMaster(self._value[index], ret, index) return CreoleLeader(self._value[index], ret, index)
def __iter__(self): def __iter__(self):
"""Iterate over master.slave. """Iterate over master.slave.
@ -171,7 +180,7 @@ class CreoleMaster(object):
ret = {} ret = {}
for key, values in self.slave.items(): for key, values in self.slave.items():
ret[key] = values[i] ret[key] = values[i]
yield CreoleMaster(self._value[i], ret, i) yield CreoleLeader(self._value[i], ret, i)
def __len__(self): def __len__(self):
"""Delegate to master value """Delegate to master value
@ -179,7 +188,7 @@ class CreoleMaster(object):
return len(self._value) return len(self._value)
def __repr__(self): def __repr__(self):
"""Show CreoleMaster as dictionary. """Show CreoleLeader as dictionary.
The master value is stored under 'value' key. The master value is stored under 'value' key.
The slaves are stored under 'slave' key. The slaves are stored under 'slave' key.
@ -218,31 +227,30 @@ class CreoleMaster(object):
def __contains__(self, item): def __contains__(self, item):
return item in self._value return item in self._value
def add_slave(self, name, value): async def add_slave(self, config, name, path):
"""Add a slave variable
Minimal check on type and value of the slave in regards to the
master one.
@param name: name of the slave variable
@type name: C{str}
@param value: value of the slave variable
"""
if isinstance(self._value, list): if isinstance(self._value, list):
if not isinstance(value, list): values = []
raise TypeError for idx in range(len(self._value)):
elif len(value) != len(self._value): try:
raise ValueError(_('length mismatch')) values.append(await config.option(path, idx).value.get())
new_value = [] except PropertiesOptionError as err:
for val in value: values.append(err)
if isinstance(val, dict):
new_value.append(ValueError(val['err']))
else: else:
new_value.append(val) raise Exception('hu?')
value = new_value self.slave[name] = values
elif isinstance(value, list):
raise TypeError
self.slave[name] = value class CreoleExtra:
def __init__(self,
suboption: Dict) -> None:
self.suboption = suboption
def __getattr__(self,
key: str) -> Any:
return self.suboption[key]
def __repr__(self):
return self.suboption.__str__()
class CreoleTemplateEngine: class CreoleTemplateEngine:
@ -250,51 +258,68 @@ class CreoleTemplateEngine:
""" """
def __init__(self, def __init__(self,
config: Config, config: Config,
eosfunc_file: str): eosfunc_file: str,
distrib_dir: str,
tmp_dir: str,
dest_dir:str) -> None:
self.config = config self.config = config
self.dest_dir = dest_dir
self.tmp_dir = tmp_dir
self.distrib_dir = distrib_dir
eos = {} eos = {}
if eosfunc_file is not None:
eosfunc = imp.load_source('eosfunc', eosfunc_file) eosfunc = imp.load_source('eosfunc', eosfunc_file)
for func in dir(eosfunc): for func in dir(eosfunc):
if not func.startswith('_'): if not func.startswith('_'):
eos[func] = getattr(eosfunc, func) eos[func] = getattr(eosfunc, func)
self.eosfunc = eos self.eosfunc = eos
self.creole_variables_dict = {} self.creole_variables_dict = {}
self.load_eole_variables(self.config.option('creole'))
def load_eole_variables(self, optiondescription): async def load_eole_variables_creole(self,
# remplacement des variables EOLE optiondescription):
for option in optiondescription.list('all'): for option in await optiondescription.list('all'):
if option.option.isoptiondescription(): if await option.option.isoptiondescription():
if option.option.isleadership(): if await option.option.isleadership():
print('leadership') for idx, suboption in enumerate(await option.list('all')):
raise Exception('a faire') if idx == 0:
leader = CreoleLeader(await suboption.value.get())
self.creole_variables_dict[await suboption.option.name()] = leader
else: else:
self.load_eole_variables(option) await leader.add_slave(self.config,
await suboption.option.name(),
await suboption.option.path())
else: else:
self.creole_variables_dict[option.option.name()] = option.value.get() await self.load_eole_variables_creole(option)
#if varname.find('.') != -1: else:
# #support des groupes self.creole_variables_dict[await option.option.name()] = await option.value.get()
# mastername, slavename = varname.split('.')
# if not mastername in self.creole_variables_dict or not \ async def load_eole_variables(self,
# isinstance(self.creole_variables_dict [mastername], namespace,
# CreoleMaster): optiondescription):
# # Create the master variable families = {}
# if mastername in values: for family in await optiondescription.list('all'):
# self.creole_variables_dict[mastername] = CreoleMaster(values[mastername]) variables = {}
# else: for variable in await family.list('all'):
# #only for CreoleLint if await variable.option.isoptiondescription() and await variable.option.isleadership():
# self.creole_variables_dict[mastername] = CreoleMaster(value) for idx, suboption in enumerate(await variable.list('all')):
# #test only for CreoleLint if idx == 0:
# if mastername != slavename: leader = CreoleLeader(await suboption.value.get())
# self.creole_variables_dict[mastername].add_slave(slavename, value) leader_name = await suboption.option.name()
#else: else:
# self.creole_variables_dict[varname] = value await leader.add_slave(self.config,
await suboption.option.name(),
await suboption.option.path())
variables[leader_name] = leader
else:
variables[await variable.option.name()] = await variable.value.get()
families[await family.option.name()] = CreoleExtra(variables)
self.creole_variables_dict[namespace] = CreoleExtra(families)
def patch_template(self, def patch_template(self,
filename: str): filename: str):
"""Apply patch to a template """Apply patch to a template
""" """
patch_cmd = ['patch', '-d', templatedir, '-N', '-p1'] patch_cmd = ['patch', '-d', self.tmp_dir, '-N', '-p1']
patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch'] patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch']
# patches variante + locaux # patches variante + locaux
@ -306,50 +331,31 @@ class CreoleTemplateEngine:
if ret: if ret:
patch_cmd_err = ' '.join(patch_cmd + ['-i', patch_file]) patch_cmd_err = ' '.join(patch_cmd + ['-i', patch_file])
log.error(_(f"Error applying patch: '{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(filename, templatedir) copy(filename, self.tmp_dir)
def strip_template_comment(self,
filename: str):
"""Strip comment from template
This apply if filevar has a del_comment attribut
"""
# suppression des commentaires si demandé (attribut del_comment)
if 'del_comment' in filevar and filevar['del_comment'] != '':
strip_cmd = ['sed', '-i']
log.info(_("Cleaning file '{0}'").format( filevar['source'] ))
raise Exception('hu')
#ret, out, err = pyeole.process.system_out(strip_cmd
# + ['/^\s*{0}/d ; /^$/d'.format(filevar['del_comment']),
# filevar['source'] ])
#if ret != 0:
# msg = _("Error removing comments '{0}': {1}")
# raise TemplateError(msg.format(filevar['del_comment'], err))
def prepare_template(self, def prepare_template(self,
filename: str): filename: str):
"""Prepare template source file """Prepare template source file
""" """
log.info(_("Copy template: '{filename}' -> '{templatedir}'")) log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
copy(filename, templatedir) copy(filename, self.tmp_dir)
self.patch_template(filename) self.patch_template(filename)
# self.strip_template_comment(filename)
def process(self, def process(self,
destfilename: str,
filevar: Dict, filevar: Dict,
container: str): variable: Any):
"""Process a cheetah template """Process a cheetah template
""" """
# full path of the destination file # full path of the destination file
destfilename = join(dest_dir, filevar['source'])
log.info(_(f"Cheetah processing: '{destfilename}'")) log.info(_(f"Cheetah processing: '{destfilename}'"))
try: try:
cheetah_template = CheetahTemplate(join(templatedir, filevar['source']), cheetah_template = CheetahTemplate(join(self.tmp_dir,
filevar['source']),
self.creole_variables_dict, self.creole_variables_dict,
self.eosfunc, self.eosfunc,
self.config.config.copy(), destfilename,
container) variable)
data = str(cheetah_template) data = str(cheetah_template)
except CheetahNotFound as err: except CheetahNotFound as err:
varname = err.args[0][13:-1] varname = err.args[0][13:-1]
@ -360,83 +366,78 @@ class CreoleTemplateEngine:
with open(destfilename, 'w') as file_h: with open(destfilename, 'w') as file_h:
file_h.write(data) file_h.write(data)
def change_properties(self,
filevar: Dict):
destfilename = join(dest_dir, filevar['source'])
#chowncmd = ['chown']
#chownarg = ''
chmodcmd = ['chmod']
chmodarg = ''
#if 'owner' in filevar and filevar['owner']:
# chownarg = filevar['owner']
#else:
# chownarg = 'root'
#if 'group' in filevar and filevar['group']:
# chownarg += ":" + filevar['group']
#else:
# chownarg += ':root'
if 'mode' in filevar and filevar['mode']:
chmodarg = filevar['mode']
else:
chmodarg = '0644'
#chowncmd.extend( [chownarg, destfilename] )
chmodcmd.extend([chmodarg, destfilename])
#log.info(_('Changing properties: {0}').format(' '.join(chowncmd)) )
#ret = call(chowncmd)
#if ret:
# log.error(_('Error changing properties {0}: {1}').format(ret, err) )
log.info(_('Changing properties: {0}').format(' '.join(chmodcmd)) )
ret = call(chmodcmd)
if ret:
chmod_cmd = ' '.join(chmodcmd)
log.error(_(f'Error changing properties: {chmodcmd}'))
def instance_file(self, def instance_file(self,
filevar: Dict, filevar: Dict,
container: str): systemd_rights: list) -> None:
"""Run templatisation on one file of one container """Run templatisation on one file
""" """
log.info(_("Instantiating file '{filename}'")) log.info(_("Instantiating file '{filename}'"))
self.process(filevar, filenames = filevar['name']
container) if 'variable' in filevar:
self.change_properties(filevar) variable = filevar['variable']
else:
variable = None
if not isinstance(filenames, list):
filenames = [filenames]
if variable:
variable = [variable]
for idx, filename in enumerate(filenames):
destfilename = join(self.dest_dir,
filename[1:])
makedirs(dirname(destfilename), exist_ok=True)
if variable:
var = variable[idx]
else:
var = None
self.process(destfilename,
filevar,
var)
systemd_rights.append(f'C {filename} {filevar["mode"]} {filevar["owner"]} {filevar["group"]} - -')
systemd_rights.append(f'z {filename} - - - - -')
def instance_files(self, async def instance_files(self) -> None:
container=None): """Run templatisation on all files
"""Run templatisation on all files of all containers
@param container: name of a container
@type container: C{str}
""" """
for template in listdir(distrib_dir): for option in await self.config.option.list(type='all'):
self.prepare_template(join(distrib_dir, template)) namespace = await option.option.name()
for container_obj in self.config.option('containers').list('all'): if namespace in ['services', 'actions']:
current_container = container_obj.option.doc()
if container is not None and container != current_container:
continue continue
for fills in container_obj.list('all'): elif namespace == 'creole':
if fills.option.name() == 'files': await self.load_eole_variables_creole(option)
for fill_obj in fills.list('all'): else:
fill = fill_obj.value.dict() await self.load_eole_variables(namespace,
option)
for template in listdir(self.distrib_dir):
self.prepare_template(join(self.distrib_dir, template))
systemd_rights = []
for service_obj in await self.config.option('services').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()
filename = fill['source'] filename = fill['source']
if not isfile(join(distrib_dir, filename)): distib_file = join(self.distrib_dir, filename)
raise FileNotFound(_(f"File {filename} does not exist.")) if not isfile(distib_file):
print(fill) raise FileNotFound(_(f"File {distib_file} does not exist."))
if fill['activate']: if fill.get('activate', False):
self.instance_file(fill, current_container) self.instance_file(fill,
systemd_rights)
else: else:
log.debug(_("Instantiation of file '{filename}' disabled")) log.debug(_("Instantiation of file '{filename}' disabled"))
with open(join(self.dest_dir, 'rougail.conf'), 'w') as fh:
fh.write('\n'.join(systemd_rights))
fh.write('\n')
def generate(config: Config,
async def generate(config: Config,
eosfunc_file: str, eosfunc_file: str,
container: str=None): distrib_dir: str,
tmp_dir: str,
dest_dir: str) -> None:
engine = CreoleTemplateEngine(config, engine = CreoleTemplateEngine(config,
eosfunc_file) eosfunc_file,
engine.instance_files(container=container) distrib_dir,
tmp_dir,
dest_dir)
await engine.instance_files()

View File

@ -2,25 +2,22 @@
utilitaires créole utilitaires créole
""" """
import unicodedata import unicodedata
from .i18n import _
# définition des classes d'adresse IP existantes def normalize_family(family_name: str,
def normalize_family(family_name, check_name=True): check_name: bool=True,
allow_dot: bool=False) -> str:
"""replace space, accent, uppercase, ... by valid character
""" """
il ne faut pas d'espace, d'accent, de majuscule, de tiré, ... family_name = family_name.replace('-', '_')
dans le nom des familles if not allow_dot:
""" family_name = family_name.replace('.', '_')
f = family_name family_name = family_name.replace(' ', '_')
f = f.replace('-', '_') nfkd_form = unicodedata.normalize('NFKD', family_name)
#f = f.replace(u'é', 'e') family_name = ''.join([c for c in nfkd_form if not unicodedata.combining(c)])
#f = f.replace(u'è', 'e') family_name = family_name.lower()
nfkd_form = unicodedata.normalize('NFKD', f) if check_name and family_name == 'containers':
f = u"".join([c for c in nfkd_form if not unicodedata.combining(c)]) raise ValueError(_(f'"{family_name}" is a forbidden family name'))
f = f.replace(' ', '_') return family_name
f = f.lower()
if f[0].isnumeric():
raise ValueError(u'Le nom de la famille ne doit pas commencer par un chiffre : {0}'.format(f))
if check_name and f == 'containers':
raise ValueError(u'nom de la famille interdit {0}'.format(f))
return f

View File

@ -1,4 +1,4 @@
from tiramisu import valid_not_equal, valid_ip_netmask from tiramisu import valid_not_equal, valid_ip_netmask, calc_value
def calc_val(*args, **kwargs): def calc_val(*args, **kwargs):
pass pass

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -20,6 +20,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -20,6 +20,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -17,6 +17,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -17,6 +17,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -18,6 +18,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -20,6 +20,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -17,6 +17,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -17,6 +17,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name='général'> <family name='général'>
@ -18,6 +18,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -17,12 +17,12 @@
<constraints> <constraints>
<auto name="calc_val" target="mode_conteneur_actif"> <auto name="calc_val" target="mode_conteneur_actif">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</auto> </auto>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -12,7 +12,7 @@
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param> <param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value> </value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -22,6 +22,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="oui/non" description="Redefine description" hidden="True" multi="True">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<family doc="" name="creole">
<family doc="general" name="general">
<property>normal</property>
<variable doc="Redefine description" multi="True" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>hidden</property>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
</family>
<separators/>
</family>
</creole>

View File

@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="oui/non" description="Redefine description" hidden="True" submulti="True">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<family doc="" name="creole">
<family doc="general" name="general">
<property>normal</property>
<variable doc="Redefine description" multi="submulti" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>hidden</property>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
</family>
<separators/>
</family>
</creole>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -20,12 +20,12 @@
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</fill> </fill>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -12,7 +12,7 @@
<property>basic</property> <property>basic</property>
<property expected="oui" inverse="True" source="creole.general.module_instancie" type="calculation">auto_frozen</property> <property expected="oui" inverse="True" source="creole.general.module_instancie" type="calculation">auto_frozen</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param> <param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value> </value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -17,12 +17,12 @@
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</fill> </fill>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -10,7 +10,7 @@
<property>mandatory</property> <property>mandatory</property>
<property>basic</property> <property>basic</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param> <param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value> </value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -17,12 +17,12 @@
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</fill> </fill>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -12,7 +12,7 @@
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param> <param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value> </value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="Général"> <family name="Général">
@ -17,12 +17,12 @@
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</fill> </fill>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -12,7 +12,7 @@
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param> <param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value> </value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general" mode="basic"> <family name="general" mode="basic">
@ -15,12 +15,12 @@
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</fill> </fill>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -7,7 +7,7 @@
<property>mandatory</property> <property>mandatory</property>
<property>expert</property> <property>expert</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param> <param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value> </value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -21,6 +21,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -17,14 +17,14 @@
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">
<param type="eole" optional="True">mode_conteneur_actif4</param> <param type="variable" optional="True">mode_conteneur_actif4</param>
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<param type="eole" optional="True">mode_conteneur_actif3</param> <param type="variable" optional="True">mode_conteneur_actif3</param>
</fill> </fill>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -12,7 +12,7 @@
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.mode_conteneur_actif1</param> <param transitive="False" type="variable">creole.general.mode_conteneur_actif1</param>
</value> </value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -19,6 +19,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -19,6 +19,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -22,6 +22,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="général"> <family name="général">
@ -25,6 +25,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -22,6 +22,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -19,12 +19,12 @@
<constraints> <constraints>
<check name="valid_entier" target="int"> <check name="valid_entier" target="int">
<param name="mini">0</param> <param name="mini">0</param>
<param name="maxi" type="eole">int2</param> <param name="maxi" type="variable">int2</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -16,7 +16,7 @@
<variable doc="No change" multi="False" name="int" type="number"> <variable doc="No change" multi="False" name="int" type="number">
<check name="valid_entier" warnings_only="False"> <check name="valid_entier" warnings_only="False">
<param name="mini" type="string">0</param> <param name="mini" type="string">0</param>
<param name="maxi" type="eole">creole.general.int2</param> <param name="maxi" type="variable">creole.general.int2</param>
</check> </check>
<property>normal</property> <property>normal</property>
</variable> </variable>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -16,16 +16,16 @@
<constraints> <constraints>
<check name="valid_differ" target="int"> <check name="valid_differ" target="int">
<param type="eole" optional="True">int2</param> <param type="variable" optional="True">int2</param>
</check> </check>
<check name="valid_differ" target="int"> <check name="valid_differ" target="int">
<param type="eole" optional="True">int3</param> <param type="variable" optional="True">int3</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -10,7 +10,7 @@
</variable> </variable>
<variable doc="No change" multi="False" name="int" type="number"> <variable doc="No change" multi="False" name="int" type="number">
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.int2</param> <param type="variable">creole.general.int2</param>
</check> </check>
<check name="valid_not_equal" warnings_only="False"/> <check name="valid_not_equal" warnings_only="False"/>
<property>normal</property> <property>normal</property>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -17,12 +17,12 @@
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif"> <check name="valid_differ" target="mode_conteneur_actif">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -5,7 +5,7 @@
<property>normal</property> <property>normal</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param> <param type="variable">creole.general.mode_conteneur_actif1</param>
</check> </check>
<choice type="string">oui</choice> <choice type="string">oui</choice>
<choice type="string">non</choice> <choice type="string">non</choice>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -23,15 +23,15 @@
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</check> </check>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif2</param> <param type="variable">mode_conteneur_actif2</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -14,15 +14,15 @@
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</check> </check>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif2</param> <param type="variable">mode_conteneur_actif2</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -26,16 +26,16 @@
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string"> <variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string">
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param> <param type="variable">creole.general.mode_conteneur_actif1</param>
</check> </check>
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif2</param> <param type="variable">creole.general.mode_conteneur_actif2</param>
</check> </check>
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param> <param type="variable">creole.general.mode_conteneur_actif1</param>
</check> </check>
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif2</param> <param type="variable">creole.general.mode_conteneur_actif2</param>
</check> </check>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -23,15 +23,15 @@
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</check> </check>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif2</param> <param type="variable">mode_conteneur_actif2</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -14,15 +14,15 @@
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
</check> </check>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ" target="mode_conteneur_actif3">
<param type="eole">mode_conteneur_actif2</param> <param type="variable">mode_conteneur_actif2</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -26,10 +26,10 @@
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string"> <variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string">
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif1</param> <param type="variable">creole.general.mode_conteneur_actif1</param>
</check> </check>
<check name="valid_not_equal" warnings_only="False"> <check name="valid_not_equal" warnings_only="False">
<param type="eole">creole.general.mode_conteneur_actif2</param> <param type="variable">creole.general.mode_conteneur_actif2</param>
</check> </check>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -16,12 +16,12 @@
<constraints> <constraints>
<check name="valid_ipnetmask" target="adresse_netmask_eth0" level="warning"> <check name="valid_ipnetmask" target="adresse_netmask_eth0" level="warning">
<param type="eole">adresse_ip_eth0</param> <param type="variable">adresse_ip_eth0</param>
</check> </check>
</constraints> </constraints>
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -16,7 +16,7 @@
</variable> </variable>
<variable doc="Masque de sous réseau de la carte" multi="False" name="adresse_netmask_eth0" type="netmask"> <variable doc="Masque de sous réseau de la carte" multi="False" name="adresse_netmask_eth0" type="netmask">
<check name="valid_ip_netmask" warnings_only="True"> <check name="valid_ip_netmask" warnings_only="True">
<param type="eole">creole.general.adresse_ip_eth0</param> <param type="variable">creole.general.adresse_ip_eth0</param>
</check> </check>
<property>mandatory</property> <property>mandatory</property>
<property>basic</property> <property>basic</property>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -29,6 +29,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -29,6 +29,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="Général"> <family name="Général">
@ -34,6 +34,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -33,6 +33,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -29,6 +29,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -28,6 +28,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -31,6 +31,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -32,6 +32,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<creole> <rougail>
<variables> <variables>
<family name='general'> <family name='general'>
@ -29,6 +29,6 @@
</condition> </condition>
</constraints> </constraints>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -28,6 +28,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -21,7 +21,7 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</fill> </fill>
<fill name="calc_val" target="slave2"> <fill name="calc_val" target="slave2">
<param type="eole">slave1</param> <param type="variable">slave1</param>
</fill> </fill>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -31,4 +31,4 @@
<help/> <help/>
</creole> </rougail>

View File

@ -25,7 +25,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string"> <variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general1.master.slave1</param> <param transitive="False" type="variable">creole.general1.master.slave1</param>
</value> </value>
</variable> </variable>
</leader> </leader>

View File

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

View File

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

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail>
<variables>
<family name='general'>
<variable name='mode_conteneur_actif' type='oui/non' description="No change">
<value>non</value>
</variable>
</family>
<family name='general1'>
<variable name='master' type='string' description="master" multi="True"/>
<variable name='slave1' type='string' description="slave1" multi="True"/>
<variable name='slave2' type='string' description="slave2" multi="True"/>
</family>
</variables>
<constraints>
<fill name='calc_val' target='slave1'>
<param name='valeur'>valfill</param>
</fill>
<fill name='calc_val' target='slave2'>
<param type='variable'>slave1</param>
</fill>
<group master='master' description="other description">
<slave>slave1</slave>
<slave>slave2</slave>
</group>
</constraints>
</rougail>

View File

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

View File

@ -0,0 +1,34 @@
<?xml version='1.0' encoding='UTF-8'?>
<creole>
<family doc="" name="creole">
<family doc="general" name="general">
<property>normal</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
</family>
<family doc="general1" name="general1">
<property>normal</property>
<leader doc="other description" name="master">
<property>normal</property>
<variable doc="master" multi="True" name="master" type="string"/>
<variable doc="slave1" multi="True" name="slave1" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param name="valeur" transitive="False" type="string">valfill</param>
</value>
</variable>
<variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property>
<value name="calc_val" type="calculation">
<param transitive="False" type="variable">creole.general1.master.slave1</param>
</value>
</variable>
</leader>
</family>
</family>
</creole>

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -18,6 +18,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -19,7 +19,7 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</fill> </fill>
<fill name="calc_val" target="slave2"> <fill name="calc_val" target="slave2">
<param type="eole">slave1</param> <param type="variable">slave1</param>
</fill> </fill>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -29,4 +29,4 @@
<help/> <help/>
</creole> </rougail>

View File

@ -22,7 +22,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string"> <variable doc="slave2" multi="True" name="slave2" type="string">
<property>expert</property> <property>expert</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param> <param transitive="False" type="variable">creole.general.master.slave1</param>
</value> </value>
</variable> </variable>
</leader> </leader>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -19,7 +19,7 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</fill> </fill>
<fill name="calc_val" target="slave2"> <fill name="calc_val" target="slave2">
<param type="eole">slave1</param> <param type="variable">slave1</param>
</fill> </fill>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -29,4 +29,4 @@
<help/> <help/>
</creole> </rougail>

View File

@ -23,7 +23,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string"> <variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param> <param transitive="False" type="variable">creole.general.master.slave1</param>
</value> </value>
</variable> </variable>
</leader> </leader>

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<variables> <variables>
<family name="général"> <family name="général">
@ -20,6 +20,6 @@
<help/> <help/>
</creole> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -19,7 +19,7 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</fill> </fill>
<fill name="calc_val" target="slave2"> <fill name="calc_val" target="slave2">
<param type="eole">slave1</param> <param type="variable">slave1</param>
</fill> </fill>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -29,4 +29,4 @@
<help/> <help/>
</creole> </rougail>

View File

@ -24,7 +24,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string"> <variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param> <param transitive="False" type="variable">creole.general.master.slave1</param>
</value> </value>
</variable> </variable>
</leader> </leader>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -24,7 +24,7 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</fill> </fill>
<fill name="calc_val" target="slave2"> <fill name="calc_val" target="slave2">
<param type="eole">slave1</param> <param type="variable">slave1</param>
</fill> </fill>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -38,4 +38,4 @@
<help/> <help/>
</creole> </rougail>

View File

@ -25,7 +25,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string"> <variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general1.master.slave1</param> <param transitive="False" type="variable">creole.general1.master.slave1</param>
</value> </value>
</variable> </variable>
</leader> </leader>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -21,7 +21,7 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</fill> </fill>
<fill name="calc_val" target="slave2"> <fill name="calc_val" target="slave2">
<param type="eole">slave1</param> <param type="variable">slave1</param>
</fill> </fill>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -31,4 +31,4 @@
<help/> <help/>
</creole> </rougail>

View File

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

View File

@ -25,7 +25,7 @@
<variable doc="slave2" multi="True" name="slave2" type="string"> <variable doc="slave2" multi="True" name="slave2" type="string">
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general1.master.slave1</param> <param transitive="False" type="variable">creole.general1.master.slave1</param>
</value> </value>
</variable> </variable>
<variable doc="slave3" multi="True" name="slave3" type="string"> <variable doc="slave3" multi="True" name="slave3" type="string">

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -20,10 +20,10 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</auto> </auto>
<auto name="calc_val" target="slave2"> <auto name="calc_val" target="slave2">
<param type="eole">slave1</param> <param type="variable">slave1</param>
</auto> </auto>
<auto name="calc_val" target="slave3"> <auto name="calc_val" target="slave3">
<param type="eole">master</param> <param type="variable">master</param>
</auto> </auto>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -34,4 +34,4 @@
<help/> <help/>
</creole> </rougail>

View File

@ -28,7 +28,7 @@
<property>hidden</property> <property>hidden</property>
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.slave1</param> <param transitive="False" type="variable">creole.general.master.slave1</param>
</value> </value>
</variable> </variable>
<variable doc="slave3" multi="True" name="slave3" type="string"> <variable doc="slave3" multi="True" name="slave3" type="string">
@ -37,7 +37,7 @@
<property>hidden</property> <property>hidden</property>
<property>normal</property> <property>normal</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param transitive="False" type="eole">creole.general.master.master</param> <param transitive="False" type="variable">creole.general.master.master</param>
</value> </value>
</variable> </variable>
</leader> </leader>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<creole> <rougail>
<containers/> <services/>
<variables> <variables>
<family name="general"> <family name="general">
@ -19,7 +19,7 @@
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
</auto> </auto>
<auto name="calc_val" target="slave2"> <auto name="calc_val" target="slave2">
<param type="eole">master</param> <param type="variable">master</param>
</auto> </auto>
<group master="master"> <group master="master">
<slave>slave1</slave> <slave>slave1</slave>
@ -29,4 +29,4 @@
<help/> <help/>
</creole> </rougail>

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