Skip to content

Commit

Permalink
Checking env PATH before updating
Browse files Browse the repository at this point in the history
  • Loading branch information
pokearu committed Nov 11, 2021
1 parent 0ab2000 commit 981d3d9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/framework/awsiam.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

eksdv1alpha1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1"

Expand Down Expand Up @@ -91,9 +92,13 @@ func (e *ClusterE2ETest) setIamAuthClientPATH() error {
if err != nil {
return fmt.Errorf("error finding current working directory: %v", err)
}
err = os.Setenv("PATH", fmt.Sprintf("%s/bin:%s", workDir, envPath))
iamAuthClientPath := fmt.Sprintf("%s/bin", workDir)
if strings.Contains(envPath, iamAuthClientPath) {
return nil
}
err = os.Setenv("PATH", fmt.Sprintf("%s:%s", iamAuthClientPath, envPath))
if err != nil {
return fmt.Errorf("error setting %s/bin to PATH: %v", workDir, err)
return fmt.Errorf("error setting %s to PATH: %v", iamAuthClientPath, err)
}
return nil
}
Expand Down

0 comments on commit 981d3d9

Please sign in to comment.