mirror of
https://github.com/ansible/awx.git
synced 2026-01-31 17:18:59 -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:
@@ -118,7 +118,7 @@ options:
|
||||
description:
|
||||
- Desired state of the resource.
|
||||
default: "present"
|
||||
choices: ["present", "absent"]
|
||||
choices: ["present", "absent", "exists"]
|
||||
type: str
|
||||
notification_templates_started:
|
||||
description:
|
||||
@@ -192,7 +192,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'),
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
@@ -219,6 +219,7 @@ def main():
|
||||
inventory_source_object = module.get_one(
|
||||
'inventory_sources',
|
||||
name_or_id=name,
|
||||
check_exists=(state == 'exists'),
|
||||
**{
|
||||
'data': {
|
||||
'inventory': inventory_object['id'],
|
||||
|
||||
Reference in New Issue
Block a user