diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-08-05 09:27:03 -0700 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-08-05 09:27:03 -0700 |
commit | dce3d4054e950980207c5705706320f2184eba93 (patch) | |
tree | 2beaf623ba0bceb292a84455fa0bb75eb5f25598 | |
parent | 3ec3e77d535559d341d19067dd1494fc2cd1aa66 (diff) | |
download | ansible-modules-extras-open_url-vsphere-copy.tar.gz |
Return errno and http status as requested by @bcocaopen_url-vsphere-copy
-rw-r--r-- | cloud/vmware/vsphere_copy.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cloud/vmware/vsphere_copy.py b/cloud/vmware/vsphere_copy.py index 446f62bd..100a8c8f 100644 --- a/cloud/vmware/vsphere_copy.py +++ b/cloud/vmware/vsphere_copy.py @@ -141,17 +141,17 @@ def main(): except socket.error, e: if isinstance(e.args, tuple) and e[0] == errno.ECONNRESET: # VSphere resets connection if the file is in use and cannot be replaced - module.fail_json(msg='Failed to upload, image probably in use', status=e[0], reason=str(e), url=url) + module.fail_json(msg='Failed to upload, image probably in use', status=None, errno=e[0], reason=str(e), url=url) else: - module.fail_json(msg=str(e), status=e[0], reason=str(e), url=url) + module.fail_json(msg=str(e), status=None, errno=e[0], reason=str(e), url=url) except Exception, e: - status = -1 + error_code = -1 try: if isinstance(e[0], int): - status = e[0] + error_code = e[0] except KeyError: pass - module.fail_json(msg=str(e), status=status, reason=str(e), url=url) + module.fail_json(msg=str(e), status=None, errno=error_code, reason=str(e), url=url) status = r.getcode() if 200 <= status < 300: @@ -163,7 +163,7 @@ def main(): else: chunked = 0 - module.fail_json(msg='Failed to upload', status=status, reason=r.msg, length=length, headers=dict(r.headers), chunked=chunked, url=url) + module.fail_json(msg='Failed to upload', errno=None, status=status, reason=r.msg, length=length, headers=dict(r.headers), chunked=chunked, url=url) # Import module snippets from ansible.module_utils.basic import * |