modulecmd: prevent loading Pmodules module if other modules are loaded

This commit is contained in:
2021-05-10 15:53:06 +02:00
parent d32f04ea83
commit ca4c530a5e
+12
View File
@@ -508,8 +508,20 @@ subcommand_load() {
fi
if [[ ${current_modulefile} =~ ${PMODULES_ROOT} ]] \
&& [[ ! ${m} =~ / ]]; then
# the module is in our hierarchy but no version
# has been specified. We take the version from
# current_modulefile and append it
m+="/${current_modulefile##*/}"
fi
if [[ ${m} == Pmodules/* ]] && [[ -n ${LOADEDMODULES} ]]; then
std::error "%s %s: %s" \
"${CMD}" "${subcommand}" \
"cannot load a Pmodules module because other modules are already load!"
std::die 3 "%s %s: %s -- %s\n" \
"${CMD}" "${subcommand}" \
"failed" \
"${m}"
fi
if [[ ":${LOADEDMODULES}:" =~ ":${m}:" ]]; then
continue
fi