diff --git a/software-client/software_client/v1/release.py b/software-client/software_client/v1/release.py index 1f3f248f..fdf7bd34 100644 --- a/software-client/software_client/v1/release.py +++ b/software-client/software_client/v1/release.py @@ -104,7 +104,7 @@ class ReleaseManager(base.Manager): signal.signal(signal.SIGINT, signal.SIG_IGN) to_upload_files = {} - raw_files = [] + all_raw_files = [] # Find all files that need to be uploaded in given directories for release_dir in release_dirs: @@ -114,27 +114,30 @@ class ReleaseManager(base.Manager): # Get absolute path of files raw_files = [os.path.abspath(os.path.join(release_dir, f)) for f in raw_files] + + # Append files from directory into the full list + all_raw_files.extend(raw_files) else: print("Skipping invalid directory: %s" % release_dir, file=sys.stderr) - if len(raw_files) == 0: + if len(all_raw_files) == 0: print("No file to upload") return 0 - temp_iso_files = [f for f in raw_files if f.endswith(constants.ISO_EXTENSION)] + temp_iso_files = [f for f in all_raw_files if f.endswith(constants.ISO_EXTENSION)] if len(temp_iso_files) > 1: # Verify that only one ISO file is being uploaded print("Only one ISO file can be uploaded at a time. Found: %s" % temp_iso_files, file=sys.stderr) return 1 - temp_sig_files = [f for f in raw_files if f.endswith(constants.SIG_EXTENSION)] + temp_sig_files = [f for f in all_raw_files if f.endswith(constants.SIG_EXTENSION)] if len(temp_sig_files) > 1: # Verify that only one SIG file is being uploaded print("Only one SIG file can be uploaded at a time. Found: %s" % temp_sig_files, file=sys.stderr) return 1 - for software_file in sorted(set(raw_files)): + for software_file in sorted(set(all_raw_files)): _, 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')) @@ -147,6 +150,15 @@ class ReleaseManager(base.Manager): utils.print_result_debug(req, data) 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() + 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): diff --git a/software-client/software_client/v1/release_shell.py b/software-client/software_client/v1/release_shell.py index 601836ef..435b4138 100644 --- a/software-client/software_client/v1/release_shell.py +++ b/software-client/software_client/v1/release_shell.py @@ -145,14 +145,13 @@ def do_is_committed(cc, args): @utils.arg('release', metavar='(iso + sig) | patch', nargs="+", # accepts a list - help='Software releases to upload') -@utils.arg('--local', - required=False, - default=False, - action='store_true', help=('pair of install iso and sig files for major release ' '(GA or patched) and/or one or more files containing a ' 'patch release. NOTE: specify at most ONE pair of (iso + sig)')) +@utils.arg('--local', + required=False, + default=False, + action='store_true') def do_upload(cc, args): """Upload a software release""" req, data = cc.release.upload(args) @@ -175,8 +174,13 @@ def do_upload(cc, args): @utils.arg('release', + metavar='directory', nargs="+", # accepts a list - help='Directory containing software releases to upload') + help=('directory containing software releases files to upload. ' + 'The release files may be either a pair of install iso and ' + 'sig files for major release (GA or patched) and/or one or ' + 'more files containing a patch release. NOTE: specify at most ' + 'ONE pair of (iso + sig)')) def do_upload_dir(cc, args): """Upload a software release dir""" return cc.release.upload_dir(args)