Remove idle ShellError exception and get_exception() method from nxos modules
This commit is contained in:
parent
a13d89da68
commit
bc22223d63
15 changed files with 29 additions and 91 deletions
|
@ -946,13 +946,9 @@ def main():
|
|||
if state == 'present' or (state == 'absent' and existing):
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -605,13 +605,9 @@ def main():
|
|||
if state == 'present' or (state == 'absent' and existing):
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -958,13 +958,9 @@ def main():
|
|||
if state == 'present' or (state == 'absent' and existing):
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -268,12 +268,8 @@ def state_absent(module, existing, proposed):
|
|||
|
||||
def execute_config(module, candidate):
|
||||
result = {}
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -232,12 +232,8 @@ def main():
|
|||
file_exists = True
|
||||
|
||||
if not module.check_mode and not file_exists:
|
||||
try:
|
||||
transfer_file(module, dest)
|
||||
transfer_status = 'Sent'
|
||||
except ShellError:
|
||||
clie = get_exception()
|
||||
module.fail_json(msg=str(clie))
|
||||
transfer_file(module, dest)
|
||||
transfer_status = 'Sent'
|
||||
|
||||
if remote_file is None:
|
||||
remote_file = os.path.basename(local_file)
|
||||
|
|
|
@ -233,13 +233,9 @@ def main():
|
|||
True in existing.values()) or restart):
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('get_commands', module, existing, proposed_args, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -519,13 +519,9 @@ def main():
|
|||
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -335,11 +335,7 @@ def main():
|
|||
if module.check_mode:
|
||||
module.exit_json(changed=True, commands=cmds)
|
||||
else:
|
||||
try:
|
||||
load_config(module, cmds)
|
||||
except ShellError:
|
||||
clie = get_exception()
|
||||
module.fail_json(msg=str(clie) + ": " + cmds)
|
||||
load_config(module, cmds)
|
||||
end_state = get_ntp_auth_info(key_id, module)
|
||||
delta = dict(set(end_state.items()).difference(existing.items()))
|
||||
if delta or (len(existing) != len(end_state)):
|
||||
|
|
|
@ -188,13 +188,9 @@ def main():
|
|||
if (state == 'present' or (state == 'absent' and ospf in existing_list)):
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -434,13 +434,9 @@ def main():
|
|||
if state == 'present' or (state == 'absent' and existing):
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -173,13 +173,8 @@ def main():
|
|||
result = {}
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('get_commands', module, existing, proposed, candidate)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
if module._verbosity > 0:
|
||||
end_state = invoke('get_existing', module, args)
|
||||
|
|
|
@ -253,13 +253,8 @@ def main():
|
|||
result = {}
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
if module._verbosity > 0:
|
||||
end_state = invoke('get_existing', module, args)
|
||||
|
|
|
@ -174,12 +174,8 @@ def main():
|
|||
|
||||
commands = get_commands(module, pkg, file_system)
|
||||
if not module.check_mode and commands:
|
||||
try:
|
||||
apply_patch(module, commands)
|
||||
changed = True
|
||||
except ShellError:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=str(e))
|
||||
apply_patch(module, commands)
|
||||
changed = True
|
||||
|
||||
if 'configure' in commands:
|
||||
commands.pop(0)
|
||||
|
|
|
@ -270,13 +270,9 @@ def main():
|
|||
if state == 'present' or (state == 'absent' and existing):
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
|
@ -363,13 +363,9 @@ def main():
|
|||
"all logical interfaces.")
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
invoke('state_%s' % state, module, existing, proposed, candidate)
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
|
||||
try:
|
||||
response = load_config(module, candidate)
|
||||
result.update(response)
|
||||
except ShellError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg=str(exc))
|
||||
else:
|
||||
result['updates'] = []
|
||||
|
||||
|
|
Loading…
Reference in a new issue