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>
1 file changed
tree: b1bf4925ce1e82fbb6c5bce481a6beb5acc1fc0f
  1. module/
  2. servers/
  3. LICENSE