The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3576
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) === This fixes the config dir handling of LXD on Windows. Before this, it'd fail if the config dir didn't exist AND defaulted to c:\.config\lxc as the default path, which is obviously wrong and unsuitable for unprivileged Windows users. This solves it by moving things under the user's home directory and also creates the paths as needed. This will require a manual fix for existing users. Moving c:\.config to c:\Users\USERNAME\.config but it's unlikely that we had very many functional users given that bug so it shouldn't end up being too painful a fix. @techtonik FYI, as this is likely to affect you.
From 0d927771bee6d2fc7cd7ce077a927969af97724e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Fri, 21 Jul 2017 14:40:45 +0200 Subject: [PATCH 1/2] lxc: Cross-platform HOME handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3573 Signed-off-by: Stéphane Graber <[email protected]> --- lxc/main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lxc/main.go b/lxc/main.go index 3d0c245d9..d5b940fca 100644 --- a/lxc/main.go +++ b/lxc/main.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "os/exec" + "os/user" "path" "path/filepath" "strings" @@ -48,9 +49,16 @@ func run() error { forceLocal := gnuflag.Bool("force-local", false, i18n.G("Force using the local unix socket")) noAlias := gnuflag.Bool("no-alias", false, i18n.G("Ignore aliases when determining what command to run")) - configDir := "$HOME/.config/lxc" + var configDir string if os.Getenv("LXD_CONF") != "" { configDir = os.Getenv("LXD_CONF") + } else { + user, err := user.Current() + if err != nil { + return err + } + + configDir = path.Join(user.HomeDir, ".config", "lxc") } configPath = os.ExpandEnv(path.Join(configDir, "config.yml")) From d2af30d1e8d935e723983df50a16e7c7abff8821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Fri, 21 Jul 2017 14:55:04 +0200 Subject: [PATCH 2/2] lxc: Create missing config paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <[email protected]> --- lxc/remote.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lxc/remote.go b/lxc/remote.go index 8d1c8269d..594d24566 100644 --- a/lxc/remote.go +++ b/lxc/remote.go @@ -71,6 +71,14 @@ func (c *remoteCmd) flags() { } func (c *remoteCmd) generateClientCertificate(conf *config.Config) error { + // Create the config path if needed + if !shared.PathExists(conf.ConfigDir) { + err := os.MkdirAll(conf.ConfigDir, 0750) + if err != nil { + return fmt.Errorf(i18n.G("Could not create config dir")) + } + } + // Generate a client certificate if necessary. The default repositories are // either local or public, neither of which requires a client certificate. // Generation of the cert is delayed to avoid unnecessary overhead, e.g in
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
