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

wsl: do not enable livepatch on wsl #3364

Open
wants to merge 1 commit into
base: next-v36
Choose a base branch
from
Open
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions features/livepatch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,27 @@ Feature: Livepatch
| release | machine_type |
| xenial | lxd-vm |
| bionic | lxd-vm |

Scenario Outline: Livepatch doesn't enable on wsl from a systemd service
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
When I create the file `/lib/systemd/system/test.service` with the following
"""
[Unit]
Description=test

[Service]
Type=oneshot
ExecStart=/usr/bin/pro attach <contract_token>
PrivateMounts=yes
"""
When I replace `<contract_token>` in `/lib/systemd/system/test.service` with token `contract_token`
When I run `systemctl start test.service` with sudo
Then I verify that running `canonical-livepatch` `with sudo` exits `1`
Then I will see the following on stderr
"""
sudo: canonical-livepatch: command not found
"""

Examples: ubuntu release
| release | machine_type |
| jammy | wsl |
3 changes: 2 additions & 1 deletion uaclient/entitlements/livepatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def static_affordances(self) -> Tuple[StaticAffordance, ...]:
messages.SERVICE_ERROR_INSTALL_ON_CONTAINER.format(
title=self.title
),
lambda: system.is_container(),
lambda: system.is_container()
or system.get_virt_type() == "wsl",
False,
),
(
Expand Down
Loading