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):
# test if it's redefined calculation
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)
targets.append(target.name)

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|cheetah|jinja) #IMPLIED>
<!ATTLIST service engine CDATA #IMPLIED>
<!ATTLIST service target CDATA #IMPLIED>
<!ATTLIST service type (service|mount|swap|timer|target) "service">
<!ATTLIST service undisable (True|False) "False">
@ -79,13 +79,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|cheetah|jinja|creole_legacy) #IMPLIED>
<!ATTLIST file engine CDATA #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|cheetah|jinja) #IMPLIED>
<!ATTLIST override engine CDATA #IMPLIED>
<!ELEMENT certificate (#PCDATA)>
<!ATTLIST certificate certificate_type (string|variable) "string">

View file

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

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
Silique (https://www.silique.fr)
Copyright (C) 2022
Copyright (C) 2022-2023
distribued with GPL-2 or later license
@ -359,10 +359,13 @@ class RougailBaseTemplate:
destfilenames.append(destfilename)
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'):
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':
is_service_namespace = 'root'
else:

View file

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

View file

@ -285,7 +285,7 @@ class Common:
if child.inverse:
kwargs += ", 'reverse_condition': ParamValue(True)"
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):
"""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):