-
Notifications
You must be signed in to change notification settings - Fork 346
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_vpc_nat_gateway show fails if EIP doesn't exist #1604
ec2_vpc_nat_gateway show fails if EIP doesn't exist #1604
Conversation
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 5m 02s |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 12s |
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
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 new parameter needs to be added in a couple other places.
In the DOCUMENTATION block at the top of the file (make sure to document that the default value is False) https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html#documentation-block
In the module argument_spec in main().
This is also where you set the default value as False. (The types in the documentation must match the types in the arg spec, linting rules will check this)
https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#argument-spec
The value of the parameter must then be assigned to a variable in this section: https://github.com/ansible-collections/amazon.aws/blob/main/plugins/modules/ec2_vpc_nat_gateway.py#L881-L892
That value would be passed to functions that need it, instead of being defined through the code.
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 57s |
@@ -75,6 +75,11 @@ | |||
When specifying this option, ensure you specify the eip_address parameter | |||
as well otherwise any subsequent runs will fail. | |||
type: str | |||
default_create: | |||
description: | |||
- if EIP address is not found, create NAT gateway with EIP address as null. |
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.
I guess the description of this parameter must be carified. What happens when the users specifies an invalid allocation_id? Does default_create: True allow to still create the NAT gateway and allocate a new EIP?
Something like this:
- When I(default_create=True), if I(eip_address) is set and it is invalid or does not exist, the NAT gateway is successfully created and a new EIP is automatically allocated.
- When I(default_create=True), if I(allocation_id) is set and it is invalid or not found, the NAT gateway is successfully created and a new EIP is automatically allocated. (If this is true!!!)
- When I(default_create=False), what happens?
Please feel free to rephrase and correct my suggestions.
changelogs/fragments/1604-c2_vpc_nat_gateway-fails-silently.yml
Outdated
Show resolved
Hide resolved
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
Co-authored-by: Alina Buzachis <abuzachis@redhat.com>
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 13s |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 43s |
- When I(default_create=True), if I(eip_address) is set and it is not found, the NAT | ||
gateway is successfully created and a new EIP is automatically allocated. | ||
- The validity of the I(allocation_id) is independent of the I(default_create). If | ||
I(allocation_id) is set and it is invalid or not found, this will fail, regardless | ||
of I(default_create). | ||
- The validity of the I(eip_address) is independent of the I(default_create). If | ||
I(eip_address) is set and it is invalid, this will fail, regardless of | ||
I(default_create). | ||
- When I (default_create=False), if I(eip_address) is set and it is invalid or does not | ||
exist, this will fail. |
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.
This parameter only comes into play when eip_address
has been set. IMO I would keep the allocation_id
out of the description and state that the parameter has no effect when eip_address
has not been set:
- When I(default_create=True) and I(eip_address) has been set, but not yet allocated, the NAT gateway is created and a new EIP is automatically allocated.
- When I(default_create=False) and I(eip_address) has been set, but not yet allocated, the module will fail.
- If I(eip_address) has not been set, this parameter has no effect.
That said, what you have looks correct and makes sense, so I don't have a problem with merging as is. I'll let @alinabuzachis make the call.
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.
If allocation_id
is out, it does not make sense to mention it. Agreed with @gravesm! @taehopark32 Thanks for updating docs!
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.
@taehopark32 This looks great to me if you remove the reference to the allocation_id
since the parameter applies only to eip_address.
- When I(default_create=True), if I(eip_address) is set and it is not found, the NAT | ||
gateway is successfully created and a new EIP is automatically allocated. | ||
- The validity of the I(allocation_id) is independent of the I(default_create). If | ||
I(allocation_id) is set and it is invalid or not found, this will fail, regardless | ||
of I(default_create). | ||
- The validity of the I(eip_address) is independent of the I(default_create). If | ||
I(eip_address) is set and it is invalid, this will fail, regardless of | ||
I(default_create). | ||
- When I (default_create=False), if I(eip_address) is set and it is invalid or does not | ||
exist, this will fail. |
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.
If allocation_id
is out, it does not make sense to mention it. Agreed with @gravesm! @taehopark32 Thanks for updating docs!
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 55s |
@alinabuzachis Thank you. I fixed the description and passed all the tests. |
We have already 2 approvals.
regate |
Build succeeded (gate pipeline). ✔️ ansible-galaxy-importer SUCCESS in 4m 30s |
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #1642 🤖 @patchback |
ec2_vpc_nat_gateway show fails if EIP doesn't exist SUMMARY Fixes #1295 ISSUE TYPE Bugfix Pull Request COMPONENT NAME plugins/modules/ec2_vpc_nat_gateway ADDITIONAL INFORMATION Reviewed-by: Jill R Reviewed-by: Bikouo Aubin Reviewed-by: Alina Buzachis Reviewed-by: Mike Graves <mgraves@redhat.com> (cherry picked from commit 6f207ec)
[PR #1604/6f207ec1 backport][stable-6] ec2_vpc_nat_gateway show fails if EIP doesn't exist This is a backport of PR #1604 as merged into main (6f207ec). SUMMARY Fixes #1295 ISSUE TYPE Bugfix Pull Request COMPONENT NAME plugins/modules/ec2_vpc_nat_gateway ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis
SUMMARY
Fixes #1295
ISSUE TYPE
COMPONENT NAME
plugins/modules/ec2_vpc_nat_gateway
ADDITIONAL INFORMATION