Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip determining unix socket if a remote config address is set #358

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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