wallix / awless

A Mighty CLI for AWS
http://awless.io/
Apache License 2.0
4.97k stars 263 forks source link

Impossible to update an image with an AWS account beginning with 0 #192

Closed moulip closed 6 years ago

moulip commented 6 years ago

I'm trying to share a private AMI using someone's AWS account number, and it seems that Awless doen't like account numbers beginning with 0:

awless update image id=ami-30xxxx accounts=0929XXXX operation=add
Confirm (region: eu-west-1)? [y/N] y
[info]    KO update image
          InvalidAMIAttributeItemValue: Invalid attribute item value "929XXXX " for userId item type.

It strips the 0 and add a trailing space before the closing ".

When I try with a non-zero beginning account it works flawlessly:

update image accounts=103XXXXX id=ami-30xxxx operation=add

Confirm (region: eu-west-1)? [y/N] y
[info]    OK update image
[info]    Resyncing infra ... (disable with --no-sync global flag)
simcap commented 6 years ago

@moulip Thanks for reporting and well spotted! I will have a look. Though after tomorrow I am away for 2 weeks.

simcap commented 6 years ago

awless indeed parses that value as Integer base 10 so the preceding 0 is removed.

Fix is to quote that value like so:

awless update image id=ami-30xxxx accounts="0929XXXX"

As seen with @moulip it fixes the issue.

Note that is it not working with the fish shell due to the way it handles quotes in commands.

Issue is considered fixed.