better leader support in extra
This commit is contained in:
parent
e75965fad2
commit
f9acc7d6f8
15 changed files with 59 additions and 59 deletions
|
@ -448,7 +448,7 @@ class RougailBaseTemplate:
|
||||||
await suboption.option.name(),
|
await suboption.option.name(),
|
||||||
await suboption.option.path(),
|
await suboption.option.path(),
|
||||||
)
|
)
|
||||||
variables[leadership_name] = leader
|
variables[leadership_name] = RougailExtra({leader_name: leader})
|
||||||
else:
|
else:
|
||||||
if is_service_namespace == 'root':
|
if is_service_namespace == 'root':
|
||||||
new_is_service_namespace = 'service_name'
|
new_is_service_namespace = 'service_name'
|
||||||
|
|
|
@ -118,7 +118,7 @@ def process(filename: str,
|
||||||
)
|
)
|
||||||
data = str(cheetah_template)
|
data = str(cheetah_template)
|
||||||
except NotFound as err: # pragma: no cover
|
except NotFound as err: # pragma: no cover
|
||||||
varname = err.args[0][13:-1]
|
varname = err.args[0][13:].split(' ', 1)[0][:-1]
|
||||||
if filename:
|
if filename:
|
||||||
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<rougail version="0.10">
|
<rougail version="0.10">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="ejabberd">
|
<family name="ejabberd">
|
||||||
<family name="description" description="description" leadership="True">
|
<family name="leadership" description="description" leadership="True">
|
||||||
<variable name="description" type="string" multi="True">
|
<variable name="description" type="string" multi="True">
|
||||||
<value>test</value>
|
<value>test</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"extra.ejabberd.description.description": {
|
"extra.ejabberd.leadership.description": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": [
|
"value": [
|
||||||
"test"
|
"test"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"extra.ejabberd.description.mode": {
|
"extra.ejabberd.leadership.mode": {
|
||||||
"owner": [
|
"owner": [
|
||||||
"default"
|
"default"
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
"rougail.general.mode_conteneur_actif": "non",
|
||||||
"rougail.general.activer_ejabberd": "non",
|
"rougail.general.activer_ejabberd": "non",
|
||||||
"extra.ejabberd.description.description": [
|
"extra.ejabberd.leadership.description": [
|
||||||
{
|
{
|
||||||
"extra.ejabberd.description.description": "test",
|
"extra.ejabberd.leadership.description": "test",
|
||||||
"extra.ejabberd.description.mode": "pre"
|
"extra.ejabberd.leadership.mode": "pre"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"services.test.files.mailname.name": "/etc/mailname",
|
"services.test.files.mailname.name": "/etc/mailname",
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": "non"
|
"value": "non"
|
||||||
},
|
},
|
||||||
"extra.ejabberd.description.description": {
|
"extra.ejabberd.leadership.description": {
|
||||||
"owner": "default",
|
"owner": "default",
|
||||||
"value": [
|
"value": [
|
||||||
"test"
|
"test"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"extra.ejabberd.description.mode": {
|
"extra.ejabberd.leadership.mode": {
|
||||||
"owner": [
|
"owner": [
|
||||||
"default"
|
"default"
|
||||||
],
|
],
|
||||||
|
|
|
@ -17,7 +17,7 @@ option_2 = OptionDescription(name="general", doc="général", children=[option_3
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
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_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_9 = StrOption(name="mode", doc="mode", multi=True, default_multi="pre", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_7 = Leadership(name="description", doc="description", children=[option_8, option_9], properties=frozenset({"normal"}))
|
option_7 = Leadership(name="leadership", doc="description", children=[option_8, option_9], properties=frozenset({"normal"}))
|
||||||
option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7], 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_5 = OptionDescription(name="extra", doc="extra", children=[option_6])
|
||||||
option_14 = FilenameOption(name="name", doc="name", default="/etc/mailname")
|
option_14 = FilenameOption(name="name", doc="name", default="/etc/mailname")
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
%if 'test' in %%extra.ejabberd.description
|
%if 'test' in %%extra.ejabberd.leadership.description
|
||||||
contain test
|
contain test
|
||||||
%end if
|
%end if
|
||||||
%%len(%%extra.ejabberd.description)
|
%%len(%%extra.ejabberd.leadership.description)
|
||||||
%if 'a' in %%extra.ejabberd.description
|
%if 'a' in %%extra.ejabberd.leadership.description
|
||||||
contain a
|
contain a
|
||||||
%end if
|
%end if
|
||||||
%for %%description in %%extra.ejabberd.description
|
%for %%description in %%extra.ejabberd.leadership.description
|
||||||
leader: %%description
|
leader: %%description
|
||||||
follower: %%description.mode
|
follower: %%description.mode
|
||||||
%if %%description <= %%description.mode
|
%if %%description <= %%description.mode
|
||||||
|
@ -31,5 +31,5 @@ diff
|
||||||
%set %%var = %%description.mode + %%description
|
%set %%var = %%description.mode + %%description
|
||||||
%%var
|
%%var
|
||||||
%end for
|
%end for
|
||||||
leader2: %%extra.ejabberd.description[0]
|
leader2: %%extra.ejabberd.leadership.description[0]
|
||||||
follower2: %%extra.ejabberd.description[0].mode
|
follower2: %%extra.ejabberd.leadership.description[0].mode
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{% if 'test' in extra.ejabberd.description -%}
|
{% if 'test' in extra.ejabberd.leadership.description -%}
|
||||||
contain test
|
contain test
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{{ extra.ejabberd.description|length }}
|
{{ extra.ejabberd.leadership.description|length }}
|
||||||
{% if 'a' in extra.ejabberd.description -%}
|
{% if 'a' in extra.ejabberd.leadership.description -%}
|
||||||
contain a
|
contain a
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% for description in extra.ejabberd.description -%}
|
{% for description in extra.ejabberd.leadership.description -%}
|
||||||
leader: {{ description }}
|
leader: {{ description }}
|
||||||
follower: {{ description.mode }}
|
follower: {{ description.mode }}
|
||||||
{% if description <= description.mode -%}
|
{% if description <= description.mode -%}
|
||||||
|
@ -29,5 +29,5 @@ diff
|
||||||
{{ description + description.mode }}
|
{{ description + description.mode }}
|
||||||
{{ description.mode + description }}
|
{{ description.mode + description }}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
leader2: {{ extra.ejabberd.description[0] }}
|
leader2: {{ extra.ejabberd.leadership.description[0] }}
|
||||||
follower2: {{ extra.ejabberd.description[0].mode }}
|
follower2: {{ extra.ejabberd.leadership.description[0].mode }}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
%if 'test' in %%extra.ejabberd.new_name
|
%if 'test' in %%extra.ejabberd.new_name.description
|
||||||
contain test
|
contain test
|
||||||
%end if
|
%end if
|
||||||
%%len(%%extra.ejabberd.new_name)
|
%%len(%%extra.ejabberd.new_name.description)
|
||||||
%if 'a' in %%extra.ejabberd.new_name
|
%if 'a' in %%extra.ejabberd.new_name.description
|
||||||
contain a
|
contain a
|
||||||
%end if
|
%end if
|
||||||
%for %%description in %%extra.ejabberd.new_name
|
%for %%description in %%extra.ejabberd.new_name.description
|
||||||
leader: %%description
|
leader: %%description
|
||||||
follower: %%description.mode
|
follower: %%description.mode
|
||||||
%if %%description <= %%description.mode
|
%if %%description <= %%description.mode
|
||||||
|
@ -31,5 +31,5 @@ diff
|
||||||
%set %%var = %%description.mode + %%description
|
%set %%var = %%description.mode + %%description
|
||||||
%%var
|
%%var
|
||||||
%end for
|
%end for
|
||||||
leader2: %%extra.ejabberd.new_name[0].description
|
leader2: %%extra.ejabberd.new_name.description[0].description
|
||||||
follower2: %%extra.ejabberd.new_name[0].mode
|
follower2: %%extra.ejabberd.new_name.description[0].mode
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{% if 'test' in extra.ejabberd.new_name -%}
|
{% if 'test' in extra.ejabberd.new_name.description -%}
|
||||||
contain test
|
contain test
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{{ extra.ejabberd.new_name |length }}
|
{{ extra.ejabberd.new_name.description |length }}
|
||||||
{% if 'a' in extra.ejabberd.new_name -%}
|
{% if 'a' in extra.ejabberd.new_name.description -%}
|
||||||
contain a
|
contain a
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% for description in extra.ejabberd.new_name -%}
|
{% for description in extra.ejabberd.new_name.description -%}
|
||||||
leader: {{ description }}
|
leader: {{ description }}
|
||||||
follower: {{ description.mode }}
|
follower: {{ description.mode }}
|
||||||
{% if description <= description.mode -%}
|
{% if description <= description.mode -%}
|
||||||
|
@ -29,5 +29,5 @@ diff
|
||||||
{{ description + description.mode }}
|
{{ description + description.mode }}
|
||||||
{{ description.mode + description }}
|
{{ description.mode + description }}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
leader2: {{ extra.ejabberd.new_name[0].description }}
|
leader2: {{ extra.ejabberd.new_name.description[0].description }}
|
||||||
follower2: {{ extra.ejabberd.new_name[0].mode }}
|
follower2: {{ extra.ejabberd.new_name.description[0].mode }}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
%if 'test' in %%extra['ejabberd']['new_name']
|
%if 'test' in %%extra['ejabberd']['new_name']['description']
|
||||||
contain test
|
contain test
|
||||||
%end if
|
%end if
|
||||||
%%len(%%extra['ejabberd']['new_name'])
|
%%len(%%extra['ejabberd']['new_name']['description'])
|
||||||
%if 'a' in %%extra['ejabberd']['new_name']
|
%if 'a' in %%extra['ejabberd']['new_name']['description']
|
||||||
contain a
|
contain a
|
||||||
%end if
|
%end if
|
||||||
%for %%description in %%extra['ejabberd']['new_name']
|
%for %%description in %%extra['ejabberd']['new_name']['description']
|
||||||
leader: %%description
|
leader: %%description
|
||||||
follower: %%description['mode']
|
follower: %%description['mode']
|
||||||
%if %%description <= %%description['mode']
|
%if %%description <= %%description['mode']
|
||||||
|
@ -31,5 +31,5 @@ diff
|
||||||
%set %%var = %%description['mode'] + %%description
|
%set %%var = %%description['mode'] + %%description
|
||||||
%%var
|
%%var
|
||||||
%end for
|
%end for
|
||||||
leader2: %%extra['ejabberd']['new_name'][0]['description']
|
leader2: %%extra['ejabberd']['new_name']['description'][0]
|
||||||
follower2: %%extra['ejabberd']['new_name'][0]['mode']
|
follower2: %%extra['ejabberd']['new_name']['description'][0]['mode']
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{% if 'test' in extra.ejabberd.new_name -%}
|
{% if 'test' in extra.ejabberd.new_name.description -%}
|
||||||
contain test
|
contain test
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{{ extra.ejabberd.new_name |length }}
|
{{ extra.ejabberd.new_name.description |length }}
|
||||||
{% if 'a' in extra.ejabberd.new_name -%}
|
{% if 'a' in extra.ejabberd.new_name.description -%}
|
||||||
contain a
|
contain a
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% for description in extra.ejabberd.new_name -%}
|
{% for description in extra.ejabberd.new_name.description -%}
|
||||||
leader: {{ description }}
|
leader: {{ description }}
|
||||||
follower: {{ description.mode }}
|
follower: {{ description.mode }}
|
||||||
{% if description <= description.mode -%}
|
{% if description <= description.mode -%}
|
||||||
|
@ -29,5 +29,5 @@ diff
|
||||||
{{ description + description.mode }}
|
{{ description + description.mode }}
|
||||||
{{ description.mode + description }}
|
{{ description.mode + description }}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
leader2: {{ extra.ejabberd.new_name[0].description }}
|
leader2: {{ extra.ejabberd.new_name.description[0] }}
|
||||||
follower2: {{ extra.ejabberd.new_name[0].mode }}
|
follower2: {{ extra.ejabberd.new_name.description[0].mode }}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
%if 'test' in %%extra.ejabberd.description
|
%if 'test' in %%extra.ejabberd.description.description
|
||||||
contain test
|
contain test
|
||||||
%end if
|
%end if
|
||||||
%%len(%%extra.ejabberd.description)
|
%%len(%%extra.ejabberd.description.description)
|
||||||
%if 'a' in %%extra.ejabberd.description
|
%if 'a' in %%extra.ejabberd.description.description
|
||||||
contain a
|
contain a
|
||||||
%end if
|
%end if
|
||||||
%for %%description in %%extra.ejabberd.description
|
%for %%description in %%extra.ejabberd.description.description
|
||||||
leader: %%description
|
leader: %%description
|
||||||
follower: %%description.mode
|
follower: %%description.mode
|
||||||
%if %%description <= %%description.mode
|
%if %%description <= %%description.mode
|
||||||
|
@ -31,5 +31,5 @@ diff
|
||||||
%set %%var = %%description.mode + %%description
|
%set %%var = %%description.mode + %%description
|
||||||
%%var
|
%%var
|
||||||
%end for
|
%end for
|
||||||
leader2: %%extra.ejabberd.description[0]
|
leader2: %%extra.ejabberd.description.description[0]
|
||||||
follower2: %%extra.ejabberd.description[0].mode
|
follower2: %%extra.ejabberd.description.description[0].mode
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{% if 'test' in extra.ejabberd.description -%}
|
{% if 'test' in extra.ejabberd.description.description -%}
|
||||||
contain test
|
contain test
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{{ extra.ejabberd.description|length }}
|
{{ extra.ejabberd.description.description|length }}
|
||||||
{% if 'a' in extra.ejabberd.description -%}
|
{% if 'a' in extra.ejabberd.description.description -%}
|
||||||
contain a
|
contain a
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% for description in extra.ejabberd.description -%}
|
{% for description in extra.ejabberd.description.description -%}
|
||||||
leader: {{ description }}
|
leader: {{ description }}
|
||||||
follower: {{ description.mode }}
|
follower: {{ description.mode }}
|
||||||
{% if description <= description.mode -%}
|
{% if description <= description.mode -%}
|
||||||
|
@ -29,5 +29,5 @@ diff
|
||||||
{{ description + description.mode }}
|
{{ description + description.mode }}
|
||||||
{{ description.mode + description }}
|
{{ description.mode + description }}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
leader2: {{ extra.ejabberd.description[0] }}
|
leader2: {{ extra.ejabberd.description.description[0] }}
|
||||||
follower2: {{ extra.ejabberd.description[0].mode }}
|
follower2: {{ extra.ejabberd.description.description[0].mode }}
|
||||||
|
|
Loading…
Reference in a new issue