Skip to content
Snippets Groups Projects
Commit 5b19c262 authored by Damian Alvarez's avatar Damian Alvarez
Browse files

To allow the hook to work in environments without jutil (like

singularity containers)
parent c3aeb931
Branches
Tags
No related merge requests found
......@@ -86,13 +86,24 @@ def installation_vetoer(ec):
def get_user_info():
# Query jutil to extract the contact information
if os.getenv('CI') is None:
jutil = subprocess.Popen([os.getenv('JUMO_USRCMD_EXEC'), 'person', 'show', '-o', 'parseable'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
jutil_path = os.getenv('JUMO_USRCMD_EXEC')
if os.path.isfile(jutil_path) and os.access(jutil_path, os.X_OK):
jutil = subprocess.Popen([jutil_path, 'person', 'show', '-o', 'parseable'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = jutil.communicate()
if not stderr:
return stdout.decode('utf-8').splitlines()[-1].split('|')[0:2]
else:
print_warning(f'Could not query jutil: {stderr}')
exit(1)
else:
name = os.getenv('SITE_CONTACT_NAME')
email = os.getenv('SITE_CONTACT_EMAIL')
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)
else:
return ['CI user', 'ci_user@fz-juelich.de']
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment