Skip to content

Commit

Permalink
Merge pull request #120291 from lzhecheng/fix-credentialprovider-win-…
Browse files Browse the repository at this point in the history
…bin-path

Fix Windows credential provider cannot find binary
  • Loading branch information
k8s-ci-robot committed Jan 4, 2024
2 parents f12529c + 6102357 commit 2efed1f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/credentialprovider/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ func RegisterCredentialProviderPlugins(pluginConfigFile, pluginBinDir string) er
registerMetrics()

for _, provider := range credentialProviderConfig.Providers {
pluginBin := filepath.Join(pluginBinDir, provider.Name)
if _, err := os.Stat(pluginBin); err != nil {
// Considering Windows binary with suffix ".exe", LookPath() helps to find the correct path.
// LookPath() also calls os.Stat().
pluginBin, err := exec.LookPath(filepath.Join(pluginBinDir, provider.Name))
if err != nil {
if os.IsNotExist(err) {
return fmt.Errorf("plugin binary executable %s did not exist", pluginBin)
}
Expand Down

0 comments on commit 2efed1f

Please sign in to comment.