[lxc-devel] [lxd/master] Fixup launch init

tych0 on Github lxc-bot at linuxcontainers.org
Tue Dec 20 17:33:43 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161220/6c11b721/attachment.bin>
-------------- next part --------------
From 0bcc7843b236be2be031e17fd4df3d6cec1b6b44 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 20 Dec 2016 10:15:06 -0700
Subject: [PATCH 1/2] just use init.go's flags()

...instead of duplicating the contents of this method.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 lxc/launch.go | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/lxc/launch.go b/lxc/launch.go
index f570b82..90823df 100644
--- a/lxc/launch.go
+++ b/lxc/launch.go
@@ -6,7 +6,6 @@ import (
 
 	"github.com/lxc/lxd"
 	"github.com/lxc/lxd/shared"
-	"github.com/lxc/lxd/shared/gnuflag"
 	"github.com/lxc/lxd/shared/i18n"
 	"github.com/lxc/lxd/shared/version"
 )
@@ -36,16 +35,7 @@ Example:
 
 func (c *launchCmd) flags() {
 	c.init = initCmd{}
-
-	c.init.massage_args()
-	gnuflag.Var(&c.init.confArgs, "config", i18n.G("Config key/value to apply to the new container"))
-	gnuflag.Var(&c.init.confArgs, "c", i18n.G("Config key/value to apply to the new container"))
-	gnuflag.Var(&c.init.profArgs, "profile", i18n.G("Profile to apply to the new container"))
-	gnuflag.Var(&c.init.profArgs, "p", i18n.G("Profile to apply to the new container"))
-	gnuflag.BoolVar(&c.init.ephem, "ephemeral", false, i18n.G("Ephemeral container"))
-	gnuflag.BoolVar(&c.init.ephem, "e", false, i18n.G("Ephemeral container"))
-	gnuflag.StringVar(&c.init.network, "network", "", i18n.G("Network name"))
-	gnuflag.StringVar(&c.init.network, "n", "", i18n.G("Network name"))
+	c.init.flags()
 }
 
 func (c *launchCmd) run(config *lxd.Config, args []string) error {

From 81eb14f4d4df3ef17b1e9b687107903e6d83014b Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 20 Dec 2016 17:29:51 +0000
Subject: [PATCH 2/2] cli: fix example in `lxc init`

Similar to 5161ddf32426df7a3f0f3889bbd555d71a70a262.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 lxc/init.go |  2 +-
 po/lxd.pot  | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lxc/init.go b/lxc/init.go
index 1a4e1d7..fec1ef0 100644
--- a/lxc/init.go
+++ b/lxc/init.go
@@ -82,7 +82,7 @@ Not specifying -p will result in the default profile.
 Specifying "-p" with no argument will result in no profile.
 
 Example:
-    lxc init ubuntu u1`)
+    lxc init ubuntu:16.04 u1`)
 }
 
 func (c *initCmd) is_ephem(s string) bool {
diff --git a/po/lxd.pot b/po/lxd.pot
index 05ee064..9954cb5 100644
--- a/po/lxd.pot
+++ b/po/lxd.pot
@@ -7,7 +7,7 @@
 msgid   ""
 msgstr  "Project-Id-Version: lxd\n"
         "Report-Msgid-Bugs-To: lxc-devel at lists.linuxcontainers.org\n"
-        "POT-Creation-Date: 2016-12-15 13:20-0500\n"
+        "POT-Creation-Date: 2016-12-20 17:29+0000\n"
         "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
         "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
         "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -212,7 +212,7 @@ msgstr  ""
 msgid   "Columns"
 msgstr  ""
 
-#: lxc/copy.go:31 lxc/copy.go:32 lxc/init.go:135 lxc/init.go:136 lxc/launch.go:40 lxc/launch.go:41
+#: lxc/copy.go:31 lxc/copy.go:32 lxc/init.go:135 lxc/init.go:136
 msgid   "Config key/value to apply to the new container"
 msgstr  ""
 
@@ -288,7 +288,7 @@ msgstr  ""
 msgid   "Created: %s"
 msgstr  ""
 
-#: lxc/init.go:180 lxc/launch.go:135
+#: lxc/init.go:180 lxc/launch.go:126
 #, c-format
 msgid   "Creating %s"
 msgstr  ""
@@ -347,7 +347,7 @@ msgstr  ""
 msgid   "Environment:"
 msgstr  ""
 
-#: lxc/copy.go:35 lxc/copy.go:36 lxc/init.go:139 lxc/init.go:140 lxc/launch.go:44 lxc/launch.go:45
+#: lxc/copy.go:35 lxc/copy.go:36 lxc/init.go:139 lxc/init.go:140
 msgid   "Ephemeral container"
 msgstr  ""
 
@@ -460,7 +460,7 @@ msgid   "Initialize a container from a particular image.\n"
         "Specifying \"-p\" with no argument will result in no profile.\n"
         "\n"
         "Example:\n"
-        "    lxc init ubuntu u1"
+        "    lxc init ubuntu:16.04 u1"
 msgstr  ""
 
 #: lxc/remote.go:135
@@ -866,7 +866,7 @@ msgstr  ""
 msgid   "Network %s deleted"
 msgstr  ""
 
-#: lxc/init.go:141 lxc/init.go:142 lxc/launch.go:46 lxc/launch.go:47
+#: lxc/init.go:141 lxc/init.go:142
 msgid   "Network name"
 msgstr  ""
 
@@ -1007,7 +1007,7 @@ msgstr  ""
 msgid   "Profile %s removed from %s"
 msgstr  ""
 
-#: lxc/copy.go:33 lxc/copy.go:34 lxc/init.go:137 lxc/init.go:138 lxc/launch.go:42 lxc/launch.go:43
+#: lxc/copy.go:33 lxc/copy.go:34 lxc/init.go:137 lxc/init.go:138
 msgid   "Profile to apply to the new container"
 msgstr  ""
 
@@ -1156,7 +1156,7 @@ msgstr  ""
 msgid   "Source:"
 msgstr  ""
 
-#: lxc/launch.go:144
+#: lxc/launch.go:135
 #, c-format
 msgid   "Starting %s"
 msgstr  ""
@@ -1252,7 +1252,7 @@ msgstr  ""
 msgid   "Transferring image: %s"
 msgstr  ""
 
-#: lxc/action.go:99 lxc/launch.go:157
+#: lxc/action.go:99 lxc/launch.go:148
 #, c-format
 msgid   "Try `lxc info --show-log %s` for more info"
 msgstr  ""
@@ -1315,7 +1315,7 @@ msgstr  ""
 msgid   "`lxc config profile` is deprecated, please use `lxc profile`"
 msgstr  ""
 
-#: lxc/launch.go:128
+#: lxc/launch.go:119
 msgid   "bad number of things scanned from image, container or snapshot"
 msgstr  ""
 
@@ -1343,7 +1343,7 @@ msgstr  ""
 msgid   "default"
 msgstr  ""
 
-#: lxc/copy.go:131 lxc/copy.go:136 lxc/copy.go:232 lxc/copy.go:237 lxc/init.go:219 lxc/init.go:224 lxc/launch.go:112 lxc/launch.go:117
+#: lxc/copy.go:131 lxc/copy.go:136 lxc/copy.go:232 lxc/copy.go:237 lxc/init.go:219 lxc/init.go:224 lxc/launch.go:103 lxc/launch.go:108
 msgid   "didn't get any affected image, container or snapshot from server"
 msgstr  ""
 
@@ -1365,7 +1365,7 @@ msgstr  ""
 msgid   "error: unknown command: %s"
 msgstr  ""
 
-#: lxc/launch.go:132
+#: lxc/launch.go:123
 msgid   "got bad version"
 msgstr  ""
 


More information about the lxc-devel mailing list