[lxc-devel] [lxd/master] Bugfixes
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Feb 19 19:18:16 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/20160219/456b8745/attachment.bin>
-------------- next part --------------
From 804e1f19340d5856bfa25dbb21b8aed28997ebc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 19 Feb 2016 10:52:51 -0500
Subject: [PATCH 1/3] Fix container creation from remote image alias
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #1624
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/remote.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lxd/remote.go b/lxd/remote.go
index 238ea0e..9469ce2 100644
--- a/lxd/remote.go
+++ b/lxd/remote.go
@@ -17,10 +17,10 @@ func remoteGetImageFingerprint(d *Daemon, server string, certificate string, ali
return "", err
}
- var result shared.ImageAlias
+ var result shared.ImageAliasesEntry
if err = json.Unmarshal(resp.Metadata, &result); err != nil {
return "", fmt.Errorf("Error reading alias")
}
- return result.Name, nil
+ return result.Target, nil
}
From 68d0e52777bce612a577bdf79302cf2dab62809d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 19 Feb 2016 11:01:49 -0500
Subject: [PATCH 2/3] Fix Content-Type value for errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #1622
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/devlxd.go | 1 -
lxd/response.go | 7 ++++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lxd/devlxd.go b/lxd/devlxd.go
index 0b941ab..380da30 100644
--- a/lxd/devlxd.go
+++ b/lxd/devlxd.go
@@ -99,7 +99,6 @@ func hoistReq(f func(container, *http.Request) *devLxdResponse, d *Daemon) func(
resp := f(c, r)
if resp.code != http.StatusOK {
- w.Header().Set("Content-Type", "application/octet-stream")
http.Error(w, fmt.Sprintf("%s", resp.content), resp.code)
} else if resp.ctype == "json" {
w.Header().Set("Content-Type", "application/json")
diff --git a/lxd/response.go b/lxd/response.go
index f916a20..f4f3f48 100644
--- a/lxd/response.go
+++ b/lxd/response.go
@@ -204,7 +204,12 @@ func (r *errorResponse) Render(w http.ResponseWriter) error {
if debug {
shared.DebugJson(captured)
}
- http.Error(w, buf.String(), r.code)
+
+ w.Header().Set("Content-Type", "application/json")
+ w.Header().Set("X-Content-Type-Options", "nosniff")
+ w.WriteHeader(r.code)
+ fmt.Fprintln(w, buf.String())
+
return nil
}
From 17e323c0d46ce5595a9c5908125f18a78e03e564 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 19 Feb 2016 14:15:24 -0500
Subject: [PATCH 3/3] Don't stop containers before asking the user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #1623
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/delete.go | 27 ++++++++++++++++++---------
po/lxd.pot | 16 ++++++++--------
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/lxc/delete.go b/lxc/delete.go
index a9de74f..3b5eca0 100644
--- a/lxc/delete.go
+++ b/lxc/delete.go
@@ -37,17 +37,19 @@ func (c *deleteCmd) flags() {
gnuflag.BoolVar(&c.interactive, "interactive", false, i18n.G("Require user confirmation."))
}
-func (c *deleteCmd) doDelete(d *lxd.Client, name string) error {
- if c.interactive {
- reader := bufio.NewReader(os.Stdin)
- fmt.Printf(i18n.G("Remove %s (yes/no): "), name)
- input, _ := reader.ReadString('\n')
- input = strings.TrimSuffix(input, "\n")
- if !shared.StringInSlice(strings.ToLower(input), []string{i18n.G("yes")}) {
- return fmt.Errorf(i18n.G("User aborted delete operation."))
- }
+func (c *deleteCmd) promptDelete(name string) error {
+ reader := bufio.NewReader(os.Stdin)
+ fmt.Printf(i18n.G("Remove %s (yes/no): "), name)
+ input, _ := reader.ReadString('\n')
+ input = strings.TrimSuffix(input, "\n")
+ if !shared.StringInSlice(strings.ToLower(input), []string{i18n.G("yes")}) {
+ return fmt.Errorf(i18n.G("User aborted delete operation."))
}
+ return nil
+}
+
+func (c *deleteCmd) doDelete(d *lxd.Client, name string) error {
resp, err := d.Delete(name)
if err != nil {
return err
@@ -69,6 +71,13 @@ func (c *deleteCmd) run(config *lxd.Config, args []string) error {
return err
}
+ if c.interactive {
+ err := c.promptDelete(name)
+ if err != nil {
+ return err
+ }
+ }
+
if shared.IsSnapshot(name) {
return c.doDelete(d, name)
}
diff --git a/po/lxd.pot b/po/lxd.pot
index 22f2a39..1d5dc2c 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-02-17 21:05-0500\n"
+ "POT-Creation-Date: 2016-02-19 14:15-0500\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"
@@ -172,7 +172,7 @@ msgstr ""
msgid "Container name is: %s"
msgstr ""
-#: lxc/publish.go:133 lxc/publish.go:153
+#: lxc/publish.go:141 lxc/publish.go:156
#, c-format
msgid "Container published with fingerprint: %s"
msgstr ""
@@ -778,7 +778,7 @@ msgstr ""
msgid "Remote admin password"
msgstr ""
-#: lxc/delete.go:43
+#: lxc/delete.go:42
#, c-format
msgid "Remove %s (yes/no): "
msgstr ""
@@ -868,15 +868,15 @@ msgstr ""
msgid "Stop the container if currently running"
msgstr ""
-#: lxc/delete.go:97 lxc/publish.go:103
+#: lxc/delete.go:106 lxc/publish.go:111
msgid "Stopping container failed!"
msgstr ""
-#: lxc/delete.go:83
+#: lxc/delete.go:92
msgid "The container is currently running, stop it first or pass --force."
msgstr ""
-#: lxc/publish.go:81
+#: lxc/publish.go:89
msgid "The container is currently running. Use --force to have it stopped and restarted."
msgstr ""
@@ -927,7 +927,7 @@ msgstr ""
msgid "Usage: lxc [subcommand] [options]"
msgstr ""
-#: lxc/delete.go:47
+#: lxc/delete.go:46
msgid "User aborted delete operation."
msgstr ""
@@ -1042,7 +1042,7 @@ msgstr ""
msgid "wrong number of subcommand arguments"
msgstr ""
-#: lxc/delete.go:46 lxc/image.go:294 lxc/image.go:542
+#: lxc/delete.go:45 lxc/image.go:294 lxc/image.go:542
msgid "yes"
msgstr ""
More information about the lxc-devel
mailing list