1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

PEP 8 E111 cleanup for nxos modules.

This commit is contained in:
Matt Clay 2017-01-30 15:31:59 -08:00
parent 4a57cba86d
commit 462ab6b1db
61 changed files with 380 additions and 427 deletions

View file

@ -173,12 +173,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -168,12 +168,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -259,12 +259,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -117,12 +117,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -372,12 +372,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -312,12 +312,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -256,12 +256,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -333,12 +333,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -84,12 +84,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -138,12 +138,12 @@ from ansible.module_utils.network import NetworkModule
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -115,12 +115,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -103,12 +103,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -175,12 +175,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -131,12 +131,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -155,12 +155,12 @@ from ansible.module_utils.network import NetworkModule
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -574,8 +574,8 @@ def is_default(interface, module):
def validate_config(body, vip, module): def validate_config(body, vip, module):
new_body = ''.join(body) new_body = ''.join(body)
if "invalid ip address" in new_body.lower(): if "invalid ip address" in new_body.lower():
module.fail_json(msg="Invalid VIP. Possible duplicate IP address.", module.fail_json(msg="Invalid VIP. Possible duplicate IP address.",
vip=vip) vip=vip)
def validate_params(param, module): def validate_params(param, module):

View file

@ -124,12 +124,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -250,12 +250,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -145,12 +145,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -129,12 +129,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -174,12 +174,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -178,12 +178,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -128,12 +128,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -135,12 +135,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -548,8 +548,8 @@ def main():
if sysmtu: if sysmtu:
if ((int(sysmtu) < 576 or int(sysmtu) > 9216 or if ((int(sysmtu) < 576 or int(sysmtu) > 9216 or
((int(sysmtu) % 2) != 0))): ((int(sysmtu) % 2) != 0))):
module.fail_json(msg='Invalid MTU- needs to be an even ' module.fail_json(msg='Invalid MTU- needs to be an even '
'number between 576 and 9216') 'number between 576 and 9216')
args = dict(mtu=mtu, sysmtu=sysmtu) args = dict(mtu=mtu, sysmtu=sysmtu)
proposed = dict((k, v) for k, v in args.items() if v is not None) proposed = dict((k, v) for k, v in args.items() if v is not None)

View file

@ -141,12 +141,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -139,12 +139,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -120,12 +120,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -92,12 +92,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -183,12 +183,12 @@ from ansible.module_utils.shell import ShellError
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -394,8 +394,8 @@ def get_existing(module, args):
vrf_index = False vrf_index = False
for index in range(0, len(splitted_config) - 1): for index in range(0, len(splitted_config) - 1):
if 'vrf' in splitted_config[index].strip(): if 'vrf' in splitted_config[index].strip():
vrf_index = index vrf_index = index
break break
if vrf_index: if vrf_index:
config = '\n'.join(splitted_config[0:vrf_index]) config = '\n'.join(splitted_config[0:vrf_index])

View file

@ -123,12 +123,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -87,12 +87,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -204,12 +204,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -737,10 +737,10 @@ def default_pim_interface_policies(existing, jp_bidir):
if jp_bidir: if jp_bidir:
if existing.get('jp_policy_in') or existing.get('jp_policy_out'): if existing.get('jp_policy_in') or existing.get('jp_policy_out'):
if existing.get('jp_type_in') == 'prefix': if existing.get('jp_type_in') == 'prefix':
command = 'no ip pim jp-policy prefix-list {0}'.format( command = 'no ip pim jp-policy prefix-list {0}'.format(
existing.get('jp_policy_in') existing.get('jp_policy_in')
) )
if command: if command:
commands.append(command) commands.append(command)

View file

@ -117,12 +117,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -133,12 +133,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -142,12 +142,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -75,12 +75,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -91,12 +91,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -98,12 +98,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -224,12 +224,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -114,12 +114,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -99,12 +99,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -147,12 +147,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -106,12 +106,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -117,12 +117,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -128,12 +128,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -122,12 +122,12 @@ from ansible.module_utils.network import NetworkModule
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -170,12 +170,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -124,12 +124,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -123,12 +123,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -171,12 +171,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -162,12 +162,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -114,12 +114,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -131,12 +131,12 @@ from ansible.module_utils.network import NetworkModule
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -502,8 +502,8 @@ def main():
command = get_commands_to_config_vrf(delta, vrf) command = get_commands_to_config_vrf(delta, vrf)
commands.extend(command) commands.extend(command)
elif delta: elif delta:
command = get_commands_to_config_vrf(delta, vrf) command = get_commands_to_config_vrf(delta, vrf)
commands.extend(command) commands.extend(command)
if commands: if commands:
if proposed.get('vni'): if proposed.get('vni'):

