Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMware: vsphere_copy IndexError: tuple index out of range #58170

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
4 participants
@lijok
Copy link
Contributor

commented Jun 21, 2019

SUMMARY

hotfixes #58168

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vsphere_copy

ADDITIONAL INFORMATION

before:

Traceback (most recent call last):
  File "/home/user/.ansible/tmp/ansible-tmp-1561111440.8274398-36240207362500/AnsiballZ_vsphere_copy.py", line 114, in <module>
    _ansiballz_main()
  File "/home/user/.ansible/tmp/ansible-tmp-1561111440.8274398-36240207362500/AnsiballZ_vsphere_copy.py", line 106, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/user/.ansible/tmp/ansible-tmp-1561111440.8274398-36240207362500/AnsiballZ_vsphere_copy.py", line 49, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/tmp/ansible_vsphere_copy_payload_Ad8BJj/__main__.py", line 200, in <module>
  File "/tmp/ansible_vsphere_copy_payload_Ad8BJj/__main__.py", line 179, in main
IndexError: tuple index out of range

after:

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_vsphere_copy_payload_v0wHic/__main__.py", line 179, in main
    if isinstance(e[0], int):
IndexError: tuple index out of range

fatal: [router1.private]: FAILED! => {
    "changed": false,
    "errno": -1,
    "invocation": {
        "module_args": {
            "datacenter": "ha-datacenter",
            "datastore": "live",
            "dest": "cfg/router1.private.iso",
            "host": "10.1.1.10",
            "hostname": "10.1.1.10",
            "login": "ansible",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "path": "cfg/router1.private.iso",
            "src": "/tmp/router1.private/router1.private.iso",
            "timeout": 60,
            "username": "ansible",
            "validate_certs": false
        }
    },
    "msg": "HTTP Error 500: Internal Server Error",
    "reason": "HTTP Error 500: Internal Server Error",
    "status": null,
    "url": "https://10.1.1.10/folder/cfg/router1.private.iso?dcPath=ha-datacenter&dsName=live"
}
@lijok

This comment has been minimized.

Copy link
Contributor Author

commented Jun 21, 2019

This most likely requires a proper fix, as the error should be caught as part of https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/vmware/vsphere_copy.py#L193-L203

@lijok

This comment has been minimized.

Copy link
Contributor Author

commented Jun 21, 2019

consecutive reruns of this module after a failure tend to result in the following

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_vsphere_copy_payload_UIs8Yx/__main__.py", line 168, in main
    force_basic_auth=True)
  File "/tmp/ansible_vsphere_copy_payload_UIs8Yx/ansible_vsphere_copy_payload.zip/ansible/module_utils/urls.py", line 1257, in open_url
    use_gssapi=use_gssapi, unix_socket=unix_socket)
  File "/tmp/ansible_vsphere_copy_payload_UIs8Yx/ansible_vsphere_copy_payload.zip/ansible/module_utils/urls.py", line 1163, in open
    r = urllib_request.urlopen(*urlopen_args)
  File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/tmp/ansible_vsphere_copy_payload_UIs8Yx/ansible_vsphere_copy_payload.zip/ansible/module_utils/urls.py", line 374, in https_open
    return self.do_open(self._build_https_connection, req)
  File "/usr/lib64/python2.7/urllib2.py", line 1200, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 32] Broken pipe>

which i would understand is what is being referenced in https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/vmware/vsphere_copy.py#L197 ?

@ansibot

This comment has been minimized.

@@ -206,7 +206,7 @@ def main():
try:
if isinstance(e[0], int):
error_code = e[0]
except (KeyError, TypeError):
except (KeyError, TypeError, IndexError):

This comment has been minimized.

Copy link
@dagwieers

dagwieers Jun 23, 2019

Member

I warned for this, the catchall Exception above is the wrong approach.

This comment has been minimized.

Copy link
@Akasurde

Akasurde Jun 24, 2019

Member

@dagwieers I am totally agree with you. @lijok Could you please do the needful, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.