Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking β€œSign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vaultsecrets.secrets.create): parse correct secret-type key #216

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(vaultsecrets.secrets.create): parse correct secret-type key
Closes: #215
Signed-off-by: Sebastian Yaghoubi <[email protected]>
syaghoubi00 committed Feb 25, 2025
commit c42435b0c8801165d71b7e0b420cc86e171d694e
2 changes: 1 addition & 1 deletion internal/commands/vaultsecrets/secrets/create.go
Original file line number Diff line number Diff line change
@@ -212,7 +212,7 @@ var (

func createRun(opts *CreateOpts) error {
switch opts.Type {
case secretTypeKV, "":
case "static", "":
if err := readPlainTextSecret(opts); err != nil {
return err
}
10 changes: 5 additions & 5 deletions internal/commands/vaultsecrets/secrets/create_test.go
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ func TestCreateRun(t *testing.T) {
RespErr: true,
AugmentOpts: func(o *CreateOpts) {
o.SecretFilePath = "-"
o.Type = secretTypeKV
o.Type = "static"
},
ErrMsg: "secret value cannot be empty",
},
@@ -156,7 +156,7 @@ func TestCreateRun(t *testing.T) {
ReadViaStdin: true,
AugmentOpts: func(o *CreateOpts) {
o.SecretFilePath = "-"
o.Type = secretTypeKV
o.Type = "static"
},
MockCalled: true,
},
@@ -166,7 +166,7 @@ func TestCreateRun(t *testing.T) {
ErrMsg: "[POST /secrets/2023-11-28/organizations/{organization_id}/projects/{project_id}/apps/{app_name}/secret/kv][429] CreateAppKVSecret default &{Code:8 Details:[] Message:maximum number of secret versions reached}",
AugmentOpts: func(o *CreateOpts) {
o.SecretValuePlaintext = testSecretValue
o.Type = secretTypeKV
o.Type = "static"
},
MockCalled: true,
},
@@ -175,7 +175,7 @@ func TestCreateRun(t *testing.T) {
RespErr: false,
AugmentOpts: func(o *CreateOpts) {
o.SecretValuePlaintext = testSecretValue
o.Type = secretTypeKV
o.Type = "static"
},
MockCalled: true,
},
@@ -294,7 +294,7 @@ details = {
}

dt := strfmt.NewDateTime()
if opts.Type == secretTypeKV {
if opts.Type == "static" {
if c.MockCalled {
if c.RespErr {
vs.EXPECT().CreateAppKVSecret(mock.Anything, mock.Anything).Return(nil, errors.New(c.ErrMsg)).Once()