Remove module_utils.shell (#28560)

* Get rid of module_utils.shell

* There is no way this actually raises ShellError
This commit is contained in:
Nathaniel Case 2017-08-24 14:55:03 -04:00 committed by GitHub
parent ac6892efe4
commit 07cd4fda0e
2 changed files with 2 additions and 288 deletions

View file

@ -112,7 +112,6 @@ import os
import time
from xml.etree import ElementTree
import paramiko
from ansible.module_utils.shell import ShellError
from ansible.module_utils.basic import get_exception, AnsibleModule
from ansible.module_utils.ce import ce_argument_spec, run_commands, get_nc_config
@ -359,13 +358,8 @@ class FileCopy(object):
self.transfer_result = 'The local file already exists on the device.'
if not file_exists:
try:
self.transfer_file(dest)
self.transfer_result = 'The local file has been successfully ' \
'transferred to the device.'
except ShellError:
clie = get_exception()
self.module.fail_json(msg=get_cli_exception(clie))
self.transfer_file(dest)
self.transfer_result = 'The local file has been successfully transferred to the device.'
if self.remote_file is None:
self.remote_file = '/' + os.path.basename(self.local_file)