[lxc-devel] [lxd/master] Tweak to initial message in "lxc"
stgraber on Github
lxc-bot at linuxcontainers.org
Wed Jul 25 17:01:52 UTC 2018
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/20180725/3144112b/attachment.bin>
-------------- next part --------------
From 270c9d0ce80abb60f2251757104c929491dc35ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 25 Jul 2018 12:51:35 -0400
Subject: [PATCH 1/2] lxc: Switch to Ubuntu 18.04 as initial container
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/main.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxc/main.go b/lxc/main.go
index fe330e289..a212a5a4e 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -285,7 +285,7 @@ func (c *cmdGlobal) PreRun(cmd *cobra.Command, args []string) error {
}
fmt.Fprintf(os.Stderr, i18n.G("If this is your first time running LXD on this machine, you should also run: lxd init")+"\n")
- fmt.Fprintf(os.Stderr, i18n.G("To start your first container, try: lxc launch ubuntu:16.04")+"\n\n")
+ fmt.Fprintf(os.Stderr, i18n.G("To start your first container, try: lxc launch ubuntu:18.04")+"\n\n")
}
// Only setup macaroons if a config path exists (so the jar can be saved)
From ce2a62aa9c98036d3d8e348995f058de636bf0ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 25 Jul 2018 12:59:45 -0400
Subject: [PATCH 2/2] lxc: Be clever about when showing "lxd init"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #4832
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/main.go | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lxc/main.go b/lxc/main.go
index a212a5a4e..605881ff7 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -284,7 +284,20 @@ func (c *cmdGlobal) PreRun(cmd *cobra.Command, args []string) error {
return err
}
- fmt.Fprintf(os.Stderr, i18n.G("If this is your first time running LXD on this machine, you should also run: lxd init")+"\n")
+ // Attempt to connect to the local server
+ runInit := true
+ d, err := lxd.ConnectLXDUnix("", nil)
+ if err == nil {
+ info, _, err := d.GetServer()
+ if err == nil && info.Environment.Storage != "" {
+ runInit = false
+ }
+ }
+
+ if runInit {
+ fmt.Fprintf(os.Stderr, i18n.G("If this is your first time running LXD on this machine, you should also run: lxd init")+"\n")
+ }
+
fmt.Fprintf(os.Stderr, i18n.G("To start your first container, try: lxc launch ubuntu:18.04")+"\n\n")
}
More information about the lxc-devel
mailing list