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

pubsys: fix AWS SDK API calls and surface service error codes #2895

Merged
merged 3 commits into from
Mar 15, 2023

Conversation

etungsten
Copy link
Contributor

@etungsten etungsten commented Mar 14, 2023

Issue number:

N/A

Description of changes:

    pubsys: fix put-parameter taking a empty list
    
    Ensure we pass None if the list of names we're passing is empty.
    pubsys: fix AWS SDK API calls
    
    The EC2 API call for modify-snapshot-attribute and
    modify-image-attribute errors on empty vecs. This passes 'None' for the
    list parameters if the list is empty.

    pubsys: surface AWS API service error code in error log
    
    This surfaces the actual AWS API service error code in the error log message.

Testing done:
@jpculp ran the tests:

  • Ran pubsys directly to revoke user ids
  • Ran pubsys directly to grant user ids
  • Published ami with cargo make -e BUILDSYS_ARCH=x86_64 -e BUILDSYS_VARIANT=aws-k8s-1.24 ami
  • Granted permissions to ami with cargo make -e BUILDSYS_ARCH=x86_64 -e BUILDSYS_VARIANT=aws-k8s-1.24 -e GRANT_TO_USERS=<> grant-ami

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

This surfaces the actual AWS API service error code in the error log message.
tools/pubsys/src/aws/publish_ami/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@jpculp jpculp left a comment

Choose a reason for hiding this comment

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

  • Ran pubsys directly to revoke user ids
  • Ran pubsys directly to grant user ids
  • Published ami with cargo make -e BUILDSYS_ARCH=x86_64 -e BUILDSYS_VARIANT=aws-k8s-1.24 ami
  • Granted permissions to ami with cargo make -e BUILDSYS_ARCH=x86_64 -e BUILDSYS_VARIANT=aws-k8s-1.24 -e GRANT_TO_USERS=XXXXXXXXX grant-ami

The EC2 API call for modify-snapshot-attribute and
modify-image-attribute errors on empty vecs. This passes 'None' for the
list parameters if the list is empty.
Ensure we pass None if the list of names we're passing is empty.
@etungsten
Copy link
Contributor Author

Push above changes the if .is_empty() { None } else { Some(...) } to then_some()

Copy link
Member

@jpculp jpculp left a comment

Choose a reason for hiding this comment

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

Re-ran the same cargo make tests. LGTM!

@etungsten etungsten merged commit 972c38b into bottlerocket-os:develop Mar 15, 2023
@etungsten etungsten deleted the sdk-pls branch March 15, 2023 00:16
jpmcb added a commit to jpmcb/bottlerocket that referenced this pull request Mar 15, 2023
jpmcb added a commit to jpmcb/bottlerocket that referenced this pull request Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants