consul: Verify compilation of rules

This commit is contained in:
Armon Dadgar 2014-08-08 16:00:32 -07:00
parent ea1ee5c13e
commit edcd69019c
1 changed files with 9 additions and 4 deletions

View File

@ -2,9 +2,11 @@ package consul
import ( import (
"fmt" "fmt"
"github.com/armon/go-metrics"
"github.com/hashicorp/consul/consul/structs"
"time" "time"
"github.com/armon/go-metrics"
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/consul/structs"
) )
// ACL endpoint is used to manipulate ACLs // 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") 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: case structs.ACLDelete:
if args.ACL.ID == "" { if args.ACL.ID == "" {