From 77011a075ef8ed7353ef5bfb9e740e26875f0229 Mon Sep 17 00:00:00 2001 From: cskh Date: Wed, 1 Mar 2023 14:17:26 -0500 Subject: [PATCH] fix: return error msg if acl policy not found --- command/acl/policy/read/policy_read.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/command/acl/policy/read/policy_read.go b/command/acl/policy/read/policy_read.go index 455f5e5f7d..3868b1fdf3 100644 --- a/command/acl/policy/read/policy_read.go +++ b/command/acl/policy/read/policy_read.go @@ -92,6 +92,11 @@ func (c *cmd) Run(args []string) int { return 1 } + if pol == nil { + c.UI.Error(fmt.Sprintf("Error not found policy %s", c.policyName)) + return 1 + } + formatter, err := policy.NewFormatter(c.format, c.showMeta) if err != nil { c.UI.Error(err.Error())