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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

lijok
Copy link
Contributor

@lijok lijok 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
Copy link
Contributor Author

lijok 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
Copy link
Contributor Author

lijok 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
Copy link
Contributor

ansibot commented Jun 21, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. small_patch support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. vmware VMware community labels Jun 21, 2019
@@ -206,7 +206,7 @@ def main():
try:
if isinstance(e[0], int):
error_code = e[0]
except (KeyError, TypeError):
except (KeyError, TypeError, IndexError):
Copy link
Contributor

@dagwieers dagwieers Jun 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jun 23, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jul 2, 2019
@ansibot ansibot removed the new_contributor This PR is the first contribution by a new community member. label Jul 10, 2019
@ansibot ansibot added the needs_repo This PR no longer has an associated branch as it was removed by the submitter. label Aug 8, 2019
@gundalow gundalow added pr_day Has been reviewed during a PR review Day candidate_to_close Think we can close this, though need to check with Core labels Sep 3, 2019
@gundalow
Copy link
Contributor

gundalow commented Sep 3, 2019

Looked at this during PR review day

I propose that this be closed and remaining work is tracked via issue #58168

@gundalow gundalow closed this Sep 3, 2019
@ansible ansible locked and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. candidate_to_close Think we can close this, though need to check with Core cloud community_review In order to be merged, this PR must follow the community review workflow. has_issue module This issue/PR relates to a module. needs_repo This PR no longer has an associated branch as it was removed by the submitter. pr_day Has been reviewed during a PR review Day small_patch stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. vmware VMware community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants