diff options
author | John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> | 2023-05-10 14:05:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 14:05:29 +0200 |
commit | 7f020052db92a85c659cc252f05f4ea631a8a9ee (patch) | |
tree | 33f6820cc20dbd92333ab7d89c8c78b91fdd4bde /awx_collection/plugins/modules/instance_group.py | |
parent | Issue template: Remind people to use security@ (#13971) (diff) | |
download | awx-7f020052db92a85c659cc252f05f4ea631a8a9ee.tar.xz awx-7f020052db92a85c659cc252f05f4ea631a8a9ee.zip |
Make state exists universal in collection (#13890)
Make state: exists available for all API modules
Make state:exists return the ID just like it would if it created the resource
Diffstat (limited to 'awx_collection/plugins/modules/instance_group.py')
-rw-r--r-- | awx_collection/plugins/modules/instance_group.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/awx_collection/plugins/modules/instance_group.py b/awx_collection/plugins/modules/instance_group.py index dc993f8b5b..e9d3a9fa53 100644 --- a/awx_collection/plugins/modules/instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -81,7 +81,7 @@ options: state: description: - Desired state of the resource. - choices: ["present", "absent"] + choices: ["present", "absent", "exists"] default: "present" type: str extends_documentation_fragment: awx.awx.auth @@ -107,7 +107,7 @@ def main(): policy_instance_list=dict(type='list', elements='str'), pod_spec_override=dict(), instances=dict(required=False, type="list", elements='str'), - state=dict(choices=['present', 'absent'], default='present'), + state=dict(choices=['present', 'absent', 'exists'], default='present'), ) # Create a module for ourselves @@ -128,7 +128,7 @@ def main(): state = module.params.get('state') # Attempt to look up an existing item based on the provided data - existing_item = module.get_one('instance_groups', name_or_id=name) + existing_item = module.get_one('instance_groups', name_or_id=name, check_exists=(state == 'exists')) if state == 'absent': # If the state was absent we can let the module delete it if needed, the module will handle exiting from this |