Skip to content

Commit

Permalink
Set number of pester retries to zero by default and make seal command…
Browse files Browse the repository at this point in the history
… return 403 if unauthorized instead of 500
  • Loading branch information
jefferai committed Nov 14, 2016
1 parent d78a756 commit 5108345
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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) {
respondError(w, http.StatusUnauthorized, err)
return
} else {
respondError(w, http.StatusInternalServerError, err)
return
}
}

respondOk(w, nil)
Expand Down

0 comments on commit 5108345

Please sign in to comment.