reworks on ip
This commit is contained in:
@ -202,10 +202,10 @@ class ServiceAnnotator:
|
||||
if type_ == 'symlink':
|
||||
variable.opt = self.objectspace.paths.get_variable(value)
|
||||
variable.multi = None
|
||||
if self.objectspace.types[dtd_key_type] != 'variable' and \
|
||||
variable.opt.type != self.objectspace.types[dtd_key_type]:
|
||||
msg = _(f'"{key}" in "{elttype}" must be a variable with type '
|
||||
f'"{self.objectspace.types[dtd_key_type]}" not "{variable.opt.type}"')
|
||||
needed_type = self.objectspace.types[dtd_key_type]
|
||||
if needed_type != 'variable' and variable.opt.type != needed_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)
|
||||
|
||||
else:
|
||||
@ -245,3 +245,20 @@ class ServiceAnnotator:
|
||||
msg = _(f'attribute "source" is mandatory for the file "{file_.name}" '
|
||||
f'"({service_name})"')
|
||||
raise DictConsistencyError(msg, 34, file_.xmlfiles)
|
||||
|
||||
def _update_ip(self,
|
||||
ip,
|
||||
service_name,
|
||||
) -> None:
|
||||
variable = self.objectspace.paths.get_variable(ip.name)
|
||||
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)
|
||||
if variable.type == 'network' and not hasattr(ip, 'netmask'):
|
||||
msg = _(f'ip with ip_type "{variable.type}" must have netmask')
|
||||
raise DictConsistencyError(msg, 64, ip.xmlfiles)
|
||||
if hasattr(ip, 'netmask'):
|
||||
netmask = self.objectspace.paths.get_variable(ip.netmask)
|
||||
if netmask.type != 'netmask':
|
||||
msg = _(f'netmask in ip must have type "netmask", not "{netmask.type}"')
|
||||
raise DictConsistencyError(msg, 65, ip.xmlfiles)
|
||||
|
@ -56,11 +56,9 @@
|
||||
|
||||
<!ELEMENT ip (#PCDATA)>
|
||||
<!ATTLIST ip iplist CDATA #IMPLIED>
|
||||
<!ATTLIST ip ip_type (network|variable) "network">
|
||||
<!ATTLIST ip interface_type (string|variable) "string">
|
||||
<!ATTLIST ip interface CDATA #REQUIRED>
|
||||
<!ATTLIST ip netmask_type (netmask|variable) "netmask">
|
||||
<!ATTLIST ip netmask CDATA "255.255.255.255">
|
||||
<!ATTLIST ip ip_type (variable) "variable">
|
||||
<!ATTLIST ip netmask_type (variable) "variable">
|
||||
<!ATTLIST ip netmask CDATA #IMPLIED>
|
||||
|
||||
<!ELEMENT file EMPTY>
|
||||
<!ATTLIST file name CDATA #REQUIRED>
|
||||
|
Reference in New Issue
Block a user