mirror of
https://github.com/envmodules/modules.git
synced 2026-06-18 00:06:53 +08:00
Warn when evaluate a nearly-forbidden module
Produce a warning message when a module with *nearly-forbidden* is evaluated. Message produced indicate the date time starting when module will effectively be forbidden.
This commit is contained in:
@@ -1237,6 +1237,12 @@ proc getForbiddenMsg {mod} {
|
||||
return $msg
|
||||
}
|
||||
|
||||
proc getNearlyForbiddenMsg {mod} {
|
||||
set after [getModuleTagProp $mod nearly-forbidden after]
|
||||
set msg "Access to module will be denied starting '$after'"
|
||||
return $msg
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Use a subordinate Tcl interpreter to execute modulefiles
|
||||
#
|
||||
@@ -1427,6 +1433,11 @@ proc execute-modulefile {modfile modname modspec {must_have_cookie 1}} {
|
||||
|
||||
reportDebug "sourcing $modfile"
|
||||
|
||||
# inform that access to module will be soon denied
|
||||
if {[isModuleTagged $modname nearly-forbidden]} {
|
||||
reportWarning [getNearlyForbiddenMsg $modname]
|
||||
}
|
||||
|
||||
if {![info exists ::g_modfileUntrackVars]} {
|
||||
# list variable that should not be tracked for saving
|
||||
array set ::g_modfileUntrackVars [list ModulesCurrentModulefile 1\
|
||||
|
||||
Reference in New Issue
Block a user