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

Fixes python keyerror if no port is specified and default should be used #34662

Closed
wants to merge 1 commit into from

Conversation

grumpymatt
Copy link

SUMMARY

Received python keyerror when port value was missing. Used python dict get method to properly default the port value

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
ANSIBLE VERSION
ansible 2.5.0 (devel d1846425db) last updated 2018/01/09 19:53:23 (GMT +000)
  config file = /home/itmxg01/ansible/vmware-provisioning/ansible.cfg
  configured module search path = [u'/home/itmxg01/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/itmxg01/ansible/ansible/lib/ansible
  executable location = /home/itmxg01/ansible/ansible/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Jan 9, 2018

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jan 9, 2018
@Akasurde Akasurde removed the needs_triage Needs a first human triage before being processed. label Jan 10, 2018
@Akasurde
Copy link
Member

Closing and re-opening for CI trigger.

@Akasurde Akasurde closed this Jan 10, 2018
@Akasurde Akasurde reopened this Jan 10, 2018
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jan 10, 2018
@resmo
Copy link
Contributor

resmo commented Jan 10, 2018

The port is already defaulted https://github.com/grumpymatt/ansible/blob/4e4ea2508c65e2bfb7b4920ccb7e40d2f16cfc86/lib/ansible/module_utils/vmware.py#L440 and the key "port" does exist. I wonder if the error is related to a module not using the common arg spec.

@grumpymatt
Copy link
Author

@resmo You are correct. I didn't realize we had a custom module using vmware.py and it was the one throwing the error. We have not updated it to the latest arg spec.

@grumpymatt
Copy link
Author

I updated my custom module and it works now without this change. I think perhaps line 449 could still be updated since the port is specified elsewhere. Maybe a better change would be to remove the 'or 443'?

@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 Jan 18, 2018
@ansibot ansibot added the new_contributor This PR is the first contribution by a new community member. label Jan 26, 2018
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 2, 2018
@ansibot
Copy link
Contributor

ansibot commented May 5, 2018

@Akasurde
Copy link
Member

Akasurde commented Jul 2, 2018

superseded by #37726

@Akasurde Akasurde closed this Jul 2, 2018
@ansible ansible locked and limited conversation to collaborators Jul 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. cloud new_contributor This PR is the first contribution by a new community member. 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. vmware VMware community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants