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

rds.py: ensure port is expecting an int - fixes #24802 #25310

Merged
merged 1 commit into from
Jun 2, 2017

Conversation

s-hertel
Copy link
Contributor

@s-hertel s-hertel commented Jun 2, 2017

SUMMARY

If port is passed in as a string it won't be caught. Fixes #24802

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/cloud/amazon/rds.py

ANSIBLE VERSION
2.4.0

@ansibot
Copy link
Contributor

ansibot commented Jun 2, 2017

The test ansible-test sanity --test validate-modules failed with the following error:

lib/ansible/modules/cloud/amazon/rds.py:0:0: E305 DOCUMENTATION.options.port.type: not a valid value for dictionary value @ data['options']['port']['type']. Got 'int'

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jun 2, 2017

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 aws bugfix_pull_request ci_verified Changes made in this PR are causing tests to fail. cloud module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. labels Jun 2, 2017
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jun 2, 2017
@jctanner jctanner removed the needs_triage Needs a first human triage before being processed. label Jun 2, 2017
@jmcginn13
Copy link

jmcginn13 commented Jun 2, 2017

I tested this fix locally:

  • I reverted my property setting to the old one to reproduce the original error (note the extra space):
    port: "{{ database_port }} "
  • I applied the patch and tested with:
    port: "bob"
    Got this error message:

argument port is of type <type 'str'> and we were unable to convert to int: invalid literal for int() with base 10: 'bob'"

Good error message!

Then back to my original value with the extra space - database successfully created with no errors even with the extra space.

Copy link

@jmcginn13 jmcginn13 left a comment

Choose a reason for hiding this comment

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

I reviewed and tested this change and it resolves the issues of ambiguous error messages for non-int ports and at the same time automatically trims off extra white space successfully converting to an int

@s-hertel s-hertel merged commit 7700870 into ansible:devel Jun 2, 2017
@s-hertel s-hertel deleted the rds-port-int branch July 25, 2017 16:56
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 aws 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ec2 rds postgres creation fails with error: Failed to create instance: null
4 participants