Use typeurl package for spec types

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-07-05 15:11:59 -07:00
parent f8720382b3
commit a60511d5aa
22 changed files with 163 additions and 264 deletions

View File

@@ -139,7 +139,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
if err != nil {
return nil, err
}
bundle, err := newBundle(filepath.Join(r.root, namespace), namespace, id, opts.Spec)
bundle, err := newBundle(filepath.Join(r.root, namespace), namespace, id, opts.Spec.Value)
if err != nil {
return nil, err
}
@@ -183,7 +183,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
if _, err = s.Create(ctx, sopts); err != nil {
return nil, errors.New(grpc.ErrorDesc(err))
}
t := newTask(id, namespace, opts.Spec, s)
t := newTask(id, namespace, s)
if err := r.tasks.add(ctx, t); err != nil {
return nil, err
}
@@ -323,14 +323,9 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
}
continue
}
spec, err := bundle.Spec()
if err != nil {
log.G(ctx).WithError(err).Error("load task spec")
}
o = append(o, &Task{
containerID: id,
shim: s,
spec: spec,
namespace: ns,
})
}