mirror of
https://github.com/ansible/awx.git
synced 2026-02-02 01:58:09 -03:30
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
This commit is contained in:
@@ -122,7 +122,7 @@ options:
|
||||
description:
|
||||
- Desired state of the resource.
|
||||
default: "present"
|
||||
choices: ["present", "absent"]
|
||||
choices: ["present", "absent", "exists"]
|
||||
type: str
|
||||
wait:
|
||||
description:
|
||||
@@ -272,7 +272,7 @@ def main():
|
||||
notification_templates_started=dict(type="list", elements='str'),
|
||||
notification_templates_success=dict(type="list", elements='str'),
|
||||
notification_templates_error=dict(type="list", elements='str'),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
state=dict(choices=['present', 'absent', 'exists'], default='present'),
|
||||
wait=dict(type='bool', default=True),
|
||||
update_project=dict(default=False, type='bool'),
|
||||
interval=dict(default=2.0, type='float'),
|
||||
@@ -313,7 +313,7 @@ def main():
|
||||
lookup_data['organization'] = org_id
|
||||
|
||||
# Attempt to look up project based on the provided name and org ID
|
||||
project = module.get_one('projects', name_or_id=name, data=lookup_data)
|
||||
project = module.get_one('projects', name_or_id=name, check_exists=(state == 'exists'), data=lookup_data)
|
||||
|
||||
# Attempt to look up credential to copy based on the provided name
|
||||
if copy_from:
|
||||
|
||||
Reference in New Issue
Block a user