mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-07-10 02:04:37 +02:00
ip dhcp-client: dhcp-options can be removed with value '' (#154)
* dhcp-options can be removed with value ''. * Fix handling of disabled keys on creation. * Fix typo.
This commit is contained in:
parent
071f742100
commit
4329928474
5 changed files with 166 additions and 11 deletions
|
@ -118,9 +118,9 @@ class Or(object):
|
|||
return repr(self.args)
|
||||
|
||||
|
||||
def _normalize_entry(entry, path_info):
|
||||
def _normalize_entry(entry, path_info, on_create=False):
|
||||
for key, data in path_info.fields.items():
|
||||
if key not in entry and data.default is not None and not data.can_disable:
|
||||
if key not in entry and data.default is not None and (not data.can_disable or on_create):
|
||||
entry[key] = data.default
|
||||
if data.can_disable:
|
||||
if key in entry and entry[key] in (None, data.remove_value):
|
||||
|
@ -188,7 +188,7 @@ class Path(object):
|
|||
'.id': id,
|
||||
}
|
||||
entry.update(kwargs)
|
||||
_normalize_entry(entry, self._path_info)
|
||||
_normalize_entry(entry, self._path_info, on_create=True)
|
||||
self._values.append(entry)
|
||||
return id
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue