pylxd icon indicating copy to clipboard operation
pylxd copied to clipboard

API can't connect to LXD socket on Fedora 30 if installed from GANTO repository (official procedure)

Open tanacca opened this issue 6 years ago • 2 comments

Issue: following the procedure from linuxcontainers.org installing LXD 3.X on Fedora 30 from the GANTO repository (not SNAPD method) the default LXD socket path results in "/run/lxd.socket", which is not expected in "pylxd/client" (line 280ish).

doing

from pylxd import Client client = Client()

generate an error. A condition such as "elif os.path.exists('/run/lxd.socket'): path = '/run/lxd.socket' might be added.

Also doing

from pylxd import Client client = Client('/run/lxd.socket')

generate an error as well because the condition for manual socket path verification uses the "os.path.isfile(endpoint)" method which check regular files but not unix sockets. I think a "os.path.exists(endpoint)" may be more appropriate.

Dario

tanacca avatar Jul 01 '19 11:07 tanacca

I agree with the os.path.exists(...) rather than isfile(...). I think the isfile() is an error, when it was introduced.

Patches welcome, please, if you have the time?

As a work around, you can set the "LXD_DIR" env variable to perform an override, but it looks for unix.socket rather than lxd.socket which is a bit annoying.

ajkavanagh avatar Jul 01 '19 13:07 ajkavanagh

I have created the pull request

tanacca avatar Jul 01 '19 13:07 tanacca