From 1501ab76bf727fe67771d956f3ea63efa88bf121 Mon Sep 17 00:00:00 2001 From: Pradeepsingh Bhati Date: Tue, 17 Oct 2023 00:43:03 +0530 Subject: [PATCH] Change api url for fetching time machine using name to get complete info same as uuid --- plugins/module_utils/ndb/time_machines.py | 7 +++++-- plugins/modules/ntnx_ndb_time_machines_info.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/ndb/time_machines.py b/plugins/module_utils/ndb/time_machines.py index dc54b0dc0..a5ed83b73 100644 --- a/plugins/module_utils/ndb/time_machines.py +++ b/plugins/module_utils/ndb/time_machines.py @@ -37,8 +37,11 @@ def get_time_machine(self, uuid=None, name=None, query=None): if uuid: resp = self.read(uuid=uuid, query=query) elif name: - endpoint = "{0}/{1}".format("name", name) - resp = self.read(endpoint=endpoint, query=query) + if not query: + query = {} + query["vaue_type"] = "name" + query["value"] = name + resp = self.read(query=query) if isinstance(resp, list): if not resp: return None, "Time machine with name {0} not found".format(name) diff --git a/plugins/modules/ntnx_ndb_time_machines_info.py b/plugins/modules/ntnx_ndb_time_machines_info.py index f3d9dc861..8fce6fdae 100644 --- a/plugins/modules/ntnx_ndb_time_machines_info.py +++ b/plugins/modules/ntnx_ndb_time_machines_info.py @@ -307,7 +307,7 @@ def get_time_machine(module, result): resp, err = tm.get_time_machine(uuid=uuid, name=name, query=query_params) if err: result["error"] = err - module.fail_json(msg="Failed fetching sla info", **result) + module.fail_json(msg="Failed fetching time machine info", **result) result["response"] = resp