Fix upload-dir respond missing info

This commit is to fix 'software upload-dir' not having
respond that contains uploaded release info.

Test Plan:

PASS:  upload files using 'software upload-dir'

Task: 49634
Story: 2010676
Change-Id: I635554fdbdb80fe31a38d1170202405fe6f32d3a
Signed-off-by: junfeng-li <junfeng.li@windriver.com>
This commit is contained in:
junfeng-li 2024-03-18 19:59:12 +00:00
parent b0afdd45f1
commit 1d78ce4cec

View File

@ -141,6 +141,8 @@ class ReleaseManager(base.Manager):
_, ext = os.path.splitext(software_file)
if ext in constants.SUPPORTED_UPLOAD_FILE_EXT:
to_upload_files[software_file] = (software_file, open(software_file, 'rb'))
else:
print("Skipping unsupported file: %s" % software_file, file=sys.stderr)
encoder = MultipartEncoder(fields=to_upload_files)
headers = {'Content-Type': encoder.content_type}
@ -151,14 +153,14 @@ class ReleaseManager(base.Manager):
else:
utils.print_software_op_result(req, data)
data = json.loads(req.text)
data_list = [(k, v["id"])
for d in data["upload_info"] for k, v in d.items()
data_list = [(lambda key, value: (key, value["id"]))(k, v)
for d in data["upload_info"]
for k, v in d.items()
if not k.endswith(".sig")]
header_data_list = ["Uploaded File", "Id"]
has_error = 'error' in data and data["error"]
utils.print_result_list(header_data_list, data_list, has_error)
return utils.check_rc(req, data)
def commit_patch(self, args):