creole => cheetah

This commit is contained in:
egarette@silique.fr 2022-11-10 22:55:23 +01:00
parent a357d97e5a
commit 7e38b4d952
19 changed files with 48 additions and 51 deletions

View file

@ -54,12 +54,12 @@ RougailConfig = {'dictionaries_dir': [join(ROUGAILROOT, 'dictionaries')],
'modes_level': ['basic', 'normal', 'expert'],
'default_family_mode': 'basic',
'default_variable_mode': 'normal',
'default_files_engine': 'creole',
'default_files_engine': 'cheetah',
'default_files_mode': '0644',
'default_files_owner': 'root',
'default_files_group': 'root',
'default_files_included': 'no',
'default_overrides_engine': 'creole',
'default_overrides_engine': 'cheetah',
'default_service_names_engine': 'none',
'default_systemd_directory': '/systemd',
'base_option_name': 'baseoption',

View file

@ -54,7 +54,7 @@
<!ATTLIST service manage (True|False) "True">
<!ATTLIST service servicelist CDATA #IMPLIED>
<!ATTLIST service disabled (True|False) "False">
<!ATTLIST service engine (none|creole|jinja) #IMPLIED>
<!ATTLIST service engine (none|cheetah|jinja) #IMPLIED>
<!ATTLIST service target CDATA #IMPLIED>
<!ATTLIST service type (service|mount|swap|timer|target) "service">
<!ATTLIST service undisable (True|False) "False">
@ -77,13 +77,13 @@
<!ATTLIST file group_type (unix_user|variable) "unix_user">
<!ATTLIST file filelist CDATA #IMPLIED>
<!ATTLIST file redefine (True|False) "False">
<!ATTLIST file engine (none|creole|jinja|creole_legacy) #IMPLIED>
<!ATTLIST file engine (none|cheetah|jinja|creole_legacy) #IMPLIED>
<!ATTLIST file included (no|name|content) #IMPLIED>
<!ATTLIST file disabled (True|False) "False">
<!ELEMENT override EMPTY>
<!ATTLIST override source CDATA #IMPLIED>
<!ATTLIST override engine (none|creole|jinja) #IMPLIED>
<!ATTLIST override engine (none|cheetah|jinja) #IMPLIED>
<!ELEMENT variables ((variable*|family*)*)>

View file

@ -59,7 +59,7 @@ mapping:
type: str
enum:
- "none"
- "creole"
- "cheetah"
- "jinja"
- "creole_legacy"
redefine:
@ -102,7 +102,7 @@ mapping:
type: str
enum:
- "none"
- "creole"
- "cheetah"
- "jinja"
name:
type: str
@ -122,7 +122,7 @@ mapping:
type: str
enum:
- "none"
- "creole"
- "cheetah"
- "jinja"
disabled:
type: bool

View file

@ -1,4 +1,4 @@
from . import none, creole, jinja, creole_legacy
from . import none, cheetah, jinja, creole_legacy
__all__ = ('none', 'creole', 'jinja', 'creole_legacy')
__all__ = ('none', 'cheetah', 'jinja', 'creole_legacy')

View file

@ -43,10 +43,7 @@ def cl_compile(kls, *args, **kwargs):
"""
kwargs['compilerSettings'] = {'directiveStartToken': '%',
'cheetahVarStartToken': '%%',
'EOLSlurpToken': '%',
'commentStartToken': '#',
'multiLineCommentStartToken': '#*',
'multiLineCommentEndToken': '*#',
}
return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
Template.old_compile = Template.compile

View file

@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from typing import Dict, Any
from Cheetah.NameMapper import NotFound
from .creole import CheetahTemplate as oriCheetahTemplate
from .cheetah import CheetahTemplate as oriCheetahTemplate
from ...i18n import _
from ...utils import normalize_family
from ...error import TemplateError

View file

@ -151,17 +151,17 @@ C %%filename %%file.mode %%file.owner %%file.group - {self.rougailconfig['tmpfil
destfile = f'{self.rougailconfig["default_systemd_directory"]}/system/{service_name}.d/rougail_ip.conf'
destfilename = join(self.destinations_dir, destfile[1:])
makedirs(dirname(destfilename), exist_ok=True)
self.log.info(_(f"creole processing: '{destfilename}'"))
self.engines['creole'].process(filename=None,
source=ROUGAIL_IP_TEMPLATE,
true_destfilename=destfile,
destfilename=destfilename,
destdir=self.destinations_dir,
variable=self.ip_per_service,
index=None,
rougail_variables_dict=self.rougail_variables_dict,
eosfunc=self.eosfunc,
)
self.log.info(_(f"Cheetah processing: '{destfilename}'"))
self.engines['cheetah'].process(filename=None,
source=ROUGAIL_IP_TEMPLATE,
true_destfilename=destfile,
destfilename=destfilename,
destdir=self.destinations_dir,
variable=self.ip_per_service,
index=None,
rougail_variables_dict=self.rougail_variables_dict,
eosfunc=self.eosfunc,
)
self.ip_per_service = None
def process(self,
@ -183,14 +183,14 @@ C %%filename %%file.mode %%file.owner %%file.group - {self.rougailconfig['tmpfil
def post_instance(self):
destfilename = join(self.destinations_dir, ROUGAIL_DEST_FILE[1:])
makedirs(dirname(destfilename), exist_ok=True)
self.log.info(_(f"creole processing: '{destfilename}'"))
self.engines['creole'].process(filename=None,
source=self.rougail_tmpl_template,
true_destfilename=ROUGAIL_DEST_FILE,
destfilename=destfilename,
destdir=self.destinations_dir,
variable=None,
index=None,
rougail_variables_dict=self.rougail_variables_dict,
eosfunc=self.eosfunc,
)
self.log.info(_(f"Cheetah processing: '{destfilename}'"))
self.engines['cheetah'].process(filename=None,
source=self.rougail_tmpl_template,
true_destfilename=ROUGAIL_DEST_FILE,
destfilename=destfilename,
destdir=self.destinations_dir,
variable=None,
index=None,
rougail_variables_dict=self.rougail_variables_dict,
eosfunc=self.eosfunc,
)

View file

@ -24,7 +24,7 @@ optiondescription_5 = OptionDescription(name="rougail", doc="Rougail", children=
option_3 = BoolOption(name="activate", doc="activate", default=True)
option_4 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_7 = OptionDescription(name="testsrv_service", doc="testsrv.service", children=[option_3, option_4])
optiondescription_7.impl_set_information('engine', "creole")
optiondescription_7.impl_set_information('engine', "cheetah")
optiondescription_7.impl_set_information('type', "service")
optiondescription_6 = OptionDescription(name="services", doc="services", children=[optiondescription_7], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_6])

View file

@ -24,7 +24,7 @@ optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children
option_5 = BoolOption(name="activate", doc="activate", default=True)
option_6 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_12 = OptionDescription(name="testsrv_service", doc="testsrv.service", children=[option_5, option_6])
optiondescription_12.impl_set_information('engine', "creole")
optiondescription_12.impl_set_information('engine', "cheetah")
optiondescription_12.impl_set_information('type', "service")
optiondescription_11 = OptionDescription(name="services", doc="services", children=[optiondescription_12], properties=frozenset({"hidden"}))
optiondescription_9 = OptionDescription(name="1", doc="1", children=[optiondescription_10, optiondescription_11])
@ -34,7 +34,7 @@ optiondescription_14 = OptionDescription(name="rougail", doc="Rougail", children
option_7 = BoolOption(name="activate", doc="activate", default=True)
option_8 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_16 = OptionDescription(name="testsrv_service", doc="testsrv.service", children=[option_7, option_8])
optiondescription_16.impl_set_information('engine', "creole")
optiondescription_16.impl_set_information('engine', "cheetah")
optiondescription_16.impl_set_information('type', "service")
optiondescription_15 = OptionDescription(name="services", doc="services", children=[optiondescription_16], properties=frozenset({"hidden"}))
optiondescription_13 = OptionDescription(name="2", doc="2", children=[optiondescription_14, optiondescription_15])

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="testsrv" engine="creole">
<service name="testsrv" engine="cheetah">
</service>
</services>
<variables>

View file

@ -2,7 +2,7 @@ version: '0.10'
services:
- service:
- name: testsrv
engine: creole
engine: cheetah
variables:
- family:
- name: general

View file

@ -24,7 +24,7 @@ optiondescription_5 = OptionDescription(name="rougail", doc="Rougail", children=
option_3 = BoolOption(name="activate", doc="activate", default=True)
option_4 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_7 = OptionDescription(name="test_srv_service", doc="test-srv.service", children=[option_3, option_4])
optiondescription_7.impl_set_information('engine', "creole")
optiondescription_7.impl_set_information('engine', "cheetah")
optiondescription_7.impl_set_information('type', "service")
optiondescription_6 = OptionDescription(name="services", doc="services", children=[optiondescription_7], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_6])

View file

@ -24,7 +24,7 @@ optiondescription_10 = OptionDescription(name="rougail", doc="Rougail", children
option_5 = BoolOption(name="activate", doc="activate", default=True)
option_6 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_12 = OptionDescription(name="test_srv_service", doc="test-srv.service", children=[option_5, option_6])
optiondescription_12.impl_set_information('engine', "creole")
optiondescription_12.impl_set_information('engine', "cheetah")
optiondescription_12.impl_set_information('type', "service")
optiondescription_11 = OptionDescription(name="services", doc="services", children=[optiondescription_12], properties=frozenset({"hidden"}))
optiondescription_9 = OptionDescription(name="1", doc="1", children=[optiondescription_10, optiondescription_11])
@ -34,7 +34,7 @@ optiondescription_14 = OptionDescription(name="rougail", doc="Rougail", children
option_7 = BoolOption(name="activate", doc="activate", default=True)
option_8 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_16 = OptionDescription(name="test_srv_service", doc="test-srv.service", children=[option_7, option_8])
optiondescription_16.impl_set_information('engine', "creole")
optiondescription_16.impl_set_information('engine', "cheetah")
optiondescription_16.impl_set_information('type', "service")
optiondescription_15 = OptionDescription(name="services", doc="services", children=[optiondescription_16], properties=frozenset({"hidden"}))
optiondescription_13 = OptionDescription(name="2", doc="2", children=[optiondescription_14, optiondescription_15])

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test-srv" engine="creole">
<service name="test-srv" engine="cheetah">
</service>
</services>
<variables>

View file

@ -2,7 +2,7 @@ version: '0.10'
services:
- service:
- name: test-srv
engine: creole
engine: cheetah
variables:
- family:
- name: general

View file

@ -25,6 +25,6 @@ option_3 = BoolOption(name="activate", doc="activate", default=True)
option_4 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_7 = OptionDescription(name="testsrv_mount", doc="testsrv.mount", children=[option_3, option_4])
optiondescription_7.impl_set_information('type', "mount")
optiondescription_7.impl_set_information('engine', "creole")
optiondescription_7.impl_set_information('engine', "cheetah")
optiondescription_6 = OptionDescription(name="services", doc="services", children=[optiondescription_7], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_5, optiondescription_6])

View file

@ -25,7 +25,7 @@ option_5 = BoolOption(name="activate", doc="activate", default=True)
option_6 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_12 = OptionDescription(name="testsrv_mount", doc="testsrv.mount", children=[option_5, option_6])
optiondescription_12.impl_set_information('type', "mount")
optiondescription_12.impl_set_information('engine', "creole")
optiondescription_12.impl_set_information('engine', "cheetah")
optiondescription_11 = OptionDescription(name="services", doc="services", children=[optiondescription_12], properties=frozenset({"hidden"}))
optiondescription_9 = OptionDescription(name="1", doc="1", children=[optiondescription_10, optiondescription_11])
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
@ -35,7 +35,7 @@ option_7 = BoolOption(name="activate", doc="activate", default=True)
option_8 = BoolOption(name="manage", doc="manage", default=True)
optiondescription_16 = OptionDescription(name="testsrv_mount", doc="testsrv.mount", children=[option_7, option_8])
optiondescription_16.impl_set_information('type', "mount")
optiondescription_16.impl_set_information('engine', "creole")
optiondescription_16.impl_set_information('engine', "cheetah")
optiondescription_15 = OptionDescription(name="services", doc="services", children=[optiondescription_16], properties=frozenset({"hidden"}))
optiondescription_13 = OptionDescription(name="2", doc="2", children=[optiondescription_14, optiondescription_15])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_9, optiondescription_13])

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="testsrv" type="mount" engine="creole"/>
<service name="testsrv" type="mount" engine="cheetah"/>
</services>
<variables>
<family name="general" description="général">

View file

@ -3,7 +3,7 @@ services:
- service:
- name: testsrv
type: mount
engine: creole
engine: cheetah
variables:
- family:
- name: general