fix(agent): Don't bail out if we cannot find a WSL adapter #840
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The UP4W background agent relies on the existence of the WSL net adapter and the distro instance to properly detect on which address it should serve.
Clean installs of Windows with recent versions of WSL won’t have any of those until the user creates the first WSL instance.
The
daemon
reports the error to find the address and the agent quickly exits.We need to detect that situation and listen on localhost, so we have time to read Landscape information from registry (or talk to the GUI), so that we may end up creating WSL instances for the current user.
The current implementation won't never allow that, because the agent exits early if the WSL adapter address is not found.
There is a secondary issue to this: once an instance is created it won’t be able to talk to the agent if the networking mode is NAT (the current default), because
wsl-pro-service
expects the agent listening on the WSL adapter. At least the provisioning tasks are delivered via cloud-init, thus independently of the communication to the agent, so that lack of communication won’t be an apparent issue and it solves itself when the agent restarts.No user 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.