mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
secrets: Support custom plugins in Windows (#26751)
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
log "github.com/hashicorp/go-hclog"
|
||||
@@ -51,6 +52,9 @@ type externalSecretsPlugin struct {
|
||||
// which will be used as environment variables for Fetch.
|
||||
func NewExternalSecretsPlugin(commonPluginDir string, name string, env map[string]string) (*externalSecretsPlugin, error) {
|
||||
// validate plugin
|
||||
if runtime.GOOS == "windows" {
|
||||
name += ".exe"
|
||||
}
|
||||
executable := filepath.Join(commonPluginDir, SecretsPluginDir, name)
|
||||
f, err := os.Stat(executable)
|
||||
if err != nil {
|
||||
|
||||
@@ -53,6 +53,7 @@ func (s *SecretsPluginFingerprint) Fingerprint(request *FingerprintRequest, resp
|
||||
// map of plugin names to fingerprinted versions
|
||||
plugins := map[string]string{}
|
||||
for name := range files {
|
||||
name = strings.TrimSuffix(name, ".exe")
|
||||
plug, err := commonplugins.NewExternalSecretsPlugin(request.Config.CommonPluginDir, name, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user