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:
@@ -11,12 +11,12 @@ import (
|
||||
|
||||
const newLine = "\n"
|
||||
|
||||
func generateSpec(opts ...SpecOpts) (*specs.Spec, error) {
|
||||
return GenerateSpec(opts...)
|
||||
func generateSpec(ctx context.Context, client *Client, opts ...SpecOpts) (*specs.Spec, error) {
|
||||
return GenerateSpec(ctx, client, opts...)
|
||||
}
|
||||
|
||||
func withExitStatus(es int) SpecOpts {
|
||||
return func(s *specs.Spec) error {
|
||||
return func(_ context.Context, _ *Client, s *specs.Spec) error {
|
||||
s.Process.Args = []string{"sh", "-c", fmt.Sprintf("exit %d", es)}
|
||||
return nil
|
||||
}
|
||||
@@ -42,14 +42,9 @@ func withExecArgs(s *specs.Process, args ...string) {
|
||||
s.Args = args
|
||||
}
|
||||
|
||||
func withImageConfig(ctx context.Context, i Image) SpecOpts {
|
||||
return WithImageConfig(ctx, i)
|
||||
}
|
||||
|
||||
func withNewSnapshot(id string, i Image) NewContainerOpts {
|
||||
return WithNewSnapshot(id, i)
|
||||
}
|
||||
|
||||
var withUserNamespace = WithUserNamespace
|
||||
|
||||
var withRemappedSnapshot = WithRemappedSnapshot
|
||||
var (
|
||||
withUserNamespace = WithUserNamespace
|
||||
withRemappedSnapshot = WithRemappedSnapshot
|
||||
withNewSnapshot = WithNewSnapshot
|
||||
withImageConfig = WithImageConfig
|
||||
)
|
||||
|
Reference in New Issue
Block a user