The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6776
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) ===
From 008309aa61b367284306a01957dfb707f4d7356b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Sat, 25 Jan 2020 23:17:38 +0200 Subject: [PATCH 1/2] lxd/instances: Don't rquire type on copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #6774 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/containers_post.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lxd/containers_post.go b/lxd/containers_post.go index a13838351b..f78781b903 100644 --- a/lxd/containers_post.go +++ b/lxd/containers_post.go @@ -550,6 +550,11 @@ func createFromCopy(d *Daemon, project string, req *api.InstancesPost) response. return response.BadRequest(err) } + // If type isn't specified, match the source type. + if req.Type == "" { + dbType = source.Type() + } + if dbType != instancetype.Any && dbType != source.Type() { return response.BadRequest(fmt.Errorf("Instance type should not be specified or should match source type")) } From ee49331382e6b2ad180af0a8c423e582bd3d49d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Sat, 25 Jan 2020 23:55:42 +0200 Subject: [PATCH 2/2] lxc/config: Tweak argument processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #6754 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxc/config.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lxc/config.go b/lxc/config.go index 5ad44a14b3..636d6df333 100644 --- a/lxc/config.go +++ b/lxc/config.go @@ -479,9 +479,35 @@ func (c *cmdConfigSet) Run(cmd *cobra.Command, args []string) error { return err } + hasKeyValue := func(args []string) bool { + for _, arg := range args { + if strings.Contains(arg, "=") { + return true + } + } + + return false + } + + onlyKeyValue := func(args []string) bool { + for _, arg := range args { + if !strings.Contains(arg, "=") { + return false + } + } + + return true + } + // Parse remote remote := "" - if len(args) != 2 && !strings.Contains(args[0], "=") { + if onlyKeyValue(args) { + // server set with: <key>=<value>... + remote = "" + } else if len(args) == 2 && !hasKeyValue(args) { + // server set with: <key> <value> + remote = "" + } else { remote = args[0] }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel