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

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) ===
The $SNAP environment variable used to signal that LXD is running inside
a snap can be empty, which results in HostPath being a no-op inside a
snap. Instead we just use os.LookupEnv.

Fixes #5730
Signed-off-by: Aleksa Sarai <[email protected]>
From fb38532b0327d31955a367d8c3dc375feebae2c5 Mon Sep 17 00:00:00 2001
From: Aleksa Sarai <[email protected]>
Date: Wed, 8 May 2019 11:33:57 +1000
Subject: [PATCH] shared: fix $SNAP handling under new snappy

The $SNAP environment variable used to signal that LXD is running inside
a snap can be empty, which results in HostPath being a no-op inside a
snap. Instead we just use os.LookupEnv.

Signed-off-by: Aleksa Sarai <[email protected]>
---
 shared/util.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shared/util.go b/shared/util.go
index 4f98cbbb26..fb03e2ee4a 100644
--- a/shared/util.go
+++ b/shared/util.go
@@ -120,9 +120,9 @@ func HostPath(path string) string {
        }
 
        // Check if we're running in a snap package
-       snap := os.Getenv("SNAP")
+       _, inSnap := os.LookupEnv("SNAP")
        snapName := os.Getenv("SNAP_NAME")
-       if snap == "" || snapName != "lxd" {
+       if !inSnap || snapName != "lxd" {
                return path
        }
 
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to