The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/pylxd/pull/250
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 3b00709783b9aa91c8ff3c0fcf0d3a36c2a65b71 Mon Sep 17 00:00:00 2001 From: Chris MacNaughton <[email protected]> Date: Tue, 26 Sep 2017 15:17:18 -0400 Subject: [PATCH 1/2] Revert "Revert "update to pmock os.path.exists"" This reverts commit 738ab033e23f61eb2c236e1d25d1c1a0c5dc8edc. --- pylxd/tests/test_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pylxd/tests/test_client.py b/pylxd/tests/test_client.py index c286cd4..088ada4 100644 --- a/pylxd/tests/test_client.py +++ b/pylxd/tests/test_client.py @@ -48,8 +48,10 @@ def tearDown(self): self.get_patcher.stop() self.post_patcher.stop() - def test_create(self): + @mock.patch('os.path.exists') + def test_create(self, _path_exists): """Client creation sets default API endpoint.""" + _path_exists.return_value = False expected = 'http+unix://%2Fvar%2Flib%2Flxd%2Funix.socket/1.0' an_client = client.Client() From 4f7056bfbe10916fc4109225d0cc38cf92a90e3f Mon Sep 17 00:00:00 2001 From: Chris MacNaughton <[email protected]> Date: Tue, 26 Sep 2017 15:17:30 -0400 Subject: [PATCH 2/2] Revert "Revert "Update pylxd to look in snap path as well"" This reverts commit be4f5dca90f8315da942502a66c50e1e1a181745. --- pylxd/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pylxd/client.py b/pylxd/client.py index 19c4ff1..499ce7d 100644 --- a/pylxd/client.py +++ b/pylxd/client.py @@ -219,7 +219,10 @@ def __init__( path = os.path.join( os.environ.get('LXD_DIR'), 'unix.socket') else: - path = '/var/lib/lxd/unix.socket' + if os.path.exists('/var/snap/lxd/common/lxd/unix.socket'): + path = '/var/snap/lxd/common/lxd/unix.socket' + else: + path = '/var/lib/lxd/unix.socket' self.api = _APINode('http+unix://{}'.format( parse.quote(path, safe='')), timeout=timeout) self.api = self.api[version]
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
