-
Notifications
You must be signed in to change notification settings - Fork 183
cosalib/aws: only replicate WinLI AMIs when --winli is specified #4339
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
base: main
Are you sure you want to change the base?
Conversation
The current logic always considers the `aws-winli` buildmeta key when present, which causes WinLI AMIs to be replicated in both the standard AWS and GovCloud cases. Restore `aws_run_ore_replicate`[1] to only work on the 'amis' buildmeta key and switch to aws-winli when `--winli` is used. This ensures WinLI replication happens only when explicitly requested. Also update the CLI help text for `--winli` to clarify that it applies to replication as well as creation. [1]: coreos@a5bfbde
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.
Code Review
This pull request correctly modifies the AWS replication logic to only replicate Windows License Included (WinLI) AMIs when the --winli
flag is specified, which resolves an issue where they were always replicated if present. The logic is now cleaner and correctly tied to the command-line flag. The update to the CLI help text is also a good clarification. I've added a few minor suggestions to improve code conciseness.
meta_key = "amis" | ||
# only replicate WinLI AMIs if `--winli` is used | ||
if args.winli: | ||
meta_key = "aws-winli" |
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.
For better conciseness, you can use a conditional expression to assign meta_key
. The comment on line 36 can then be moved to this new line as an inline comment.
meta_key = "amis" | |
# only replicate WinLI AMIs if `--winli` is used | |
if args.winli: | |
meta_key = "aws-winli" | |
meta_key = "aws-winli" if args.winli else "amis" |
# only replicate WinLI AMIs if `--winli` is used | ||
if args.winli: | ||
meta_key = "aws-winli" | ||
if len(buildmeta.get(meta_key, [])) < 1: |
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.
"skipping listed region(s)...")) | ||
|
||
region_list = list(set(args.region) - set(duplicates)) | ||
if len(region_list) == 0: |
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.
The current logic always considers the
aws-winli
buildmeta key when present, which causes WinLI AMIs to be replicated in both the standard AWS and GovCloud cases.Restore
aws_run_ore_replicate
[1]
to only work on the 'amis' buildmeta key and switch to aws-winli when--winli
is used. This ensures WinLI replication happens only when explicitly requested. Also update the CLI help text for--winli
to clarify that it applies to replication as well as creation.[1]
: a5bfbde