Skip to content

Commit

Permalink
lxd/provider: Skip determining unix socket if a remote config address…
Browse files Browse the repository at this point in the history
… is set

Signed-off-by: Din Music <[email protected]>
  • Loading branch information
MusicDin committed Oct 20, 2023
1 parent 708baed commit f072c02
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lxd/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,11 @@ func (p *lxdProvider) GetServer(remoteName string) (lxd.Server, error) {
}
}

// If scheme is set to unix, but address (socket path) is not provided
remoteConfig := p.getRemoteConfig(remoteName)

// If remote address is not provided or socket path is missing
// then determine which LXD directory contains a writable unix socket.
if (remote.scheme == "" || remote.scheme == "unix") && remote.address == "" {
if remoteConfig.Addr == "" || remoteConfig.Addr == "unix://" {
lxdDir, err := determineLxdDir()
if err != nil {
return nil, err
Expand All @@ -550,7 +552,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:
Expand Down

0 comments on commit f072c02

Please sign in to comment.