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

Set number of pester retries to zero by default and make seal command… #2093

Merged
merged 4 commits into from Nov 16, 2016
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
4 changes: 1 addition & 3 deletions api/client.go
Expand Up @@ -48,7 +48,7 @@ type Config struct {
redirectSetup sync.Once

// MaxRetries controls the maximum number of times to retry when a 5xx error
// occurs. Set to 0 or less to disable retrying.
// occurs. Set to 0 or less to disable retrying. Defaults to 0.
MaxRetries int
}

Expand Down Expand Up @@ -99,8 +99,6 @@ func DefaultConfig() *Config {
config.Address = v
}

config.MaxRetries = pester.DefaultClient.MaxRetries

return config
}

Expand Down
9 changes: 7 additions & 2 deletions http/sys_seal.go
Expand Up @@ -30,8 +30,13 @@ func handleSysSeal(core *vault.Core) http.Handler {

// Seal with the token above
if err := core.SealWithRequest(req); err != nil {
respondError(w, http.StatusInternalServerError, err)
return
if errwrap.Contains(err, logical.ErrPermissionDenied.Error()) {
respondError(w, http.StatusForbidden, err)
return
} else {
respondError(w, http.StatusInternalServerError, err)
return
}
}

respondOk(w, nil)
Expand Down
6 changes: 3 additions & 3 deletions http/sys_seal_test.go
Expand Up @@ -285,7 +285,7 @@ func TestSysSeal_Permissions(t *testing.T) {

// We expect this to fail since it needs update and sudo
httpResp := testHttpPut(t, "child", addr+"/v1/sys/seal", nil)
testResponseStatus(t, httpResp, 500)
testResponseStatus(t, httpResp, 403)

// Now modify to add update capability
req = &logical.Request{
Expand All @@ -306,7 +306,7 @@ func TestSysSeal_Permissions(t *testing.T) {

// We expect this to fail since it needs sudo
httpResp = testHttpPut(t, "child", addr+"/v1/sys/seal", nil)
testResponseStatus(t, httpResp, 500)
testResponseStatus(t, httpResp, 403)

// Now modify to just sudo capability
req = &logical.Request{
Expand All @@ -327,7 +327,7 @@ func TestSysSeal_Permissions(t *testing.T) {

// We expect this to fail since it needs update
httpResp = testHttpPut(t, "child", addr+"/v1/sys/seal", nil)
testResponseStatus(t, httpResp, 500)
testResponseStatus(t, httpResp, 403)

// Now modify to add all needed capabilities
req = &logical.Request{
Expand Down