mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-26 17:11:13 +02:00
1. gofmt
2. Change if expr syntax to be consist with the rest of Vault code 3. More details on error message
This commit is contained in:
parent
4b709a7a7a
commit
3886d68de3
@ -63,7 +63,7 @@ func newZookeeperBackend(conf map[string]string) (Backend, error) {
|
|||||||
schema = "world"
|
schema = "world"
|
||||||
} else {
|
} else {
|
||||||
parsedSchemaAndOwner := strings.SplitN(schemaAndOwner, ":", 2)
|
parsedSchemaAndOwner := strings.SplitN(schemaAndOwner, ":", 2)
|
||||||
if !(len(parsedSchemaAndOwner)==2) {
|
if len(parsedSchemaAndOwner) != 2 {
|
||||||
return nil, fmt.Errorf("znode_owner expected format is 'schema:owner'")
|
return nil, fmt.Errorf("znode_owner expected format is 'schema:owner'")
|
||||||
} else {
|
} else {
|
||||||
schema = parsedSchemaAndOwner[0]
|
schema = parsedSchemaAndOwner[0]
|
||||||
@ -73,7 +73,6 @@ func newZookeeperBackend(conf map[string]string) (Backend, error) {
|
|||||||
|
|
||||||
acl := []zk.ACL{{zk.PermAll, schema, owner}}
|
acl := []zk.ACL{{zk.PermAll, schema, owner}}
|
||||||
|
|
||||||
|
|
||||||
// Authnetication info
|
// Authnetication info
|
||||||
var schemaAndUser string
|
var schemaAndUser string
|
||||||
schemaAndUser, ok = conf["auth_info"]
|
schemaAndUser, ok = conf["auth_info"]
|
||||||
@ -82,7 +81,7 @@ func newZookeeperBackend(conf map[string]string) (Backend, error) {
|
|||||||
schema = ""
|
schema = ""
|
||||||
} else {
|
} else {
|
||||||
parsedSchemaAndUser := strings.SplitN(schemaAndUser, ":", 2)
|
parsedSchemaAndUser := strings.SplitN(schemaAndUser, ":", 2)
|
||||||
if !(len(parsedSchemaAndUser)==2) {
|
if len(parsedSchemaAndUser) != 2 {
|
||||||
return nil, fmt.Errorf("auth_info expected format is 'schema:auth'")
|
return nil, fmt.Errorf("auth_info expected format is 'schema:auth'")
|
||||||
} else {
|
} else {
|
||||||
schema = parsedSchemaAndUser[0]
|
schema = parsedSchemaAndUser[0]
|
||||||
@ -90,7 +89,6 @@ func newZookeeperBackend(conf map[string]string) (Backend, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Attempt to create the ZK client
|
// Attempt to create the ZK client
|
||||||
client, _, err := zk.Connect(strings.Split(machines, ","), time.Second)
|
client, _, err := zk.Connect(strings.Split(machines, ","), time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -101,7 +99,7 @@ func newZookeeperBackend(conf map[string]string) (Backend, error) {
|
|||||||
if owner != "" {
|
if owner != "" {
|
||||||
err = client.AddAuth(schema, []byte(owner))
|
err = client.AddAuth(schema, []byte(owner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Zookeeper rejected authentication information provided at auth_info")
|
return nil, fmt.Errorf("Zookeeper rejected authentication information provided at auth_info: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user