-
Notifications
You must be signed in to change notification settings - Fork 397
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
Prepare ec2_vpc_vgw_* modules for promotion #2171
Prepare ec2_vpc_vgw_* modules for promotion #2171
Conversation
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
a7ef6b2
to
a7550db
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
Please update the documentation of the ec2_vpc_vgw
module, the state
argument has values C(present)
and C(absent)
, should be V(present)
and V(absent)
instead.
You also need to update the ec2_vpc_vgw
integration test case: add uppercase to tasks names and use FQCN for module.
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.
Can you also check why some tasks are commented out in the integration tests https://github.com/ansible-collections/community.aws/blob/main/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml and make sure that the module is fully tested, adding more tests if necessary?
This comment was marked as outdated.
This comment was marked as outdated.
b8497ac
to
29639e8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ec2_vpc_vgw did not had check_mode support. Added check_mode support and enabled tests, added more tests. |
This comment was marked as outdated.
This comment was marked as outdated.
Build failed. ✔️ ansible-galaxy-importer SUCCESS in 3m 18s (non-voting) |
plugins/modules/ec2_vpc_vgw.py
Outdated
if desired_status == "attached": | ||
wait_for_resource_state( | ||
client, | ||
module, | ||
"vpn_gateway_attached", | ||
VpnGatewayIds=vpn_gateway_id, | ||
delay=polling_increment_secs, | ||
max_attempts=max_retries, | ||
) | ||
elif desired_status == "detached": | ||
wait_for_resource_state( | ||
client, | ||
module, | ||
"vpn_gateway_detached", | ||
VpnGatewayIds=vpn_gateway_id, | ||
delay=polling_increment_secs, | ||
max_attempts=max_retries, | ||
) |
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 desired_status == "attached": | |
wait_for_resource_state( | |
client, | |
module, | |
"vpn_gateway_attached", | |
VpnGatewayIds=vpn_gateway_id, | |
delay=polling_increment_secs, | |
max_attempts=max_retries, | |
) | |
elif desired_status == "detached": | |
wait_for_resource_state( | |
client, | |
module, | |
"vpn_gateway_detached", | |
VpnGatewayIds=vpn_gateway_id, | |
delay=polling_increment_secs, | |
max_attempts=max_retries, | |
) | |
if desired_status not in ("attached", "detached"): | |
module.fail_json(msg=f"Unsupported status: {desired_status}") | |
wait_for_resource_state( | |
client, | |
module, | |
f"vpn_gateway_{desired_status}", | |
VpnGatewayIds=[vpn_gateway_id], | |
delay=polling_increment_secs, | |
max_attempts=max_retries, | |
) | |
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.
changing VpnGatewayIds=vpn_gateway_id to VpnGatewayIds=[vpn_gateway_id] causes failure with
"msg": "An exception happened while trying to wait for 'vpn_gateway_attached': Parameter validation failed:\nInvalid type for parameter VpnGatewayIds[0], value: ['vgw-0c3df60baf0acc49f'], type: <class 'list'>, valid types: <class 'str'>",
"resource_actions": [
"ec2:DescribeVpnGateways",
"ec2:CreateVpnGateway",
"ec2:AttachVpnGateway"
]
even though API states otherwise it to be a list of str, weird.
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.
Same as below.
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.
Hi @alinabuzachis , fixed. It was indeed being passed as List[Str] at the API call.
Only thing was that it was handled to be passed as List[Str] earlier in the function call tree.
Updated the code to ensure it is passed as List[Str] before calling module_utils/ec2 functions.
27b07e0
plugins/modules/ec2_vpc_vgw.py
Outdated
|
||
result = response | ||
return result | ||
|
||
|
||
def find_vgw(client, module, vpn_gateway_id=None): | ||
def find_vgw( | ||
client, module: AnsibleAWSModule, vpn_gateway_id: Optional[Union[str, List[str]]] = None |
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.
client, module: AnsibleAWSModule, vpn_gateway_id: Optional[Union[str, List[str]]] = None | |
client, module: AnsibleAWSModule, vpn_gateway_id: Optional[str] = None |
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.
We should also update the way the VpcGatewayIds
attribute of the describe_vpn_gateways()
See suggestion below
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.
Hi @alinabuzachis @abikouo , fixed. It was indeed being passed as List[Str] at the API call.
Only thing was that it was handled to be passed as List[Str] earlier in the function call tree.
Updated the code to ensure it is passed as List[Str] before calling module_utils/ec2 functions.
27b07e0
plugins/modules/ec2_vpc_vgw.py
Outdated
def find_vgw(client, module, vpn_gateway_id=None): | ||
def find_vgw( | ||
client, module: AnsibleAWSModule, vpn_gateway_id: Optional[Union[str, List[str]]] = None | ||
) -> List[Dict[str, Any]]: | ||
params = dict() | ||
if vpn_gateway_id: | ||
params["VpnGatewayIds"] = vpn_gateway_id |
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.
params["VpnGatewayIds"] = vpn_gateway_id | |
params["VpnGatewayIds"] = [vpn_gateway_id] |
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.
not sure what happens with the API but it fails with
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Invalid type for parameter VpnGatewayIds[0], value: ['vgw-0849b49ec813d18ee'], type: <class 'list'>, valid types: <class 'str'>
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.
Same as below.
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.
Hi @alinabuzachis , fixed. It was indeed being passed as List[Str] at the API call.
Only thing was that it was handled to be passed as List[Str] earlier in the function call tree.
Updated the code to ensure it is passed as List[Str] before calling module_utils/ec2 functions.
27b07e0
Build failed. ❌ ansible-galaxy-importer FAILURE in 3m 46s (non-voting) |
Build failed. ❌ ansible-galaxy-importer FAILURE in 3m 16s (non-voting) |
Build failed. ❌ ansible-galaxy-importer FAILURE in 5m 09s (non-voting) |
Build failed. ❌ ansible-galaxy-importer FAILURE in 4m 38s (non-voting) |
recheck |
Build failed. ❌ ansible-galaxy-importer FAILURE in 4m 55s (non-voting) |
recheck |
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.
Can you please ensure that the other linter test are green (don't worry about the import errors for the moment)?
ERROR: plugins/modules/ec2_vpc_vgw.py:99:30: invalid-examples: EXAMPLES is not valid YAML
ERROR: plugins/modules/ec2_vpc_vgw_info.py:0:0: invalid-documentation-markup: Directive "RV(resource_tags)" contains a non-existing return value "resource_tags"
ERROR: plugins/modules/ec2_vpc_vgw_info.py:0:0: invalid-documentation-markup: Directive "RV(tags)" contains a non-existing return value "tags"
Build failed. ✔️ ansible-galaxy-importer SUCCESS in 3m 12s (non-voting) |
recheck |
@mandar242 there are still other linting issues. |
Build succeeded. ❌ ansible-galaxy-importer FAILURE in 4m 29s (non-voting) |
When state == absent, the expectation and the current behavior is to delete the vgw.
Build succeeded (gate pipeline). ❌ ansible-galaxy-importer FAILURE in 3m 46s (non-voting) |
b78cba1
into
ansible-collections:main
SUMMARY Depends-On: ansible-collections/amazon.aws#2331 Prepare ec2_vpc_vgw_* modules for promotion ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ec2_vpc_vgw ec2_vpc_vgw_info ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni <[email protected]> Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS <[email protected]>
SUMMARY Depends-On: ansible-collections/amazon.aws#2331 Prepare ec2_vpc_vgw_* modules for promotion ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ec2_vpc_vgw ec2_vpc_vgw_info ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni <[email protected]> Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS <[email protected]>
SUMMARY Depends-On: ansible-collections/amazon.aws#2331 Prepare ec2_vpc_vgw_* modules for promotion ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ec2_vpc_vgw ec2_vpc_vgw_info ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni <[email protected]> Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS <[email protected]>
SUMMARY
Depends-On: ansible-collections/amazon.aws#2331
Prepare ec2_vpc_vgw_* modules for promotion
ISSUE TYPE
COMPONENT NAME
ec2_vpc_vgw
ec2_vpc_vgw_info
ADDITIONAL INFORMATION