Skip to content

Commit 6ea8416

Browse files
authored
fix: policy-exception json keys (#1107)
1 parent 5faea9b commit 6ea8416

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

cli/cmd/policy_exceptions.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ func init() {
111111
}
112112

113113
func listPolicyExceptions(_ *cobra.Command, args []string) error {
114-
var policyExceptions [][]string
115114
if len(args) > 0 {
116115
cli.StartProgress(fmt.Sprintf(
117116
"Retrieving policy exceptions from policy ID '%s'...", args[0],
@@ -121,19 +120,19 @@ func listPolicyExceptions(_ *cobra.Command, args []string) error {
121120
if err != nil {
122121
return errors.Wrapf(err, "unable to list policy exceptions for ID %s", args[0])
123122
}
124-
policyExceptions = append(policyExceptions,
125-
policyExceptionTable(policyExceptionResponse.Data, args[0])...)
126-
}
127123

128-
if cli.JSONOutput() {
129-
return cli.OutputJSON(policyExceptions)
130-
}
131-
if len(policyExceptions) == 0 {
132-
cli.OutputHuman("There were no policy exceptions found.\n")
133-
return nil
124+
if cli.JSONOutput() {
125+
return cli.OutputJSON(policyExceptionResponse.Data)
126+
}
127+
128+
if len(policyExceptionResponse.Data) == 0 {
129+
cli.OutputHuman("There were no policy exceptions found.\n")
130+
return nil
131+
}
132+
133+
cli.OutputHuman(renderSimpleTable(policyExceptionTableHeaders, policyExceptionTable(policyExceptionResponse.Data, args[0])))
134134
}
135135

136-
cli.OutputHuman(renderSimpleTable(policyExceptionTableHeaders, policyExceptions))
137136
return nil
138137
}
139138

0 commit comments

Comments
 (0)