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:
Xavier Delaruelle
2020-08-26 08:00:56 +02:00
parent a87706dcfd
commit e8d656d0dd

View File

@@ -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\