mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
add boto3_tag_list_to_ansible_dict to ec2_vpc_peering_facts.py, and parameter checking to ec2_vpc_peer.py (#52307)
* add boto3_tag_list_to_ansible_dict to ec2_vpc_peering_facts.py * Add parameter checking to ec2_vpc_peer and give helpful error message * Fixed modules --> module typo in ec2_vpc_peer * Added required_if logic and fixed incorrect boolean check for absent peering connection * Changed error message to one of the following is * Added changelog fragments for ec2_vpc_peer changes * Changed changelog fragment as per request
This commit is contained in:
parent
861446b2a6
commit
1aae196cfa
4 changed files with 24 additions and 2 deletions
|
@ -74,7 +74,8 @@ except ImportError:
|
|||
pass # will be picked up by imported HAS_BOTO3
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ec2 import (ec2_argument_spec, boto3_conn, get_aws_connection_info,
|
||||
from ansible.module_utils.ec2 import (boto3_tag_list_to_ansible_dict,
|
||||
ec2_argument_spec, boto3_conn, get_aws_connection_info,
|
||||
ansible_dict_to_boto3_filter_list, HAS_BOTO3, camel_dict_to_snake_dict)
|
||||
|
||||
|
||||
|
@ -128,8 +129,13 @@ def main():
|
|||
except botocore.exceptions.NoCredentialsError as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# Turn the boto3 result in to ansible friendly_snaked_names
|
||||
results = [camel_dict_to_snake_dict(peer) for peer in get_vpc_peers(ec2, module)]
|
||||
|
||||
# Turn the boto3 result in to ansible friendly tag dictionary
|
||||
for peer in results:
|
||||
peer['tags'] = boto3_tag_list_to_ansible_dict(peer.get('tags', []))
|
||||
|
||||
module.exit_json(result=results)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue