From: garciadeblas Date: Wed, 16 May 2018 13:29:46 +0000 (+0200) Subject: fix sol005 client so that delete_cmd output is processed in the caller function X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F54%2F6154%2F1;p=osm%2Fosmclient.git fix sol005 client so that delete_cmd output is processed in the caller function Change-Id: I0311de2bfafd86bf26ac79f762d76cec9e7a065e Signed-off-by: garciadeblas --- diff --git a/osmclient/sol005/http.py b/osmclient/sol005/http.py index 8e80ba9..5311ca8 100644 --- a/osmclient/sol005/http.py +++ b/osmclient/sol005/http.py @@ -50,7 +50,7 @@ class Http(http.Http): curl_cmd.close() # TODO 202 accepted should be returned somehow if data.getvalue(): - return http_code, json.loads(data.getvalue().decode()) + return http_code, data.getvalue().decode() else: return http_code, None diff --git a/osmclient/sol005/ns.py b/osmclient/sol005/ns.py index 30bbe02..ebb779c 100644 --- a/osmclient/sol005/ns.py +++ b/osmclient/sol005/ns.py @@ -77,6 +77,8 @@ class Ns(object): def delete(self, name): ns = self.get(name) http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,ns['_id'])) + if resp: + resp = json.loads(resp) #print 'RESP: {}'.format(resp) if http_code == 202: print 'Deletion in progress' diff --git a/osmclient/sol005/nsd.py b/osmclient/sol005/nsd.py index 4ae755b..055d2e5 100644 --- a/osmclient/sol005/nsd.py +++ b/osmclient/sol005/nsd.py @@ -93,6 +93,8 @@ class Nsd(object): def delete(self, name): nsd = self.get(name) http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase, nsd['_id'])) + if resp: + resp = json.loads(resp) #print 'RESP: {}'.format(resp) if http_code == 202: print 'Deletion in progress' diff --git a/osmclient/sol005/sdncontroller.py b/osmclient/sol005/sdncontroller.py index 0639559..7833fbd 100644 --- a/osmclient/sol005/sdncontroller.py +++ b/osmclient/sol005/sdncontroller.py @@ -62,6 +62,8 @@ class SdnController(object): def delete(self, name): sdn_controller = self.get(name) http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,sdn_controller['_id'])) + if resp: + resp = json.loads(resp) #print 'RESP: {}'.format(resp) if http_code == 202: print 'Deletion in progress' diff --git a/osmclient/sol005/vim.py b/osmclient/sol005/vim.py index 8aee453..dca8444 100644 --- a/osmclient/sol005/vim.py +++ b/osmclient/sol005/vim.py @@ -95,6 +95,8 @@ class Vim(object): if not utils.validate_uuid4(vim_name): vim_id = self.get_id(vim_name) http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,vim_id)) + if resp: + resp = json.loads(resp) #print 'RESP: {}'.format(resp) if http_code == 202: print 'Deletion in progress' diff --git a/osmclient/sol005/vnfd.py b/osmclient/sol005/vnfd.py index cc5f04a..dd12096 100644 --- a/osmclient/sol005/vnfd.py +++ b/osmclient/sol005/vnfd.py @@ -92,6 +92,8 @@ class Vnfd(object): def delete(self, name): vnfd = self.get(name) http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,vnfd['_id'])) + if resp: + resp = json.loads(resp) #print 'RESP: {}'.format(resp) if http_code == 202: print 'Deletion in progress'