The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7350

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 5799eea6a617e02f49e22bd7438d7ba0406dd5e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Mon, 11 May 2020 12:24:00 -0400
Subject: [PATCH] lxc/project: Fix remote handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxc/project.go | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lxc/project.go b/lxc/project.go
index 0978b9a832..b6a0fc6c61 100644
--- a/lxc/project.go
+++ b/lxc/project.go
@@ -404,6 +404,7 @@ func (c *cmdProjectList) Run(cmd *cobra.Command, args 
[]string) error {
        if len(args) > 0 {
                remote = args[0]
        }
+       remoteName := strings.TrimSuffix(remote, ":")
 
        resources, err := c.global.ParseServers(remote)
        if err != nil {
@@ -418,7 +419,7 @@ func (c *cmdProjectList) Run(cmd *cobra.Command, args 
[]string) error {
                return err
        }
 
-       currentProject := conf.Remotes[remote].Project
+       currentProject := conf.Remotes[remoteName].Project
        if currentProject == "" {
                currentProject = "default"
        }
@@ -681,16 +682,15 @@ func (c *cmdProjectSwitch) Run(cmd *cobra.Command, args 
[]string) error {
        conf := c.global.conf
 
        // Sanity checks
-       exit, err := c.global.CheckArgs(cmd, args, 1, 2)
+       exit, err := c.global.CheckArgs(cmd, args, 1, 1)
        if exit {
                return err
        }
 
-       remote := conf.DefaultRemote
-       project := args[0]
-       if len(args) > 1 {
-               remote = args[0]
-               project = args[1]
+       // Parse the remote
+       remote, project, err := conf.ParseRemote(args[0])
+       if err != nil {
+               return err
        }
 
        // Make sure the remote exists
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to