1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Update pkg/apparmor to provide a better error message when apparmor_parser cannot be found

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
Tianon Gravi 2014-04-29 23:19:21 -06:00
parent 70b5652984
commit a1a9baf926

View file

@ -69,15 +69,8 @@ func InstallDefaultProfile(backupPath string) error {
cmd.Dir = "/etc/apparmor.d"
output, err := cmd.CombinedOutput()
if err != nil && !os.IsNotExist(err) {
if e, ok := err.(*exec.Error); ok {
// keeping with the current profile load code, if the parser does not
// exist then just return
if e.Err == exec.ErrNotFound || os.IsNotExist(e.Err) {
return nil
}
}
return fmt.Errorf("Error loading docker profile: %s (%s)", err, output)
if err != nil {
return fmt.Errorf("Error loading docker apparmor profile: %s (%s)", err, output)
}
return nil
}