From 6b2ce042cbd934635f97c9e3a75b7d144e5c3dfb Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Thu, 10 May 2018 14:14:37 -0700 Subject: Improve _get_list_resources Registraty method The logic implemented into the _get_list_resources function for ocata had an unnecessary conditional. This change refactors the implementation. Change-Id: Ic70dfd0b6d7f9f5599381a7179e5990310a25732 Signed-off-by: Victor Morales Issue-ID: MULTICLOUD-214 --- share/newton_base/registration/registration.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py index 726eb691..67004390 100644 --- a/share/newton_base/registration/registration.py +++ b/share/newton_base/registration/registration.py @@ -47,12 +47,9 @@ class Registry(APIView): self._logger.info("request returns with status %s" % resp.status_code) if resp.status_code == status.HTTP_200_OK: self._logger.debug("with content:%s" % resp.json()) - pass - content = resp.json() - - if resp.status_code != status.HTTP_200_OK: - return # failed to discover resources - return content.get(content_key) + content = resp.json() + return content.get(content_key) + return # failed to discover resources def _update_resoure(self, cloud_owner, cloud_region_id, resoure_id, resource_info, resource_type): -- cgit 1.2.3-korg