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.opt = self.objectspace.paths.get_variable(value)
|
||||||
variable.multi = None
|
variable.multi = None
|
||||||
needed_type = self.objectspace.types[dtd_key_type]
|
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 '
|
msg = _(f'"{value}" in "{elttype}" must be a variable with type '
|
||||||
f'"{needed_type}" not "{variable.opt.type}"')
|
f'"{needed_type}" not "{variable.opt.type}"')
|
||||||
raise DictConsistencyError(msg, 58, elt.xmlfiles)
|
raise DictConsistencyError(msg, 58, elt.xmlfiles)
|
||||||
|
@ -239,9 +239,9 @@ class ServiceAnnotator:
|
||||||
):
|
):
|
||||||
|
|
||||||
if service_name in self.uniq_overrides:
|
if service_name in self.uniq_overrides:
|
||||||
msg = _(f'only one override is allowed by service, '
|
msg = _('only one override is allowed by service, '
|
||||||
f'please use a variable multiple if you want have more than one IP')
|
'please use a variable multiple if you want have more than one IP')
|
||||||
raise DictConsistencyError(msg, 69, ip.xmlfiles)
|
raise DictConsistencyError(msg, 69, override.xmlfiles)
|
||||||
self.uniq_overrides.append(service_name)
|
self.uniq_overrides.append(service_name)
|
||||||
override.name = service_name
|
override.name = service_name
|
||||||
if not hasattr(override, 'engine'):
|
if not hasattr(override, 'engine'):
|
||||||
|
@ -260,8 +260,6 @@ class ServiceAnnotator:
|
||||||
msg = _(f'attribute "source" is mandatory for the file "{file_.name}" '
|
msg = _(f'attribute "source" is mandatory for the file "{file_.name}" '
|
||||||
f'"({service_name})"')
|
f'"({service_name})"')
|
||||||
raise DictConsistencyError(msg, 34, file_.xmlfiles)
|
raise DictConsistencyError(msg, 34, file_.xmlfiles)
|
||||||
if not file_.source:
|
|
||||||
del file_.source
|
|
||||||
if not hasattr(file_, 'engine'):
|
if not hasattr(file_, 'engine'):
|
||||||
file_.engine = RougailConfig['default_engine']
|
file_.engine = RougailConfig['default_engine']
|
||||||
|
|
||||||
|
@ -270,11 +268,14 @@ class ServiceAnnotator:
|
||||||
service_name,
|
service_name,
|
||||||
) -> None:
|
) -> None:
|
||||||
if service_name in self.uniq_ip:
|
if service_name in self.uniq_ip:
|
||||||
msg = _(f'only one IP is allowed by service, '
|
msg = _('only one IP is allowed by service, '
|
||||||
f'please use a variable multiple if you want have more than one IP')
|
'please use a variable multiple if you want have more than one IP')
|
||||||
raise DictConsistencyError(msg, 67, ip.xmlfiles)
|
raise DictConsistencyError(msg, 67, ip.xmlfiles)
|
||||||
self.uniq_ip.append(service_name)
|
self.uniq_ip.append(service_name)
|
||||||
variable = self.objectspace.paths.get_variable(ip.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'):
|
if variable.type in ['ip', 'network_cidr'] and hasattr(ip, 'netmask'):
|
||||||
msg = _(f'ip with ip_type "{variable.type}" must not have netmask')
|
msg = _(f'ip with ip_type "{variable.type}" must not have netmask')
|
||||||
raise DictConsistencyError(msg, 59, ip.xmlfiles)
|
raise DictConsistencyError(msg, 59, ip.xmlfiles)
|
||||||
|
|
|
@ -298,22 +298,22 @@ class RougailBaseTemplate:
|
||||||
self.post_instance()
|
self.post_instance()
|
||||||
chdir(ori_dir)
|
chdir(ori_dir)
|
||||||
|
|
||||||
def post_instance(self):
|
def post_instance(self): # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _instance_ip(self,
|
def _instance_ip(self,
|
||||||
*args,
|
*args,
|
||||||
) -> None:
|
) -> None: # pragma: no cover
|
||||||
raise NotImplementedError(_('cannot instanciate this service type ip'))
|
raise NotImplementedError(_('cannot instanciate this service type ip'))
|
||||||
|
|
||||||
def _instance_files(self,
|
def _instance_files(self,
|
||||||
*args,
|
*args,
|
||||||
) -> None:
|
) -> None: # pragma: no cover
|
||||||
raise NotImplementedError(_('cannot instanciate this service type file'))
|
raise NotImplementedError(_('cannot instanciate this service type file'))
|
||||||
|
|
||||||
def _instance_overrides(self,
|
def _instance_overrides(self,
|
||||||
*args,
|
*args,
|
||||||
) -> None:
|
) -> None: # pragma: no cover
|
||||||
raise NotImplementedError(_('cannot instanciate this service type override'))
|
raise NotImplementedError(_('cannot instanciate this service type override'))
|
||||||
|
|
||||||
async def load_variables(self,
|
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