engine can be customized

This commit is contained in:
egarette@silique.fr 2023-05-11 16:01:50 +02:00
parent 565abbbca3
commit 4eccb75c73
11 changed files with 33 additions and 23 deletions

View file

@ -50,7 +50,7 @@ class TargetAnnotator(Walk):
for index, target in enumerate(obj.target): for index, target in enumerate(obj.target):
# test if it's redefined calculation # test if it's redefined calculation
if self.target_is_uniq and target.name in targets: if self.target_is_uniq and target.name in targets:
msg = _(f'A fill already exists for the target of "{target.name}" created') msg = _(f'A fill already exists for the target of "{target.name.path}" created')
raise DictConsistencyError(msg, 24, obj.xmlfiles) raise DictConsistencyError(msg, 24, obj.xmlfiles)
targets.append(target.name) targets.append(target.name)

View file

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

View file

@ -57,11 +57,6 @@ mapping:
- "content" - "content"
engine: engine:
type: str type: str
enum:
- "none"
- "cheetah"
- "jinja"
- "creole_legacy"
redefine: redefine:
type: bool type: bool
filelist: filelist:
@ -105,10 +100,6 @@ mapping:
type: str type: str
engine: engine:
type: str type: str
enum:
- "none"
- "cheetah"
- "jinja"
certificate: certificate:
required: false required: false
type: seq type: seq
@ -178,10 +169,6 @@ mapping:
type: str type: str
engine: engine:
type: str type: str
enum:
- "none"
- "cheetah"
- "jinja"
disabled: disabled:
type: bool type: bool
servicelist: servicelist:

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021 Copyright (C) 2019-2021
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2022 Copyright (C) 2022-2023
distribued with GPL-2 or later license distribued with GPL-2 or later license
@ -359,10 +359,13 @@ class RougailBaseTemplate:
destfilenames.append(destfilename) destfilenames.append(destfilename)
return destfilenames return destfilenames
async def load_variables(self): async def load_variables(self, with_flatten=True):
for option in await self.config.option.list(type='all'): for option in await self.config.option.list(type='all'):
namespace = await option.option.name() namespace = await option.option.name()
is_variable_namespace = namespace == self.rougailconfig['variable_namespace'] if with_flatten and namespace == self.rougailconfig['variable_namespace']:
is_variable_namespace = True
else:
is_variable_namespace = False
if namespace == 'services': if namespace == 'services':
is_service_namespace = 'root' is_service_namespace = 'root'
else: else:

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2021 Copyright (C) 2021
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2022 Copyright (C) 2022-2023
distribued with GPL-2 or later license distribued with GPL-2 or later license

View file

@ -285,7 +285,7 @@ class Common:
if child.inverse: if child.inverse:
kwargs += ", 'reverse_condition': ParamValue(True)" kwargs += ", 'reverse_condition': ParamValue(True)"
return (f"Calculation(func.calc_value, Params(ParamValue('{child.name}'), " return (f"Calculation(func.calc_value, Params(ParamValue('{child.name}'), "
f"kwargs={{{kwargs}}}))") f"kwargs={{{kwargs}}}), func.calc_value_property_help)")
def populate_informations(self): def populate_informations(self):
"""Populate Tiramisu's informations """Populate Tiramisu's informations

View file

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<variables>
<family name="general">
<family name="general">
<variable name="my_variable"/>
</family>
</family>
</variables>
</rougail>

View file

@ -0,0 +1,10 @@
version: '0.10'
variables:
- family:
- name: general
variables:
- family:
- name: general
variables:
- variable:
- name: my_variable

View file

@ -1,4 +1,4 @@
from tiramisu import valid_not_equal, valid_ip_netmask, calc_value, valid_in_network from tiramisu import valid_not_equal, valid_ip_netmask, calc_value, valid_in_network, calc_value_property_help
def trange(start, stop): def trange(start, stop):