Improve _get_list_resources Registraty method 33/47133/1
authorVictor Morales <victor.morales@intel.com>
Thu, 10 May 2018 21:14:37 +0000 (14:14 -0700)
committerVictor Morales <victor.morales@intel.com>
Thu, 10 May 2018 21:14:37 +0000 (14:14 -0700)
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 <victor.morales@intel.com>
Issue-ID: MULTICLOUD-214

share/newton_base/registration/registration.py

index 726eb69..6700439 100644 (file)
@@ -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):