Proper log output

This commit is contained in:
Troy Dawson 2023-02-27 09:54:37 -08:00
parent 1e7ef8239a
commit 315e8a0cdd

View file

@ -169,6 +169,7 @@ class centpkgClient(cliClient):
rhel_dist_git = config_get_safely(cfg, "centpkg.internal", 'rhel_dist_git') rhel_dist_git = config_get_safely(cfg, "centpkg.internal", 'rhel_dist_git')
# Find out divergent branch and stabalization # Find out divergent branch and stabalization
self.log.info("Checking rhel-target information:")
stream_version = self.cmd.target.split('-')[0] stream_version = self.cmd.target.split('-')[0]
rhel_version = centpkg.utils.stream_mapping(stream_version) rhel_version = centpkg.utils.stream_mapping(stream_version)
active_y, in_stabilization = centpkg.utils.determine_active_y_version(rhel_version, pp_api_url) 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 # Good to know
if divergent_branch : if divergent_branch :
print("divergent_branch: TRUE") self.log.info(" A divergent branch was found.")
else: else:
print("divergent_branch: FALSE") self.log.info(" A divergent branch was not found.")
if in_stabilization : if in_stabilization :
print("in_stabilization: TRUE") self.log.info(" We are in stabilization mode.")
else: else:
print("in_stabilization: FALSE") self.log.info(" We are not in stabilization mode.")
# Update args.custom_user_metadata # Update args.custom_user_metadata
if hasattr(self.args, 'custom_user_metadata') and self.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 : elif not divergent_branch and not in_stabilization :
temp_custom_user_metadata["rhel-target"] = "zstream" temp_custom_user_metadata["rhel-target"] = "zstream"
else: else:
print("We are currently in Stabalization mode") self.log.info("We are currently in Stabalization mode")
print("You must either set the rhel-target (--rhel-target)") self.log.info("You must either set the rhel-target (--rhel-target)")
print("or branch for the previous version.") self.log.info("or branch for the previous version.")
print("Exiting") self.log.info("Exiting")
raise SystemExit raise SystemExit
self.args.custom_user_metadata = json.dumps(temp_custom_user_metadata) self.args.custom_user_metadata = json.dumps(temp_custom_user_metadata)
else: else:
@ -222,24 +223,24 @@ class centpkgClient(cliClient):
elif not divergent_branch and not in_stabilization : elif not divergent_branch and not in_stabilization :
self.args.custom_user_metadata = '{"rhel-target": "zstream"}' self.args.custom_user_metadata = '{"rhel-target": "zstream"}'
else: else:
print("We are currently in Stabalization mode") self.log.info("We are currently in Stabalization mode")
print("You must either set the rhel-target (--rhel-target)") self.log.info("You must either set the rhel-target (--rhel-target)")
print("or branch for the previous version.") self.log.info("or branch for the previous version.")
print("Exiting") self.log.info("Exiting")
raise SystemExit raise SystemExit
# Good to know, but take out for final cut # 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 # 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: else:
if not self.args.scratch: if not self.args.scratch:
print("NO SCRATCH BUILD") self.log.info("NO SCRATCH BUILD")
print("Only scratch builds are allowed without internal configurations") self.log.info("Only scratch builds are allowed without internal configurations")
print("Exiting") self.log.info("Exiting")
raise SystemExit raise SystemExit
# Proceed with build # Proceed with build