Skip to content

Commit

Permalink
Turn off retries on CLI (hashicorp#4918)
Browse files Browse the repository at this point in the history
For the CLI it just ends up confusing people as to why it's "hanging"
before returning a 500. This can still be overridden with
VAULT_MAX_RETRIES.
  • Loading branch information
jefferai authored Jul 12, 2018
1 parent 5d706e1 commit 2b70c9e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions command/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"io/ioutil"
"os"
"regexp"
"strings"
"sync"
Expand Down Expand Up @@ -88,6 +89,11 @@ func (c *BaseCommand) Client() (*api.Client, error) {
return nil, errors.Wrap(err, "failed to create client")
}

// Turn off retries on the CLI
if os.Getenv(api.EnvVaultMaxRetries) == "" {
client.SetMaxRetries(0)
}

// Set the wrapping function
client.SetWrappingLookupFunc(c.DefaultWrappingLookupFunc)

Expand Down
6 changes: 6 additions & 0 deletions command/base_predict.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package command

import (
"os"
"sort"
"strings"
"sync"
Expand Down Expand Up @@ -35,6 +36,11 @@ func (p *Predict) Client() *api.Client {
client.SetToken(token)
}

// Turn off retries for prediction
if os.Getenv(api.EnvVaultMaxRetries) == "" {
client.SetMaxRetries(0)
}

p.client = client
}
})
Expand Down

0 comments on commit 2b70c9e

Please sign in to comment.