Skip to content

Commit

Permalink
Fix bootstrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeler committed Oct 18, 2018
1 parent c9cd1ec commit 1a52612
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions agent/acl_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -40,7 +41,13 @@ func (s *HTTPServer) ACLBootstrap(resp http.ResponseWriter, req *http.Request) (
Datacenter: s.agent.config.Datacenter,
}

if s.agent.delegate.UseLegacyACLs() {
legacy := false
legacyStr := req.URL.Query().Get("legacy")
if legacyStr != "" {
legacy, _ = strconv.ParseBool(legacyStr)
}

if legacy && s.agent.delegate.UseLegacyACLs() {
var out structs.ACL
err := s.agent.RPC("ACL.Bootstrap", &args, &out)
if err != nil {
Expand All @@ -55,7 +62,7 @@ func (s *HTTPServer) ACLBootstrap(resp http.ResponseWriter, req *http.Request) (
return &aclBootstrapResponse{ID: out.ID}, nil
} else {
var out structs.ACLToken
err := s.agent.RPC("ACL.BootsrapTokens", &args, &out)
err := s.agent.RPC("ACL.BootstrapTokens", &args, &out)
if err != nil {
if strings.Contains(err.Error(), structs.ACLBootstrapNotAllowedErr.Error()) {
resp.WriteHeader(http.StatusForbidden)
Expand Down

0 comments on commit 1a52612

Please sign in to comment.