[lxc-devel] [lxd/master] import: error on out missing name
brauner on Github
lxc-bot at linuxcontainers.org
Mon May 1 15:03:08 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 851 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170501/53d6e6c7/attachment.bin>
-------------- next part --------------
From fc4707298bf7847c4b704d795e7d54382c495ca3 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 1 May 2017 17:01:12 +0200
Subject: [PATCH] import: error on out missing name
Fixes this long-standing bug:
chb at conventiont|~
> ~/source/go/bin/lxd import
panic: runtime error: index out of range
goroutine 1 [running]:
main.cmdImport(0xc42008e090, 0x1, 0x1, 0x6, 0xffffffffffffffff)
/home/chb/source/go/src/github.com/lxc/lxd/lxd/main_import.go:8 +0x320
main.run(0xc420120750, 0x0)
/home/chb/source/go/src/github.com/lxc/lxd/lxd/main.go:217 +0x844
main.main()
/home/chb/source/go/src/github.com/lxc/lxd/lxd/main.go:53 +0x26
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/main_import.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/main_import.go b/lxd/main_import.go
index e7b141f..8f03623 100644
--- a/lxd/main_import.go
+++ b/lxd/main_import.go
@@ -1,10 +1,14 @@
package main
import (
+ "fmt"
"github.com/lxc/lxd/client"
)
func cmdImport(args []string) error {
+ if len(args) < 2 {
+ return fmt.Errorf("please specify a container to import")
+ }
name := args[1]
req := map[string]interface{}{
"name": name,
More information about the lxc-devel
mailing list