mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Remove module_utils.shell (#28560)
* Get rid of module_utils.shell * There is no way this actually raises ShellError
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user