summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-10-20 14:23:13 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-10-20 16:57:13 +0900
commitff1312613fe295dab0479a6053ad5700c88ba636 (patch)
tree6c556e121a100787cf4bc5d45ef557043c780e7e /table
parent52c73c394a832fa80357d57b8da7a0c2428fb7f4 (diff)
policy: name statement automatically also via grpc
fix an incomplete commit 204eacc5c0503cecc796a74fd0c1948ad6a28051 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r--table/policy.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/table/policy.go b/table/policy.go
index 7369a823..6bcaa5fe 100644
--- a/table/policy.go
+++ b/table/policy.go
@@ -2366,7 +2366,10 @@ func NewPolicyFromApiStruct(a *api.Policy, dmap DefinedSetMap) (*Policy, error)
return nil, fmt.Errorf("empty policy name")
}
stmts := make([]*Statement, 0, len(a.Statements))
- for _, x := range a.Statements {
+ for idx, x := range a.Statements {
+ if x.Name == "" {
+ x.Name = fmt.Sprintf("%s_stmt%d", a.Name, idx)
+ }
y, err := NewStatementFromApiStruct(x, dmap)
if err != nil {
return nil, err