mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-05 02:03:09 +00:00
adds common function to_list to network_common
used to coerce a value into a list
This commit is contained in:
@@ -27,6 +27,14 @@
|
||||
#
|
||||
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:
|
||||
|
||||
def __init__(self, attrs):
|
||||
|
||||
Reference in New Issue
Block a user