add manage service

This commit is contained in:
Emmanuel Garette 2021-02-19 11:03:52 +01:00
parent bc25216c27
commit 41620cc92e
6 changed files with 36 additions and 1 deletions

View file

@ -65,7 +65,9 @@ class ServiceAnnotator:
self.objectspace.space.services.doc = 'services' self.objectspace.space.services.doc = 'services'
self.objectspace.space.services.path = 'services' self.objectspace.space.services.path = 'services'
for service_name, service in self.objectspace.space.services.service.items(): for service_name, service in self.objectspace.space.services.service.items():
service.information = self.objectspace.information(service.xmlfiles) if not service.manage:
service.information = self.objectspace.information(service.xmlfiles)
service.information.manage = service.manage
for elttype, values in dict(vars(service)).items(): for elttype, values in dict(vars(service)).items():
if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES: if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES:
continue continue

View file

@ -48,6 +48,7 @@
<!ELEMENT service ((port*|ip*|file*|override*)*)> <!ELEMENT service ((port*|ip*|file*|override*)*)>
<!ATTLIST service name CDATA #REQUIRED> <!ATTLIST service name CDATA #REQUIRED>
<!ATTLIST service manage (True|False) "True">
<!ELEMENT port (#PCDATA)> <!ELEMENT port (#PCDATA)>
<!ATTLIST port port_type (port|variable) "port"> <!ATTLIST port port_type (port|variable) "port">

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail version="0.9">
<services>
<service name='test' manage="False">
</service>
</services>
<variables>
<variable name='var' type='string'>
<value>mailname</value>
</variable>
</variables>
</rougail>

View file

@ -0,0 +1 @@
{"rougail.var": "mailname"}

View file

@ -0,0 +1,19 @@
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="var", doc="var", default="mailname", properties=frozenset({"mandatory", "normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_4 = OptionDescription(name="test", doc="test", children=[])
option_4.impl_set_information('manage', False)
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])