From ba55f965415de8ff0bca7ae0b97341f9b9ba70bc Mon Sep 17 00:00:00 2001 From: caohongtao Date: Tue, 30 Apr 2024 10:25:38 +0800 Subject: [PATCH] Keep same format for all program 1.Keep the first letter of the log capitalized; 2.The log.warn No longer applicable python3.3 latest; Signed-off-by: caohongtao --- src/cmd-build | 2 +- src/cmd-buildextend-live | 9 ++++++--- src/cmd-ore-wrapper | 14 +++++++------- src/cosalib/build.py | 4 ++-- src/cosalib/cmdlib.py | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/cmd-build b/src/cmd-build index 32290683..a4780484 100755 --- a/src/cmd-build +++ b/src/cmd-build @@ -129,7 +129,7 @@ build_followup_targets() { cd "${workdir}" for target in "${!targets[@]}"; do if ! "/usr/lib/coreos-assembler/cmd-buildextend-${target}"; then - fatal "failed buildextend-${target}" + fatal "Failed buildextend-${target}" fi done } diff --git a/src/cmd-buildextend-live b/src/cmd-buildextend-live index f4d122fb..3f04ddb0 100755 --- a/src/cmd-buildextend-live +++ b/src/cmd-buildextend-live @@ -161,8 +161,11 @@ def get_os_features(): def mkinitrd_pipe(tmproot, destf, compress=True): if not compress: align_initrd_for_uncompressed_append(destf) - files = subprocess.check_output(['find', '.', '-mindepth', '1', '-print0'], - cwd=tmproot) + try: + files = subprocess.check_output(['find', '.', '-mindepth', '1', '-print0'], + cwd=tmproot) + except subprocess.CalledProcessError as e: + raise e file_list = files.split(b'\0') # If there's a root.squashfs, it _must_ be the first file in the cpio # archive, since the dracut 20live module assumes its contents are at @@ -523,7 +526,7 @@ def generate_iso(): # Find name of vendor directory vendor_ids = [n for n in os.listdir(tmpimageefidir) if n != "BOOT"] if len(vendor_ids) != 1: - raise Exception(f"did not find exactly one EFI vendor ID: {vendor_ids}") + raise Exception(f"Did not find exactly one EFI vendor ID: {vendor_ids}") # Delete fallback and its CSV file. Its purpose is to create # EFI boot variables, which we don't want when booting from diff --git a/src/cmd-ore-wrapper b/src/cmd-ore-wrapper index 2ad6d68c..76510f0c 100755 --- a/src/cmd-ore-wrapper +++ b/src/cmd-ore-wrapper @@ -39,11 +39,11 @@ Each target has its own sub options. To access them us: # Check if this is a legacy interface if str(self_basename).endswith("-replicate"): - log.info("symlink is for a replication command") + log.info("Symlink is for a replication command") default_replicate = True if str(self_basename).startswith("cmd-buildextend-"): - log.info("symlink is for a build and publish command") + log.info("Symlink is for a build and publish command") default_build_artifact = True # previous cmd-buildextend- used symlinks @@ -58,7 +58,7 @@ Each target has its own sub options. To access them us: help="Target type for ore command") pre_args = parser.parse_known_args()[0] target = pre_args.target - log.debug(f"extending cli for {target}") + log.debug(f"Extending cli for {target}") # Check to make sure that a target has been chosen if target is None: @@ -104,7 +104,7 @@ Each target has its own sub options. To access them us: build = get_ibmcloud_variant(target, args) else: build = get_qemu_variant(target, args) - log.info(f"operating on {build.image_name}") + log.info(f"Operating on {build.image_name}") if args.build_artifact: if args.force: build.build_artifacts() @@ -114,13 +114,13 @@ Each target has its own sub options. To access them us: if args.upload: if not build.have_artifact: raise Exception(f"Missing build artifact {build.image_path}") - log.info("executing upload commands for ore") + log.info("Executing upload commands for ore") cmd, _ = get_cloud_ore_cmds(target) cmd(build, args) if args.replicate: - log.info("executing replicate commands for ore") + log.info("Executing replicate commands for ore") _, cmd = get_cloud_ore_cmds(target) cmd(build, args) - log.info("finishing ore processing") + log.info("Finishing ore processing") diff --git a/src/cosalib/build.py b/src/cosalib/build.py index 9f735789..06c35a62 100644 --- a/src/cosalib/build.py +++ b/src/cosalib/build.py @@ -150,7 +150,7 @@ class _Build: except Exception as e: raise Exception( - f"failed to remove temporary directory: {self._tmpdir}", e) + f"Failed to remove temporary directory: {self._tmpdir}", e) self.unset_token() @@ -414,7 +414,7 @@ class _Build: self._build_artifacts(*args, **kwargs) log.info("Finished building artifacts") if len(self._found_files.keys()) == 0: - log.warn("There were no files found after building") + log.warning("There were no files found after building") def _build_artifacts(self, *args, **kwargs): """ diff --git a/src/cosalib/cmdlib.py b/src/cosalib/cmdlib.py index 120087aa..d76c8bd9 100644 --- a/src/cosalib/cmdlib.py +++ b/src/cosalib/cmdlib.py @@ -342,7 +342,7 @@ def image_info(image): out['submformat'] = "fixed" return out except Exception as e: - raise Exception(f"failed to inspect {image} with qemu", e) + raise Exception(f"Failed to inspect {image} with qemu", e) # Hackily run some bash code from cmdlib.sh helpers. -- Gitee