Fix ec2 run-instances not validating --no-associate-public-ip-address against --network-interfaces - #10559
Open
Adityaj0 wants to merge 1 commit into
Open
Conversation
… against --network-interfaces --no-associate-public-ip-address is a separate argparse dest (no_associate_public_ip_address) from --associate-public-ip-address, so the existing mutual-exclusivity check against --network-interfaces never inspected it. This let the flag silently overwrite AssociatePublicIpAddress inside the user's own --network-interfaces JSON instead of raising the documented ParamValidationError.
Author
|
Fixes #10558 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10558.
--no-associate-public-ip-addressand--associate-public-ip-addressare two independent argparse destinations (no_associate_public_ip_address/associate_public_ip_address) — they only share agroup_namefor help-text grouping, not adest._check_args()inawscli/customizations/ec2/runinstances.pyonly ever checkedassociate_public_ip_addresswhen validating that--network-interfacesisn't mixed with the scalar options, so--no-associate-public-ip-addresssilently bypassed the check and overwroteAssociatePublicIpAddressinside the user's own--network-interfacesJSON instead of raising the documentedParamValidationError.This adds the missing check for
no_associate_public_ip_address is False(its "flag was explicitly passed" state, since it's astore_falseaction defaulting toTrue).Test plan
test_network_interfaces_with_no_associate_public_ip_address_errors(regression test for the bug) andtest_network_interfaces_with_associate_public_ip_address_errors(locks in existing correct behavior) totests/functional/ec2/test_run_instances.pypython -m pytest tests/functional/ec2/ tests/unit/customizations/ec2/— 108 passed.changes/next-release/