Skip to content

Commit

Permalink
Give better error if namespaces not enabled (hashicorp#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkysow authored Nov 20, 2020
1 parent ce728d6 commit d04cc0c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion subcommand/server-acl-init/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,13 @@ func (c *Command) Run(args []string) int {
}
_, _, err = consulClient.Namespaces().Update(&consulNamespace, &api.WriteOptions{})
if err != nil {
c.log.Error("Error updating the default namespace to include the cross namespace policy", "err", err)
if strings.Contains(strings.ToLower(err.Error()), "unexpected response code: 404") {
// If this returns a 404 it's most likely because they're not running
// Consul Enterprise.
c.log.Error("Error updating the default namespace to include the cross namespace policy - ensure you're running Consul Enterprise with namespaces enabled", "err", err)
} else {
c.log.Error("Error updating the default namespace to include the cross namespace policy", "err", err)
}
return 1
}
}
Expand Down

0 comments on commit d04cc0c

Please sign in to comment.