mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Some additional module cleanup of mistakes made during merging
This commit is contained in:
parent
6ba6819446
commit
fa5386c488
36 changed files with 183 additions and 183 deletions
0
lib/ansible/modules/cloud/centurylink/__init__.py
Normal file
0
lib/ansible/modules/cloud/centurylink/__init__.py
Normal file
|
@ -234,7 +234,7 @@ class LibvirtConnection(object):
|
||||||
|
|
||||||
self.module = module
|
self.module = module
|
||||||
|
|
||||||
conn = libvirt.open(uri)
|
conn = libvirt.open(uri)
|
||||||
|
|
||||||
if not conn:
|
if not conn:
|
||||||
raise Exception("hypervisor connection failure")
|
raise Exception("hypervisor connection failure")
|
||||||
|
@ -439,10 +439,10 @@ class VirtStoragePool(object):
|
||||||
def list_pools(self, state=None):
|
def list_pools(self, state=None):
|
||||||
results = []
|
results = []
|
||||||
for entry in self.conn.find_entry(-1):
|
for entry in self.conn.find_entry(-1):
|
||||||
if state:
|
if state:
|
||||||
if state == self.conn.get_status2(entry):
|
if state == self.conn.get_status2(entry):
|
||||||
results.append(entry.name())
|
results.append(entry.name())
|
||||||
else:
|
else:
|
||||||
results.append(entry.name())
|
results.append(entry.name())
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- Information necessary to turn this server on / off.
|
- Information necessary to turn this server on / off.
|
||||||
This often includes such things as IPMI username, password, and IP address.
|
This often includes such things as IPMI username, password, and IP address.
|
||||||
required: true
|
required: true
|
||||||
deploy:
|
deploy:
|
||||||
description:
|
description:
|
||||||
- Information necessary to deploy this server directly, without using Nova. THIS IS NOT RECOMMENDED.
|
- Information necessary to deploy this server directly, without using Nova. THIS IS NOT RECOMMENDED.
|
||||||
|
@ -91,7 +91,7 @@ options:
|
||||||
management:
|
management:
|
||||||
description:
|
description:
|
||||||
- Information necessary to interact with this server's management interface. May be shared by power_info in some cases.
|
- Information necessary to interact with this server's management interface. May be shared by power_info in some cases.
|
||||||
required: true
|
required: true
|
||||||
nics:
|
nics:
|
||||||
description:
|
description:
|
||||||
- 'A list of network interface cards, eg, " - mac: aa:bb:cc:aa:bb:cc"'
|
- 'A list of network interface cards, eg, " - mac: aa:bb:cc:aa:bb:cc"'
|
||||||
|
|
|
@ -263,7 +263,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -383,13 +383,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
action = module.params['action']
|
action = module.params['action']
|
||||||
|
|
|
@ -121,7 +121,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ def get_config(module, include_defaults=False):
|
||||||
config = module.params['config']
|
config = module.params['config']
|
||||||
if not config:
|
if not config:
|
||||||
try:
|
try:
|
||||||
config = module.get_config()
|
config = module.get_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
defaults = module.params['include_defaults']
|
defaults = module.params['include_defaults']
|
||||||
config = module.config.get_config(include_defaults=defaults)
|
config = module.config.get_config(include_defaults=defaults)
|
||||||
|
@ -241,13 +241,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
name = module.params['name']
|
name = module.params['name']
|
||||||
|
|
|
@ -376,7 +376,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -496,13 +496,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -903,9 +903,9 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
required_together=[['timer_bgp_hold',
|
required_together=[['timer_bgp_hold',
|
||||||
'timer_bgp_keepalive']],
|
'timer_bgp_keepalive']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
args = [
|
args = [
|
||||||
|
|
|
@ -316,7 +316,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -436,13 +436,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -993,11 +993,11 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
required_together=[DAMPENING_PARAMS,
|
required_together=[DAMPENING_PARAMS,
|
||||||
['distance_ibgp',
|
['distance_ibgp',
|
||||||
'distance_ebgp',
|
'distance_ebgp',
|
||||||
'distance_local']],
|
'distance_local']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
if module.params['dampening_routemap']:
|
if module.params['dampening_routemap']:
|
||||||
|
|
|
@ -90,7 +90,7 @@ options:
|
||||||
log_neighbor_changes:
|
log_neighbor_changes:
|
||||||
description:
|
description:
|
||||||
- Specify whether or not to enable log messages for neighbor
|
- Specify whether or not to enable log messages for neighbor
|
||||||
up/down event.
|
up/down event.
|
||||||
required: false
|
required: false
|
||||||
choices: ['enable', 'disable', 'inherit']
|
choices: ['enable', 'disable', 'inherit']
|
||||||
default: null
|
default: null
|
||||||
|
@ -260,7 +260,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -380,13 +380,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ def main():
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
required_together=[['timer_bgp_hold',
|
required_together=[['timer_bgp_hold',
|
||||||
'timer_bgp_keepalive']],
|
'timer_bgp_keepalive']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
if module.params['pwd_type'] == 'default':
|
if module.params['pwd_type'] == 'default':
|
||||||
|
|
|
@ -337,7 +337,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -457,13 +457,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -1005,9 +1005,9 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
mutually_exclusive=[['advertise_map_exist',
|
mutually_exclusive=[['advertise_map_exist',
|
||||||
'advertise_map_non_exist']],
|
'advertise_map_non_exist']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
if ((module.params['max_prefix_interval'] or
|
if ((module.params['max_prefix_interval'] or
|
||||||
|
|
|
@ -88,7 +88,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ def get_config(module, include_defaults=False):
|
||||||
config = module.params['config']
|
config = module.params['config']
|
||||||
if not config:
|
if not config:
|
||||||
try:
|
try:
|
||||||
config = module.get_config()
|
config = module.get_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
defaults = module.params['include_defaults']
|
defaults = module.params['include_defaults']
|
||||||
config = module.config.get_config(include_defaults=defaults)
|
config = module.config.get_config(include_defaults=defaults)
|
||||||
|
@ -208,13 +208,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
existing = invoke('get_existing', module)
|
existing = invoke('get_existing', module)
|
||||||
end_state = existing
|
end_state = existing
|
||||||
|
|
|
@ -142,7 +142,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -262,13 +262,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -239,13 +239,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
feature = validate_feature(module)
|
feature = validate_feature(module)
|
||||||
state = module.params['state'].lower()
|
state = module.params['state'].lower()
|
||||||
|
|
|
@ -107,7 +107,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -227,13 +227,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
local_file = module.params['local_file']
|
local_file = module.params['local_file']
|
||||||
remote_file = module.params['remote_file']
|
remote_file = module.params['remote_file']
|
||||||
|
|
|
@ -159,7 +159,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -279,13 +279,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
interface = module.params['interface'].lower()
|
interface = module.params['interface'].lower()
|
||||||
group = module.params['group']
|
group = module.params['group']
|
||||||
|
|
|
@ -128,7 +128,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -248,13 +248,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
restart = module.params['restart']
|
restart = module.params['restart']
|
||||||
|
|
|
@ -254,7 +254,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -374,13 +374,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
interface = module.params['interface']
|
interface = module.params['interface']
|
||||||
|
@ -907,4 +907,4 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
|
@ -182,7 +182,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -302,13 +302,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -601,11 +601,11 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
required_together=[['message_digest_key_id',
|
required_together=[['message_digest_key_id',
|
||||||
'message_digest_algorithm_type',
|
'message_digest_algorithm_type',
|
||||||
'message_digest_encryption_type',
|
'message_digest_encryption_type',
|
||||||
'message_digest_password']],
|
'message_digest_password']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
for param in ['message_digest_encryption_type',
|
for param in ['message_digest_encryption_type',
|
||||||
'message_digest_algorithm_type',
|
'message_digest_algorithm_type',
|
||||||
|
|
|
@ -132,7 +132,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -252,13 +252,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
addr = module.params['addr']
|
addr = module.params['addr']
|
||||||
version = module.params['version']
|
version = module.params['version']
|
||||||
|
|
|
@ -96,7 +96,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ def get_config(module, include_defaults=False):
|
||||||
config = module.params['config']
|
config = module.params['config']
|
||||||
if not config:
|
if not config:
|
||||||
try:
|
try:
|
||||||
config = module.get_config()
|
config = module.get_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
defaults = module.params['include_defaults']
|
defaults = module.params['include_defaults']
|
||||||
config = module.config.get_config(include_defaults=defaults)
|
config = module.config.get_config(include_defaults=defaults)
|
||||||
|
@ -216,13 +216,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -307,13 +307,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -247,13 +247,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
'anycast_gateway_mac'
|
'anycast_gateway_mac'
|
||||||
|
|
|
@ -91,7 +91,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -211,13 +211,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
splitted_ssm_range = module.params['ssm_range'].split('.')
|
splitted_ssm_range = module.params['ssm_range'].split('.')
|
||||||
if len(splitted_ssm_range) != 4 and module.params['ssm_range'] != 'none':
|
if len(splitted_ssm_range) != 4 and module.params['ssm_range'] != 'none':
|
||||||
|
|
|
@ -121,7 +121,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -241,13 +241,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -358,10 +358,10 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
mutually_exclusive=[['group_list', 'route_map'],
|
mutually_exclusive=[['group_list', 'route_map'],
|
||||||
['group_list', 'prefix_list'],
|
['group_list', 'prefix_list'],
|
||||||
['route_map', 'prefix_list']],
|
['route_map', 'prefix_list']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -257,13 +257,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
destination = module.params['dest']
|
destination = module.params['dest']
|
||||||
count = module.params['count']
|
count = module.params['count']
|
||||||
|
|
|
@ -79,7 +79,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -199,13 +199,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
confirm = module.params['confirm']
|
confirm = module.params['confirm']
|
||||||
if not confirm:
|
if not confirm:
|
||||||
|
|
|
@ -95,7 +95,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -215,13 +215,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -248,18 +248,18 @@ def execute_commands(cmds, module, command_type=None):
|
||||||
module.fail_json(msg='Error sending {0}'.format(cmds),
|
module.fail_json(msg='Error sending {0}'.format(cmds),
|
||||||
error=str(clie))
|
error=str(clie))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
try:
|
try:
|
||||||
if command_type:
|
if command_type:
|
||||||
command_type = command_type_map.get(command_type)
|
command_type = command_type_map.get(command_type)
|
||||||
module.cli.add_commands(cmds, output=command_type)
|
module.cli.add_commands(cmds, output=command_type)
|
||||||
response = module.cli.run_commands()
|
response = module.cli.run_commands()
|
||||||
else:
|
else:
|
||||||
module.cli.add_commands(cmds, output=command_type)
|
module.cli.add_commands(cmds, output=command_type)
|
||||||
response = module.cli.run_commands()
|
response = module.cli.run_commands()
|
||||||
except ShellError:
|
except ShellError:
|
||||||
clie = get_exception()
|
clie = get_exception()
|
||||||
module.fail_json(msg='Error sending {0}'.format(cmds),
|
module.fail_json(msg='Error sending {0}'.format(cmds),
|
||||||
error=str(clie))
|
error=str(clie))
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ def checkpoint(filename, module):
|
||||||
def rollback(filename, module):
|
def rollback(filename, module):
|
||||||
commands = ['rollback running-config file %s' % filename]
|
commands = ['rollback running-config file %s' % filename]
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
try:
|
try:
|
||||||
module.cli.add_commands(commands, output='config')
|
module.cli.add_commands(commands, output='config')
|
||||||
|
|
|
@ -102,7 +102,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -222,13 +222,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
pkg = module.params['pkg']
|
pkg = module.params['pkg']
|
||||||
file_system = module.params['file_system']
|
file_system = module.params['file_system']
|
||||||
|
|
|
@ -126,7 +126,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -248,13 +248,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ def main():
|
||||||
)
|
)
|
||||||
|
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -295,13 +295,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -568,9 +568,9 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
mutually_exclusive=[['vlan_range', 'name'],
|
mutually_exclusive=[['vlan_range', 'name'],
|
||||||
['vlan_id', 'vlan_range']],
|
['vlan_id', 'vlan_range']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
vlan_range = module.params['vlan_range']
|
vlan_range = module.params['vlan_range']
|
||||||
vlan_id = module.params['vlan_id']
|
vlan_id = module.params['vlan_id']
|
||||||
|
|
|
@ -166,7 +166,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -286,13 +286,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
domain = module.params['domain']
|
domain = module.params['domain']
|
||||||
role_priority = module.params['role_priority']
|
role_priority = module.params['role_priority']
|
||||||
|
|
|
@ -118,7 +118,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -238,13 +238,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -486,8 +486,8 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
mutually_exclusive=[['vpc', 'peer_link']],
|
mutually_exclusive=[['vpc', 'peer_link']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
portchannel = module.params['portchannel']
|
portchannel = module.params['portchannel']
|
||||||
vpc = module.params['vpc']
|
vpc = module.params['vpc']
|
||||||
|
|
|
@ -135,7 +135,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -255,13 +255,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
vrf = module.params['vrf']
|
vrf = module.params['vrf']
|
||||||
admin_state = module.params['admin_state'].lower()
|
admin_state = module.params['admin_state'].lower()
|
||||||
|
|
|
@ -122,7 +122,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -242,13 +242,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ def to_list(val):
|
||||||
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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ class CustomNetworkConfig(NetworkConfig):
|
||||||
|
|
||||||
|
|
||||||
def get_network_module(**kwargs):
|
def get_network_module(**kwargs):
|
||||||
try:
|
try:
|
||||||
return get_module(**kwargs)
|
return get_module(**kwargs)
|
||||||
except NameError:
|
except NameError:
|
||||||
return NetworkModule(**kwargs)
|
return NetworkModule(**kwargs)
|
||||||
|
@ -239,13 +239,13 @@ def load_config(module, candidate):
|
||||||
if commands:
|
if commands:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
module.configure(commands)
|
module.configure(commands)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
|
|
||||||
if save_config:
|
if save_config:
|
||||||
try:
|
try:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
module.execute(['copy running-config startup-config'])
|
module.execute(['copy running-config startup-config'])
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ def main():
|
||||||
save=dict(type='bool', default=False)
|
save=dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
module = get_network_module(argument_spec=argument_spec,
|
module = get_network_module(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
vrf = module.params['vrf']
|
vrf = module.params['vrf']
|
||||||
interface = module.params['interface'].lower()
|
interface = module.params['interface'].lower()
|
||||||
|
@ -505,4 +505,4 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
|
@ -170,12 +170,12 @@ def main():
|
||||||
space_pattern = re.compile(r'\s+')
|
space_pattern = re.compile(r'\s+')
|
||||||
|
|
||||||
message = ''
|
message = ''
|
||||||
f = open (limits_conf, 'r')
|
f = open (limits_conf, 'r')
|
||||||
# Tempfile
|
# Tempfile
|
||||||
nf = tempfile.NamedTemporaryFile()
|
nf = tempfile.NamedTemporaryFile()
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
new_value = value
|
new_value = value
|
||||||
|
|
||||||
for line in f:
|
for line in f:
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ options:
|
||||||
update_password:
|
update_password:
|
||||||
description:
|
description:
|
||||||
- C(always) will update passwords if they differ. C(on_create) will
|
- C(always) will update passwords if they differ. C(on_create) will
|
||||||
only set the password for newly created users.
|
only set the password for newly created users.
|
||||||
required: false
|
required: false
|
||||||
choices: [ 'always', 'on_create' ]
|
choices: [ 'always', 'on_create' ]
|
||||||
default: always
|
default: always
|
||||||
|
|
Loading…
Reference in a new issue