From bffe6b7c226a1a37fdd94da6c45f4244810d3eae Mon Sep 17 00:00:00 2001 From: 36970 Date: Mon, 1 Apr 2024 16:47:36 +0000 Subject: [PATCH] Coverity(phase2)-CWE 398:Code Quality Added fix for CWE 398: Code Quality Change-Id: Ie86246c6606bc5fd12d00b297a5b19661747baa7 Signed-off-by: 36970 --- osmclient/sol005/sdncontroller.py | 5 +---- osmclient/sol005/vim.py | 5 +---- osmclient/sol005/wim.py | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/osmclient/sol005/sdncontroller.py b/osmclient/sol005/sdncontroller.py index 3d4b7f7..b8860d7 100644 --- a/osmclient/sol005/sdncontroller.py +++ b/osmclient/sol005/sdncontroller.py @@ -61,10 +61,7 @@ class SdnController(object): """Returns id of name, or the id itself if given as argument""" self._logger.debug("") for sdnc in self.list(): - if name == sdnc["_id"]: - return sdnc["_id"] - for sdnc in self.list(): - if name == sdnc["name"]: + if name == sdnc["_id"] or name == sdnc["name"]: return sdnc["_id"] return "" diff --git a/osmclient/sol005/vim.py b/osmclient/sol005/vim.py index 4962a91..6be1dbb 100644 --- a/osmclient/sol005/vim.py +++ b/osmclient/sol005/vim.py @@ -62,10 +62,7 @@ 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 "" diff --git a/osmclient/sol005/wim.py b/osmclient/sol005/wim.py index 2466113..c9249d0 100644 --- a/osmclient/sol005/wim.py +++ b/osmclient/sol005/wim.py @@ -61,10 +61,7 @@ class Wim(object): """Returns id of name, or the id itself if given as argument""" self._logger.debug("") for wim in self.list(): - if name == wim["uuid"]: - return wim["uuid"] - for wim in self.list(): - if name == wim["name"]: + if name == wim["uuid"] or name == wim["name"]: return wim["uuid"] return "" -- 2.25.1