Cleans up some drift between the OSS and Enterprise trees.

pull/3573/head
James Phillips 2017-10-11 15:52:20 -07:00
parent 4ab59af09e
commit 575d70aaa7
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
6 changed files with 32 additions and 7 deletions

View File

@ -603,7 +603,7 @@ func (p *PolicyACL) NodeWrite(name string, scope sentinel.ScopeFn) bool {
pr := rule.(PolicyRule)
switch pr.aclPolicy {
case PolicyWrite:
return p.executeCodePolicy(&pr.sentinelPolicy, scope)
return true
default:
return false
}
@ -686,7 +686,7 @@ func (p *PolicyACL) ServiceWrite(name string, scope sentinel.ScopeFn) bool {
pr := rule.(PolicyRule)
switch pr.aclPolicy {
case PolicyWrite:
return p.executeCodePolicy(&pr.sentinelPolicy, scope)
return true
default:
return false
}

View File

@ -127,8 +127,6 @@ func isPolicyValid(policy string) bool {
// isSentinelValid makes sure the given sentinel block is valid, and will skip
// out if the evaluator is nil.
func isSentinelValid(sentinel sentinel.Evaluator, basicPolicy string, sp Sentinel) error {
// TODO (slackpad) - Need a unit test for this.
// Sentinel not enabled at all, or for this policy.
if sentinel == nil {
return nil

View File

@ -631,7 +631,6 @@ func TestFSM_SnapshotRestore(t *testing.T) {
default:
t.Fatalf("bad")
}
}
func TestFSM_BadRestore(t *testing.T) {

View File

@ -30,7 +30,7 @@ func waitForLeader(servers ...*Server) error {
}
// wantPeers determines whether the server has the given
// number of raft peers.
// number of voting raft peers.
func wantPeers(s *Server, peers int) error {
n, err := s.numPeers()
if err != nil {

View File

@ -25,6 +25,10 @@ type Area struct {
// RetryJoin specifies the address of Consul servers to join to, such as
// an IPs or hostnames with an optional port number. This is optional.
RetryJoin []string
// UseTLS specifies whether gossip over this area should be encrypted with TLS
// if possible.
UseTLS bool
}
// AreaJoinResponse is returned when a join occurs and gives the result for each
@ -100,6 +104,27 @@ func (op *Operator) AreaCreate(area *Area, q *WriteOptions) (string, *WriteMeta,
return out.ID, wm, nil
}
// AreaUpdate will update the configuration of the network area with the given ID.
func (op *Operator) AreaUpdate(areaID string, area *Area, q *WriteOptions) (string, *WriteMeta, error) {
r := op.c.newRequest("PUT", "/v1/operator/area/"+areaID)
r.setWriteOptions(q)
r.obj = area
rtt, resp, err := requireOK(op.c.doRequest(r))
if err != nil {
return "", nil, err
}
defer resp.Body.Close()
wm := &WriteMeta{}
wm.RequestTime = rtt
var out struct{ ID string }
if err := decodeBody(resp, &out); err != nil {
return "", nil, err
}
return out.ID, wm, nil
}
// AreaGet returns a single network area.
func (op *Operator) AreaGet(areaID string, q *QueryOptions) ([]*Area, *QueryMeta, error) {
var out []*Area

View File

@ -40,9 +40,12 @@ Usage: consul snapshot <subcommand> [options] [args]
$ consul snapshot inspect backup.snap
Run a daemon process that locally saves a snapshot every hour (available only in
Consul Enterprise) :
$ consul snapshot agent
For more examples, ask for subcommand help or view the documentation.
`
return strings.TrimSpace(helpText)
}