Fix software upload error message

The return message in case of the iso or sig file doesn't exist was
also returning "cannot unpack non-iterable int object". This commit
fix this behavior.

Test Plan:
PASS: Software upload with non-existent files.
PASS: Software upload successfully.

Story: 2010676
Task: 51023

Change-Id: I8d487eee10d1471344ea3644d438c93bd880aa6c
Signed-off-by: Luis Eduardo Bonatti <luizeduardo.bonatti@windriver.com>
This commit is contained in:
Luis Eduardo Bonatti
2024-09-13 17:31:01 -03:00
parent c6d64feab8
commit a3306d9df0
2 changed files with 6 additions and 3 deletions

View File

@@ -63,7 +63,6 @@ class ReleaseManager(base.Manager):
return self._fetch(path)
def upload(self, args):
rc = 0
# arg.release is a list
releases = args.release
@@ -92,7 +91,7 @@ class ReleaseManager(base.Manager):
if len(valid_files) == 0:
print("No file to be uploaded.")
return rc
return 1
path = '/v1/release'
if is_local:

View File

@@ -191,7 +191,11 @@ def _print_upload_result(resp, data, debug):
action='store_true')
def do_upload(cc, args):
"""Upload a software release"""
resp, data = cc.release.upload(args)
result = cc.release.upload(args)
if isinstance(result, int):
return result
else:
resp, data = result[0], result[1]
_print_upload_result(resp, data, args.debug)
return utils.check_rc(resp, data)