def get_resource_map(self, resource_type=None):

        retries = RETRIES
        status = ""
        self.logger.debug("Running resource health command")

        request_id = Discovery.generate_node_health(rpath=resource_type)
        self.logger.debug(f"Requestid for resource map - {request_id}")

        while retries > 0:
            status = Discovery.get_gen_node_health_status(request_id)
            if "Success" in status:
                break
            elif "Failed" in status:
                raise CortxSetupError(status)
            retries -= 1
            time.sleep(WAIT)
        else:
            if retries == 0 and "Success" not in status:
                raise CortxSetupError(
                    "Timed out error."
                    "Generation of resource map is taking longer than expected.")

        return Discovery.get_node_health(request_id)
 def test_generate_node_health_on_invalid_rpath(self):
     """Check for failed status on invalid rpath."""
     req_id = Discovery.generate_node_health(invalid_rpath)
     status = Discovery.get_gen_node_health_status(req_id)
     self.assertIn("Failed", status)
     self.assertIn("Invalid rpath", status)
 def test_get_node_health_static_store_url(self):
     """Check for static store url."""
     request_id = Discovery.generate_node_health()
     url = Discovery.get_node_health(request_id)
     self.assertIsNotNone(url)
 def test_get_node_health(self):
     """Check for generated resource map location."""
     req_id = Discovery.generate_node_health(valid_rpath)
     url = Discovery.get_node_health(req_id)
     self.assertIsNotNone(url)
 def test_get_gen_node_health_status_success_on_health(self):
     """Check for node health status using valid request_id."""
     request_id = Discovery.generate_node_health(valid_rpath)
     status = Discovery.get_gen_node_health_status(request_id)
     self.assertEqual(status, "Success")
 def test_generate_node_health(self):
     """Check for immediate request id."""
     request_id = Discovery.generate_node_health(valid_rpath)
     self.assertIsNotNone(request_id)