[lxc-devel] [lxd/master] Fix failure to launch containers with random names
stgraber on Github
lxc-bot at linuxcontainers.org
Wed Jun 28 18:47:31 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170628/d05ddb25/attachment.bin>
-------------- next part --------------
From 640fcbd73a8e094a98dd6a81776ba0134acd1a96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 28 Jun 2017 14:47:05 -0400
Subject: [PATCH] Fix failure to launch containers with random names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/init.go | 3 ++-
test/suites/basic.sh | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lxc/init.go b/lxc/init.go
index 1a7934e3d..254da6952 100644
--- a/lxc/init.go
+++ b/lxc/init.go
@@ -310,7 +310,8 @@ func (c *initCmd) create(conf *config.Config, args []string) (lxd.ContainerServe
if len(containers) == 1 && name == "" {
fields := strings.Split(containers[0], "/")
- fmt.Printf(i18n.G("Container name is: %s")+"\n", fields[len(fields)-1])
+ name = fields[len(fields)-1]
+ fmt.Printf(i18n.G("Container name is: %s")+"\n", name)
}
// Validate the network setup
diff --git a/test/suites/basic.sh b/test/suites/basic.sh
index 318303be6..19b7885e3 100644
--- a/test/suites/basic.sh
+++ b/test/suites/basic.sh
@@ -201,9 +201,9 @@ test_basic_usage() {
[ ! -d "${LXD_DIR}/snapshots/bar" ]
# Test randomly named container creation
- lxc init testimage
+ lxc launch testimage
RDNAME=$(lxc list | tail -n2 | grep ^\| | awk '{print $2}')
- lxc delete "${RDNAME}"
+ lxc delete -f "${RDNAME}"
# Test "nonetype" container creation
wait_for "${LXD_ADDR}" my_curl -X POST "https://${LXD_ADDR}/1.0/containers" \
More information about the lxc-devel
mailing list