I am trying to put together a module facility for Linux that will be
somewhat backward compatible with our existing module facility (running on
AIX).
Along these lines, I want to allow users to load modules for their
individual projects, where each project module file will do lots of
individual other module loads. Unfortunately, I do not have all of the
same tools available for Linux that we have on AIX, so there are lots of
modules in these project modulefiles that I cannot support for Linux.
Currently, if the module in a project's modulefile is not found on my Linux
modulefile directory, I get an ugly error message like:
# module load some_aix_tool
ModuleCmd_Load.c(199):ERROR:105: Unable to locate a modulefile for
'some_aix_tool'
But what I want is some more elegant and meaningful message like:
# module load apps/verilint
Note: The module 'apps/verilint' is not available for Linux.
So currently I have hacked up lots of 'dummy' modules that match most of
the modules in our AIX modulefiles directory but really are symbolic links
back to a single module file called 'notavail'. In the second example
above, I use a symlink from modulefiles/apps/verilint ->
modulefiles/notavail. I looked through the module source code and found
out that if, at the end of the 'notavail' module, I pass back a return code
of '11' (or any other number that doesn't happen to match 'TCL_OK' or
'TCL_ERROR'), then I can get the module file to display the warning note
and not actually add itself to the list of loaded modules.
I am posting this here for two reasons:
1) Is there a more elegant way to handle this -- ie. can I define a default
module that is executed (without being loaded) whenever a 'module load'
command doesn't find it's target?
2) Is there any reason that it may be unsafe to pass return values back
from modulefiles like I am currently doing?
Here is my 'notavail' module:
#%Module1.0#####################################################################
##
## notavail modulefile
##
proc ModulesHelp { } {
global version
puts stderr "\tThis module does absolutely nothing."
puts stderr "\tIt's meant simply as notice to the user"
puts stderr "\tthat the [module-info name] module"
puts stderr "\tis not available at this time."
puts stderr "\n\tVersion $version\n"
}
module-whatis "Notifies user that module is not available."
# for Tcl script use only
set version "3.1.3"
set curMod [module-info name]
if { [ module-info mode load ] } {
puts stderr "Note: The module '$curMod' is not available for [uname
sysname]."
}
#Return code 11 == do not add this module to the loaded modules list
return 11
Thank you,
-------------------------------------------
W. Scott Gaskins
T/L 441-9863
(919) 543-9863
sga...@us...
IBM Bldg062/C215
P.O. Box 12195 - YM6A/062
3039 Cornwallis Rd
RTP, NC 27709
(PS.. If this mail is poorly formated, blame Lotus Notes' stupid insistance
that everything going out to the internet be word-wrapped at 80
characters!!)
|