pyinfra icon indicating copy to clipboard operation
pyinfra copied to clipboard

Current LXD support doesn't support remote servers

Open goetzk opened this issue 9 months ago • 1 comments

(I'm bringing this in from the matrix chat so it can be tracked)

Describe the bug

I've had a quick look at existing LXD support in pyinfra and noticed the existing lxd support requires the remote to be lxc's default remote.

facts/lxd.py has no way to specify a remote server to list the instances from operations/lxd.py has no way to specify a remote server to add new instances to / remove unwanted instances from

To Reproduce

The hard coding is visible in the source code:

:~/source/pyinfra$ grep 'lxc ' pyinfra/operations/lxd.py
                yield "lxc stop {0}".format(id)
            yield "lxc delete {0}".format(id)
            yield "lxc launch {image} {id} < /dev/null".format(id=id, image=image)
:~/source/pyinfra$ grep 'lxc ' pyinfra/facts/lxd.py
        return "lxc list --format json --fast"

Its possible this will use the default remote configured for lxc but I haven't tested.

Expected behavior

Some way to access a remote server to manage instances.

As noted in #677#issuecomment-2644410227 I'm doing some experiments with pyinfra and LXD so might be able to look at this issue as part of that process.

goetzk avatar Feb 08 '25 01:02 goetzk