Modules loading and unloading other modules has never really worked
well; there have always been lots of weird gotchas along the way.
In this case, the "module unload" is causing the TWO_TEST environment
variable to be unset. Modules is not aware that the two modules use
the same environment variables since you don't use "conflict" or "switch".
I'd use "conflict" statements instead if I were you.
You really want to be doing a "module switch" for the two modules,
anyway - the proper command is "module switch test1 test2". But don't
do that in the test2 modulefile, do it on the command line after
checking if the module is loaded.
> Hello,
>
> I have a interesting problem with a couple of modules in Modules-v2.2BETA.
>
> I have a module file which test to see if another one exists and if so
> then it removes it and then continues. And the same for another.
>
> But when I examine the environment variables I notice that only 1 is
> set, and one is missing. The variable missing is the one which
> is the same in both cases.
>
> % module load test1 ; printenv ORACLE_SID ; printenv TWO_TASK
>
> test1
> atlas
> % module load use test2 ; printenv ORACLE_SID ; printenv TWO_TASK
>
> test2
>
> % module load use test1 ; printenv ORACLE_SID ; printenv TWO_TASK
>
> test1
> atlas
>
> --------------------------------------------
> #modulefile "test1"
> #
> if { [module-info mode load] && [info exists env(LOADEDMODULES)] } {
> set loaded "[split $env(LOADEDMODULES) :]"
> if { [lsearch $loaded test2 ] >= 0} {
> module unload test2
> }
> }
> #
> setenv ORACLE_SID test1
> setenv TWO_TASK atlas
> -------------------------------------------
> #modulefile "test2"
> #
> if { [module-info mode load] && [info exists env(LOADEDMODULES)] } {
> set loaded "[split $env(LOADEDMODULES) :]"
> if { [lsearch $loaded test1 ] >= 0} {
> module unload test1
> }
> }
> #
> setenv ORACLE_SID test2
> setenv TWO_TASK atlas
> -------------------------------------------
>
> I have down loaded version Modules-3.0pre to see if I have the same problem.
>
> Thanks for reading
>
> Andrew
>
> ******************************************************************************
> Andrew Watkins tel: 0171-631 6720
> Unix Administrator fax: 0171-631 6727
> System Group
> Computer Science Department e-mail: an...@dc...
> Birkbeck College (University of London) http://www.dcs.bbk.ac.uk/~andrew
> Malet Street
> London
> WC1E 7HX
> ******************************************************************************
>
--
Bob Myers InteleNet Communications, Inc.
Email: bo...@In... 30 Executive Park, Suite 150
Phone: 714-851-8250 Irvine, CA 92714
Fax: 714-851-1088 http://www.intelenet.net/
|