daemon: Daemon.getIpcContainer: make errors less repetitive

- Most error-message returned would already include "container" and the
  container ID in the error-message (e.g. "container %s is not running"),
  so there's no need to add a custom prefix for that.
- os.Stat returns a PathError, which already includes the operation ("stat"),
  the path, and the underlying error that occurred.

And while updating, let's also fix the name to be proper camelCase :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-08-12 00:23:21 +02:00
parent 3d94eb9bcd
commit dd26e6b15e
2 changed files with 10 additions and 12 deletions

View File

@@ -292,9 +292,9 @@ func WithNamespaces(daemon *Daemon, c *container.Container) coci.SpecOpts {
}
switch {
case ipcMode.IsContainer():
ic, err := daemon.getIpcContainer(ipcMode.Container())
ic, err := daemon.getIPCContainer(ipcMode.Container())
if err != nil {
return errors.Wrapf(err, "invalid IPC mode: %v", ipcMode)
return errors.Wrap(err, "failed to join IPC namespace")
}
setNamespace(s, specs.LinuxNamespace{
Type: specs.IPCNamespace,
@@ -526,7 +526,7 @@ func withMounts(daemon *Daemon, daemonCfg *configStore, c *container.Container)
return err
}
if err := daemon.setupIpcDirs(c); err != nil {
if err := daemon.setupIPCDirs(c); err != nil {
return err
}