From 315e8a0cdd49c594665909a2eca389d09d97cde5 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Feb 27 2023 17:54:37 +0000 Subject: Proper log output --- diff --git a/src/centpkg/cli.py b/src/centpkg/cli.py index 199cbc9..502ebb3 100755 --- a/src/centpkg/cli.py +++ b/src/centpkg/cli.py @@ -169,6 +169,7 @@ class centpkgClient(cliClient): rhel_dist_git = config_get_safely(cfg, "centpkg.internal", 'rhel_dist_git') # Find out divergent branch and stabalization + self.log.info("Checking rhel-target information:") stream_version = self.cmd.target.split('-')[0] rhel_version = centpkg.utils.stream_mapping(stream_version) active_y, in_stabilization = centpkg.utils.determine_active_y_version(rhel_version, pp_api_url) @@ -181,13 +182,13 @@ class centpkgClient(cliClient): # Good to know if divergent_branch : - print("divergent_branch: TRUE") + self.log.info(" A divergent branch was found.") else: - print("divergent_branch: FALSE") + self.log.info(" A divergent branch was not found.") if in_stabilization : - print("in_stabilization: TRUE") + self.log.info(" We are in stabilization mode.") else: - print("in_stabilization: FALSE") + self.log.info(" We are not in stabilization mode.") # Update args.custom_user_metadata if hasattr(self.args, 'custom_user_metadata') and self.args.custom_user_metadata: @@ -206,10 +207,10 @@ class centpkgClient(cliClient): elif not divergent_branch and not in_stabilization : temp_custom_user_metadata["rhel-target"] = "zstream" else: - print("We are currently in Stabalization mode") - print("You must either set the rhel-target (--rhel-target)") - print("or branch for the previous version.") - print("Exiting") + self.log.info("We are currently in Stabalization mode") + self.log.info("You must either set the rhel-target (--rhel-target)") + self.log.info("or branch for the previous version.") + self.log.info("Exiting") raise SystemExit self.args.custom_user_metadata = json.dumps(temp_custom_user_metadata) else: @@ -222,24 +223,24 @@ class centpkgClient(cliClient): elif not divergent_branch and not in_stabilization : self.args.custom_user_metadata = '{"rhel-target": "zstream"}' else: - print("We are currently in Stabalization mode") - print("You must either set the rhel-target (--rhel-target)") - print("or branch for the previous version.") - print("Exiting") + self.log.info("We are currently in Stabalization mode") + self.log.info("You must either set the rhel-target (--rhel-target)") + self.log.info("or branch for the previous version.") + self.log.info("Exiting") raise SystemExit # Good to know, but take out for final cut - print('Metadata: %r', self.args.custom_user_metadata) + self.log.info(" rhel-target: " + json.loads(self.args.custom_user_metadata)['rhel-target']) # Purposely fail during testing so we do not have so many builds - #self.args.custom_user_metadata = json.loads(self.args.custom_user_metadata) + # self.args.custom_user_metadata = json.loads(self.args.custom_user_metadata) else: if not self.args.scratch: - print("NO SCRATCH BUILD") - print("Only scratch builds are allowed without internal configurations") - print("Exiting") + self.log.info("NO SCRATCH BUILD") + self.log.info("Only scratch builds are allowed without internal configurations") + self.log.info("Exiting") raise SystemExit # Proceed with build