mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Use mutually_exclusive in AnsibleModule
This commit is contained in:
@@ -837,6 +837,7 @@ def main():
|
|||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
mutually_exclusive = [['security_group_ids', 'security_group_names']]
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_BOTO:
|
if not HAS_BOTO:
|
||||||
@@ -868,9 +869,7 @@ def main():
|
|||||||
if state == 'present' and not (zones or subnets):
|
if state == 'present' and not (zones or subnets):
|
||||||
module.fail_json(msg="At least one availability zone or subnet is required for ELB creation")
|
module.fail_json(msg="At least one availability zone or subnet is required for ELB creation")
|
||||||
|
|
||||||
if security_group_ids and security_group_names:
|
if security_group_names:
|
||||||
module.fail_json(msg = str("Use only one type of parameter (security_group_ids) or (security_group_names)"))
|
|
||||||
elif security_group_names:
|
|
||||||
security_group_ids = []
|
security_group_ids = []
|
||||||
try:
|
try:
|
||||||
ec2 = ec2_connect(module)
|
ec2 = ec2_connect(module)
|
||||||
|
|||||||
Reference in New Issue
Block a user