Skip to content

Commit

Permalink
CreateOperation should only be implemented alongside ExistenceCheck (o…
Browse files Browse the repository at this point in the history
…penbao#50)

* CreateOperation should only be implemented alongside ExistenceCheck

See hashicorp/vault#18492

* Change CreateOperation to UpdateOperation in tests, too
  • Loading branch information
maxb authored Jan 19, 2023
1 parent 2865f8d commit 5f620a8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
10 changes: 0 additions & 10 deletions path_rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ func (b *backend) pathRotateCredentials() []*framework.Path {
ForwardPerformanceStandby: true,
ForwardPerformanceSecondary: true,
},
logical.CreateOperation: &framework.PathOperation{
Callback: b.pathRotateRootCredentialsUpdate,
ForwardPerformanceStandby: true,
ForwardPerformanceSecondary: true,
},
},
HelpSynopsis: "Request to rotate the root credentials Vault uses for the LDAP administrator account.",
HelpDescription: "This path attempts to rotate the root credentials of the administrator account " +
Expand All @@ -52,11 +47,6 @@ func (b *backend) pathRotateCredentials() []*framework.Path {
ForwardPerformanceStandby: true,
ForwardPerformanceSecondary: true,
},
logical.CreateOperation: &framework.PathOperation{
Callback: b.pathRotateRoleCredentialsUpdate,
ForwardPerformanceStandby: true,
ForwardPerformanceSecondary: true,
},
},
HelpSynopsis: "Request to rotate the credentials for a static user account.",
HelpDescription: "This path attempts to rotate the credentials for the given LDAP static user account.",
Expand Down
6 changes: 3 additions & 3 deletions path_rotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestManualRotate(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: rotateRootPath,
Storage: storage,
Data: nil,
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestManualRotate(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: rotateRootPath,
Storage: storage,
Data: nil,
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestManualRotate(t *testing.T) {
defer b.Cleanup(context.Background())

req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: rotateRolePath + "hashicorp",
Storage: storage,
Data: nil,
Expand Down
2 changes: 1 addition & 1 deletion rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAutoRotate(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: rotateRootPath,
Storage: storage,
Data: nil,
Expand Down

0 comments on commit 5f620a8

Please sign in to comment.