Skip to content

Commit

Permalink
one_service: fix recreation (#8887)
Browse files Browse the repository at this point in the history
* Fix one_service unique creation

* Revert empty space

* Add CHANGELOG fragment

* Update CHANGELOG fragment

(cherry picked from commit 0bc5f24)
  • Loading branch information
abakanovskii authored and patchback[bot] committed Sep 26, 2024
1 parent 1caee89 commit 7355ebc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8887-fix-one_service-unique.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- 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).
3 changes: 1 addition & 2 deletions plugins/modules/one_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def create_service_and_operation(module, auth, template_id, service_name, owner_
if unique:
service = get_service_by_name(module, auth, service_name)

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


def get_connection_info(module):

url = module.params.get('api_url')
username = module.params.get('api_username')
password = module.params.get('api_password')
Expand Down

0 comments on commit 7355ebc

Please sign in to comment.