mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix ipset new_set bug
This commit is contained in:
parent
8f9405cf8e
commit
f1a35823f7
3 changed files with 18 additions and 1 deletions
1
changelog/61620.fixed.md
Normal file
1
changelog/61620.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
`ipset.new_set` no longer fails when creating a set type that uses the `family` create option
|
|
@ -328,7 +328,7 @@ def new_set(name=None, set_type=None, family="ipv4", comment=False, **kwargs):
|
|||
|
||||
# Family only valid for certain set types
|
||||
if "family" in _CREATE_OPTIONS[set_type]:
|
||||
cmd.extend(["family", cmd, ipset_family])
|
||||
cmd.extend(["family", ipset_family])
|
||||
|
||||
if comment:
|
||||
cmd.append("comment")
|
||||
|
|
|
@ -47,3 +47,19 @@ def test_ipset_add_comment_kwarg(ipset, setup_set):
|
|||
assert ret == "Success"
|
||||
check_set = ipset.list_sets()
|
||||
assert any([x for x in check_set if x["Name"] == setup_set])
|
||||
|
||||
|
||||
def test_ipset_new_set_with_family(ipset):
|
||||
"""
|
||||
test ipset.new_set with set_type that uses family (eg. hash:ip)
|
||||
"""
|
||||
set_name = "test_name_haship"
|
||||
ret = ipset.new_set(name=set_name, set_type="hash:ip")
|
||||
assert ret == True
|
||||
check_set = ipset.list_sets()
|
||||
try:
|
||||
assert any([x for x in check_set if x["Name"] == set_name])
|
||||
except Exception as e:
|
||||
raise e
|
||||
finally:
|
||||
ipset.delete_set(set_name)
|
||||
|
|
Loading…
Add table
Reference in a new issue