Reviewed-on: #5
This commit is contained in:
commit
d7a1a52ebb
@ -29,6 +29,16 @@ Un service non géré ne peut conteneur que des fichiers.
|
||||
|
||||
## Désactiver la génération d'un service
|
||||
|
||||
Il est possible de désactiver un service. Pour cela il faut rajouter l'attribut "disabled" à True :
|
||||
|
||||
```
|
||||
<services>
|
||||
<service name="test" disabled="True"/>
|
||||
</services>
|
||||
```
|
||||
|
||||
Dans ce cas, tous les services et les éléments qu'il compose ([fichier](file.md), ...) seront désactivés.
|
||||
|
||||
Il est possible de définir une [condition](../condition/README.md) de type "disabled_if_in" ou "disabled_if_not_in" sur une balise service :
|
||||
|
||||
```
|
||||
|
@ -76,10 +76,11 @@ class Annotator:
|
||||
None,
|
||||
None,
|
||||
'activate',
|
||||
True,
|
||||
not service.disabled,
|
||||
service,
|
||||
'.'.join(['services', normalize_family(service_name), 'activate']),
|
||||
)
|
||||
service.disabled = None
|
||||
for elttype, values in dict(vars(service)).items():
|
||||
if elttype == 'servicelist':
|
||||
self.objectspace.list_conditions.setdefault('servicelist',
|
||||
|
@ -50,6 +50,7 @@
|
||||
<!ATTLIST service name CDATA #REQUIRED>
|
||||
<!ATTLIST service manage (True|False) "True">
|
||||
<!ATTLIST service servicelist CDATA #IMPLIED>
|
||||
<!ATTLIST service disabled (True|False) "False">
|
||||
|
||||
<!ELEMENT ip (#PCDATA)>
|
||||
<!ATTLIST ip iplist CDATA #IMPLIED>
|
||||
|
12
tests/dictionaries/70service_disabled/00-base.xml
Normal file
12
tests/dictionaries/70service_disabled/00-base.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<services>
|
||||
<service name="test" disabled="True">
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<variable name="condition">
|
||||
<value>no</value>
|
||||
</variable>
|
||||
</variables>
|
||||
</rougail>
|
0
tests/dictionaries/70service_disabled/__init__.py
Normal file
0
tests/dictionaries/70service_disabled/__init__.py
Normal file
14
tests/dictionaries/70service_disabled/makedict/after.json
Normal file
14
tests/dictionaries/70service_disabled/makedict/after.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": "no"
|
||||
},
|
||||
"services.test.activate": {
|
||||
"owner": "default",
|
||||
"value": false
|
||||
},
|
||||
"services.test.manage": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
}
|
||||
}
|
5
tests/dictionaries/70service_disabled/makedict/base.json
Normal file
5
tests/dictionaries/70service_disabled/makedict/base.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"rougail.condition": "no",
|
||||
"services.test.activate": false,
|
||||
"services.test.manage": true
|
||||
}
|
14
tests/dictionaries/70service_disabled/makedict/before.json
Normal file
14
tests/dictionaries/70service_disabled/makedict/before.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": "no"
|
||||
},
|
||||
"services.test.activate": {
|
||||
"owner": "default",
|
||||
"value": false
|
||||
},
|
||||
"services.test.manage": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
/dev/null
|
20
tests/dictionaries/70service_disabled/tiramisu/base.py
Normal file
20
tests/dictionaries/70service_disabled/tiramisu/base.py
Normal file
@ -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="rougail", doc="rougail", children=[option_2])
|
||||
option_5 = BoolOption(name="activate", doc="activate", default=False)
|
||||
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])
|
Loading…
Reference in New Issue
Block a user