cmd/gobgp: fix policy printing

make policy printing same with v1.x

Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
FUJITA Tomonori
2019-02-16 19:19:01 +09:00
committed by FUJITA Tomonori
parent 483a0b6e7d
commit aaa71b1bf4
+4 -3
View File
@@ -1042,7 +1042,6 @@ func stateChangeNeighbor(cmd string, remoteIP string, args []string) error {
}
func showNeighborPolicy(remoteIP, policyType string, indent int) error {
var assignment *api.PolicyAssignment
var err error
var dir api.PolicyDirection
@@ -1064,11 +1063,13 @@ func showNeighborPolicy(remoteIP, policyType string, indent int) error {
if err != nil {
return err
}
assignment := &api.PolicyAssignment{}
r, err := stream.Recv()
if err != nil {
if err == nil {
assignment = r.Assignment
} else if err != io.EOF {
return err
}
assignment = r.Assignment
if globalOpts.Json {
j, _ := json.Marshal(assignment)