Skip to content

Commit

Permalink
Update error message for apparmor parser
Browse files Browse the repository at this point in the history
Signed-off-by: Derek McGowan <[email protected]>
  • Loading branch information
dmcgowan committed Jan 7, 2022
1 parent 77d53d2 commit 8aca314
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions contrib/apparmor/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func generate(p *data, o io.Writer) error {
func load(path string) error {
out, err := aaParser("-Kr", path)
if err != nil {
return fmt.Errorf("%s: %s", err, out)
return fmt.Errorf("parser error(%q): %w", strings.TrimSpace(out), err)
}
return nil
}
Expand All @@ -164,10 +164,7 @@ func macroExists(m string) bool {

func aaParser(args ...string) (string, error) {
out, err := exec.Command("apparmor_parser", args...).CombinedOutput()
if err != nil {
return "", err
}
return string(out), nil
return string(out), err
}

func getVersion() (int, error) {
Expand Down

0 comments on commit 8aca314

Please sign in to comment.