Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add admin.list files to warn users of known issues #197

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
build
hosts
*.list
*-known-issues.yml
52 changes: 52 additions & 0 deletions scripts/create_admin.list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python3
#
# Create admin.list file for Lmod.
# This will use information from the known_issues.yaml file to display
# a message to the user when they load a module that is known to have issues.
import os
import yaml
from urllib import request


# Download the known issues YAML file from the EESSI/software-layer GitHub repository
# TODO: This hardcodes version 2023.06, we should make this dynamic
KNOWN_ISSUES_FILE = 'eessi-2023.06-known-issues.yml'
KNOWN_ISSUES_URL = 'https://raw.githubusercontent.com/EESSI/software-layer/2023.06-software.eessi.io/' + KNOWN_ISSUES_FILE
r = request.urlretrieve(KNOWN_ISSUES_URL, KNOWN_ISSUES_FILE)

# Open the YAML file
try:
with open(KNOWN_ISSUES_FILE, 'r') as file:
# Load the YAML data
known_issues = yaml.safe_load(file)
except IOError:
raise IOError("Unable to open the known issues file")

# Create a admin.list file per arch
path = '/cvmfs/software.eessi.io/versions/2023.06/software/linux/'
for i in range(len(known_issues)):
arch, known_issues_arch = list(known_issues[i].items())[0]
admin_list_filename = f"admin.list.{arch}"

# Remove the admin.list file if it exists, we will recreate it
if os.path.exists(admin_list_filename):
try:
os.remove(admin_list_filename)
except OSError:
raise OSError(f"Unable to remove the {admin_list_filename} file")

# Open the admin.list file, with no dashes in the filename
admin_list_file = open(admin_list_filename.replace('/', '_'), 'a')
for j in range(len(known_issues_arch)):
# Write known issue per arch and module
known_issues_module, known_issue = list(known_issues_arch[j].items())[0]
known_issues_module = known_issues_module.replace('/', '_')
module_path = os.path.join(path, 'modules/all', arch, known_issues_module)
message = f"{module_path}:"
message += (
f"\n There is a known issue: {known_issue[1]['info']}"
f"\n See: {known_issue[0]['issue']}\n\n"
)
admin_list_file.write(message)

admin_list_file.close()
Loading