-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Fix ec2_ami block_device_mapping volume_size to be int in 2.5 #40938
Conversation
new_item = dict_object.get(attribute) | ||
if new_item is not None: | ||
value = dict_object.get(attribute) | ||
if type is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like overriding the type
builtin - can we use attribute_type
as parameter or similar?
new_item = dict_object.get(attribute) | ||
if new_item is not None: | ||
value = dict_object.get(attribute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're setting value
exactly the same way that new_item
was set. Either reuse new_item
or use value
instead of new_item
renamed `type` to `attribute_type` reused `new_item` instead of creating new variable `value`
@willthames Fixed CR issues |
@willthames is there a way for me to be informed when this is released? Also, is this going to be released for 2.5 as well? |
@mentos1386 not that I know of - it'll go out with 2.7 but it's definitely a candidate for backporting to 2.5 and 2.6 To use it prior to release see: http://willthames.github.io/2017/12/12/using-updated-modules-with-stable-ansible.html |
Backport PRs created for 2.5 and 2.6 |
#41217) * Fix ec2_ami block_device_mapping volume_size to be int in 2.5 (#40938) * fix ec2_ami block_device_mapping size to be int * fixed cr issues renamed `type` to `attribute_type` reused `new_item` instead of creating new variable `value` (cherry picked from commit ab96a84) * changelog (cherry picked from commit e6cd727) * changelog format tweak
…e#40938) * fix ec2_ami block_device_mapping size to be int * fixed cr issues renamed `type` to `attribute_type` reused `new_item` instead of creating new variable `value`
SUMMARY
boto3 added type validation to many methods #28506. Similar to #18999 and #32291, the ec2_ami module didn't cast the volume_size parameter to int before passing it to boto. This was fine if the yaml used an integer value, but if a string was used (because of templating, or variable substitution mostly), a type error was raised.
This #32738 PR will make this PR obsolete. But until then, i think this is a valid fix.
ISSUE TYPE
COMPONENT NAME
ec2_ami
ANSIBLE VERSION
ADDITIONAL INFORMATION
If we have a task like this:
We will get an error that
volume_size
isn't correct type:After applying the PR, there is no issues anymore.