Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch around detection of whether unix socket is snap or pkg #366

Merged

Conversation

ajkavanagh
Copy link
Contributor

A previous change (which added LXD_DIR) switched around the detection of
whether LXD is installed as a snap or a package to "test for packaged
first". Unfortunately, the LXD pkg leaves behind the unix socket after
it is uninstalled when the snap is installed on xenial and a lxd.migrate
command is issued. This means that the detection code fails. This
patch reverts the behaviour to look "test for snapped first".

This is reasonable as the only way that a both unix socket files could
exist is if the snapped version was added to a pkg version default
install (e.g. Xenial). As running both isn't really a supported
scenario, the default of checking for the snap first is more likely to
work in most default scenarios. The LXD_DIR environment variable is
still available if it needs overriding for the corner cases.

Fixes: #365

@ajkavanagh ajkavanagh force-pushed the bug/365/revert-to-snap-first-discovery branch from 83a338f to 2271ffb Compare June 10, 2019 17:58
A previous change (which added LXD_DIR) switched around the detection of
whether LXD is installed as a snap or a package to "test for packaged
first".  Unfortunately, the LXD pkg leaves behind the unix socket after
it is uninstalled when the snap is installed on xenial and a lxd.migrate
command is issued.  This means that the detection code fails.  This
patch reverts the behaviour to look "test for snapped first".

This is reasonable as the only way that a both unix socket files could
exist is if the snapped version was added to a pkg version default
install (e.g. Xenial).  As running both isn't really a supported
scenario, the default of checking for the snap first is more likely to
work in most default scenarios.  The LXD_DIR environment variable is
still available if it needs overriding for the corner cases.

Fixes: canonical#365
Signed-off-by: Alex Kavanagh <alex.kavanagh@canonical.com>
@ajkavanagh ajkavanagh force-pushed the bug/365/revert-to-snap-first-discovery branch from 2271ffb to 25aaf6b Compare June 11, 2019 11:59
@codecov-io
Copy link

Codecov Report

Merging #366 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #366   +/-   ##
=======================================
  Coverage   96.44%   96.44%           
=======================================
  Files          12       12           
  Lines        1042     1042           
  Branches      120      120           
=======================================
  Hits         1005     1005           
  Misses         16       16           
  Partials       21       21
Impacted Files Coverage Δ
pylxd/client.py 98.8% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7812f95...25aaf6b. Read the comment docs.

@javacruft javacruft merged commit 068bc78 into canonical:master Jun 11, 2019
@ajkavanagh ajkavanagh deleted the bug/365/revert-to-snap-first-discovery branch June 13, 2019 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pylxd Connection error on fresh installed LXD from snap
3 participants