Respect default snapshotter label

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
This commit is contained in:
Maksym Pavlenko
2019-07-10 12:16:43 -07:00
parent 47d2ac0902
commit 1918ee4d11
6 changed files with 17 additions and 34 deletions

View File

@@ -332,7 +332,6 @@ func defaultRemoteContext() *RemoteContext {
Resolver: docker.NewResolver(docker.ResolverOptions{
Client: http.DefaultClient,
}),
Snapshotter: DefaultSnapshotter,
}
}
@@ -672,7 +671,13 @@ func (c *Client) Version(ctx context.Context) (Version, error) {
}, nil
}
func (c *Client) getSnapshotter(name string) (snapshots.Snapshotter, error) {
func (c *Client) getSnapshotter(ctx context.Context, name string) (snapshots.Snapshotter, error) {
if name == "" {
if err := c.GetLabel(ctx, defaults.DefaultSnapshotterNSLabel, &name, DefaultSnapshotter); err != nil {
return nil, err
}
}
s := c.SnapshotService(name)
if s == nil {
return nil, errors.Wrapf(errdefs.ErrNotFound, "snapshotter %s was not found", name)