Compare commits
11 Commits
533c70aef2
...
pkg/dev/ri
Author | SHA1 | Date | |
---|---|---|---|
49a5a454f4 | |||
904bc270bb | |||
ed9e177e41 | |||
38b30c12b4 | |||
a91e7ae68c | |||
ed1ee9e8a6 | |||
ddf33faf91 | |||
1fb0ed5918 | |||
b89eaaf805 | |||
4810a8d683 | |||
21bee4715a |
@ -71,6 +71,9 @@ class SpaceAnnotator: # pylint: disable=R0903
|
|||||||
get_annotators(ANNOTATORS, 'rougail.annotator')
|
get_annotators(ANNOTATORS, 'rougail.annotator')
|
||||||
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
||||||
get_annotators(ANNOTATORS, extra_annotator)
|
get_annotators(ANNOTATORS, extra_annotator)
|
||||||
|
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
||||||
|
if extra_annotator not in ANNOTATORS:
|
||||||
|
get_annotators(ANNOTATORS, extra_annotator)
|
||||||
annotators = ANNOTATORS['rougail.annotator'].copy()
|
annotators = ANNOTATORS['rougail.annotator'].copy()
|
||||||
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
for extra_annotator in objectspace.rougailconfig['extra_annotators']:
|
||||||
annotators.extend(ANNOTATORS[extra_annotator])
|
annotators.extend(ANNOTATORS[extra_annotator])
|
||||||
|
@ -32,7 +32,7 @@ from rougail.annotator.target import TargetAnnotator
|
|||||||
from rougail.annotator.param import ParamAnnotator
|
from rougail.annotator.param import ParamAnnotator
|
||||||
|
|
||||||
|
|
||||||
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename')
|
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename', 'zone_information', 'get_certificates', 'nsd_filename', 'get_linked_configuration')
|
||||||
|
|
||||||
|
|
||||||
class Annotator(TargetAnnotator, ParamAnnotator):
|
class Annotator(TargetAnnotator, ParamAnnotator):
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<!ATTLIST service disabled (True|False) "False">
|
<!ATTLIST service disabled (True|False) "False">
|
||||||
<!ATTLIST service engine (none|creole|jinja2) #IMPLIED>
|
<!ATTLIST service engine (none|creole|jinja2) #IMPLIED>
|
||||||
<!ATTLIST service target CDATA #IMPLIED>
|
<!ATTLIST service target CDATA #IMPLIED>
|
||||||
<!ATTLIST service type (service|mount) "service">
|
<!ATTLIST service type (service|mount|swap) "service">
|
||||||
|
|
||||||
<!ELEMENT ip (#PCDATA)>
|
<!ELEMENT ip (#PCDATA)>
|
||||||
<!ATTLIST ip iplist CDATA #IMPLIED>
|
<!ATTLIST ip iplist CDATA #IMPLIED>
|
||||||
|
@ -174,6 +174,7 @@ class Path:
|
|||||||
)
|
)
|
||||||
namespace = dico['variableobj'].namespace
|
namespace = dico['variableobj'].namespace
|
||||||
if namespace not in [self.variable_namespace, 'services'] and \
|
if namespace not in [self.variable_namespace, 'services'] and \
|
||||||
|
current_namespace != 'services' and \
|
||||||
current_namespace != namespace:
|
current_namespace != namespace:
|
||||||
msg = _(f'A variable located in the "{namespace}" namespace shall not be used '
|
msg = _(f'A variable located in the "{namespace}" namespace shall not be used '
|
||||||
f'in the "{current_namespace}" namespace')
|
f'in the "{current_namespace}" namespace')
|
||||||
|
@ -184,6 +184,11 @@ class RougailExtra:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
raise AttributeError(f'unable to find extra "{key}"')
|
raise AttributeError(f'unable to find extra "{key}"')
|
||||||
|
|
||||||
|
def __getitem__(self,
|
||||||
|
key: str,
|
||||||
|
) -> Any:
|
||||||
|
return self.__getattr__(key)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self._suboption.values())
|
return iter(self._suboption.values())
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class RougailSystemdTemplate(RougailBaseTemplate):
|
|||||||
self.ip_per_service = None
|
self.ip_per_service = None
|
||||||
|
|
||||||
def post_instance(self):
|
def post_instance(self):
|
||||||
destfile = '/tmpfiles.d/rougail.conf'
|
destfile = '/tmpfiles.d/0rougail.conf'
|
||||||
destfilename = join(self.destinations_dir, destfile[1:])
|
destfilename = join(self.destinations_dir, destfile[1:])
|
||||||
makedirs(dirname(destfilename), exist_ok=True)
|
makedirs(dirname(destfilename), exist_ok=True)
|
||||||
self.log.info(_(f"creole processing: '{destfilename}'"))
|
self.log.info(_(f"creole processing: '{destfilename}'"))
|
||||||
|
19
tests/dictionaries/60extra_leadership_name_item/00-base.xml
Normal file
19
tests/dictionaries/60extra_leadership_name_item/00-base.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file>/etc/mailname</file>
|
||||||
|
<file engine="jinja2">/etc/mailname2</file>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
<variables>
|
||||||
|
<family name="general" description="général">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="activer_ejabberd" type="string" description="No change" hidden="True">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<variables>
|
||||||
|
<family name="ejabberd">
|
||||||
|
<family name="new_name" description="new_name" leadership="True">
|
||||||
|
<variable name="description" type="string" multi="True">
|
||||||
|
<value>test</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="mode" type="string">
|
||||||
|
<value>pre</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
<constraints/>
|
||||||
|
</rougail>
|
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
},
|
||||||
|
"rougail.general.activer_ejabberd": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
},
|
||||||
|
"extra.ejabberd.new_name.description": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra.ejabberd.new_name.mode": {
|
||||||
|
"owner": [
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"pre"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"services.test.files.mailname.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/mailname"
|
||||||
|
},
|
||||||
|
"services.test.files.mailname.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.files.mailname2.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/mailname2"
|
||||||
|
},
|
||||||
|
"services.test.files.mailname2.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.manage": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
|
"rougail.general.activer_ejabberd": "non",
|
||||||
|
"extra.ejabberd.new_name.description": [
|
||||||
|
{
|
||||||
|
"extra.ejabberd.new_name.description": "test",
|
||||||
|
"extra.ejabberd.new_name.mode": "pre"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services.test.files.mailname.name": "/etc/mailname",
|
||||||
|
"services.test.files.mailname.activate": true,
|
||||||
|
"services.test.files.mailname2.name": "/etc/mailname2",
|
||||||
|
"services.test.files.mailname2.activate": true,
|
||||||
|
"services.test.activate": true,
|
||||||
|
"services.test.manage": true
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"rougail.general.mode_conteneur_actif": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
},
|
||||||
|
"rougail.general.activer_ejabberd": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
},
|
||||||
|
"extra.ejabberd.new_name.description": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra.ejabberd.new_name.mode": {
|
||||||
|
"owner": [
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"pre"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"services.test.files.mailname.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/mailname"
|
||||||
|
},
|
||||||
|
"services.test.files.mailname.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.files.mailname2.name": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "/etc/mailname2"
|
||||||
|
},
|
||||||
|
"services.test.files.mailname2.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.manage": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
contain test
|
||||||
|
1
|
||||||
|
leader: test
|
||||||
|
follower: pre
|
||||||
|
supeq
|
||||||
|
sup
|
||||||
|
diff
|
||||||
|
testpre
|
||||||
|
pretest
|
||||||
|
leader2: test
|
||||||
|
follower2: pre
|
@ -0,0 +1,11 @@
|
|||||||
|
contain test
|
||||||
|
1
|
||||||
|
leader: test
|
||||||
|
follower: pre
|
||||||
|
supeq
|
||||||
|
sup
|
||||||
|
diff
|
||||||
|
testpre
|
||||||
|
pretest
|
||||||
|
leader2: test
|
||||||
|
follower2: pre
|
@ -0,0 +1,37 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
from importlib.util import spec_from_loader, module_from_spec
|
||||||
|
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
spec = spec_from_loader(loader.name, loader)
|
||||||
|
func = module_from_spec(spec)
|
||||||
|
loader.exec_module(func)
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||||
|
option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||||
|
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"}))
|
||||||
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
|
option_8 = StrOption(name="description", doc="description", multi=True, default=['test'], properties=frozenset({"mandatory"}))
|
||||||
|
option_9 = StrOption(name="mode", doc="mode", multi=True, default_multi="pre", properties=frozenset({"mandatory", "normal"}))
|
||||||
|
option_7 = Leadership(name="new_name", doc="new_name", children=[option_8, option_9], properties=frozenset({"normal"}))
|
||||||
|
option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7], properties=frozenset({"normal"}))
|
||||||
|
option_5 = OptionDescription(name="extra", doc="extra", children=[option_6])
|
||||||
|
option_14 = FilenameOption(name="name", doc="name", default="/etc/mailname")
|
||||||
|
option_15 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15])
|
||||||
|
option_13.impl_set_information('source', "mailname")
|
||||||
|
option_17 = FilenameOption(name="name", doc="name", default="/etc/mailname2")
|
||||||
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
option_16 = OptionDescription(name="mailname2", doc="mailname2", children=[option_17, option_18])
|
||||||
|
option_16.impl_set_information('engine', "jinja2")
|
||||||
|
option_16.impl_set_information('source', "mailname2")
|
||||||
|
option_12 = OptionDescription(name="files", doc="files", children=[option_13, option_16])
|
||||||
|
option_19 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
option_20 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
|
option_11 = OptionDescription(name="test", doc="test", children=[option_12, option_19, option_20])
|
||||||
|
option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10])
|
@ -0,0 +1,35 @@
|
|||||||
|
%if 'test' in %%extra['ejabberd']['new_name']
|
||||||
|
contain test
|
||||||
|
%end if
|
||||||
|
%%len(%%extra['ejabberd']['new_name'])
|
||||||
|
%if 'a' in %%extra['ejabberd']['new_name']
|
||||||
|
contain a
|
||||||
|
%end if
|
||||||
|
%for %%description in %%extra['ejabberd']['new_name']
|
||||||
|
leader: %%description
|
||||||
|
follower: %%description['mode']
|
||||||
|
%if %%description <= %%description['mode']
|
||||||
|
infeq
|
||||||
|
%end if
|
||||||
|
%if %%description >= %%description['mode']
|
||||||
|
supeq
|
||||||
|
%end if
|
||||||
|
%if %%description < %%description['mode']
|
||||||
|
inf
|
||||||
|
%end if
|
||||||
|
%if %%description > %%description['mode']
|
||||||
|
sup
|
||||||
|
%end if
|
||||||
|
%if %%description == %%description['mode']
|
||||||
|
eq
|
||||||
|
%end if
|
||||||
|
%if %%description != %%description['mode']
|
||||||
|
diff
|
||||||
|
%end if
|
||||||
|
%set %%var = %%description + %%description['mode']
|
||||||
|
%%var
|
||||||
|
%set %%var = %%description['mode'] + %%description
|
||||||
|
%%var
|
||||||
|
%end for
|
||||||
|
leader2: %%extra['ejabberd']['new_name'][0]['description']
|
||||||
|
follower2: %%extra['ejabberd']['new_name'][0]['mode']
|
@ -0,0 +1,33 @@
|
|||||||
|
{% if 'test' in extra.ejabberd.new_name -%}
|
||||||
|
contain test
|
||||||
|
{% endif -%}
|
||||||
|
{{ extra.ejabberd.new_name |length }}
|
||||||
|
{% if 'a' in extra.ejabberd.new_name -%}
|
||||||
|
contain a
|
||||||
|
{% endif -%}
|
||||||
|
{% for description in extra.ejabberd.new_name -%}
|
||||||
|
leader: {{ description }}
|
||||||
|
follower: {{ description.mode }}
|
||||||
|
{% if description <= description.mode -%}
|
||||||
|
infeq
|
||||||
|
{% endif -%}
|
||||||
|
{% if description >= description.mode -%}
|
||||||
|
supeq
|
||||||
|
{% endif -%}
|
||||||
|
{% if description < description.mode -%}
|
||||||
|
inf
|
||||||
|
{% endif -%}
|
||||||
|
{% if description > description.mode -%}
|
||||||
|
sup
|
||||||
|
{% endif -%}
|
||||||
|
{% if description == description.mode -%}
|
||||||
|
eq
|
||||||
|
{% endif -%}
|
||||||
|
{% if description != description.mode -%}
|
||||||
|
diff
|
||||||
|
{% endif -%}
|
||||||
|
{{ description + description.mode }}
|
||||||
|
{{ description.mode + description }}
|
||||||
|
{% endfor -%}
|
||||||
|
leader2: {{ extra.ejabberd.new_name[0].description }}
|
||||||
|
follower2: {{ extra.ejabberd.new_name[0].mode }}
|
@ -0,0 +1,4 @@
|
|||||||
|
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
|
||||||
|
z /etc/mailname - - - - -
|
||||||
|
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
|
||||||
|
z /etc/mailname2 - - - - -
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<services>
|
||||||
|
<service name="test" servicelist="test"/>
|
||||||
|
</services>
|
||||||
|
</rougail>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.10">
|
||||||
|
<variables>
|
||||||
|
<variable name="condition">
|
||||||
|
<value>no</value>
|
||||||
|
</variable>
|
||||||
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
<condition name="disabled_if_in" source="extra.condition">
|
||||||
|
<param>yes</param>
|
||||||
|
<target type="servicelist">test</target>
|
||||||
|
</condition>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"extra.condition": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"services.test.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.manage": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"extra.condition": "no",
|
||||||
|
"services.test.activate": true,
|
||||||
|
"services.test.manage": true
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"extra.condition": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"services.test.activate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"services.test.manage": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
from importlib.util import spec_from_loader, module_from_spec
|
||||||
|
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
spec = spec_from_loader(loader.name, loader)
|
||||||
|
func = module_from_spec(spec)
|
||||||
|
loader.exec_module(func)
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
option_2 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
|
option_1 = OptionDescription(name="extra", doc="extra", children=[option_2])
|
||||||
|
option_5 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_2, notraisepropertyerror=True), 'expected_0': ParamValue("yes")})))
|
||||||
|
option_6 = BoolOption(name="manage", doc="manage", default=True)
|
||||||
|
option_4 = OptionDescription(name="test", doc="test", children=[option_5, option_6])
|
||||||
|
option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3])
|
Reference in New Issue
Block a user