oci package passing tests

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin
2017-11-17 14:38:13 -05:00
parent 70e0c8443f
commit 081f8c7ce0
14 changed files with 254 additions and 233 deletions

23
oci/spec.go Normal file
View File

@@ -0,0 +1,23 @@
package oci
import (
"context"
"github.com/containerd/containerd/containers"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
// GenerateSpec will generate a default spec from the provided image
// for use as a containerd container
func GenerateSpec(ctx context.Context, client Client, c *containers.Container, opts ...SpecOpts) (*specs.Spec, error) {
s, err := createDefaultSpec(ctx, c.ID)
if err != nil {
return nil, err
}
for _, o := range opts {
if err := o(ctx, client, c, s); err != nil {
return nil, err
}
}
return s, nil
}