rest_dbus: upload: Add version id error code

If there was no D-Bus object created, it means that either the version
already existed, or there was a failure extracting the file. Ideally the
REST server would query to see if the version already exists, but it
doesn't know the version id to look for, so adding a single error msg
for all error cases. It still makes sense to have a 400 (client) error
for tar errors since a failure to untar is most likely an invalid or
corrupted file that the user would need to address.

Tested:
Uploading a regular file (that triggers a tar failure) or a
version that already exists on the system:
Before:
  {
    "data": null,
    "message": "200 OK",
    "status": "ok"
  }

After:
  {
    "data": {
      "description": "Version already exists or failed to be extracted"
    },
    "message": "400 Bad Request",
    "status": "error"
  }

Fixes openbmc/openbmc#2939

Change-Id: Ia4be5fe1dac3c2c7ebb5eb2aa28e4d58f9222c7f
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py
index 93cd4de..6374add 100644
--- a/module/obmc/wsgi/apps/rest_dbus.py
+++ b/module/obmc/wsgi/apps/rest_dbus.py
@@ -788,7 +788,10 @@
                 break
         cls.signal.remove()
         cls.signal = None
-        return version_id
+        if version_id:
+            return version_id
+        else:
+            abort(400, "Version already exists or failed to be extracted")
 
 
 class ImagePostHandler(RouteHandler):