mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 10:51:24 -07:00
[PR #6769/9d8bec14 backport][stable-7] nmcli: fix empty list to replace / remove values (#6869)
nmcli: fix empty list to replace / remove values (#6769)
(cherry picked from commit 9d8bec14c0
)
Co-authored-by: genofire <geno+dev@fireorbit.de>
This commit is contained in:
parent
f8fc18412c
commit
330b0304ef
3 changed files with 69 additions and 2 deletions
|
@ -2183,7 +2183,10 @@ class Nmcli(object):
|
|||
if key and len(pair) > 1:
|
||||
raw_value = pair[1].lstrip()
|
||||
if raw_value == '--':
|
||||
conn_info[key] = None
|
||||
if key_type == list:
|
||||
conn_info[key] = []
|
||||
else:
|
||||
conn_info[key] = None
|
||||
elif key == 'bond.options':
|
||||
# Aliases such as 'miimon', 'downdelay' are equivalent to the +bond.options 'option=value' syntax.
|
||||
opts = raw_value.split(',')
|
||||
|
@ -2270,7 +2273,7 @@ class Nmcli(object):
|
|||
# We can't just do `if not value` because then if there's a value
|
||||
# of 0 specified as an integer it'll be interpreted as empty when
|
||||
# it actually isn't.
|
||||
if value != 0 and not value:
|
||||
if value not in (0, []) and not value:
|
||||
continue
|
||||
|
||||
if key in conn_info:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue