mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
consul: Verify compilation of rules
This commit is contained in:
parent
50ba1f6067
commit
b5c9e65175
@ -2,9 +2,11 @@ package consul
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/consul/consul/structs"
|
||||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/consul/acl"
|
||||
"github.com/hashicorp/consul/consul/structs"
|
||||
)
|
||||
|
||||
// ACL endpoint is used to manipulate ACLs
|
||||
@ -30,8 +32,11 @@ func (a *ACL) Apply(args *structs.ACLRequest, reply *string) error {
|
||||
return fmt.Errorf("Invalid ACL Type")
|
||||
}
|
||||
|
||||
// TODO: Validate the rules compile
|
||||
//
|
||||
// Validate the rules compile
|
||||
_, err := acl.Parse(args.ACL.Rules)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ACL rule compilation failed: %v", err)
|
||||
}
|
||||
|
||||
case structs.ACLDelete:
|
||||
if args.ACL.ID == "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user