View file

@ -118,12 +118,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -301,8 +301,8 @@ def get_existing(module, args):
vrf_index = False vrf_index = False
for index in range(0, len(splitted_config) - 1): for index in range(0, len(splitted_config) - 1):
if 'vrf' in splitted_config[index].strip(): if 'vrf' in splitted_config[index].strip():
vrf_index = index vrf_index = index
break break
if vrf_index: if vrf_index:
config = '\n'.join(splitted_config[0:vrf_index]) config = '\n'.join(splitted_config[0:vrf_index])

View file

@ -115,12 +115,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -153,12 +153,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -100,12 +100,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -117,12 +117,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -440,8 +440,8 @@ def main():
"state=present.") "state=present.")
else: else:
if not existing.get('domain'): if not existing.get('domain'):
module.fail_json(msg='Cannot remove a vtp password ' module.fail_json(msg='Cannot remove a vtp password '
'before vtp domain is set.') 'before vtp domain is set.')
elif existing['vtp_password'] != ('\\'): elif existing['vtp_password'] != ('\\'):
commands.append(['no vtp password']) commands.append(['no vtp password'])

View file

@ -95,12 +95,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -138,12 +138,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):

View file

@ -157,12 +157,12 @@ except ImportError:
def to_list(val): def to_list(val):
if isinstance(val, (list, tuple)): if isinstance(val, (list, tuple)):
return list(val) return list(val)
elif val is not None: elif val is not None:
return [val] return [val]
else: else:
return list() return list()
class CustomNetworkConfig(NetworkConfig): class CustomNetworkConfig(NetworkConfig):
@ -555,10 +555,10 @@ def main():
'the switch.') 'the switch.')
elif (existing and state == 'absent' and elif (existing and state == 'absent' and
existing['vni'] != module.params['vni']): existing['vni'] != module.params['vni']):
module.fail_json(msg="ERROR: VNI delete failed: Could not find" module.fail_json(msg="ERROR: VNI delete failed: Could not find"
" vni node for {0}".format( " vni node for {0}".format(
module.params['vni']), module.params['vni']),
existing_vni=existing['vni']) existing_vni=existing['vni'])
else: else:
candidate = CustomNetworkConfig(indent=3) candidate = CustomNetworkConfig(indent=3)
invoke('state_%s' % state, module, existing, proposed, candidate) invoke('state_%s' % state, module, existing, proposed, candidate)

View file

