fix windows oci package

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin 2017-11-22 16:54:06 -05:00
parent cdf62f69a1
commit a21a19a658
3 changed files with 12 additions and 12 deletions

View File

@ -7,28 +7,29 @@ import (
"strconv"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
const newLine = "\r\n"
func withExitStatus(es int) SpecOpts {
return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error {
func withExitStatus(es int) oci.SpecOpts {
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
s.Process.Args = []string{"powershell", "-noprofile", "exit", strconv.Itoa(es)}
return nil
}
}
func withProcessArgs(args ...string) SpecOpts {
return WithProcessArgs(append([]string{"powershell", "-noprofile"}, args...)...)
func withProcessArgs(args ...string) oci.SpecOpts {
return oci.WithProcessArgs(append([]string{"powershell", "-noprofile"}, args...)...)
}
func withCat() SpecOpts {
return WithProcessArgs("cmd", "/c", "more")
func withCat() oci.SpecOpts {
return oci.WithProcessArgs("cmd", "/c", "more")
}
func withTrue() SpecOpts {
return WithProcessArgs("cmd", "/c")
func withTrue() oci.SpecOpts {
return oci.WithProcessArgs("cmd", "/c")
}
func withExecExitStatus(s *specs.Process, es int) {
@ -39,8 +40,8 @@ func withExecArgs(s *specs.Process, args ...string) {
s.Args = append([]string{"powershell", "-noprofile"}, args...)
}
func withImageConfig(i Image) SpecOpts {
return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error {
func withImageConfig(i Image) oci.SpecOpts {
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
s.Windows.LayerFolders = dockerLayerFolders
return nil
}

View File

@ -10,7 +10,6 @@ import (
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/platforms"
"github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

View File

@ -8,7 +8,7 @@ import (
// WithResources sets the provided resources on the spec for task updates
func WithResources(resources *specs.WindowsResources) UpdateTaskOpts {
return func(ctx context.Context, client Client, r *UpdateTaskInfo) error {
return func(ctx context.Context, client *Client, r *UpdateTaskInfo) error {
r.Resources = resources
return nil
}