mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
plugin: use pkg/errors in more places
Also provide stack trace output in daemon logs.
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 26d0bac895
)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
parent
7b15b4a9b2
commit
68f9fb9fd7
4 changed files with 9 additions and 9 deletions
|
@ -137,7 +137,7 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
|
|||
}
|
||||
|
||||
if err := handlerFunc(ctx, w, r, vars); err != nil {
|
||||
logrus.Errorf("Handler for %s %s returned error: %v", r.Method, r.URL.Path, err)
|
||||
logrus.Errorf("Handler for %s %s returned error: %+v", r.Method, r.URL.Path, err)
|
||||
httputils.MakeErrorHandler(err)(w, r)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ func (pm *Manager) save(p *v2.Plugin) error {
|
|||
return errors.Wrap(err, "failed to marshal plugin json")
|
||||
}
|
||||
if err := ioutils.AtomicWriteFile(filepath.Join(pm.config.Root, p.GetID(), configFileName), pluginJSON, 0600); err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "failed to write atomically plugin json")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
|||
|
||||
if p.PropagatedMount != "" {
|
||||
if err := mount.MakeRShared(p.PropagatedMount); err != nil {
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := initlayer.Setup(filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName), 0, 0); err != nil {
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
if err := pm.containerdClient.Create(p.GetID(), "", "", specs.Spec(*spec), attachToLog(p.GetID())); err != nil {
|
||||
|
@ -56,7 +56,7 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
|||
logrus.Warnf("Could not unmount %s: %v", p.PropagatedMount, err)
|
||||
}
|
||||
}
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
return pm.pluginPostStart(p, c)
|
||||
|
@ -67,7 +67,7 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
|
|||
if err != nil {
|
||||
c.restart = false
|
||||
shutdownPlugin(p, c, pm.containerdClient)
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
p.SetPClient(client)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package v2
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -12,6 +11,7 @@ import (
|
|||
"github.com/docker/docker/oci"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// InitSpec creates an OCI spec from the plugin's config.
|
||||
|
@ -29,7 +29,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
|
|||
|
||||
execRoot = filepath.Join(execRoot, p.PluginObj.ID)
|
||||
if err := os.MkdirAll(execRoot, 0700); err != nil {
|
||||
return nil, err
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
mounts := append(p.PluginObj.Config.Mounts, types.PluginMount{
|
||||
|
@ -95,7 +95,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
|
|||
path := *dev.Path
|
||||
d, dPermissions, err := oci.DevicesFromPath(path, path, "rwm")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
s.Linux.Devices = append(s.Linux.Devices, d...)
|
||||
s.Linux.Resources.Devices = append(s.Linux.Resources.Devices, dPermissions...)
|
||||
|
|
Loading…
Reference in a new issue