diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-12-28 21:18:36 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-12-28 21:18:36 +0000 |
commit | 73ef85bc5db590c22689e11be20737a3dd88168f (patch) | |
tree | fe393a6f0776bca1889b2113ab341a2922e25d10 /vendor/github.com/hashicorp/vault | |
parent | 9e573e571fe878ed32947cae5a6d43cb5d72d3bb (diff) |
Update dependencies
Diffstat (limited to 'vendor/github.com/hashicorp/vault')
-rw-r--r-- | vendor/github.com/hashicorp/vault/api/client.go | 9 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/vault/api/logical.go | 19 |
2 files changed, 20 insertions, 8 deletions
diff --git a/vendor/github.com/hashicorp/vault/api/client.go b/vendor/github.com/hashicorp/vault/api/client.go index 4aee40c..88a8ea4 100644 --- a/vendor/github.com/hashicorp/vault/api/client.go +++ b/vendor/github.com/hashicorp/vault/api/client.go @@ -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 } @@ -99,8 +99,6 @@ func DefaultConfig() *Config { config.Address = v } - config.MaxRetries = pester.DefaultClient.MaxRetries - return config } @@ -289,6 +287,11 @@ func (c *Client) SetAddress(addr string) error { return nil } +// Address returns the Vault URL the client is configured to connect to +func (c *Client) Address() string { + return c.addr.String() +} + // SetWrappingLookupFunc sets a lookup function that returns desired wrap TTLs // for a given operation and path func (c *Client) SetWrappingLookupFunc(lookupFunc WrappingLookupFunc) { diff --git a/vendor/github.com/hashicorp/vault/api/logical.go b/vendor/github.com/hashicorp/vault/api/logical.go index 9753e96..0d5e7d4 100644 --- a/vendor/github.com/hashicorp/vault/api/logical.go +++ b/vendor/github.com/hashicorp/vault/api/logical.go @@ -119,9 +119,13 @@ func (c *Logical) Delete(path string) (*Secret, error) { func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) { var data map[string]interface{} - if wrappingToken != "" && wrappingToken != c.c.Token() { - data = map[string]interface{}{ - "token": wrappingToken, + if wrappingToken != "" { + if c.c.Token() == "" { + c.c.SetToken(wrappingToken) + } else if wrappingToken != c.c.Token() { + data = map[string]interface{}{ + "token": wrappingToken, + } } } @@ -134,8 +138,13 @@ func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) { if resp != nil { defer resp.Body.Close() } - if err != nil && resp.StatusCode != 404 { - return nil, err + if err != nil { + if resp != nil && resp.StatusCode != 404 { + return nil, err + } + } + if resp == nil { + return nil, nil } switch resp.StatusCode { |