Fix bug in vnfd/nsd creation when reporting errors v4.0.1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 30 May 2018 08:17:16 +0000 (10:17 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 1 Jun 2018 05:37:02 +0000 (07:37 +0200)
Change-Id: I8c9fd2d7c4a81723a41082ad5c06d7d1540fda1b
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/sol005/nsd.py
osmclient/sol005/vnfd.py

index af1e2ef..10ad38f 100644 (file)
@@ -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)
index 5afde93..b4d7987 100644 (file)
@@ -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)