From ee9ff4d1e1b1d457411eae63ff62a63930110fd7 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Tue, 28 May 2024 09:38:09 +0200 Subject: [PATCH] chore: add state to return --- plugins/modules/grafana_contact_point.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/modules/grafana_contact_point.py b/plugins/modules/grafana_contact_point.py index 464ccd78..3a85207e 100644 --- a/plugins/modules/grafana_contact_point.py +++ b/plugins/modules/grafana_contact_point.py @@ -1015,7 +1015,7 @@ def grafana_handle_contact_point(self, data): if self.contact_point: return self.grafana_delete_contact_point(data) else: - return {"changed": False} + return {"changed": False, "state": data["state"]} def grafana_create_contact_point(self, data, payload): r, info = fetch_url( @@ -1031,6 +1031,7 @@ def grafana_create_contact_point(self, data, payload): return { "changed": True, "contact_point": contact_point, + "state": data["state"], } else: raise GrafanaAPIException("Unable to create contact point: %s" % info) @@ -1051,12 +1052,13 @@ def grafana_update_contact_point(self, data, payload): del contact_point["provenance"] if self.contact_point == contact_point: - return {"changed": False, "contact_point": contact_point} + return {"changed": False, "contact_point": contact_point, "state": data["state"]} else: return { "changed": True, "diff": {"before": self.contact_point, "after": contact_point}, "contact_point": contact_point, + "state": data["state"], } else: raise GrafanaAPIException( @@ -1072,9 +1074,9 @@ def grafana_delete_contact_point(self, data): ) if info["status"] == 202: - return {"changed": True, "contact_point": self.contact_point} + return {"changed": True, "contact_point": self.contact_point, "state": data["state"]} elif info["status"] == 404: - return {"changed": False} + return {"changed": False, "state": data["state"]} else: raise GrafanaAPIException( "Unable to delete contact point '%s': %s" % (data["uid"], info)