mirror of https://github.com/databricks/cli.git
Include $PATH in set of environment variables to pass along. (#736)
## Changes This is necessary to ensure that our Terraform provider can use the same auxiliary programs (e.g. `az`, or `gcloud`) as the CLI. ## Tests Unit test and manual verification.
This commit is contained in:
parent
9194418ac1
commit
fabe8e88b8
|
@ -78,6 +78,14 @@ func inheritEnvVars(env map[string]string) error {
|
|||
env["HOME"] = home
|
||||
}
|
||||
|
||||
// Include $PATH in set of environment variables to pass along.
|
||||
// This is necessary to ensure that our Terraform provider can use the
|
||||
// same auxiliary programs (e.g. `az`, or `gcloud`) as the CLI.
|
||||
path, ok := os.LookupEnv("PATH")
|
||||
if ok {
|
||||
env["PATH"] = path
|
||||
}
|
||||
|
||||
// Include $TF_CLI_CONFIG_FILE to override terraform provider in development.
|
||||
configFile, ok := os.LookupEnv("TF_CLI_CONFIG_FILE")
|
||||
if ok {
|
||||
|
|
|
@ -277,6 +277,7 @@ func TestInheritEnvVars(t *testing.T) {
|
|||
env := map[string]string{}
|
||||
|
||||
t.Setenv("HOME", "/home/testuser")
|
||||
t.Setenv("PATH", "/foo:/bar")
|
||||
t.Setenv("TF_CLI_CONFIG_FILE", "/tmp/config.tfrc")
|
||||
|
||||
err := inheritEnvVars(env)
|
||||
|
@ -285,6 +286,7 @@ func TestInheritEnvVars(t *testing.T) {
|
|||
|
||||
require.Equal(t, map[string]string{
|
||||
"HOME": "/home/testuser",
|
||||
"PATH": "/foo:/bar",
|
||||
"TF_CLI_CONFIG_FILE": "/tmp/config.tfrc",
|
||||
}, env)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue