ubuntu-pro: actually show the screen with warning for future LTSes

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2024-02-08 09:22:22 +01:00
parent 20b131ce07
commit fc5adf2946
2 changed files with 27 additions and 2 deletions

View File

@ -78,3 +78,25 @@ class TestUbuntuProController(unittest.IsolatedAsyncioTestCase):
view.assert_called_once_with(
ctrler, token="", has_network=False, pre_release=True
)
@patch("subiquity.client.controllers.ubuntu_pro.UbuntuProView")
@patch(
"subiquity.client.controllers.ubuntu_pro.lsb_release",
return_value={
"description": "Ubuntu R R (development branch)",
"release": "26.04",
},
)
async def test_make_ui__26_04_future(self, release, view):
ctrler = self.ctrler
rv = UbuntuProResponse(token="", has_network=False)
with patch.object(ctrler.endpoint, "GET", return_value=rv):
await ctrler.make_ui()
view.assert_called_once()
view.assert_called_once_with(
ctrler, token="", has_network=False, pre_release=True
)

View File

@ -66,8 +66,11 @@ class UbuntuProController(SubiquityTuiController):
lsb = lsb_release(dry_run=dry_run)
if "LTS" not in lsb["description"]:
# TODO remove special handling of 24.04 when it is marked LTS
if lsb["release"] == "24.04":
major, minor = lsb["release"].split(".")
# If running a pre-LTS (e.g., 24.04, 26.04, ...), show the SSH UI
# for testing, but with a warning.
if int(major) >= 20 and int(major) % 2 == 0 and minor == "04":
pre_release = True
else:
await self.endpoint.skip.POST()