From da06b04e3020bf333bba84a6ad560383bfdcc281 Mon Sep 17 00:00:00 2001 From: Damian Alvarez <d.alvarez@fz-juelich.de> Date: Mon, 19 Sep 2022 14:01:47 +0200 Subject: [PATCH] hook update: Let the hook work inside the apptainer container even if jutil is missing --- Custom_Hooks/eb_hooks.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Custom_Hooks/eb_hooks.py b/Custom_Hooks/eb_hooks.py index 537d6a7be..20973f475 100644 --- a/Custom_Hooks/eb_hooks.py +++ b/Custom_Hooks/eb_hooks.py @@ -1,4 +1,5 @@ import os +import pwd import re import subprocess @@ -140,11 +141,15 @@ def get_user_info(): if name and email: return [name, email] else: - print_warning( - f"\n'jutil' is not present and 'SITE_CONTACT_NAME' or 'SITE_CONTACT_EMAIL' are not defined\n" - "Please defined both in your environment and try again\n" - ) - exit(1) + if install_path().lower().startswith('/p/software'): + print_warning( + f"\n'jutil' is not present and 'SITE_CONTACT_NAME' or 'SITE_CONTACT_EMAIL' are not defined\n" + "Please defined both in your environment and try again\n" + ) + exit(1) + # Assume user installations, contact data is not critical + else: + return [pwd.getpwuid(os.getuid())[4], '???'] else: return ['CI user', 'ci_user@fz-juelich.de'] -- GitLab