adds common function to_list to network_common
used to coerce a value into a list
This commit is contained in:
parent
31d6b6ef67
commit
82dbe9853c
1 changed files with 8 additions and 0 deletions
|
@ -27,6 +27,14 @@
|
||||||
#
|
#
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
|
def to_list(val):
|
||||||
|
if isinstance(val, (list, tuple, set)):
|
||||||
|
return list(val)
|
||||||
|
elif val is not None:
|
||||||
|
return [val]
|
||||||
|
else:
|
||||||
|
return list()
|
||||||
|
|
||||||
class ComplexDict:
|
class ComplexDict:
|
||||||
|
|
||||||
def __init__(self, attrs):
|
def __init__(self, attrs):
|
||||||
|
|
Loading…
Reference in a new issue