summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ask_pass.go6
-rw-r--r--cmd/ask_pass_test.go9
-rw-r--r--cmd/run.go4
3 files changed, 8 insertions, 11 deletions
diff --git a/cmd/ask_pass.go b/cmd/ask_pass.go
index 2a5f9d4..b83f981 100644
--- a/cmd/ask_pass.go
+++ b/cmd/ask_pass.go
@@ -8,8 +8,6 @@ import (
"os"
"strings"
- "github.com/argoproj/argo-cd/v2/util/git"
-
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -36,9 +34,9 @@ func NewAskPassCommand() *cobra.Command {
if len(os.Args) != 2 {
errors.CheckError(fmt.Errorf("expected 1 argument, got %d", len(os.Args)-1))
}
- nonce := os.Getenv(git.ASKPASS_NONCE_ENV)
+ nonce := os.Getenv(askpass.ASKPASS_NONCE_ENV)
if nonce == "" {
- errors.CheckError(fmt.Errorf("%s is not set", git.ASKPASS_NONCE_ENV))
+ errors.CheckError(fmt.Errorf("%s is not set", askpass.ASKPASS_NONCE_ENV))
}
conn, err := grpc_util.BlockingDial(ctx, "unix", askpass.SocketPath, nil, grpc.WithTransportCredentials(insecure.NewCredentials()))
errors.CheckError(err)
diff --git a/cmd/ask_pass_test.go b/cmd/ask_pass_test.go
index 1201ef0..f9d828f 100644
--- a/cmd/ask_pass_test.go
+++ b/cmd/ask_pass_test.go
@@ -10,7 +10,6 @@ import (
"testing"
"github.com/argoproj/argo-cd/v2/reposerver/askpass"
- "github.com/argoproj/argo-cd/v2/util/git"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
@@ -51,9 +50,9 @@ func NewTestCommand() *cobra.Command {
fmt.Fprintf(c.ErrOrStderr(), "expected 1 argument, got %d\n", len(args))
return
}
- nonce := os.Getenv(git.ASKPASS_NONCE_ENV)
+ nonce := os.Getenv(askpass.ASKPASS_NONCE_ENV)
if nonce == "" {
- fmt.Fprintf(c.ErrOrStderr(), "%s is not set\n", git.ASKPASS_NONCE_ENV)
+ fmt.Fprintf(c.ErrOrStderr(), "%s is not set\n", askpass.ASKPASS_NONCE_ENV)
return
}
// nolint:staticcheck
@@ -90,7 +89,7 @@ func TestNewAskPassCommand(t *testing.T) {
expectedErr string
}{
{"no arguments", []string{}, "testnonce", "", "expected 1 argument, got 0"},
- {"missing nonce", []string{"Username"}, "", "", fmt.Sprintf("%s is not set", git.ASKPASS_NONCE_ENV)},
+ {"missing nonce", []string{"Username"}, "", "", fmt.Sprintf("%s is not set", askpass.ASKPASS_NONCE_ENV)},
{"valid username request", []string{"Username"}, "testnonce", "testuser", ""},
{"valid password request", []string{"Password"}, "testnonce", "testpassword", ""},
{"unknown credential type", []string{"Unknown"}, "testnonce", "", "unknown credential type 'Unknown'"},
@@ -100,7 +99,7 @@ func TestNewAskPassCommand(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
os.Clearenv()
if tc.envNonce != "" {
- os.Setenv(git.ASKPASS_NONCE_ENV, tc.envNonce)
+ os.Setenv(askpass.ASKPASS_NONCE_ENV, tc.envNonce)
}
var stdout, stderr bytes.Buffer
diff --git a/cmd/run.go b/cmd/run.go
index 06030d2..6abcda2 100644
--- a/cmd/run.go
+++ b/cmd/run.go
@@ -158,11 +158,11 @@ func newRunCommand() *cobra.Command {
}
// Start up the credentials store server
- cs := askpass.NewServer()
+ cs := askpass.NewServer(askpass.SocketPath)
csErrCh := make(chan error)
go func() {
log.Debugf("Starting askpass server")
- csErrCh <- cs.Run(askpass.SocketPath)
+ csErrCh <- cs.Run()
}()
// Wait for cred server to be started, just in case