Add context and client to SpecOpts

In order to do more advanced spec generation with images, snapshots,
etc, we need to inject the context and client into the spec generation
code.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-08-22 12:03:21 -04:00
parent ba69f5d488
commit fa14f2ef3a
15 changed files with 100 additions and 92 deletions

View File

@@ -24,7 +24,7 @@ type killer interface {
}
func withEnv(context *cli.Context) containerd.SpecOpts {
return func(s *specs.Spec) error {
return func(_ gocontext.Context, _ *containerd.Client, s *specs.Spec) error {
env := context.StringSlice("env")
if len(env) > 0 {
s.Process.Env = replaceOrAppendEnvValues(s.Process.Env, env)
@@ -34,7 +34,7 @@ func withEnv(context *cli.Context) containerd.SpecOpts {
}
func withMounts(context *cli.Context) containerd.SpecOpts {
return func(s *specs.Spec) error {
return func(_ gocontext.Context, _ *containerd.Client, s *specs.Spec) error {
for _, mount := range context.StringSlice("mount") {
m, err := parseMountFlag(mount)
if err != nil {