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

api: return parse errors if any for storage endpoints #12338

Merged
merged 4 commits into from Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions api/logical.go
Expand Up @@ -81,7 +81,7 @@ func (c *Logical) ReadWithData(path string, data map[string][]string) (*Secret,
case io.EOF:
return nil, nil
default:
return nil, err
return nil, parseErr
}
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
return secret, nil
Expand Down Expand Up @@ -115,7 +115,7 @@ func (c *Logical) List(path string) (*Secret, error) {
case io.EOF:
return nil, nil
default:
return nil, err
return nil, parseErr
}
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
return secret, nil
Expand Down Expand Up @@ -159,7 +159,7 @@ func (c *Logical) write(path string, request *Request) (*Secret, error) {
case io.EOF:
return nil, nil
default:
return nil, err
return nil, parseErr
}
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
return secret, err
Expand Down Expand Up @@ -206,7 +206,7 @@ func (c *Logical) DeleteWithData(path string, data map[string][]string) (*Secret
case io.EOF:
return nil, nil
default:
return nil, err
return nil, parseErr
}
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
return secret, err
Expand Down Expand Up @@ -259,7 +259,7 @@ func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) {
case io.EOF:
return nil, nil
default:
return nil, err
return nil, parseErr
}
if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) {
return secret, nil
Expand Down
3 changes: 3 additions & 0 deletions changelog/12338.txt
@@ -0,0 +1,3 @@
```release-note: bug
api: Fixes storage APIs returning incorrect error when parsing responses
```