@ -173,66 +173,19 @@ lib/ansible/modules/network/f5/bigip_pool_member.py
lib/ansible/modules/network/f5/bigip_virtual_server.py lib/ansible/modules/network/f5/bigip_virtual_server.py
lib/ansible/modules/network/haproxy.py lib/ansible/modules/network/haproxy.py
lib/ansible/modules/network/nmcli.py lib/ansible/modules/network/nmcli.py
lib/ansible/modules/network/nxos/nxos_aaa_server.py
lib/ansible/modules/network/nxos/nxos_aaa_server_host.py
lib/ansible/modules/network/nxos/nxos_acl.py
lib/ansible/modules/network/nxos/nxos_acl_interface.py
lib/ansible/modules/network/nxos/nxos_bgp.py lib/ansible/modules/network/nxos/nxos_bgp.py
lib/ansible/modules/network/nxos/nxos_bgp_af.py lib/ansible/modules/network/nxos/nxos_bgp_af.py
lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py
lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py
lib/ansible/modules/network/nxos/nxos_evpn_global.py
lib/ansible/modules/network/nxos/nxos_evpn_vni.py lib/ansible/modules/network/nxos/nxos_evpn_vni.py
lib/ansible/modules/network/nxos/nxos_feature.py lib/ansible/modules/network/nxos/nxos_feature.py
lib/ansible/modules/network/nxos/nxos_file_copy.py
lib/ansible/modules/network/nxos/nxos_gir.py lib/ansible/modules/network/nxos/nxos_gir.py
lib/ansible/modules/network/nxos/nxos_gir_profile_management.py
lib/ansible/modules/network/nxos/nxos_hsrp.py
lib/ansible/modules/network/nxos/nxos_igmp.py
lib/ansible/modules/network/nxos/nxos_igmp_interface.py
lib/ansible/modules/network/nxos/nxos_igmp_snooping.py
lib/ansible/modules/network/nxos/nxos_install_os.py lib/ansible/modules/network/nxos/nxos_install_os.py
lib/ansible/modules/network/nxos/nxos_interface.py
lib/ansible/modules/network/nxos/nxos_interface_ospf.py lib/ansible/modules/network/nxos/nxos_interface_ospf.py
lib/ansible/modules/network/nxos/nxos_ip_interface.py
lib/ansible/modules/network/nxos/nxos_mtu.py
lib/ansible/modules/network/nxos/nxos_ntp.py
lib/ansible/modules/network/nxos/nxos_ntp_auth.py
lib/ansible/modules/network/nxos/nxos_ntp_options.py
lib/ansible/modules/network/nxos/nxos_ospf.py
lib/ansible/modules/network/nxos/nxos_ospf_vrf.py
lib/ansible/modules/network/nxos/nxos_overlay_global.py
lib/ansible/modules/network/nxos/nxos_pim.py
lib/ansible/modules/network/nxos/nxos_pim_interface.py lib/ansible/modules/network/nxos/nxos_pim_interface.py
lib/ansible/modules/network/nxos/nxos_pim_rp_address.py
lib/ansible/modules/network/nxos/nxos_ping.py
lib/ansible/modules/network/nxos/nxos_portchannel.py
lib/ansible/modules/network/nxos/nxos_reboot.py
lib/ansible/modules/network/nxos/nxos_rollback.py
lib/ansible/modules/network/nxos/nxos_smu.py
lib/ansible/modules/network/nxos/nxos_snapshot.py lib/ansible/modules/network/nxos/nxos_snapshot.py
lib/ansible/modules/network/nxos/nxos_snmp_community.py
lib/ansible/modules/network/nxos/nxos_snmp_contact.py
lib/ansible/modules/network/nxos/nxos_snmp_host.py
lib/ansible/modules/network/nxos/nxos_snmp_location.py
lib/ansible/modules/network/nxos/nxos_snmp_traps.py
lib/ansible/modules/network/nxos/nxos_snmp_user.py
lib/ansible/modules/network/nxos/nxos_static_route.py
lib/ansible/modules/network/nxos/nxos_switchport.py
lib/ansible/modules/network/nxos/nxos_udld.py
lib/ansible/modules/network/nxos/nxos_udld_interface.py
lib/ansible/modules/network/nxos/nxos_vlan.py lib/ansible/modules/network/nxos/nxos_vlan.py
lib/ansible/modules/network/nxos/nxos_vpc.py lib/ansible/modules/network/nxos/nxos_vpc.py
lib/ansible/modules/network/nxos/nxos_vpc_interface.py
lib/ansible/modules/network/nxos/nxos_vrf.py
lib/ansible/modules/network/nxos/nxos_vrf_af.py
lib/ansible/modules/network/nxos/nxos_vrf_interface.py
lib/ansible/modules/network/nxos/nxos_vrrp.py
lib/ansible/modules/network/nxos/nxos_vtp_domain.py
lib/ansible/modules/network/nxos/nxos_vtp_password.py
lib/ansible/modules/network/nxos/nxos_vtp_version.py
lib/ansible/modules/network/nxos/nxos_vxlan_vtep.py
lib/ansible/modules/network/nxos/nxos_vxlan_vtep_vni.py
lib/ansible/modules/network/panos/panos_nat_policy.py lib/ansible/modules/network/panos/panos_nat_policy.py
lib/ansible/modules/network/snmp_facts.py lib/ansible/modules/network/snmp_facts.py
lib/ansible/modules/notification/hall.py lib/ansible/modules/notification/hall.py