Skip to content

Commit

Permalink
Merge pull request #358 from MusicDin/fix/def-remote-addr
Browse files Browse the repository at this point in the history
Skip determining unix socket if a remote config address is set
  • Loading branch information
simondeziel authored Oct 24, 2023
2 parents 708baed + fc0dfcc commit 64f071d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lxd/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 64f071d

Please sign in to comment.