mirror of
https://github.com/moby/moby.git
synced 2026-08-11 01:27:11 +00:00
profiles/apparmor: loadprofile: fix double command in error message
`exec.Cmd.Path` already contains the command that was executed, so we
were printing the command twice. However, `exec.Cmd` implements a stringer
interface, which provides a readable version of the command that was
executed, so use that instead. While updating, lso change backticks in
the error for regular quotes.
Before:
running `/usr/sbin/apparmor_parser apparmor_parser -Kr /no/such/file` failed with output: Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
Use --subdomainfs to override.
error: exit status 1
After:
running '/usr/sbin/apparmor_parser -Kr /no/such/file' failed with output: Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
Use --subdomainfs to override.
error: exit status 1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -130,9 +130,8 @@ func loadProfile(profilePath string) error {
|
||||
c := exec.Command("apparmor_parser", "-Kr", profilePath)
|
||||
c.Dir = ""
|
||||
|
||||
output, err := c.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("running `%s %s` failed with output: %s\nerror: %v", c.Path, strings.Join(c.Args, " "), output, err)
|
||||
if output, err := c.CombinedOutput(); err != nil {
|
||||
return fmt.Errorf("running '%s' failed with output: %s\nerror: %v", c, output, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user