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

ec2_ami: Typecast NoDevice value to string #55565

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
4 participants
@Akasurde
Copy link
Member

commented Apr 20, 2019

SUMMARY

BOTO register_image API requires the NoDevice parameter as string
rather than a boolean. This fixes the issue by typecasting NoDevice to string.

Fixes: #49515
Signed-off-by: Abhijeet Kasurde akasurde@redhat.com

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

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

ec2_ami: Typecast NoDevice value to string
BOTO register_image API requires the `NoDevice` parameter as string
rather than a boolean. This fixes the issue by typecasting NoDevice to string.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

@Akasurde Akasurde requested review from jillr, s-hertel and goneri Apr 20, 2019

@ansibot

This comment has been minimized.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2019

@Akasurde, just so you are aware we have a dedicated Working Group for aws.
You can find other people interested in this in #ansible-aws on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@jillr

jillr approved these changes Apr 22, 2019

@ansibot ansibot removed the needs_triage label Apr 22, 2019

@s-hertel
Copy link
Contributor

left a comment

Do you mind adding a test for this? https://github.com/ansible/ansible/tree/devel/test/integration/targets/ec2_ami

I'm getting this vague error with the reproducer in the bug report and I'm not sure if it's a problem with the module or perhaps something I'm doing wrong

"msg": "Error registering image: An error occurred (InvalidRequest) when calling the CreateImage operation: The request received was invalid.",
@s-hertel

This comment has been minimized.

Copy link
Contributor

commented Apr 22, 2019

I dug around a little bit out of curiosity. To successfully suppress devices I had to set NoDevice to an empty string like:

        device_mapping:
          - device_name: /dev/sda1
            no_device: ""
          - device_name: /dev/xvda
            no_device: ""

false/true, 'false'/'true', 'False'/'True', all cause an InvalidRequest error. This seems to be a clarity problem with the AWS documentation. Using an empty string to indicate true appears to be backed up by what boto was doing in the 2.4 version of this module (https://github.com/boto/boto/blob/develop/boto/ec2/blockdevicemapping.py#L142-L143).

So I guess, if true is provided, turn it into an empty str. If false, pop the NoDevice option out of the device dict.

@ansibot ansibot added the stale_ci label Apr 30, 2019

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.