glideinWMS / glideinwms

The glideinWMS Project
http://tinyurl.com/glideinwms
Apache License 2.0
16 stars 45 forks source link

Add an option to clear conflicting variables in containers environment #342

Closed mmascher closed 1 year ago

mmascher commented 1 year ago

Using the env variable GLIDEIN_CONTAINER_ENV_CLEARLIST to clear env variables. Fixes #341

mambelli commented 1 year ago

Rebased to master Changed the var name to GLIDEIN_CONTAINER_ENV_CLEARLIST (it is not singularity specific, all new variables should use GLIDEINCONTAINER...) Fixed a couple of bugs (unit test, quotes blocking for) TODO about unclear line Specific unit test should be added

mmascher commented 1 year ago

Tested this and it does not work. The invocation of env_clear is done inside parenthesis: $(env_clear)

Therefore, as confirmed by the test script below, the velue of the variable is not going to be unset. Possibly, these two lines are not working as well in the current code and it is why we are clearing them separately here?

Anyway, for the time being I am putting the clearlist stuff in a separate function and giving it a try (see the commit).

Test script:

export A=0
marco@marco-LEGION5:~$ cat tmp.sh 
test() {
    unset A
}

echo $A
B=$(test)
#test
echo $A
marco@marco-LEGION5:~$ sh tmp.sh 
0
0
marco@marco-LEGION5:~$ vim tmp.sh 
marco@marco-LEGION5:~$ sh tmp.sh 
0

marco@marco-LEGION5:~$ cat tmp.sh 
test() {
    unset A
}

echo $A
#B=$(test)
test
echo $A
mmascher commented 1 year ago

My test were successful with the latest commit

mambelli commented 1 year ago

I generalized the functions to take an argument so I could add a unit test for them

mambelli commented 1 year ago

Did a force push after rebase to clear merge conflicts (in CHANGELOG.md)