Convert the network subfolder to py3/py2.4 syntax (#3690)

This commit is contained in:
Michael Scherer 2016-05-18 18:08:30 +02:00 committed by Matt Clay
parent 09066f1518
commit c0217e14a7
20 changed files with 90 additions and 47 deletions

View file

@ -89,7 +89,8 @@ feature:
def execute_config_command(commands, module):
try:
module.configure(commands)
except ShellError, clie:
except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands)
@ -114,9 +115,12 @@ def get_cli_body_ssh(command, response):
def execute_show(cmds, module, command_type=None):
try:
response = module.execute(cmds,
command_type=command_type) if command_type else module.execute(cmds)
except ShellError, clie:
if command_type:
response = module.execute(cmds, command_type=command_type)
else:
response = module.execute(cmds)
except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending {0}'.format(cmds),
error=str(clie))
return response
@ -267,4 +271,4 @@ from ansible.module_utils.shell import *
from ansible.module_utils.netcfg import *
from ansible.module_utils.nxos import *
if __name__ == '__main__':
main()
main()