Skip to content

Commit 18a8c6f

Browse files
[PR #8887/0bc5f248 backport][stable-8] one_service: fix recreation (#8931)
one_service: fix recreation (#8887) * Fix one_service unique creation * Revert empty space * Add CHANGELOG fragment * Update CHANGELOG fragment (cherry picked from commit 0bc5f24) Co-authored-by: alexander <[email protected]>
1 parent 1caee89 commit 18a8c6f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- one_service - fix service creation after it was deleted with ``unique`` parameter (https://github.com/ansible-collections/community.general/issues/3137, https://github.com/ansible-collections/community.general/pull/8887).

plugins/modules/one_service.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def create_service_and_operation(module, auth, template_id, service_name, owner_
522522
if unique:
523523
service = get_service_by_name(module, auth, service_name)
524524

525-
if not service:
525+
if not service or service["TEMPLATE"]["BODY"]["state"] == "DONE":
526526
if not module.check_mode:
527527
service = create_service(module, auth, template_id, service_name, custom_attrs, unique, wait, wait_timeout)
528528
changed = True
@@ -637,7 +637,6 @@ def get_service_id_by_name(module, auth, service_name):
637637

638638

639639
def get_connection_info(module):
640-
641640
url = module.params.get('api_url')
642641
username = module.params.get('api_username')
643642
password = module.params.get('api_password')

0 commit comments

Comments
 (0)