Skip to content

Commit

Permalink
fix(agent): Don't bail out if we cannot find a WSL adapter
Browse files Browse the repository at this point in the history
It could be the case that there is no instance
No instance means no system distro and no WSL net adapter.
Without this the agent will exit quickly and never have a chance to talk to Landscape to receive an install command.
  • Loading branch information
CarlosNihelton committed Jul 16, 2024
1 parent 2f1353b commit 7cdaefd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion windows-agent/internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ func (d Daemon) Serve(ctx context.Context, args ...Option) (err error) {

wslIP, err := getWslIP(ctx, args...)
if err != nil {
return fmt.Errorf("could not get the WSL adapter IP: %v", err)
log.Errorf(ctx, "could not get the WSL adapter IP: %v", err)
wslIP = net.IPv4(127, 0, 0, 1)
}

var cfg net.ListenConfig
Expand Down
2 changes: 1 addition & 1 deletion windows-agent/internal/daemon/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func findWslAdapterIP(opts options) (net.IP, error) {
return node.ip(), nil
}

return nil, fmt.Errorf("could not find WSL adapter")
return nil, fmt.Errorf("could not find WSL adapter, check if there exists a WSL instance")
}

// networkingMode detects whether the WSL network is mirrored or not.
Expand Down

0 comments on commit 7cdaefd

Please sign in to comment.