Skip to content

Commit

Permalink
refactor print to logging (Open-MSS#2092)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilupulmanodya authored Nov 14, 2023
1 parent c089c55 commit d297a00
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mslib/mscolab/mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def handle_mscolab_certificate_init():
"-nodes", "-x509", "-days", "365", "-batch", "-subj",
"/CN=localhost", "-out", f"{mscolab_settings.MSCOLAB_SSO_DIR}/crt_mscolab.crt"]
subprocess.run(cmd, check=True)
print("generated CRTs for the mscolab server.")
logging.info("generated CRTs for the mscolab server.")
return True
except subprocess.CalledProcessError as error:
print(f"Error while generating CRTs for the mscolab server: {error}")
Expand All @@ -121,7 +121,7 @@ def handle_local_idp_certificate_init():
"-nodes", "-x509", "-days", "365", "-batch", "-subj",
"/CN=localhost", "-out", f"{mscolab_settings.MSCOLAB_SSO_DIR}/crt_local_idp.crt"]
subprocess.run(cmd, check=True)
print("generated CRTs for the local identity provider")
logging.info("generated CRTs for the local identity provider")
return True
except subprocess.CalledProcessError as error:
print(f"Error while generated CRTs for the local identity provider: {error}")
Expand Down Expand Up @@ -281,7 +281,7 @@ def handle_mscolab_metadata_init(repo_exists):
"-o", f"{mscolab_settings.MSCOLAB_SSO_DIR}/metadata_sp.xml"]
subprocess.run(cmd_curl, check=True)
process.terminate()
print('mscolab metadata file generated succesfully')
logging.info('mscolab metadata file generated succesfully')
return True

except subprocess.CalledProcessError as error:
Expand All @@ -308,7 +308,7 @@ def handle_local_idp_metadata_init(repo_exists):
with open(f"{mscolab_settings.MSCOLAB_SSO_DIR}/idp.xml",
"w", encoding="utf-8") as output_file:
subprocess.run(cmd, stdout=output_file, check=True)
print("idp metadata file generated succesfully")
logging.info("idp metadata file generated succesfully")
return True
except subprocess.CalledProcessError as error:
# Delete the idp.xml file when the subprocess fails
Expand Down

0 comments on commit d297a00

Please sign in to comment.