coverage + pylint
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user