Skip to content

Commit

Permalink
fix: policy-exception json keys (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-stewart committed Jan 12, 2023
1 parent 5faea9b commit 6ea8416
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions cli/cmd/policy_exceptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func init() {
}

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

if cli.JSONOutput() {
return cli.OutputJSON(policyExceptions)
}
if len(policyExceptions) == 0 {
cli.OutputHuman("There were no policy exceptions found.\n")
return nil
if cli.JSONOutput() {
return cli.OutputJSON(policyExceptionResponse.Data)
}

if len(policyExceptionResponse.Data) == 0 {
cli.OutputHuman("There were no policy exceptions found.\n")
return nil
}

cli.OutputHuman(renderSimpleTable(policyExceptionTableHeaders, policyExceptionTable(policyExceptionResponse.Data, args[0])))
}

cli.OutputHuman(renderSimpleTable(policyExceptionTableHeaders, policyExceptions))
return nil
}

Expand Down

0 comments on commit 6ea8416

Please sign in to comment.