From fc0dfccf60ae0ba085e33d8640e372c8f8ecb10f Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 20 Oct 2023 17:47:51 +0200 Subject: [PATCH] lxd/provider: Skip determining unix socket if a remote config address is set Signed-off-by: Din Music --- lxd/provider.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lxd/provider.go b/lxd/provider.go index 9057d486..316b7294 100644 --- a/lxd/provider.go +++ b/lxd/provider.go @@ -537,9 +537,12 @@ func (p *lxdProvider) GetServer(remoteName string) (lxd.Server, error) { } } - // If scheme is set to unix, but address (socket path) is not provided - // then determine which LXD directory contains a writable unix socket. - if (remote.scheme == "" || remote.scheme == "unix") && remote.address == "" { + remoteConfig := p.getRemoteConfig(remoteName) + + // If remote address is not provided or is only set to the prefix for + // Unix sockets (`unix://`) then determine which LXD directory + // contains a writable unix socket. + if remoteConfig.Addr == "" || remoteConfig.Addr == "unix://" { lxdDir, err := determineLxdDir() if err != nil { return nil, err @@ -550,7 +553,7 @@ func (p *lxdProvider) GetServer(remoteName string) (lxd.Server, error) { var err error - switch p.getRemoteConfig(remoteName).Protocol { + switch remoteConfig.Protocol { case "simplestreams": client, err = p.getLXDImageClient(remoteName) default: