Fix error handling

This commit is contained in:
GGabriele 2016-09-02 18:51:11 +02:00
parent 3b266bf1e2
commit 0f606122bc

View file

@ -846,7 +846,7 @@ def transfer_file(module, dest):
scp = SCPClient(ssh.get_transport())
try:
scp.put(module.params['local_file'], full_remote_path)
except Exception as e:
except:
time.sleep(10)
temp_size = verify_remote_file_exists(
module, dest, file_system=module.params['file_system'])
@ -894,8 +894,9 @@ def main():
try:
transfer_file(module, dest)
transfer_status = 'Sent'
except Exception as e:
module.fail_json(msg=str(e))
except ShellError:
clie = get_exception():
module.fail_json(msg=str(clie))
if remote_file is None:
remote_file = os.path.basename(local_file)