From 7e38b4d952107aeb5d1537f20b0382875e31d814 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 10 Nov 2022 22:55:23 +0100 Subject: [PATCH] creole => cheetah --- src/rougail/config.py | 4 +- src/rougail/data/rougail.dtd | 6 +-- src/rougail/data/rougail.yml | 6 +-- src/rougail/template/engine/__init__.py | 4 +- .../template/engine/{creole.py => cheetah.py} | 3 -- src/rougail/template/engine/creole_legacy.py | 2 +- src/rougail/template/systemd.py | 44 +++++++++---------- .../70service_engine/tiramisu/base.py | 2 +- .../70service_engine/tiramisu/multi.py | 4 +- .../70service_engine/xml/00-base.xml | 2 +- .../70service_engine/yml/00-base.yml | 2 +- .../70service_engine_dash/tiramisu/base.py | 2 +- .../70service_engine_dash/tiramisu/multi.py | 4 +- .../70service_engine_dash/xml/00-base.xml | 2 +- .../70service_engine_dash/yml/00-base.yml | 2 +- .../70service_mount/tiramisu/base.py | 2 +- .../70service_mount/tiramisu/multi.py | 4 +- .../70service_mount/xml/00-base.xml | 2 +- .../70service_mount/yml/00-base.yml | 2 +- 19 files changed, 48 insertions(+), 51 deletions(-) rename src/rougail/template/engine/{creole.py => cheetah.py} (96%) diff --git a/src/rougail/config.py b/src/rougail/config.py index 326e935e8..969cb359c 100644 --- a/src/rougail/config.py +++ b/src/rougail/config.py @@ -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', diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index b7c89b054..1e008915c 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -54,7 +54,7 @@ - + @@ -77,13 +77,13 @@ - + - + diff --git a/src/rougail/data/rougail.yml b/src/rougail/data/rougail.yml index e068c81b5..4bc5e5fec 100644 --- a/src/rougail/data/rougail.yml +++ b/src/rougail/data/rougail.yml @@ -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 diff --git a/src/rougail/template/engine/__init__.py b/src/rougail/template/engine/__init__.py index d344dce67..02e371ea3 100644 --- a/src/rougail/template/engine/__init__.py +++ b/src/rougail/template/engine/__init__.py @@ -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') diff --git a/src/rougail/template/engine/creole.py b/src/rougail/template/engine/cheetah.py similarity index 96% rename from src/rougail/template/engine/creole.py rename to src/rougail/template/engine/cheetah.py index cdfa948cb..508217029 100644 --- a/src/rougail/template/engine/creole.py +++ b/src/rougail/template/engine/cheetah.py @@ -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 diff --git a/src/rougail/template/engine/creole_legacy.py b/src/rougail/template/engine/creole_legacy.py index 60090ad5d..7d6652493 100644 --- a/src/rougail/template/engine/creole_legacy.py +++ b/src/rougail/template/engine/creole_legacy.py @@ -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 diff --git a/src/rougail/template/systemd.py b/src/rougail/template/systemd.py index c52edd732..13ed5cb09 100644 --- a/src/rougail/template/systemd.py +++ b/src/rougail/template/systemd.py @@ -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, + ) diff --git a/tests/dictionaries/70service_engine/tiramisu/base.py b/tests/dictionaries/70service_engine/tiramisu/base.py index bc6295a63..d58662a6b 100644 --- a/tests/dictionaries/70service_engine/tiramisu/base.py +++ b/tests/dictionaries/70service_engine/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/70service_engine/tiramisu/multi.py b/tests/dictionaries/70service_engine/tiramisu/multi.py index 1cba7a915..a9d1b7d4d 100644 --- a/tests/dictionaries/70service_engine/tiramisu/multi.py +++ b/tests/dictionaries/70service_engine/tiramisu/multi.py @@ -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]) diff --git a/tests/dictionaries/70service_engine/xml/00-base.xml b/tests/dictionaries/70service_engine/xml/00-base.xml index a84500bde..b6704961b 100644 --- a/tests/dictionaries/70service_engine/xml/00-base.xml +++ b/tests/dictionaries/70service_engine/xml/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/70service_engine/yml/00-base.yml b/tests/dictionaries/70service_engine/yml/00-base.yml index df31195af..fba8fd6a1 100644 --- a/tests/dictionaries/70service_engine/yml/00-base.yml +++ b/tests/dictionaries/70service_engine/yml/00-base.yml @@ -2,7 +2,7 @@ version: '0.10' services: - service: - name: testsrv - engine: creole + engine: cheetah variables: - family: - name: general diff --git a/tests/dictionaries/70service_engine_dash/tiramisu/base.py b/tests/dictionaries/70service_engine_dash/tiramisu/base.py index cc517f073..3fcf9a1c2 100644 --- a/tests/dictionaries/70service_engine_dash/tiramisu/base.py +++ b/tests/dictionaries/70service_engine_dash/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/70service_engine_dash/tiramisu/multi.py b/tests/dictionaries/70service_engine_dash/tiramisu/multi.py index 281e30116..fc1539564 100644 --- a/tests/dictionaries/70service_engine_dash/tiramisu/multi.py +++ b/tests/dictionaries/70service_engine_dash/tiramisu/multi.py @@ -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]) diff --git a/tests/dictionaries/70service_engine_dash/xml/00-base.xml b/tests/dictionaries/70service_engine_dash/xml/00-base.xml index 6db4e9129..f017e5e44 100644 --- a/tests/dictionaries/70service_engine_dash/xml/00-base.xml +++ b/tests/dictionaries/70service_engine_dash/xml/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/70service_engine_dash/yml/00-base.yml b/tests/dictionaries/70service_engine_dash/yml/00-base.yml index 0679b5989..db827507d 100644 --- a/tests/dictionaries/70service_engine_dash/yml/00-base.yml +++ b/tests/dictionaries/70service_engine_dash/yml/00-base.yml @@ -2,7 +2,7 @@ version: '0.10' services: - service: - name: test-srv - engine: creole + engine: cheetah variables: - family: - name: general diff --git a/tests/dictionaries/70service_mount/tiramisu/base.py b/tests/dictionaries/70service_mount/tiramisu/base.py index ad401a829..c8668a28e 100644 --- a/tests/dictionaries/70service_mount/tiramisu/base.py +++ b/tests/dictionaries/70service_mount/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/70service_mount/tiramisu/multi.py b/tests/dictionaries/70service_mount/tiramisu/multi.py index 65ffbe5ff..585f749be 100644 --- a/tests/dictionaries/70service_mount/tiramisu/multi.py +++ b/tests/dictionaries/70service_mount/tiramisu/multi.py @@ -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]) diff --git a/tests/dictionaries/70service_mount/xml/00-base.xml b/tests/dictionaries/70service_mount/xml/00-base.xml index 92889e45a..76492d4d2 100644 --- a/tests/dictionaries/70service_mount/xml/00-base.xml +++ b/tests/dictionaries/70service_mount/xml/00-base.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/dictionaries/70service_mount/yml/00-base.yml b/tests/dictionaries/70service_mount/yml/00-base.yml index 6ce8d6d12..86c58e59f 100644 --- a/tests/dictionaries/70service_mount/yml/00-base.yml +++ b/tests/dictionaries/70service_mount/yml/00-base.yml @@ -3,7 +3,7 @@ services: - service: - name: testsrv type: mount - engine: creole + engine: cheetah variables: - family: - name: general