Skip to content

Commit

Permalink
Merge pull request #6415 from dmcgowan/contrib-apparmor-cleanup
Browse files Browse the repository at this point in the history
Update error message for apparmor parser
  • Loading branch information
AkihiroSuda committed Jan 10, 2022
2 parents e4bf686 + 8aca314 commit 35b96f9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions contrib/apparmor/template.go
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 35b96f9

Please sign in to comment.