From ab76370390b51b6fc16f3bb8b0de9ffd4e09e20d Mon Sep 17 00:00:00 2001 From: iamashwin99 <ashwin-kumar.karnad@mpsd.mpg.de> Date: Wed, 7 Jun 2023 11:25:01 +0200 Subject: [PATCH] create log_folder for non info only commands --- mpsd-software-environment.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mpsd-software-environment.py b/mpsd-software-environment.py index be87124..22d3120 100755 --- a/mpsd-software-environment.py +++ b/mpsd-software-environment.py @@ -792,8 +792,8 @@ def main(): # Get machine configs os.environ.get("MPSD_OS", "UNKNOWN_OS") - mpsd_microarch = os.environ.get("MPSD_MICROARCH", "UNKNOWN_MICROARCH") - # release `dev` in script_dir/dev-23a + mpsd_microarch = get_native_microarchitecture() + # target dir is the place where this script exists. the script_dir = Path(os.path.dirname(os.path.realpath(__file__))) mpsd_release = args.release # parse logging first @@ -801,13 +801,18 @@ def main(): installer_log_name, build_log_name = create_log_file_names( mpsd_release=mpsd_release, mpsd_microarch=mpsd_microarch, action=args.action ) - installer_log_file = ( - script_dir / mpsd_release / mpsd_microarch / "logs" / installer_log_name - ) + log_folder = script_dir / mpsd_release / mpsd_microarch / "logs" + # if the log_folder dosent exist, dont log this message if + # the command is a info-only command + if not os.path.exists(log_folder): + if args.action not in ["status", "available"]: + os.makedirs(log_folder) + installer_log_file = log_folder / installer_log_name + else: + installer_log_file = None set_up_logging(args.loglevel, installer_log_file) - # target dir is the place where this script exists. the # Check the command and run related function if args.action == "remove": -- GitLab