coverage + pylint
This commit is contained in:
parent
eb3720d6bf
commit
807842e680
|
@ -216,7 +216,7 @@ class ServiceAnnotator:
|
|||
variable.opt = self.objectspace.paths.get_variable(value)
|
||||
variable.multi = None
|
||||
needed_type = self.objectspace.types[dtd_key_type]
|
||||
if needed_type != 'variable' and variable.opt.type != needed_type:
|
||||
if needed_type not in ('variable', variable.opt.type):
|
||||
msg = _(f'"{value}" in "{elttype}" must be a variable with type '
|
||||
f'"{needed_type}" not "{variable.opt.type}"')
|
||||
raise DictConsistencyError(msg, 58, elt.xmlfiles)
|
||||
|
@ -239,9 +239,9 @@ class ServiceAnnotator:
|
|||
):
|
||||
|
||||
if service_name in self.uniq_overrides:
|
||||
msg = _(f'only one override is allowed by service, '
|
||||
f'please use a variable multiple if you want have more than one IP')
|
||||
raise DictConsistencyError(msg, 69, ip.xmlfiles)
|
||||
msg = _('only one override is allowed by service, '
|
||||
'please use a variable multiple if you want have more than one IP')
|
||||
raise DictConsistencyError(msg, 69, override.xmlfiles)
|
||||
self.uniq_overrides.append(service_name)
|
||||
override.name = service_name
|
||||
if not hasattr(override, 'engine'):
|
||||
|
@ -260,8 +260,6 @@ class ServiceAnnotator:
|
|||
msg = _(f'attribute "source" is mandatory for the file "{file_.name}" '
|
||||
f'"({service_name})"')
|
||||
raise DictConsistencyError(msg, 34, file_.xmlfiles)
|
||||
if not file_.source:
|
||||
del file_.source
|
||||
if not hasattr(file_, 'engine'):
|
||||
file_.engine = RougailConfig['default_engine']
|
||||
|
||||
|
@ -270,11 +268,14 @@ class ServiceAnnotator:
|
|||
service_name,
|
||||
) -> None:
|
||||
if service_name in self.uniq_ip:
|
||||
msg = _(f'only one IP is allowed by service, '
|
||||
f'please use a variable multiple if you want have more than one IP')
|
||||
msg = _('only one IP is allowed by service, '
|
||||
'please use a variable multiple if you want have more than one IP')
|
||||
raise DictConsistencyError(msg, 67, ip.xmlfiles)
|
||||
self.uniq_ip.append(service_name)
|
||||
variable = self.objectspace.paths.get_variable(ip.name)
|
||||
if variable.type not in ['ip', 'network', 'network_cidr']:
|
||||
msg = _('ip cannot be linked to "{variable.type}" variable')
|
||||
raise DictConsistencyError(msg, 70, ip.xmlfiles)
|
||||
if variable.type in ['ip', 'network_cidr'] and hasattr(ip, 'netmask'):
|
||||
msg = _(f'ip with ip_type "{variable.type}" must not have netmask')
|
||||
raise DictConsistencyError(msg, 59, ip.xmlfiles)
|
||||
|
|
|
@ -298,22 +298,22 @@ class RougailBaseTemplate:
|
|||
self.post_instance()
|
||||
chdir(ori_dir)
|
||||
|
||||
def post_instance(self):
|
||||
def post_instance(self): # pragma: no cover
|
||||
pass
|
||||
|
||||
def _instance_ip(self,
|
||||
*args,
|
||||
) -> None:
|
||||
) -> None: # pragma: no cover
|
||||
raise NotImplementedError(_('cannot instanciate this service type ip'))
|
||||
|
||||
def _instance_files(self,
|
||||
*args,
|
||||
) -> None:
|
||||
) -> None: # pragma: no cover
|
||||
raise NotImplementedError(_('cannot instanciate this service type file'))
|
||||
|
||||
def _instance_overrides(self,
|
||||
*args,
|
||||
) -> None:
|
||||
) -> None: # pragma: no cover
|
||||
raise NotImplementedError(_('cannot instanciate this service type override'))
|
||||
|
||||
async def load_variables(self,
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rougail version="0.9">
|
||||
<services>
|
||||
<service name='test'>
|
||||
<file file_type="variable" source="mailname">file_name</file>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<variable name='file_name' type='string'>
|
||||
<value>/etc/mailname</value>
|
||||
</variable>
|
||||
</variables>
|
||||
</rougail>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name="test">
|
||||
<override/>
|
||||
<override/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name='nut'>
|
||||
<ip>nut_monitor_host</ip>
|
||||
<ip>nut_monitor_host</ip>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<variable name="nut_monitor_host" type="ip" mandatory='True'>
|
||||
<value>192.168.0.1</value>
|
||||
</variable>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<rougail version="0.9">
|
||||
|
||||
<services>
|
||||
<service name='nut'>
|
||||
<ip>nut_monitor_host</ip>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<variable name="nut_monitor_host" type="string" mandatory='True'>
|
||||
<value>192.168.0.1</value>
|
||||
</variable>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
Loading…
Reference in New Issue