[lxc-devel] [lxd/master] Fix bad handling of remote operations

stgraber on Github lxc-bot at linuxcontainers.org
Tue Nov 5 16:13:58 UTC 2019


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/20191105/21f2538e/attachment.bin>
-------------- next part --------------
From 4aaaed70e2e81b1d8dfbaabf4186a576ba9a9c6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 5 Nov 2019 11:07:03 -0500
Subject: [PATCH 1/2] lxd/operations: Fix remote Wait
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6394

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/operations.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/operations.go b/lxd/operations.go
index d5a83fb4b3..780aa18fdc 100644
--- a/lxd/operations.go
+++ b/lxd/operations.go
@@ -361,12 +361,12 @@ func operationWaitGet(d *Daemon, r *http.Request) response.Response {
 		return response.SmartError(err)
 	}
 
-	_, body, err := client.GetOperationWait(id, timeout)
+	apiOp, _, err := client.GetOperationWait(id, timeout)
 	if err != nil {
 		return response.SmartError(err)
 	}
 
-	return response.SyncResponse(true, body)
+	return response.SyncResponse(true, apiOp)
 }
 
 type operationWebSocket struct {

From b7838e4c81eda1ecbaa23d9d24ee99061c1e832c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 5 Nov 2019 11:07:33 -0500
Subject: [PATCH 2/2] lxc/query: Fix handling of ?project=
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/query.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lxc/query.go b/lxc/query.go
index 88180c98ed..4cce83d90b 100644
--- a/lxc/query.go
+++ b/lxc/query.go
@@ -6,6 +6,7 @@ import (
 	"fmt"
 	"io/ioutil"
 	"net/http"
+	"net/url"
 
 	"github.com/spf13/cobra"
 
@@ -127,7 +128,12 @@ func (c *cmdQuery) Run(cmd *cobra.Command, args []string) error {
 	}
 
 	if c.flagRespWait && resp.Operation != "" {
-		resp, _, err = d.RawQuery("GET", fmt.Sprintf("%s/wait", resp.Operation), "", "")
+		uri, err := url.ParseRequestURI(resp.Operation)
+		if err != nil {
+			return err
+		}
+
+		resp, _, err = d.RawQuery("GET", fmt.Sprintf("%s/wait?%s", uri.Path, uri.RawQuery), "", "")
 		if err != nil {
 			return err
 		}


More information about the lxc-devel mailing list