From: garciadeblas Date: Wed, 30 May 2018 08:17:16 +0000 (+0200) Subject: Fix bug in vnfd/nsd creation when reporting errors X-Git-Tag: v4.0.1^0 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fosmclient.git;a=commitdiff_plain;h=91b80f35e103943adb4ebbdee890e23131488e57 Fix bug in vnfd/nsd creation when reporting errors Change-Id: I8c9fd2d7c4a81723a41082ad5c06d7d1540fda1b Signed-off-by: garciadeblas --- diff --git a/osmclient/sol005/nsd.py b/osmclient/sol005/nsd.py index af1e2ef..10ad38f 100644 --- a/osmclient/sol005/nsd.py +++ b/osmclient/sol005/nsd.py @@ -166,13 +166,13 @@ class Nsd(object): resp)) print resp['id'] else: - msg = "" + msg = "Error {}".format(http_code) if resp: try: - msg = json.loads(resp) + msg = "{} - {}".format(msg, json.loads(resp)) except ValueError: - msg = resp - raise ClientException("failed to create/update nsd - {}".format(name, msg)) + msg = "{} - {}".format(msg, resp) + raise ClientException("failed to create/update nsd - {}".format(msg)) def update(self, name, filename): nsd = self.get(name) diff --git a/osmclient/sol005/vnfd.py b/osmclient/sol005/vnfd.py index 5afde93..b4d7987 100644 --- a/osmclient/sol005/vnfd.py +++ b/osmclient/sol005/vnfd.py @@ -165,13 +165,13 @@ class Vnfd(object): resp)) print resp['id'] else: - msg = "" + msg = "Error {}".format(http_code) if resp: try: - msg = json.loads(resp) + msg = "{} - {}".format(msg, json.loads(resp)) except ValueError: - msg = resp - raise ClientException("failed to create/update vnfd - {}".format(name, msg)) + msg = "{} - {}".format(msg, resp) + raise ClientException("failed to create/update vnfd - {}".format(msg)) def update(self, name, filename): vnfd = self.get(name)