mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-28 23:51:23 -07:00
[ec2_ami] Ensure name or image_id is provided for state=present (#38972)
Add integration tests for backward compatibility and ensuring name or image_id is provided
This commit is contained in:
parent
cdb79b0e3a
commit
e2aa1155ba
2 changed files with 30 additions and 2 deletions
|
@ -656,7 +656,7 @@ def main():
|
|||
virtualization_type=dict(default='hvm'),
|
||||
root_device_name=dict(),
|
||||
delete_snapshot=dict(default=False, type='bool'),
|
||||
name=dict(default=''),
|
||||
name=dict(),
|
||||
wait=dict(type='bool', default=False),
|
||||
wait_timeout=dict(default=900, type='int'),
|
||||
description=dict(default=''),
|
||||
|
@ -680,6 +680,11 @@ def main():
|
|||
]
|
||||
)
|
||||
|
||||
# Using a required_one_of=[['name', 'image_id']] overrides the message that should be provided by
|
||||
# the required_if for state=absent, so check manually instead
|
||||
if not any([module.params['image_id'], module.params['name']]):
|
||||
module.fail_json(msg="one of the following is required: name, image_id")
|
||||
|
||||
try:
|
||||
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True)
|
||||
connection = boto3_conn(module, conn_type='client', resource='ec2', region=region, endpoint=ec2_url, **aws_connect_kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue