Fixing printf (and similar) issues (#2666)

This commit is contained in:
Ben Gadbois 2017-05-01 20:34:10 -07:00 committed by Jeff Mitchell
parent 44e1c64cfd
commit 537342f038
8 changed files with 13 additions and 12 deletions

View File

@ -104,7 +104,7 @@ func TestAppRole_RoleConstraints(t *testing.T) {
roleData["bind_secret_id"] = false
resp, err = b.HandleRequest(roleReq)
if resp != nil && resp.IsError() {
t.Fatalf("resp:%#v", err, resp)
t.Fatalf("err:%v, resp:%#v", err, resp)
}
if err == nil {
t.Fatalf("expected an error")
@ -433,7 +433,7 @@ func TestAppRole_RoleSecretIDAccessorReadDelete(t *testing.T) {
hmacReq.Operation = logical.ReadOperation
resp, err = b.HandleRequest(hmacReq)
if resp != nil && resp.IsError() {
t.Fatalf("error response:%#v", err, resp)
t.Fatalf("err:%v resp:%#v", err, resp)
}
if err == nil {
t.Fatalf("expected an error")

View File

@ -352,7 +352,7 @@ func (b *backend) nonLockedSecretIDStorageEntry(s logical.Storage, roleNameHMAC,
if persistNeeded {
if err := b.nonLockedSetSecretIDStorageEntry(s, roleNameHMAC, secretIDHMAC, &result); err != nil {
return nil, fmt.Errorf("failed to upgrade role storage entry", err)
return nil, fmt.Errorf("failed to upgrade role storage entry %s", err)
}
}

View File

@ -249,17 +249,18 @@ func TestBackend_pathIam(t *testing.T) {
// generate a second role, ensure we're able to list both
data["bound_ami_id"] = "ami-abcd123"
resp, err = b.HandleRequest(&logical.Request{
secondRole := &logical.Request{
Operation: logical.CreateOperation,
Path: "role/MyOtherRoleName",
Data: data,
Storage: storage,
})
}
resp, err = b.HandleRequest(secondRole)
if err != nil {
t.Fatal(err)
}
if resp != nil && resp.IsError() {
t.Fatalf("failed to create additional role: %s")
t.Fatalf("failed to create additional role: %v", *secondRole)
}
resp, err = b.HandleRequest(&logical.Request{

View File

@ -400,7 +400,7 @@ func (c *ConfigEntry) DialLDAP() (*ldap.Conn, error) {
}
conn, err = ldap.DialTLS("tcp", net.JoinHostPort(host, port), tlsConfig)
default:
retErr = multierror.Append(retErr, fmt.Errorf("invalid LDAP scheme in url %q"))
retErr = multierror.Append(retErr, fmt.Errorf("invalid LDAP scheme in url %q", net.JoinHostPort(host, port)))
continue
}
if err == nil {

View File

@ -48,7 +48,7 @@ func (c *CredentialsConfig) GenerateCredentialChain() (*credentials.Credentials,
SecretAccessKey: c.SecretKey,
SessionToken: c.SessionToken,
}})
case c.AccessKey == "" && c.AccessKey == "":
case c.AccessKey == "" && c.SecretKey == "":
// Attempt to get credentials from the IAM instance role below
default: // Have one or the other but not both and not neither

View File

@ -248,7 +248,7 @@ func (lm *LockManager) getPolicyCommon(req PolicyRequest, lockType bool) (*Polic
case KeyType_ECDSA_P256:
if req.Derived || req.Convergent {
return nil, nil, false, fmt.Errorf("key derivation and convergent encryption not supported for keys of type %s", KeyType_ECDSA_P256)
return nil, nil, false, fmt.Errorf("key derivation and convergent encryption not supported for keys of type %v", KeyType_ECDSA_P256)
}
default:

View File

@ -95,7 +95,7 @@ func TestRouter_Mount(t *testing.T) {
}
if v := r.MatchingStorageView("prod/aws/foo"); v != view {
t.Fatalf("bad: %s", v)
t.Fatalf("bad: %v", v)
}
if path := r.MatchingMount("stage/aws/foo"); path != "" {
@ -103,7 +103,7 @@ func TestRouter_Mount(t *testing.T) {
}
if v := r.MatchingStorageView("stage/aws/foo"); v != nil {
t.Fatalf("bad: %s", v)
t.Fatalf("bad: %v", v)
}
mount, prefix, ok := r.MatchingStoragePrefix("logical/foo")

View File

@ -2173,7 +2173,7 @@ func (ts *TokenStore) tokenStoreRoleCreateUpdate(
}
resp.AddWarning(fmt.Sprintf(
"Given explicit max TTL of %d is greater than system/mount allowed value of %d seconds; until this is fixed attempting to create tokens against this role will result in an error",
entry.ExplicitMaxTTL.Seconds(), sysView.MaxLeaseTTL().Seconds()))
int64(entry.ExplicitMaxTTL.Seconds()), int64(sysView.MaxLeaseTTL().Seconds())))
}
}