Switch around detection of whether unix socket is snap or pkg #366
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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