diff options
author | Jeremiah Snapp <jeremiah@chef.io> | 2019-06-24 15:55:43 -0400 |
---|---|---|
committer | Jeremiah Snapp <jeremiah@chef.io> | 2019-06-24 15:58:05 -0400 |
commit | dc95cf11f59207c8ae89f6a236a9e40e183b3e6b (patch) | |
tree | 2ea37271b61314e932cbaf8ebb423bbfb003adef | |
parent | 1cff2a26909186112d584d924149df365d65aead (diff) | |
download | chef-dc95cf11f59207c8ae89f6a236a9e40e183b3e6b.tar.gz |
Make sure ruby environment variables are unset in omnibus-test.* scripts
Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
-rw-r--r-- | omnibus/omnibus-test.ps1 | 14 | ||||
-rw-r--r-- | omnibus/omnibus-test.sh | 19 |
2 files changed, 33 insertions, 0 deletions
diff --git a/omnibus/omnibus-test.ps1 b/omnibus/omnibus-test.ps1 index 8e826cfb77..b6f054370c 100644 --- a/omnibus/omnibus-test.ps1 +++ b/omnibus/omnibus-test.ps1 @@ -28,6 +28,20 @@ $Env:TMP = "C:\cheftest" Remove-Item -Recurse -Force $Env:TEMP -ErrorAction SilentlyContinue New-Item -ItemType directory -Path $Env:TEMP +# FIXME: we should really use Bundler.with_clean_env in the caller instead of re-inventing it here +Remove-Item Env:_ORIGINAL_GEM_PATH -ErrorAction SilentlyContinue +Remove-Item Env:BUNDLE_BIN_PATH -ErrorAction SilentlyContinue +Remove-Item Env:BUNDLE_GEMFILE -ErrorAction SilentlyContinue +Remove-Item Env:GEM_HOME -ErrorAction SilentlyContinue +Remove-Item Env:GEM_PATH -ErrorAction SilentlyContinue +Remove-Item Env:GEM_ROOT -ErrorAction SilentlyContinue +Remove-Item Env:RUBYLIB -ErrorAction SilentlyContinue +Remove-Item Env:RUBYOPT -ErrorAction SilentlyContinue +Remove-Item Env:RUBY_ENGINE -ErrorAction SilentlyContinue +Remove-Item Env:RUBY_ROOT -ErrorAction SilentlyContinue +Remove-Item Env:RUBY_VERSION -ErrorAction SilentlyContinue +Remove-Item Env:BUNDLER_VERSION -ErrorAction SilentlyContinue + ForEach ($b in "chef-client", "knife", diff --git a/omnibus/omnibus-test.sh b/omnibus/omnibus-test.sh index 4b5ca82895..95ac30bec4 100644 --- a/omnibus/omnibus-test.sh +++ b/omnibus/omnibus-test.sh @@ -93,6 +93,25 @@ if [[ ! -L $USR_BIN_DIR/ohai ]] || [[ $(ls -l $USR_BIN_DIR/ohai | awk '{print$NF exit 1 fi +# Ensure the calling environment (disapproval look Bundler) does not +# infect our Ruby environment created by the `chef-client` cli. +for ruby_env_var in _ORIGINAL_GEM_PATH \ + BUNDLE_BIN_PATH \ + BUNDLE_GEMFILE \ + GEM_HOME \ + GEM_PATH \ + GEM_ROOT \ + RUBYLIB \ + RUBYOPT \ + RUBY_ENGINE \ + RUBY_ROOT \ + RUBY_VERSION \ + BUNDLER_VERSION + +do + unset $ruby_env_var +done + chef-client --version # Exercise various packaged tools to validate binstub shebangs |