Coverity(phase2)-CWE 398:Code Quality
[osm/osmclient.git] / osmclient / sol005 / vim.py
index 89c2db4..6be1dbb 100644 (file)
@@ -62,15 +62,18 @@ class Vim(object):
         self._logger.debug("")
         self._client.get_token()
         for vim in self.list():
-            if name == vim["uuid"]:
-                return vim["uuid"]
-        for vim in self.list():
-            if name == vim["name"]:
+            if name == vim["uuid"] or name == vim["name"]:
                 return vim["uuid"]
         return ""
 
     def create(
-        self, name, vim_access, config={}, sdn_controller=None, sdn_port_mapping=None, wait=False
+        self,
+        name,
+        vim_access,
+        config={},
+        sdn_controller=None,
+        sdn_port_mapping=None,
+        wait=False,
     ):
         vca_id = None
 
@@ -127,7 +130,13 @@ class Vim(object):
         #    raise ClientException("failed to create vim {} - {}".format(name, msg))
 
     def update(
-        self, vim_name, vim_account, config, sdn_controller, sdn_port_mapping, wait=False
+        self,
+        vim_name,
+        vim_account,
+        config,
+        sdn_controller,
+        sdn_port_mapping,
+        wait=False,
     ):
         self._logger.debug("")
         self._client.get_token()
@@ -185,6 +194,8 @@ class Vim(object):
         vim_account["vim_user"] = vim_access["vim-username"] or "null"
         vim_account["vim_password"] = vim_access["vim-password"] or "null"
         vim_account["vim_tenant_name"] = vim_access["vim-tenant-name"] or "null"
+        if "prometheus-config" in vim_access:
+            vim_account["prometheus-config"] = vim_access["prometheus-config"]
         return vim_account
 
     def get_id(self, name):