ctr: convert bundle paths to absolute

Fixes #75.

Signed-off-by: Burcu Dogan <jbd@google.com>
This commit is contained in:
Burcu Dogan 2016-01-25 19:36:17 -08:00
parent 1ade1f6d81
commit facfce3e8e

View file

@ -96,6 +96,10 @@ var startCommand = cli.Command{
if id == "" { if id == "" {
fatal("container id cannot be empty", 1) fatal("container id cannot be empty", 1)
} }
bpath, err := filepath.Abs(path)
if err != nil {
fatal(fmt.Sprintf("cannot get the absolute path of the bundle: %v", err), 1)
}
c := getClient(context) c := getClient(context)
events, err := c.Events(netcontext.Background(), &types.EventsRequest{}) events, err := c.Events(netcontext.Background(), &types.EventsRequest{})
if err != nil { if err != nil {
@ -103,11 +107,11 @@ var startCommand = cli.Command{
} }
r := &types.CreateContainerRequest{ r := &types.CreateContainerRequest{
Id: id, Id: id,
BundlePath: path, BundlePath: bpath,
Checkpoint: context.String("checkpoint"), Checkpoint: context.String("checkpoint"),
} }
if context.Bool("attach") { if context.Bool("attach") {
mkterm, err := readTermSetting(path) mkterm, err := readTermSetting(bpath)
if err != nil { if err != nil {
fatal(err.Error(), 1) fatal(err.Error(), 1)
} }