Compare commits
34 Commits
96e392cfd8
...
release/0.
Author | SHA1 | Date | |
---|---|---|---|
534b5f4413 | |||
5a1c39e8a1 | |||
8d09b90d26 | |||
a97c17a615 | |||
8e22886938 | |||
0b98f2ff6f | |||
5c3ab2ae17 | |||
d139862568 | |||
9bb1a8c26a | |||
d8e99fef54 | |||
25d5307415 | |||
963e93295a | |||
1c5ab706ed | |||
a542b2bfdc | |||
2207537b64 | |||
509bf21d08 | |||
3eb208b2c1 | |||
5952a8d759 | |||
d86744d1cf | |||
1ce16ad05d | |||
3881cb7e98 | |||
81028d1539 | |||
2f8fc054d0 | |||
f19a427f46 | |||
f062d9f30a | |||
881b551f47 | |||
9ec8f881ab | |||
cbf107cbdc | |||
024fecddbb | |||
729b35d372 | |||
1b65d22eaa | |||
1a3632f577 | |||
06535b42b8 | |||
79a7950b0b |
24
Makefile
24
Makefile
@ -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
64
apps.mk
@ -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
|
15
creole.mk
15
creole.mk
@ -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
200
eole.mk
@ -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
|
44
po_update.sh
44
po_update.sh
@ -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
|
||||
|
||||
|
29
setup.py
29
setup.py
@ -1,24 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from setuptools import setup
|
||||
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')),
|
||||
]
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
author='Équipe EOLE',
|
||||
author_email='eole@ac-dijon.fr',
|
||||
name='creole',
|
||||
version='2.7.0',
|
||||
description='Eole configuration tools',
|
||||
url='http://www.eole.orion.education.fr',
|
||||
packages=['creole', 'creole.lint', 'creole.valid'],
|
||||
data_files=doc
|
||||
author='Cadoles',
|
||||
author_email='contact@cadoles.com',
|
||||
name='rougail',
|
||||
version='0.1',
|
||||
description='Configuration templating engine',
|
||||
url='https://forge.cadoles.com/Infra/rougail',
|
||||
packages=find_packages('src'),
|
||||
package_dir={"": "src"},
|
||||
include_package_data=True,
|
||||
package_data={"": ["data/*.dtd"]}
|
||||
)
|
||||
|
@ -1,4 +1,5 @@
|
||||
from .loader import load
|
||||
from .objspace import CreoleObjSpace
|
||||
from .annotator import modes
|
||||
|
||||
__ALL__ = ('load', 'modes')
|
||||
__ALL__ = ('load', 'CreoleObjSpace', 'modes')
|
||||
|
@ -53,18 +53,17 @@ modes = mode_factory()
|
||||
# that shall not be present in the exported (flatened) XML
|
||||
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
||||
'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')
|
||||
|
||||
NOT_NEED_ACTIVATE = ('disknod',)
|
||||
|
||||
FORCE_CHOICE = {'oui/non': ['oui', 'non'],
|
||||
'on/off': ['on', 'off'],
|
||||
'yes/no': ['yes', 'no'],
|
||||
'schedule': ['none', 'daily', 'weekly', 'monthly'],
|
||||
'schedulemod': ['pre', 'post']}
|
||||
|
||||
KEY_TYPE = {'SymLinkOption': 'symlink',
|
||||
KEY_TYPE = {'variable': 'symlink',
|
||||
'SymLinkOption': 'symlink',
|
||||
'PortOption': 'port',
|
||||
'UnicodeOption': 'string',
|
||||
'NetworkOption': 'network',
|
||||
@ -72,20 +71,17 @@ KEY_TYPE = {'SymLinkOption': 'symlink',
|
||||
'URLOption': 'web_address',
|
||||
'FilenameOption': 'filename'}
|
||||
|
||||
TYPE_PARAM_CHECK = ('string', 'python', 'eole')
|
||||
TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'eole')
|
||||
TYPE_PARAM_FILL = ('string', 'eole', 'number', 'context')
|
||||
|
||||
DISKNOD_KEY_TYPE = {'major': 'number',
|
||||
'minor': 'number'}
|
||||
TYPE_PARAM_CHECK = ('string', 'python', 'eole', 'variable')
|
||||
TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'eole', 'variable')
|
||||
TYPE_PARAM_FILL = ('string', 'eole', 'number', 'context', 'variable')
|
||||
|
||||
ERASED_FAMILY_ACTION_ATTRIBUTES = ('index', 'action')
|
||||
|
||||
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
||||
|
||||
|
||||
class ContainerAnnotator:
|
||||
"""Manage container's object
|
||||
class ServiceAnnotator:
|
||||
"""Manage service's object
|
||||
"""
|
||||
def __init__(self, objectspace):
|
||||
self.space = objectspace.space
|
||||
@ -98,79 +94,99 @@ class ContainerAnnotator:
|
||||
</service_access>
|
||||
"""
|
||||
self.grouplist_conditions = {}
|
||||
self.convert_containers()
|
||||
self.convert_services()
|
||||
|
||||
def convert_containers(self):
|
||||
if hasattr(self.space, 'containers'):
|
||||
if hasattr(self.space.containers, 'container'):
|
||||
self.convert_all()
|
||||
def convert_services(self):
|
||||
if hasattr(self.space, 'services'):
|
||||
if hasattr(self.space.services, 'service'):
|
||||
subelts = dict()
|
||||
# self.space.containers.containers = self.objectspace.containers()
|
||||
for idx, container in enumerate(self.space.containers.container.values()):
|
||||
for idx, service in enumerate(self.space.services.service.values()):
|
||||
family = self.objectspace.family()
|
||||
family.name = 'container{}'.format(idx)
|
||||
family.doc = container.name
|
||||
family.name = 'service{}'.format(idx)
|
||||
family.doc = service.name
|
||||
family.family = OrderedDict()
|
||||
self.convert_container_to_family(family.name, family.family, container)
|
||||
setattr(self.space.containers, family.name, family)
|
||||
del self.space.containers.container
|
||||
self.convert_service_to_family(family.name, family.family, service)
|
||||
setattr(self.space.services, family.name, family)
|
||||
del self.space.services.service
|
||||
else:
|
||||
del self.space.containers
|
||||
del self.space.services
|
||||
|
||||
def convert_all(self):
|
||||
if hasattr(self.space.containers, 'all'):
|
||||
# Remove "all" and dispatch informations in all containers
|
||||
for type_, containers in vars(self.space.containers.all).items():
|
||||
if type_ == 'index':
|
||||
def convert_service_to_family(self, service_name, service_family, service):
|
||||
for elttype, values in vars(service).items():
|
||||
if elttype in ['name', 'index']:
|
||||
continue
|
||||
family = self.objectspace.family()
|
||||
family.name = elttype + 's'
|
||||
if isinstance(values, dict):
|
||||
values = list(values.values())
|
||||
family.family = self.convert_subelement_service(elttype,
|
||||
values,
|
||||
'services.{}.{}'.format(service_name, family.name))
|
||||
family.mode = None
|
||||
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
|
||||
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)
|
||||
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:
|
||||
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
|
||||
true_key = key
|
||||
if true_key in self.objectspace.booleans_attributs:
|
||||
type_ = 'boolean'
|
||||
else:
|
||||
type_ = 'string'
|
||||
dtd_key_type = true_key + '_type'
|
||||
|
||||
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()
|
||||
key_type_name = elttype.upper() + '_KEY_TYPE'
|
||||
if key_type_name in globals():
|
||||
key_type = globals()[key_type_name]
|
||||
else:
|
||||
key_type = {}
|
||||
if elttype.endswith('s'):
|
||||
family.name = elttype + 'es'
|
||||
else:
|
||||
family.name = elttype + 's'
|
||||
values = getattr(container, elttype)
|
||||
if isinstance(values, dict):
|
||||
values = list(values.values())
|
||||
family.family = self.make_group_from_elts(elttype,
|
||||
values,
|
||||
key_type,
|
||||
'containers.{}.{}'.format(container_name, family.name),
|
||||
True)
|
||||
family.mode = None
|
||||
container_family[family.name] = family
|
||||
if hasattr(elt, dtd_key_type):
|
||||
type_ = KEY_TYPE[getattr(elt, dtd_key_type)]
|
||||
multi = isinstance(value, list)
|
||||
variables.append(self._generate_element(elt_name,
|
||||
key,
|
||||
value,
|
||||
type_,
|
||||
subpath,
|
||||
multi))
|
||||
# FIXME ne devrait pas etre True par défaut
|
||||
variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath))
|
||||
family = self.objectspace.family()
|
||||
family.name = '{}{}'.format(name, index)
|
||||
family.variable = variables
|
||||
family.mode = None
|
||||
self.paths.append('family', subpath, 'services', creoleobj=family)
|
||||
families.append(family)
|
||||
return families
|
||||
|
||||
def _generate_element(self, eltname, name, value, type_, subpath, multi=False):
|
||||
var_data = {'name': name, 'doc': '', 'value': value,
|
||||
@ -183,8 +199,7 @@ class ContainerAnnotator:
|
||||
var_data['type'] = type_
|
||||
|
||||
variable = self.objectspace.variable()
|
||||
if not HIGH_COMPATIBILITY:
|
||||
variable.mandatory = True
|
||||
variable.mandatory = True
|
||||
for key, value in var_data.items():
|
||||
if key == 'value':
|
||||
if value is None:
|
||||
@ -215,113 +230,27 @@ class ContainerAnnotator:
|
||||
choices.append(choice)
|
||||
variable.choice = choices
|
||||
path = '{}.{}'.format(subpath, name)
|
||||
self.paths.append('variable', path, 'containers', 'containers', variable)
|
||||
self.paths.append('variable', path, 'services', 'service', variable)
|
||||
return variable
|
||||
|
||||
def _make_disknod_auto(self, type_, index, variable, container_path):
|
||||
if not hasattr(self.space.constraints, 'auto'):
|
||||
self.space.constraints.auto = []
|
||||
auto = self.objectspace.auto()
|
||||
self.objectspace.index += 1
|
||||
auto.index = self.objectspace.index
|
||||
auto.namespace = 'containers'
|
||||
param1 = self.objectspace.param()
|
||||
param1.text = type_
|
||||
param2 = self.objectspace.param()
|
||||
param2.text = variable.name
|
||||
auto.param = [param1, param2]
|
||||
auto.name = 'cdrom_minormajor'
|
||||
family = 'disknod{}'.format(index)
|
||||
auto.target = '{}.{}.{}'.format(container_path, family, type_)
|
||||
if not hasattr(self.space, 'constraints'):
|
||||
self.space.constraints = self.objectspace.constraints()
|
||||
self.space.constraints.auto.append(auto)
|
||||
|
||||
def _make_disknod_type(self, index, variable, container_path):
|
||||
auto = self.objectspace.auto()
|
||||
self.objectspace.index += 1
|
||||
auto.index = self.objectspace.index
|
||||
auto.namespace = 'containers'
|
||||
param = self.objectspace.param()
|
||||
param.text = variable.name
|
||||
auto.param = [param]
|
||||
auto.name = 'device_type'
|
||||
family = 'disknod{}'.format(index)
|
||||
auto.target = '{}.{}.type'.format(container_path, family)
|
||||
if not hasattr(self.space, 'constraints'):
|
||||
self.space.constraints = self.objectspace.constraints()
|
||||
if not hasattr(self.space.constraints, 'auto'):
|
||||
self.space.constraints.auto = []
|
||||
self.space.constraints.auto.append(auto)
|
||||
|
||||
|
||||
def _update_disknod(self, disknod, index, container_path):
|
||||
disknod.major = None
|
||||
disknod.minor = None
|
||||
disknod.type = None
|
||||
self._make_disknod_auto('minor', index, disknod, container_path)
|
||||
self._make_disknod_auto('major', index, disknod, container_path)
|
||||
self._make_disknod_type(index, disknod, container_path)
|
||||
disknod.mode = u'rwm'
|
||||
disknod.permission = 'allow'
|
||||
|
||||
def _update_file(self, file_, index, container_path):
|
||||
if not hasattr(file_, 'source'):
|
||||
file_.source = basename(file_.name)
|
||||
|
||||
def _split_elts(self, name, key, value, elt):
|
||||
"""for example::
|
||||
|
||||
<service_access service='ntp'>
|
||||
<port protocol='udp' service_accesslist='ntp_udp'>123</port>
|
||||
<tcpwrapper>ntpd</tcpwrapper>
|
||||
</service_access>
|
||||
|
||||
builds a `service_access` object, but we need **two** objects `service_access`,
|
||||
for example one for the port and one for the tcpwrapper
|
||||
"""
|
||||
for subelt in value:
|
||||
new_elt = copy(elt)
|
||||
for subsubelt in dir(subelt):
|
||||
if subsubelt.startswith('_') or subsubelt == 'index':
|
||||
continue
|
||||
if hasattr(new_elt, subsubelt):
|
||||
if hasattr(elt, 'name'):
|
||||
name_ = elt.name
|
||||
else:
|
||||
name_ = elt.service
|
||||
raise CreoleDictConsistencyError(_('attribute {} already exists '
|
||||
'for {}').format(subsubelt,
|
||||
name_))
|
||||
setattr(new_elt, subsubelt, getattr(subelt, subsubelt))
|
||||
if hasattr(new_elt, 'node_name') or hasattr(new_elt, 'name_type'):
|
||||
raise CreoleDictConsistencyError(_('attribute node_name or name_type '
|
||||
'already exists for {}'
|
||||
'').format(name))
|
||||
if hasattr(subelt, key + '_type'):
|
||||
type_ = getattr(subelt, key + '_type')
|
||||
setattr(new_elt, 'name_type', type_)
|
||||
setattr(new_elt, 'node_name', key)
|
||||
if not hasattr(new_elt, name + 'list'):
|
||||
setattr(new_elt, name + 'list', '___auto_{}'.format(elt.service))
|
||||
else:
|
||||
self.grouplist_conditions[new_elt] = '___auto_{}'.format(elt.service)
|
||||
yield new_elt
|
||||
def _update_file(self, file_, index, service_path):
|
||||
if file_.file_type == "UnicodeOption":
|
||||
if not hasattr(file_, 'source'):
|
||||
file_.source = basename(file_.name)
|
||||
elif not hasattr(file_, 'source'):
|
||||
raise CreoleDictConsistencyError(_('attribute source mandatory for file with variable name '
|
||||
'for {}').format(file_.name))
|
||||
|
||||
def _reorder_elts(self, name, elts, duplicate_list):
|
||||
"""Reorders by index the elts (the interface,
|
||||
the hosts, actions...)
|
||||
"""Reorders by index the elts
|
||||
"""
|
||||
dict_elts = OrderedDict()
|
||||
# reorder elts by index
|
||||
new_elts = {}
|
||||
not_indexed = []
|
||||
for elt in elts:
|
||||
if not hasattr(elt, 'index'):
|
||||
not_indexed.append(elt)
|
||||
else:
|
||||
idx = elt.index
|
||||
new_elts.setdefault(idx, []).append(elt)
|
||||
idx = elt.index
|
||||
new_elts.setdefault(idx, []).append(elt)
|
||||
idxes = list(new_elts.keys())
|
||||
idxes.sort()
|
||||
elts = not_indexed
|
||||
@ -333,16 +262,8 @@ class ContainerAnnotator:
|
||||
if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES:
|
||||
continue
|
||||
value = getattr(elt, key)
|
||||
if isinstance(value, list) and duplicate_list:
|
||||
for new_elt in self._split_elts(name, key, value, elt):
|
||||
dict_elts.setdefault(new_elt.name, []).append({'elt_name': key,
|
||||
'elt': new_elt})
|
||||
elt_added = True
|
||||
if not elt_added:
|
||||
if hasattr(elt, 'name'):
|
||||
eltname = elt.name
|
||||
else:
|
||||
eltname = idx
|
||||
eltname = elt.name
|
||||
dict_elts.setdefault(eltname, []).append({'elt_name': name, 'elt': elt})
|
||||
|
||||
result_elts = []
|
||||
@ -350,7 +271,7 @@ class ContainerAnnotator:
|
||||
result_elts.extend(elt)
|
||||
return result_elts
|
||||
|
||||
def make_group_from_elts(self, name, elts, key_type, path, duplicate_list):
|
||||
def make_group_from_elts(self, name, elts, path, duplicate_list):
|
||||
"""Splits each objects into a group (and `OptionDescription`, in tiramisu terms)
|
||||
and build elements and its attributes (the `Options` in tiramisu terms)
|
||||
"""
|
||||
@ -368,7 +289,7 @@ class ContainerAnnotator:
|
||||
subpath = '{}.{}{}'.format(path, name, index)
|
||||
listname = '{}list'.format(name)
|
||||
activate_path = '.'.join([subpath, 'activate'])
|
||||
if name not in NOT_NEED_ACTIVATE and elt in self.grouplist_conditions:
|
||||
if elt in self.grouplist_conditions:
|
||||
# FIXME transformer le activate qui disparait en boolean
|
||||
self.objectspace.list_conditions.setdefault(listname,
|
||||
{}).setdefault(self.grouplist_conditions[elt],
|
||||
@ -378,19 +299,18 @@ class ContainerAnnotator:
|
||||
continue
|
||||
value = getattr(elt, key)
|
||||
if isinstance(value, list) and duplicate_list:
|
||||
# FIXME plusieurs fichier si calculé !
|
||||
continue
|
||||
if key == 'container':
|
||||
value = value.name
|
||||
if name not in NOT_NEED_ACTIVATE and key == listname:
|
||||
if key == listname:
|
||||
self.objectspace.list_conditions.setdefault(listname,
|
||||
{}).setdefault(
|
||||
value,
|
||||
[]).append(activate_path)
|
||||
continue
|
||||
default_type = 'string'
|
||||
if key in self.objectspace.booleans_attributs:
|
||||
default_type = 'boolean'
|
||||
type_ = key_type.get(key, default_type)
|
||||
type_ = 'boolean'
|
||||
else:
|
||||
type_ = 'string'
|
||||
dtd_key_type = key + '_type'
|
||||
if hasattr(elt, dtd_key_type):
|
||||
type_ = KEY_TYPE[getattr(elt, dtd_key_type)]
|
||||
@ -401,19 +321,18 @@ class ContainerAnnotator:
|
||||
type_,
|
||||
subpath,
|
||||
multi))
|
||||
if name not in NOT_NEED_ACTIVATE:
|
||||
# FIXME ne devrait pas etre True par défaut
|
||||
variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath))
|
||||
# FIXME ne devrait pas etre True par défaut
|
||||
variables.append(self._generate_element(name, 'activate', True, 'boolean', subpath))
|
||||
family = self.objectspace.family()
|
||||
family.name = '{}{}'.format(name, index)
|
||||
family.variable = variables
|
||||
family.mode = None
|
||||
self.paths.append('family', subpath, 'containers', creoleobj=family)
|
||||
self.paths.append('family', subpath, 'services', creoleobj=family)
|
||||
families.append(family)
|
||||
return families
|
||||
|
||||
|
||||
class ActionAnnotator(ContainerAnnotator):
|
||||
class ActionAnnotator(ServiceAnnotator):
|
||||
def __init__(self, objectspace):
|
||||
self.space = objectspace.space
|
||||
self.paths = objectspace.paths
|
||||
@ -438,7 +357,7 @@ class ActionAnnotator(ContainerAnnotator):
|
||||
'').format(namespace))
|
||||
namespaces.append(namespace)
|
||||
action.name = action.namespace
|
||||
new_actions = self.make_group_from_elts('action', actions.action, {}, subpath, False)
|
||||
new_actions = self.make_group_from_elts('action', actions.action, subpath, False)
|
||||
family = self.objectspace.family()
|
||||
family.name = actions.name
|
||||
family.family = new_actions
|
||||
@ -465,7 +384,7 @@ class SpaceAnnotator(object):
|
||||
self.has_calc = []
|
||||
self.force_no_value = []
|
||||
self.force_not_mandatory = []
|
||||
if eosfunc_file is not None:
|
||||
if eosfunc_file:
|
||||
self.eosfunc = imp.load_source('eosfunc', eosfunc_file)
|
||||
else:
|
||||
self.eosfunc = None
|
||||
@ -473,6 +392,7 @@ class SpaceAnnotator(object):
|
||||
self.default_has_no_value = []
|
||||
self.has_frozen_if_in_condition = []
|
||||
self.default_variable_options()
|
||||
self.variable_submulti()
|
||||
self.convert_auto_freeze()
|
||||
self.convert_groups()
|
||||
self.filter_check()
|
||||
@ -483,8 +403,9 @@ class SpaceAnnotator(object):
|
||||
self.remove_empty_families()
|
||||
self.change_variable_mode()
|
||||
self.change_family_mode()
|
||||
self.dynamic_families()
|
||||
self.filter_separators()
|
||||
self.absolute_path_for_symlink_in_containers()
|
||||
self.absolute_path_for_symlink_in_services()
|
||||
self.convert_helps()
|
||||
if hasattr(self.space, 'constraints'):
|
||||
del self.space.constraints.index
|
||||
@ -492,10 +413,10 @@ class SpaceAnnotator(object):
|
||||
raise Exception('constraints again?')
|
||||
del self.space.constraints
|
||||
|
||||
def absolute_path_for_symlink_in_containers(self):
|
||||
if not hasattr(self.space, 'containers'):
|
||||
def absolute_path_for_symlink_in_services(self):
|
||||
if not hasattr(self.space, 'services'):
|
||||
return
|
||||
families = vars(self.space.containers).values()
|
||||
families = vars(self.space.services).values()
|
||||
for family in families:
|
||||
if hasattr(family, 'family'):
|
||||
for fam in family.family.values():
|
||||
@ -541,8 +462,8 @@ class SpaceAnnotator(object):
|
||||
if is_leader:
|
||||
if variable.name == follower_names[0]:
|
||||
# followers are multi
|
||||
if not variable.multi is True:
|
||||
raise CreoleDictConsistencyError(_('the variable {} in a group must be multi').format(variable.name))
|
||||
if not variable.multi:
|
||||
raise CreoleDictConsistencyError(_('the variable {} in a group must be multi or submulti').format(variable.name))
|
||||
follower_names.remove(variable.name)
|
||||
leader_family.variable.pop(variable.name)
|
||||
leader_space.variable.append(variable) # pylint: disable=E1101
|
||||
@ -560,6 +481,10 @@ class SpaceAnnotator(object):
|
||||
leader_space.variable = []
|
||||
leader_space.name = leader_name
|
||||
leader_space.hidden = variable.hidden
|
||||
if hasattr(group, 'description'):
|
||||
leader_space.doc = group.description
|
||||
else:
|
||||
leader_space.doc = variable.description
|
||||
variable.hidden = None
|
||||
self.paths.append('family', leader_path + '.' + leader_name, namespace, creoleobj=leader_space)
|
||||
# manage leader's variable
|
||||
@ -606,10 +531,18 @@ class SpaceAnnotator(object):
|
||||
variable_mode = variable.mode
|
||||
if variable_mode is not None and modes[mode] > modes[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):
|
||||
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):
|
||||
@ -623,7 +556,7 @@ class SpaceAnnotator(object):
|
||||
(not has_value or is_follower) and variable.type != 'choice'):
|
||||
variable.mode = modes_level[0]
|
||||
if has_value:
|
||||
if not HIGH_COMPATIBILITY or (not path.startswith('creole.containers.') \
|
||||
if not HIGH_COMPATIBILITY or (not path.startswith('creole.services.') \
|
||||
and path not in self.force_no_value and path not in self.force_not_mandatory):
|
||||
variable.mandatory = True
|
||||
if variable.hidden is True:
|
||||
@ -636,8 +569,6 @@ class SpaceAnnotator(object):
|
||||
variable.mode = family_mode
|
||||
if variable.mode != None and variable.mode != modes_level[0] and modes[variable.mode] < modes[family_mode]:
|
||||
variable.mode = family_mode
|
||||
if variable.name == "available_probes":
|
||||
variable.force_default_on_freeze = False
|
||||
|
||||
def default_variable_options(self):
|
||||
if hasattr(self.space, 'variables'):
|
||||
@ -651,6 +582,16 @@ class SpaceAnnotator(object):
|
||||
if variable.type != 'symlink' and not hasattr(variable, 'description'):
|
||||
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
|
||||
if hasattr(self.space, 'variables'):
|
||||
for variables in self.space.variables.values():
|
||||
@ -768,19 +709,9 @@ class SpaceAnnotator(object):
|
||||
is_follower = False
|
||||
path = '{}.{}.{}'.format(family.path, variable.name, follower.name)
|
||||
self._annotate_variable(follower, family_mode, path, is_follower)
|
||||
if HIGH_COMPATIBILITY:
|
||||
# leader's variable are right
|
||||
if modes[variable.variable[0].mode] > modes[follower.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
|
||||
# leader's mode is minimum level
|
||||
if modes[variable.variable[0].mode] > modes[follower.mode]:
|
||||
follower.mode = variable.variable[0].mode
|
||||
variable.mode = variable.variable[0].mode
|
||||
else:
|
||||
# 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
|
||||
if 'fill' in vars(constraints):
|
||||
for idx, fill in enumerate(constraints.fill):
|
||||
if fill.index in fills:
|
||||
raise Exception('hu?')
|
||||
fills[fill.index] = {'idx': idx, 'fill': fill, 'type': 'fill'}
|
||||
if 'auto' in vars(constraints):
|
||||
for idx, fill in enumerate(constraints.auto):
|
||||
if fill.index in fills:
|
||||
raise Exception('hu?')
|
||||
fills[fill.index] = {'idx': idx, 'fill': fill, 'type': 'auto'}
|
||||
indexes = list(fills.keys())
|
||||
indexes.sort()
|
||||
@ -826,10 +753,7 @@ class SpaceAnnotator(object):
|
||||
remove_fills = []
|
||||
for idx in indexes:
|
||||
fill = fills[idx]['fill']
|
||||
if hasattr(fill, 'redefine'):
|
||||
redefine = bool(fill.redefine)
|
||||
else:
|
||||
redefine = False
|
||||
redefine = bool(fill.redefine)
|
||||
if fill.target in targets:
|
||||
if redefine:
|
||||
if targets[fill.target][1] == 'auto':
|
||||
@ -931,9 +855,11 @@ class SpaceAnnotator(object):
|
||||
if param.type not in TYPE_PARAM_CHECK:
|
||||
raise CreoleDictConsistencyError(_('cannot use {} type as a param in check for {}').format(param.type, check.target))
|
||||
if param.type == 'eole':
|
||||
if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
|
||||
if param.optional is True:
|
||||
param_option_indexes.append(idx)
|
||||
param.type = 'variable'
|
||||
if param.type == 'variable':
|
||||
# if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
|
||||
# if param.optional is True:
|
||||
# param_option_indexes.append(idx)
|
||||
try:
|
||||
param.text = self.paths.get_variable_path(param.text, namespace)
|
||||
except CreoleDictConsistencyError as err:
|
||||
@ -981,8 +907,10 @@ class SpaceAnnotator(object):
|
||||
for idx in remove_indexes:
|
||||
del space[idx]
|
||||
remove_indexes = []
|
||||
functions = dir(self.eosfunc)
|
||||
functions.extend(['valid_enum', 'valid_in_network', 'valid_differ'])
|
||||
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))
|
||||
#is_probe = not check.name in self.eosfunc.func_on_zephir_context
|
||||
#if is_probe:
|
||||
@ -1009,7 +937,7 @@ class SpaceAnnotator(object):
|
||||
'').format(check.target))
|
||||
param = check.param[0]
|
||||
if proposed_value_type:
|
||||
if param.type != 'eole':
|
||||
if param.type == 'variable':
|
||||
try:
|
||||
values = self.load_params_in_validenum(param)
|
||||
except NameError as err:
|
||||
@ -1059,20 +987,20 @@ class SpaceAnnotator(object):
|
||||
elif name == 'valid_network_netmask':
|
||||
params_len = 1
|
||||
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':
|
||||
params_len = 1
|
||||
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'
|
||||
elif name == 'valid_broadcast':
|
||||
params_len = 2
|
||||
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':
|
||||
params_len = 2
|
||||
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_.warnings_only = check.warnings_only
|
||||
if hasattr(check, 'param'):
|
||||
@ -1108,12 +1036,13 @@ class SpaceAnnotator(object):
|
||||
if param.type not in TYPE_PARAM_FILL:
|
||||
raise CreoleDictConsistencyError(_('cannot use {} type as a param '
|
||||
'in a fill/auto').format(param.type))
|
||||
if param.type == 'eole':
|
||||
param.type = 'variable'
|
||||
param_option_indexes = []
|
||||
for fill_idx, param in enumerate(fill.param):
|
||||
if not hasattr(param, 'text') and \
|
||||
(param.type == 'eole' or param.type == 'number' or \
|
||||
#param.type == 'container' or param.type == 'python'):
|
||||
param.type == 'python'):
|
||||
(param.type == 'variable' or param.type == 'number' or \
|
||||
param.type == 'python'):
|
||||
raise CreoleDictConsistencyError(_("All '{}' variables shall be set in "
|
||||
"order to calculate {}").format(
|
||||
param.type,
|
||||
@ -1121,16 +1050,16 @@ class SpaceAnnotator(object):
|
||||
# if param.type == 'container':
|
||||
# param.type = 'eole'
|
||||
# param.text = 'container_ip_{}'.format(param.text)
|
||||
if param.type == 'eole':
|
||||
if param.type == 'variable':
|
||||
#if is_probe:
|
||||
# raise CreoleDictConsistencyError(_('Function {0} used to calculate {1} '
|
||||
# 'is executed on remote server, '
|
||||
# 'so cannot depends to an '
|
||||
# 'other variable'
|
||||
# ).format(fill.name, fill.target))
|
||||
if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
|
||||
if param.optional is True:
|
||||
param_option_indexes.append(fill_idx)
|
||||
# if HIGH_COMPATIBILITY and param.text.startswith('container_ip'):
|
||||
# if param.optional is True:
|
||||
# param_option_indexes.append(fill_idx)
|
||||
try:
|
||||
param.text = self.paths.get_variable_path(param.text, namespace)
|
||||
except CreoleDictConsistencyError as err:
|
||||
@ -1313,6 +1242,8 @@ class SpaceAnnotator(object):
|
||||
if param.type not in TYPE_PARAM_CONDITION:
|
||||
raise CreoleDictConsistencyError(_('cannot use {} type as a param '
|
||||
'in a condition').format(param.type))
|
||||
if param.type == 'eole':
|
||||
param.type = 'variable'
|
||||
|
||||
def check_choice_option_condition(self, force_remove_targets):
|
||||
# remove condition for ChoiceOption that don't have param
|
||||
|
@ -1,25 +1,17 @@
|
||||
# -*- 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'
|
||||
|
||||
eoleroot = join(eoledir, 'creole')
|
||||
rougailroot = '/var/rougail'
|
||||
patch_dir = join(rougailroot, 'patches')
|
||||
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
|
||||
templatedir = '/var/lib/creole'
|
||||
|
||||
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')
|
||||
patch_dir = '/srv/rougail/patch'
|
||||
|
@ -2,20 +2,20 @@
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<!-- Definition de la DTD du fichier creole -->
|
||||
<!-- Rougail's DTD -->
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<!--
|
||||
# Conception :
|
||||
# Eole (http://eole.orion.education.fr)
|
||||
|
||||
# Created by:
|
||||
# EOLE (http://eole.orion.education.fr)
|
||||
# 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
|
||||
# copyright demeure en anglais.
|
||||
# distribued with GPL-2 or later license
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -30,15 +30,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# Se reporter a la documentation envoyee avec le programme pour la notice.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<!--================ -->
|
||||
<!-- root element -->
|
||||
<!-- =============== -->
|
||||
|
||||
<!ELEMENT creole (containers | family_action | variables | constraints | help)*>
|
||||
<!ELEMENT rougail (services | family_action | variables | constraints | help)*>
|
||||
|
||||
<!-- ============== -->
|
||||
<!-- files element -->
|
||||
@ -58,26 +57,18 @@
|
||||
<!ATTLIST action actionlist CDATA #IMPLIED>
|
||||
<!-- for apache action -->
|
||||
<!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 -->
|
||||
<!ATTLIST action url CDATA #IMPLIED>
|
||||
<!ATTLIST action url_type (URLOption|SymLinkOption) "URLOption">
|
||||
<!ATTLIST action url_type (URLOption|SymLinkOption|variable) "URLOption">
|
||||
<!-- for form action -->
|
||||
<!ATTLIST action save (True|False) "False">
|
||||
|
||||
<!ELEMENT containers ((container* | all*)*)>
|
||||
<!ELEMENT services (service*)>
|
||||
|
||||
<!ELEMENT container ((service* | service_access* | service_restriction* | interface* | package* | file* | disknod* | host* | fstab*)*) >
|
||||
<!ATTLIST container name CDATA #REQUIRED >
|
||||
<!ATTLIST container id CDATA #IMPLIED >
|
||||
<!ATTLIST container group CDATA #IMPLIED >
|
||||
|
||||
<!ELEMENT all ((service* | interface* | package* | file* | disknod* | host* | fstab*)*) >
|
||||
|
||||
<!ELEMENT service (#PCDATA)>
|
||||
<!ATTLIST service servicelist CDATA #IMPLIED >
|
||||
<!ELEMENT service ((port* | tcpwrapper* | ip* | interface* | package* | file* | digitalcertificate*)*) >
|
||||
<!ATTLIST service name CDATA #REQUIRED>
|
||||
<!ATTLIST service method (systemd|upstart|apache|network) "systemd">
|
||||
<!ATTLIST service redefine (True|False) "False">
|
||||
|
||||
<!ELEMENT input (#PCDATA)>
|
||||
<!ELEMENT profile (#PCDATA)>
|
||||
@ -85,80 +76,48 @@
|
||||
<!ELEMENT tag (#PCDATA)>
|
||||
<!ELEMENT saltaction (#PCDATA)>
|
||||
|
||||
<!ELEMENT service_access ((port | tcpwrapper)*)>
|
||||
<!ATTLIST service_access service CDATA #REQUIRED >
|
||||
|
||||
<!ELEMENT port (#PCDATA)> <!--port_type-->
|
||||
<!ATTLIST port port_type (PortOption|SymLinkOption) "PortOption">
|
||||
<!ATTLIST port service_accesslist CDATA #IMPLIED >
|
||||
<!ELEMENT port (#PCDATA)>
|
||||
<!ATTLIST port port_type (PortOption|SymLinkOption|variable) "PortOption">
|
||||
<!ATTLIST port portlist CDATA #IMPLIED >
|
||||
<!ATTLIST port protocol (tcp|udp) "tcp">
|
||||
|
||||
<!ELEMENT tcpwrapper (#PCDATA)> <!--tcpwrapper_type-->
|
||||
<!ATTLIST tcpwrapper tcpwrapper_type (UnicodeOption|SymLinkOption) "UnicodeOption">
|
||||
<!ATTLIST tcpwrapper service_accesslist CDATA #IMPLIED >
|
||||
<!ELEMENT tcpwrapper (#PCDATA)>
|
||||
<!ATTLIST tcpwrapper tcpwrapper_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
|
||||
<!ATTLIST tcpwrapper tcpwrapperlist CDATA #IMPLIED >
|
||||
|
||||
<!ELEMENT service_restriction (ip*)>
|
||||
<!ATTLIST service_restriction service CDATA #REQUIRED >
|
||||
|
||||
<!ELEMENT ip (#PCDATA)> <!--ip_type-->
|
||||
<!ATTLIST ip service_restrictionlist CDATA #IMPLIED >
|
||||
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption) "NetworkOption">
|
||||
<!ATTLIST ip interface_type (UnicodeOption|SymLinkOption) "UnicodeOption">
|
||||
<!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 ip (#PCDATA)>
|
||||
<!ATTLIST ip iplist CDATA #IMPLIED >
|
||||
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption|variable) "NetworkOption">
|
||||
<!ATTLIST ip interface_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
|
||||
<!ATTLIST ip interface CDATA #REQUIRED>
|
||||
<!ATTLIST ip netmask_type (NetmaskOption|SymLinkOption|variable) "NetmaskOption">
|
||||
<!ATTLIST ip netmask CDATA "255.255.255.255">
|
||||
|
||||
<!ELEMENT package (#PCDATA)>
|
||||
<!ATTLIST package packagelist CDATA #IMPLIED>
|
||||
|
||||
<!ELEMENT disknod (#PCDATA)>
|
||||
<!ATTLIST package packagelist CDATA #IMPLIED >
|
||||
|
||||
<!ELEMENT file EMPTY>
|
||||
<!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 mode CDATA #IMPLIED >
|
||||
<!ATTLIST file owner CDATA #IMPLIED >
|
||||
<!ATTLIST file group CDATA #IMPLIED >
|
||||
<!ATTLIST file mode CDATA "0644">
|
||||
<!ATTLIST file owner CDATA "root">
|
||||
<!ATTLIST file group CDATA "root">
|
||||
<!ATTLIST file filelist CDATA #IMPLIED >
|
||||
<!ATTLIST file mkdir (True|False) "False">
|
||||
<!ATTLIST file rm (True|False) "False">
|
||||
<!ATTLIST file del_comment CDATA #IMPLIED >
|
||||
<!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 family (#PCDATA | variable)*>
|
||||
<!ATTLIST family name CDATA #REQUIRED>
|
||||
@ -166,6 +125,7 @@
|
||||
<!ATTLIST family mode (basic|normal|expert) "basic">
|
||||
<!ATTLIST family icon CDATA #IMPLIED>
|
||||
<!ATTLIST family hidden (True|False) "False">
|
||||
<!ATTLIST family dynamic CDATA #IMPLIED>
|
||||
|
||||
<!ELEMENT variable (#PCDATA | value)*>
|
||||
<!ATTLIST variable name CDATA #REQUIRED>
|
||||
@ -174,6 +134,7 @@
|
||||
<!ATTLIST variable hidden (True|False) "False">
|
||||
<!ATTLIST variable disabled (True|False) "False">
|
||||
<!ATTLIST variable multi (True|False) "False">
|
||||
<!ATTLIST variable submulti (True|False) "False">
|
||||
<!ATTLIST variable redefine (True|False) "False">
|
||||
<!ATTLIST variable exists (True|False) "True">
|
||||
<!ATTLIST variable mandatory (True|False) "False">
|
||||
@ -182,6 +143,7 @@
|
||||
<!ATTLIST variable mode (basic|normal|expert) "normal">
|
||||
<!ATTLIST variable remove_check (True|False) "False">
|
||||
<!ATTLIST variable remove_condition (True|False) "False">
|
||||
<!ATTLIST variable test CDATA #IMPLIED>
|
||||
|
||||
<!ELEMENT separators (separator*)>
|
||||
|
||||
@ -212,18 +174,18 @@
|
||||
|
||||
<!ELEMENT group (slave+)>
|
||||
<!ATTLIST group master CDATA #REQUIRED>
|
||||
<!ATTLIST group description CDATA #IMPLIED>
|
||||
|
||||
<!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 hidden (True|False) "True">
|
||||
<!ATTLIST param optional (True|False) "False">
|
||||
|
||||
<!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">
|
||||
|
||||
<!ELEMENT slave (#PCDATA)>
|
||||
|
||||
<!ELEMENT help ((variable* | family*)*)>
|
||||
|
@ -6,16 +6,14 @@ from os import listdir
|
||||
#from ast import literal_eval
|
||||
from lxml.etree import parse, DTD
|
||||
|
||||
from tiramisu.option import (StrOption, OptionDescription, PortOption,
|
||||
IntOption, ChoiceOption, BoolOption, SymLinkOption, IPOption,
|
||||
NetworkOption, NetmaskOption, DomainnameOption, BroadcastOption,
|
||||
URLOption, EmailOption, FilenameOption, UsernameOption, DateOption,
|
||||
PasswordOption, BoolOption, MACOption, Leadership)
|
||||
from tiramisu import Config, MetaConfig, MixConfig
|
||||
from tiramisu.setting import groups
|
||||
from tiramisu import (StrOption, OptionDescription, DynOptionDescription, PortOption,
|
||||
IntOption, ChoiceOption, BoolOption, SymLinkOption, IPOption,
|
||||
NetworkOption, NetmaskOption, DomainnameOption, BroadcastOption,
|
||||
URLOption, EmailOption, FilenameOption, UsernameOption, DateOption,
|
||||
PasswordOption, BoolOption, MACOption, Leadership, submulti,
|
||||
Params, ParamSelfOption, ParamOption, ParamValue, Calculation, calc_value,
|
||||
groups, owners)
|
||||
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 .i18n import _
|
||||
@ -23,9 +21,21 @@ from .i18n import _
|
||||
from .xmlreflector import HIGH_COMPATIBILITY
|
||||
#from . import eosfunc
|
||||
from .objspace import CreoleObjSpace
|
||||
from .utils import normalize_family
|
||||
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):
|
||||
pass
|
||||
|
||||
@ -81,7 +91,9 @@ CONVERT_OPTION = {'number': dict(opttype=IntOption),
|
||||
'hostname_strict': dict(opttype=DomainnameOption, initkwargs={'type': 'hostname', 'allow_ip': False}),
|
||||
'web_address': dict(opttype=URLOption, initkwargs={'allow_ip': True, 'allow_without_dot': True}),
|
||||
'port': dict(opttype=PortOption, initkwargs={'allow_private': True}),
|
||||
'mac': dict(opttype=MACOption)
|
||||
'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):
|
||||
elt = Elt({'name': 'baseoption'})
|
||||
family = Family(elt, self.booleans, self.storage)
|
||||
if creolefunc_file is None:
|
||||
self.eosfunc = None
|
||||
else:
|
||||
self.eosfunc = imp.load_source('eosfunc', creolefunc_file)
|
||||
family = Family(elt, self.booleans, self.storage, self.eosfunc)
|
||||
self.storage.add('.', family)
|
||||
self.eosfunc = imp.load_source('eosfunc', creolefunc_file)
|
||||
|
||||
elts = {}
|
||||
for elt in xmlroot:
|
||||
@ -167,7 +182,7 @@ class PopulateTiramisuObjects(object):
|
||||
force_icon = False
|
||||
else:
|
||||
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)
|
||||
self.storage.add(path, family)
|
||||
return family
|
||||
@ -181,7 +196,7 @@ class PopulateTiramisuObjects(object):
|
||||
|
||||
def _iter_leader(self, leader, subpath):
|
||||
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()
|
||||
self.storage.add(subpath, family)
|
||||
leader_name = None
|
||||
@ -301,15 +316,19 @@ class Variable(Common):
|
||||
self.attrib['validators'] = []
|
||||
self.eosfunc = eosfunc
|
||||
self.storage = storage
|
||||
is_submulti = False
|
||||
for key, value in elt.attrib.items():
|
||||
if key in booleans:
|
||||
if value == 'True':
|
||||
value = True
|
||||
elif value == 'False':
|
||||
value = False
|
||||
elif key == 'multi' and value == 'submulti':
|
||||
is_submulti = True
|
||||
value = submulti
|
||||
else:
|
||||
raise CreoleLoaderError(_('unknown value {} for {}').format(value, key))
|
||||
if key == 'help':
|
||||
if key in ['help', 'test']:
|
||||
self.add_information(key, value)
|
||||
elif key == 'type':
|
||||
pass
|
||||
@ -343,7 +362,7 @@ class Variable(Common):
|
||||
self.attrib['properties'].append(child.text)
|
||||
elif child.tag == 'value':
|
||||
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(),)
|
||||
else:
|
||||
params = []
|
||||
@ -355,13 +374,22 @@ class Variable(Common):
|
||||
type_ = CONVERT_OPTION[child.attrib['type']]['opttype']
|
||||
else:
|
||||
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:
|
||||
self.attrib['default'] = []
|
||||
value = convert_tiramisu_value(child.text, type_)
|
||||
self.attrib['default'].append(value)
|
||||
if 'default_multi' not in self.attrib and not is_leader:
|
||||
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:
|
||||
if 'default' in self.attrib:
|
||||
raise CreoleLoaderError(_('default value already set for {}'
|
||||
@ -395,7 +423,7 @@ class Variable(Common):
|
||||
name = param.attrib.get('name', '')
|
||||
if param.attrib['type'] == 'string':
|
||||
value = param.text
|
||||
elif param.attrib['type'] == 'eole':
|
||||
elif param.attrib['type'] == 'variable':
|
||||
transitive = param.attrib.get('transitive', 'False')
|
||||
if transitive == 'True':
|
||||
transitive = True
|
||||
@ -426,12 +454,18 @@ class Variable(Common):
|
||||
ret = []
|
||||
for value in values:
|
||||
if isinstance(value, tuple):
|
||||
args = []
|
||||
if key == 'validators':
|
||||
args = [ParamSelfOption()]
|
||||
else:
|
||||
args = []
|
||||
kwargs = {}
|
||||
if len(value) == 3:
|
||||
for param in value[1]:
|
||||
if isinstance(param[1], list):
|
||||
param_value = ParamOption(self.storage.get(param[1][0]).get(), notraisepropertyerror=param[1][1])
|
||||
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])
|
||||
else:
|
||||
param_value = ParamValue(param[1])
|
||||
if not param[0]:
|
||||
@ -474,7 +508,7 @@ class Variable(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.attrib = {}
|
||||
self.is_leader = False
|
||||
@ -484,6 +518,7 @@ class Family(Common):
|
||||
self.informations = {}
|
||||
self.children = []
|
||||
self.storage = storage
|
||||
self.eosfunc = eosfunc
|
||||
self.attrib['properties'] = []
|
||||
for key, value in elt.attrib.items():
|
||||
if key in booleans:
|
||||
@ -528,11 +563,16 @@ class Family(Common):
|
||||
self.attrib['children'].append(child.get())
|
||||
self.build_properties()
|
||||
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)
|
||||
else:
|
||||
option = Leadership(**self.attrib)
|
||||
#option = OptionDescription(**self.attrib)
|
||||
except Exception as err:
|
||||
raise CreoleLoaderError(_('cannot create optiondescription {}: {}').format(self.attrib['name'], err))
|
||||
for key, value in self.informations.items():
|
||||
|
@ -30,16 +30,16 @@ from json import dump
|
||||
|
||||
from .i18n import _
|
||||
from .xmlreflector import XMLReflector, HIGH_COMPATIBILITY
|
||||
from .annotator import ERASED_ATTRIBUTES, ActionAnnotator, ContainerAnnotator, SpaceAnnotator
|
||||
from .annotator import ERASED_ATTRIBUTES, ActionAnnotator, ServiceAnnotator, SpaceAnnotator
|
||||
from .utils import normalize_family
|
||||
from .error import CreoleOperationError, SpaceObjShallNotBeUpdated, CreoleDictConsistencyError
|
||||
|
||||
# CreoleObjSpace's elements like 'family' or 'slave', that shall be forced to the Redefinable type
|
||||
FORCE_REDEFINABLES = ('family', 'slave', 'container', 'disknod', 'variables', 'family_action')
|
||||
FORCE_REDEFINABLES = ('family', 'slave', 'service', 'disknod', 'variables', 'family_action')
|
||||
# CreoleObjSpace's elements that shall be forced to the UnRedefinable type
|
||||
FORCE_UNREDEFINABLES = ('value', 'input', 'profile', 'ewtapp', 'tag', 'saltaction')
|
||||
# CreoleObjSpace's elements that shall be set to the UnRedefinable type
|
||||
UNREDEFINABLE = ('multi', 'type')
|
||||
UNREDEFINABLE = ('submulti', 'multi', 'type')
|
||||
|
||||
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
||||
'force_store_value', 'disabled', 'mandatory')
|
||||
@ -47,6 +47,8 @@ CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force
|
||||
|
||||
RENAME_ATTIBUTES = {'description': 'doc'}
|
||||
|
||||
INCOMPATIBLE_ATTRIBUTES = [['multi', 'submulti']]
|
||||
|
||||
#TYPE_TARGET_CONDITION = ('variable', 'family')
|
||||
|
||||
# _____________________________________________________________________________
|
||||
@ -86,12 +88,8 @@ class CreoleObjSpace(object):
|
||||
self.redefine_variables = None
|
||||
self.probe_variables = []
|
||||
|
||||
# elt container's attrs list
|
||||
self.container_elt_attr_list = [] #
|
||||
# ['variable', 'separator', 'family']
|
||||
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_choice_option = {}
|
||||
self.paths = Path()
|
||||
@ -106,8 +104,7 @@ class CreoleObjSpace(object):
|
||||
forced_text_elt = False
|
||||
if elt.type == 'mixed':
|
||||
forced_text_elt = True
|
||||
if elt.name == 'container':
|
||||
self.container_elt_attr_list = [elt.content.left.name]
|
||||
if elt.name == 'service':
|
||||
self.parse_dtd_right_left_elt(elt.content)
|
||||
for attr in elt.iterattributes():
|
||||
atomic = False
|
||||
@ -152,10 +149,7 @@ class CreoleObjSpace(object):
|
||||
|
||||
def parse_dtd_right_left_elt(self, elt):
|
||||
if elt.right.type == 'or':
|
||||
self.container_elt_attr_list.append(elt.right.left.name)
|
||||
self.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
|
||||
"""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
|
||||
"""
|
||||
Builds the tree structure of the object space here
|
||||
we set containers attributes in order to be populated later on
|
||||
we set services attributes in order to be populated later on
|
||||
for example::
|
||||
|
||||
space = Family()
|
||||
@ -363,6 +357,15 @@ class CreoleObjSpace(object):
|
||||
'not {}').format(attr, val))
|
||||
if not (attr == 'name' and getattr(creoleobj, 'name', None) != None):
|
||||
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):
|
||||
"""Creole object tree manipulations
|
||||
@ -458,7 +461,7 @@ class CreoleObjSpace(object):
|
||||
|
||||
def space_visitor(self, eosfunc_file): # pylint: disable=C0111
|
||||
ActionAnnotator(self)
|
||||
ContainerAnnotator(self)
|
||||
ServiceAnnotator(self)
|
||||
SpaceAnnotator(self, eosfunc_file)
|
||||
|
||||
def save(self, filename, force_no_save=False):
|
||||
@ -513,11 +516,9 @@ class CreoleObjSpace(object):
|
||||
for subspace in space:
|
||||
if isinstance(subspace, self.Leadership):
|
||||
_name = 'leader'
|
||||
subspace.doc = subspace.variable[0].description
|
||||
#subspace.doc = 'Leadership {}'.format(subspace.name)
|
||||
else:
|
||||
_name = name
|
||||
if name in ['containers', 'variables', 'actions']:
|
||||
if name in ['services', 'variables', 'actions']:
|
||||
_name = 'family'
|
||||
if HIGH_COMPATIBILITY and not hasattr(subspace, 'doc'):
|
||||
subspace.doc = ''
|
||||
@ -526,7 +527,7 @@ class CreoleObjSpace(object):
|
||||
child_node = SubElement(node, _name)
|
||||
self._xml_export(child_node, subspace, _name)
|
||||
elif isinstance(space, self.Atom):
|
||||
if name == 'containers':
|
||||
if name == 'services':
|
||||
child_node = SubElement(node, 'family')
|
||||
child_node.attrib['name'] = name
|
||||
else:
|
||||
@ -603,7 +604,9 @@ class Path(object):
|
||||
def get_family_path(self, name, current_namespace): # pylint: disable=C0111
|
||||
if current_namespace is None: # pragma: no cover
|
||||
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']:
|
||||
raise CreoleDictConsistencyError(_('A family located in the {} namespace '
|
||||
'shall not be used in the {} namespace').format(
|
||||
@ -652,7 +655,7 @@ class Path(object):
|
||||
raise CreoleOperationError('current_namespace must not be None')
|
||||
dico = self._get_variable(name)
|
||||
if not allow_source:
|
||||
if dico['namespace'] != 'creole' and current_namespace != dico['namespace']:
|
||||
if dico['namespace'] not in ['creole', 'services'] and current_namespace != dico['namespace']:
|
||||
raise CreoleDictConsistencyError(_('A variable located in the {} namespace '
|
||||
'shall not be used in the {} namespace').format(
|
||||
dico['namespace'], current_namespace))
|
||||
|
@ -8,20 +8,22 @@ import imp
|
||||
import sys
|
||||
from shutil import copy
|
||||
import logging
|
||||
from typing import Dict
|
||||
from typing import Dict, Any
|
||||
|
||||
from subprocess import call
|
||||
from os import listdir, unlink
|
||||
from os.path import basename, join, split, isfile
|
||||
from os import listdir, unlink, makedirs
|
||||
from os.path import dirname, basename, join, split, isfile, isdir
|
||||
|
||||
from tempfile import mktemp
|
||||
|
||||
from Cheetah import Parser
|
||||
|
||||
|
||||
# l'encoding du template est déterminé par une regexp (encodingDirectiveRE dans Parser.py)
|
||||
# il cherche un ligne qui ressemble à '#encoding: utf-8
|
||||
# cette classe simule le module 're' et retourne toujours l'encoding utf-8
|
||||
# 6224
|
||||
class FakeEncoding():
|
||||
class FakeEncoding:
|
||||
def groups(self):
|
||||
return ('utf-8',)
|
||||
|
||||
@ -29,20 +31,23 @@ class FakeEncoding():
|
||||
return self
|
||||
Parser.encodingDirectiveRE = FakeEncoding()
|
||||
|
||||
|
||||
from Cheetah.Template import Template as ChtTemplate
|
||||
from Cheetah.NameMapper import NotFound as CheetahNotFound
|
||||
|
||||
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 .i18n import _
|
||||
from .utils import normalize_family
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.addHandler(logging.NullHandler())
|
||||
|
||||
class IsDefined(object):
|
||||
class IsDefined:
|
||||
"""
|
||||
filtre permettant de ne pas lever d'exception au cas où
|
||||
la variable Creole n'est pas définie
|
||||
@ -64,7 +69,7 @@ class IsDefined(object):
|
||||
return varname in self.context
|
||||
|
||||
|
||||
class CreoleGet(object):
|
||||
class CreoleGet:
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
@ -85,14 +90,14 @@ class CreoleGet(object):
|
||||
@classmethod
|
||||
def cl_compile(kls, *args, **kwargs):
|
||||
kwargs['compilerSettings'] = {'directiveStartToken' : '%',
|
||||
'cheetahVarStartToken' : '%%',
|
||||
'EOLSlurpToken' : '%',
|
||||
'PSPStartToken' : 'µ' * 10,
|
||||
'PSPEndToken' : 'µ' * 10,
|
||||
'commentStartToken' : 'µ' * 10,
|
||||
'commentEndToken' : 'µ' * 10,
|
||||
'multiLineCommentStartToken' : 'µ' * 10,
|
||||
'multiLineCommentEndToken' : 'µ' * 10}
|
||||
'cheetahVarStartToken' : '%%',
|
||||
'EOLSlurpToken' : '%',
|
||||
'PSPStartToken' : 'µ' * 10,
|
||||
'PSPEndToken' : 'µ' * 10,
|
||||
'commentStartToken' : 'µ' * 10,
|
||||
'commentEndToken' : 'µ' * 10,
|
||||
'multiLineCommentStartToken' : 'µ' * 10,
|
||||
'multiLineCommentEndToken' : 'µ' * 10}
|
||||
return kls.old_compile(*args, **kwargs)
|
||||
ChtTemplate.old_compile = ChtTemplate.compile
|
||||
ChtTemplate.compile = cl_compile
|
||||
@ -112,25 +117,29 @@ class CheetahTemplate(ChtTemplate):
|
||||
filename: str,
|
||||
context,
|
||||
eosfunc: Dict,
|
||||
config: Config,
|
||||
current_container: str):
|
||||
destfilename,
|
||||
variable):
|
||||
"""Initialize Creole CheetahTemplate
|
||||
"""
|
||||
ChtTemplate.__init__(self, file=filename,
|
||||
searchList=[context, eosfunc, {'is_defined' : IsDefined(context),
|
||||
'creole_client' : CreoleClient(config),
|
||||
'current_container':CreoleGet(current_container),
|
||||
}])
|
||||
extra_context = {'is_defined' : IsDefined(context),
|
||||
'normalize_family': normalize_family,
|
||||
'rougail_filename': destfilename
|
||||
}
|
||||
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):
|
||||
"""
|
||||
On rend la variable itérable pour pouvoir faire:
|
||||
for ip in iplist:
|
||||
print ip.network
|
||||
print ip.netmask
|
||||
print ip
|
||||
print(ip.network)
|
||||
print(ip.netmask)
|
||||
print(ip)
|
||||
index is used for CreoleLint
|
||||
"""
|
||||
self._value = value
|
||||
@ -148,8 +157,8 @@ class CreoleMaster(object):
|
||||
"""
|
||||
if name in self.slave:
|
||||
value = self.slave[name]
|
||||
if isinstance(value, Exception):
|
||||
raise value
|
||||
if isinstance(value, PropertiesOptionError):
|
||||
raise AttributeError()
|
||||
return value
|
||||
else:
|
||||
return getattr(self._value, name)
|
||||
@ -160,7 +169,7 @@ class CreoleMaster(object):
|
||||
ret = {}
|
||||
for key, values in self.slave.items():
|
||||
ret[key] = values[index]
|
||||
return CreoleMaster(self._value[index], ret, index)
|
||||
return CreoleLeader(self._value[index], ret, index)
|
||||
|
||||
def __iter__(self):
|
||||
"""Iterate over master.slave.
|
||||
@ -171,7 +180,7 @@ class CreoleMaster(object):
|
||||
ret = {}
|
||||
for key, values in self.slave.items():
|
||||
ret[key] = values[i]
|
||||
yield CreoleMaster(self._value[i], ret, i)
|
||||
yield CreoleLeader(self._value[i], ret, i)
|
||||
|
||||
def __len__(self):
|
||||
"""Delegate to master value
|
||||
@ -179,7 +188,7 @@ class CreoleMaster(object):
|
||||
return len(self._value)
|
||||
|
||||
def __repr__(self):
|
||||
"""Show CreoleMaster as dictionary.
|
||||
"""Show CreoleLeader as dictionary.
|
||||
|
||||
The master value is stored under 'value' key.
|
||||
The slaves are stored under 'slave' key.
|
||||
@ -218,31 +227,30 @@ class CreoleMaster(object):
|
||||
def __contains__(self, item):
|
||||
return item in self._value
|
||||
|
||||
def add_slave(self, name, value):
|
||||
"""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
|
||||
"""
|
||||
async def add_slave(self, config, name, path):
|
||||
if isinstance(self._value, list):
|
||||
if not isinstance(value, list):
|
||||
raise TypeError
|
||||
elif len(value) != len(self._value):
|
||||
raise ValueError(_('length mismatch'))
|
||||
new_value = []
|
||||
for val in value:
|
||||
if isinstance(val, dict):
|
||||
new_value.append(ValueError(val['err']))
|
||||
else:
|
||||
new_value.append(val)
|
||||
value = new_value
|
||||
elif isinstance(value, list):
|
||||
raise TypeError
|
||||
self.slave[name] = value
|
||||
values = []
|
||||
for idx in range(len(self._value)):
|
||||
try:
|
||||
values.append(await config.option(path, idx).value.get())
|
||||
except PropertiesOptionError as err:
|
||||
values.append(err)
|
||||
else:
|
||||
raise Exception('hu?')
|
||||
self.slave[name] = values
|
||||
|
||||
|
||||
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:
|
||||
@ -250,51 +258,68 @@ class CreoleTemplateEngine:
|
||||
"""
|
||||
def __init__(self,
|
||||
config: Config,
|
||||
eosfunc_file: str):
|
||||
eosfunc_file: str,
|
||||
distrib_dir: str,
|
||||
tmp_dir: str,
|
||||
dest_dir:str) -> None:
|
||||
self.config = config
|
||||
self.dest_dir = dest_dir
|
||||
self.tmp_dir = tmp_dir
|
||||
self.distrib_dir = distrib_dir
|
||||
eos = {}
|
||||
eosfunc = imp.load_source('eosfunc', eosfunc_file)
|
||||
for func in dir(eosfunc):
|
||||
if not func.startswith('_'):
|
||||
eos[func] = getattr(eosfunc, func)
|
||||
if eosfunc_file is not None:
|
||||
eosfunc = imp.load_source('eosfunc', eosfunc_file)
|
||||
for func in dir(eosfunc):
|
||||
if not func.startswith('_'):
|
||||
eos[func] = getattr(eosfunc, func)
|
||||
self.eosfunc = eos
|
||||
self.creole_variables_dict = {}
|
||||
self.load_eole_variables(self.config.option('creole'))
|
||||
|
||||
def load_eole_variables(self, optiondescription):
|
||||
# remplacement des variables EOLE
|
||||
for option in optiondescription.list('all'):
|
||||
if option.option.isoptiondescription():
|
||||
if option.option.isleadership():
|
||||
print('leadership')
|
||||
raise Exception('a faire')
|
||||
async def load_eole_variables_creole(self,
|
||||
optiondescription):
|
||||
for option in await optiondescription.list('all'):
|
||||
if await option.option.isoptiondescription():
|
||||
if await option.option.isleadership():
|
||||
for idx, suboption in enumerate(await option.list('all')):
|
||||
if idx == 0:
|
||||
leader = CreoleLeader(await suboption.value.get())
|
||||
self.creole_variables_dict[await suboption.option.name()] = leader
|
||||
else:
|
||||
await leader.add_slave(self.config,
|
||||
await suboption.option.name(),
|
||||
await suboption.option.path())
|
||||
else:
|
||||
self.load_eole_variables(option)
|
||||
await self.load_eole_variables_creole(option)
|
||||
else:
|
||||
self.creole_variables_dict[option.option.name()] = option.value.get()
|
||||
#if varname.find('.') != -1:
|
||||
# #support des groupes
|
||||
# mastername, slavename = varname.split('.')
|
||||
# if not mastername in self.creole_variables_dict or not \
|
||||
# isinstance(self.creole_variables_dict [mastername],
|
||||
# CreoleMaster):
|
||||
# # Create the master variable
|
||||
# if mastername in values:
|
||||
# self.creole_variables_dict[mastername] = CreoleMaster(values[mastername])
|
||||
# else:
|
||||
# #only for CreoleLint
|
||||
# self.creole_variables_dict[mastername] = CreoleMaster(value)
|
||||
# #test only for CreoleLint
|
||||
# if mastername != slavename:
|
||||
# self.creole_variables_dict[mastername].add_slave(slavename, value)
|
||||
#else:
|
||||
# self.creole_variables_dict[varname] = value
|
||||
self.creole_variables_dict[await option.option.name()] = await option.value.get()
|
||||
|
||||
async def load_eole_variables(self,
|
||||
namespace,
|
||||
optiondescription):
|
||||
families = {}
|
||||
for family in await optiondescription.list('all'):
|
||||
variables = {}
|
||||
for variable in await family.list('all'):
|
||||
if await variable.option.isoptiondescription() and await variable.option.isleadership():
|
||||
for idx, suboption in enumerate(await variable.list('all')):
|
||||
if idx == 0:
|
||||
leader = CreoleLeader(await suboption.value.get())
|
||||
leader_name = await suboption.option.name()
|
||||
else:
|
||||
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,
|
||||
filename: str):
|
||||
"""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']
|
||||
|
||||
# patches variante + locaux
|
||||
@ -306,50 +331,31 @@ class CreoleTemplateEngine:
|
||||
if ret:
|
||||
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}"))
|
||||
copy(filename, templatedir)
|
||||
|
||||
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))
|
||||
copy(filename, self.tmp_dir)
|
||||
|
||||
def prepare_template(self,
|
||||
filename: str):
|
||||
"""Prepare template source file
|
||||
"""
|
||||
log.info(_("Copy template: '{filename}' -> '{templatedir}'"))
|
||||
copy(filename, templatedir)
|
||||
log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
|
||||
copy(filename, self.tmp_dir)
|
||||
self.patch_template(filename)
|
||||
# self.strip_template_comment(filename)
|
||||
|
||||
def process(self,
|
||||
destfilename: str,
|
||||
filevar: Dict,
|
||||
container: str):
|
||||
variable: Any):
|
||||
"""Process a cheetah template
|
||||
"""
|
||||
# full path of the destination file
|
||||
destfilename = join(dest_dir, filevar['source'])
|
||||
|
||||
log.info(_(f"Cheetah processing: '{destfilename}'"))
|
||||
try:
|
||||
cheetah_template = CheetahTemplate(join(templatedir, filevar['source']),
|
||||
cheetah_template = CheetahTemplate(join(self.tmp_dir,
|
||||
filevar['source']),
|
||||
self.creole_variables_dict,
|
||||
self.eosfunc,
|
||||
self.config.config.copy(),
|
||||
container)
|
||||
destfilename,
|
||||
variable)
|
||||
data = str(cheetah_template)
|
||||
except CheetahNotFound as err:
|
||||
varname = err.args[0][13:-1]
|
||||
@ -360,83 +366,78 @@ class CreoleTemplateEngine:
|
||||
with open(destfilename, 'w') as file_h:
|
||||
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,
|
||||
filevar: Dict,
|
||||
container: str):
|
||||
"""Run templatisation on one file of one container
|
||||
systemd_rights: list) -> None:
|
||||
"""Run templatisation on one file
|
||||
"""
|
||||
log.info(_("Instantiating file '{filename}'"))
|
||||
self.process(filevar,
|
||||
container)
|
||||
self.change_properties(filevar)
|
||||
filenames = filevar['name']
|
||||
if 'variable' in 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,
|
||||
container=None):
|
||||
"""Run templatisation on all files of all containers
|
||||
|
||||
@param container: name of a container
|
||||
@type container: C{str}
|
||||
async def instance_files(self) -> None:
|
||||
"""Run templatisation on all files
|
||||
"""
|
||||
for template in listdir(distrib_dir):
|
||||
self.prepare_template(join(distrib_dir, template))
|
||||
for container_obj in self.config.option('containers').list('all'):
|
||||
current_container = container_obj.option.doc()
|
||||
if container is not None and container != current_container:
|
||||
for option in await self.config.option.list(type='all'):
|
||||
namespace = await option.option.name()
|
||||
if namespace in ['services', 'actions']:
|
||||
continue
|
||||
for fills in container_obj.list('all'):
|
||||
if fills.option.name() == 'files':
|
||||
for fill_obj in fills.list('all'):
|
||||
fill = fill_obj.value.dict()
|
||||
elif namespace == 'creole':
|
||||
await self.load_eole_variables_creole(option)
|
||||
else:
|
||||
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']
|
||||
if not isfile(join(distrib_dir, filename)):
|
||||
raise FileNotFound(_(f"File {filename} does not exist."))
|
||||
print(fill)
|
||||
if fill['activate']:
|
||||
self.instance_file(fill, current_container)
|
||||
distib_file = join(self.distrib_dir, filename)
|
||||
if not isfile(distib_file):
|
||||
raise FileNotFound(_(f"File {distib_file} does not exist."))
|
||||
if fill.get('activate', False):
|
||||
self.instance_file(fill,
|
||||
systemd_rights)
|
||||
else:
|
||||
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,
|
||||
container: str=None):
|
||||
distrib_dir: str,
|
||||
tmp_dir: str,
|
||||
dest_dir: str) -> None:
|
||||
engine = CreoleTemplateEngine(config,
|
||||
eosfunc_file)
|
||||
engine.instance_files(container=container)
|
||||
eosfunc_file,
|
||||
distrib_dir,
|
||||
tmp_dir,
|
||||
dest_dir)
|
||||
await engine.instance_files()
|
||||
|
@ -2,25 +2,22 @@
|
||||
utilitaires créole
|
||||
"""
|
||||
import unicodedata
|
||||
from .i18n import _
|
||||
|
||||
|
||||
# définition des classes d'adresse IP existantes
|
||||
def normalize_family(family_name, check_name=True):
|
||||
def normalize_family(family_name: str,
|
||||
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é, ...
|
||||
dans le nom des familles
|
||||
"""
|
||||
f = family_name
|
||||
f = f.replace('-', '_')
|
||||
#f = f.replace(u'é', 'e')
|
||||
#f = f.replace(u'è', 'e')
|
||||
nfkd_form = unicodedata.normalize('NFKD', f)
|
||||
f = u"".join([c for c in nfkd_form if not unicodedata.combining(c)])
|
||||
f = f.replace(' ', '_')
|
||||
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
|
||||
family_name = family_name.replace('-', '_')
|
||||
if not allow_dot:
|
||||
family_name = family_name.replace('.', '_')
|
||||
family_name = family_name.replace(' ', '_')
|
||||
nfkd_form = unicodedata.normalize('NFKD', family_name)
|
||||
family_name = ''.join([c for c in nfkd_form if not unicodedata.combining(c)])
|
||||
family_name = family_name.lower()
|
||||
if check_name and family_name == 'containers':
|
||||
raise ValueError(_(f'"{family_name}" is a forbidden family name'))
|
||||
return family_name
|
||||
|
||||
|
@ -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):
|
||||
pass
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<containers>
|
||||
<container name="tata">
|
||||
</container>
|
||||
</containers>
|
||||
</creole>
|
||||
<rougail>
|
||||
<services>
|
||||
<service name="tata">
|
||||
</service>
|
||||
</services>
|
||||
</rougail>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<family name="containers">
|
||||
<family name="container0" doc="tata">
|
||||
<family name="services">
|
||||
<family name="service0" doc="tata">
|
||||
<property>basic</property>
|
||||
</family>
|
||||
</family>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -20,6 +20,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}
|
||||
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -20,6 +20,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}
|
||||
{"creole.general.mode_conteneur_actif": "non", "creole.general.module_instancie": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -17,6 +17,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "non"}
|
||||
{"creole.general.mode_conteneur_actif": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -17,6 +17,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "non"}
|
||||
{"creole.general.mode_conteneur_actif": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -18,6 +18,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -20,6 +20,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.without_type": "non"}
|
||||
{"creole.general.without_type": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -17,6 +17,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -17,6 +17,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name='général'>
|
||||
@ -18,6 +18,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -17,12 +17,12 @@
|
||||
|
||||
<constraints>
|
||||
<auto name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</auto>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<property>mandatory</property>
|
||||
<property>normal</property>
|
||||
<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>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -22,6 +22,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
|
22
tests/flattener_dicos/01base_multi/00-base.xml
Normal file
22
tests/flattener_dicos/01base_multi/00-base.xml
Normal 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
|
||||
-->
|
19
tests/flattener_dicos/01base_multi/result/00-base.xml
Normal file
19
tests/flattener_dicos/01base_multi/result/00-base.xml
Normal 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>
|
22
tests/flattener_dicos/01base_submulti/00-base.xml
Normal file
22
tests/flattener_dicos/01base_submulti/00-base.xml
Normal 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
|
||||
-->
|
19
tests/flattener_dicos/01base_submulti/result/00-base.xml
Normal file
19
tests/flattener_dicos/01base_submulti/result/00-base.xml
Normal 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>
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -20,12 +20,12 @@
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non", "creole.general.module_instancie": "non"}
|
||||
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non", "creole.general.module_instancie": "non"}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<property>basic</property>
|
||||
<property expected="oui" inverse="True" source="creole.general.module_instancie" type="calculation">auto_frozen</property>
|
||||
<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>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -17,12 +17,12 @@
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -10,7 +10,7 @@
|
||||
<property>mandatory</property>
|
||||
<property>basic</property>
|
||||
<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>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -17,12 +17,12 @@
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<property>mandatory</property>
|
||||
<property>normal</property>
|
||||
<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>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="Général">
|
||||
@ -17,12 +17,12 @@
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<property>mandatory</property>
|
||||
<property>normal</property>
|
||||
<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>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general" mode="basic">
|
||||
@ -15,12 +15,12 @@
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif": null, "creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<property>mandatory</property>
|
||||
<property>expert</property>
|
||||
<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>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -21,6 +21,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -17,14 +17,14 @@
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="eole" optional="True">mode_conteneur_actif4</param>
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="eole" optional="True">mode_conteneur_actif3</param>
|
||||
<param type="variable" optional="True">mode_conteneur_actif4</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
<param type="variable" optional="True">mode_conteneur_actif3</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<property>mandatory</property>
|
||||
<property>normal</property>
|
||||
<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>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif1" type="choice">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -19,6 +19,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -19,6 +19,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -22,6 +22,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="général">
|
||||
@ -25,6 +25,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.autosavevar": null}
|
||||
{"creole.general.autosavevar": null}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -22,6 +22,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null}
|
||||
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -19,12 +19,12 @@
|
||||
<constraints>
|
||||
<check name="valid_entier" target="int">
|
||||
<param name="mini">0</param>
|
||||
<param name="maxi" type="eole">int2</param>
|
||||
<param name="maxi" type="variable">int2</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "b", "creole.general.int2": 100, "creole.general.int": null}
|
||||
{"creole.general.mode_conteneur_actif": "b", "creole.general.int2": 100, "creole.general.int": null}
|
||||
|
@ -16,7 +16,7 @@
|
||||
<variable doc="No change" multi="False" name="int" type="number">
|
||||
<check name="valid_entier" warnings_only="False">
|
||||
<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>
|
||||
<property>normal</property>
|
||||
</variable>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -16,16 +16,16 @@
|
||||
|
||||
<constraints>
|
||||
<check name="valid_differ" target="int">
|
||||
<param type="eole" optional="True">int2</param>
|
||||
<param type="variable" optional="True">int2</param>
|
||||
</check>
|
||||
<check name="valid_differ" target="int">
|
||||
<param type="eole" optional="True">int3</param>
|
||||
<param type="variable" optional="True">int3</param>
|
||||
</check>
|
||||
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null, "creole.general.int2": null}
|
||||
{"creole.general.mode_conteneur_actif": "b", "creole.general.int": null, "creole.general.int2": null}
|
||||
|
@ -10,7 +10,7 @@
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="int" type="number">
|
||||
<check name="valid_not_equal" warnings_only="False">
|
||||
<param type="eole">creole.general.int2</param>
|
||||
<param type="variable">creole.general.int2</param>
|
||||
</check>
|
||||
<check name="valid_not_equal" warnings_only="False"/>
|
||||
<property>normal</property>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -17,12 +17,12 @@
|
||||
|
||||
<constraints>
|
||||
<check name="valid_differ" target="mode_conteneur_actif">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non"}
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<property>normal</property>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
|
||||
<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>
|
||||
<choice type="string">oui</choice>
|
||||
<choice type="string">non</choice>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -23,15 +23,15 @@
|
||||
|
||||
<constraints>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</check>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif2</param>
|
||||
<param type="variable">mode_conteneur_actif2</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -14,15 +14,15 @@
|
||||
|
||||
<constraints>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</check>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif2</param>
|
||||
<param type="variable">mode_conteneur_actif2</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}
|
||||
|
@ -26,16 +26,16 @@
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string">
|
||||
<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 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 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 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>
|
||||
<property>mandatory</property>
|
||||
<property>normal</property>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -23,15 +23,15 @@
|
||||
|
||||
<constraints>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</check>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif2</param>
|
||||
<param type="variable">mode_conteneur_actif2</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -14,15 +14,15 @@
|
||||
|
||||
<constraints>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif1</param>
|
||||
<param type="variable">mode_conteneur_actif1</param>
|
||||
</check>
|
||||
<check name="valid_differ" target="mode_conteneur_actif3">
|
||||
<param type="eole">mode_conteneur_actif2</param>
|
||||
<param type="variable">mode_conteneur_actif2</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.mode_conteneur_actif1": "non", "creole.general.mode_conteneur_actif2": "non", "creole.general.mode_conteneur_actif3": "oui"}
|
||||
|
@ -26,10 +26,10 @@
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="string">
|
||||
<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 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>
|
||||
<property>mandatory</property>
|
||||
<property>normal</property>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -16,12 +16,12 @@
|
||||
|
||||
<constraints>
|
||||
<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>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.adresse_ip_eth0": null, "creole.general.adresse_netmask_eth0": null}
|
||||
{"creole.general.mode_conteneur_actif": "oui", "creole.general.adresse_ip_eth0": null, "creole.general.adresse_netmask_eth0": null}
|
||||
|
@ -16,7 +16,7 @@
|
||||
</variable>
|
||||
<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">
|
||||
<param type="eole">creole.general.adresse_ip_eth0</param>
|
||||
<param type="variable">creole.general.adresse_ip_eth0</param>
|
||||
</check>
|
||||
<property>mandatory</property>
|
||||
<property>basic</property>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -29,6 +29,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -29,6 +29,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="Général">
|
||||
@ -34,6 +34,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -33,6 +33,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -29,6 +29,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -28,6 +28,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
@ -1 +1 @@
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
{"creole.general.condition": "non", "creole.general.mode_conteneur_actif": "non", "creole.general.mode_conteneur_actif2": "non"}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<creole>
|
||||
<rougail>
|
||||
|
||||
<containers/>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
@ -31,6 +31,6 @@
|
||||
|
||||
<help/>
|
||||
|
||||
</creole>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user