oem: skip listing OEM metapkgs on ubuntu-server

OEM meta-packages have an attribute stating if they want the OEM kernel
or the "default" kernel to be installed alongside them.

That said, in the OEM archive, they expect the "default" OEM kernel to
be the HWE kernel. This is only true for ubuntu-desktop. Let's not
install OEM meta-packages on ubuntu-server for now.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2023-06-26 16:05:52 +02:00
parent 69a840fdb9
commit 527522f748
2 changed files with 29 additions and 5 deletions

View File

@ -94,6 +94,16 @@ class OEMController(SubiquityController):
async def load_metapackages_list(self, context) -> None:
with context.child("wait_apt"):
await self._wait_apt.wait()
# Skip looking for OEM meta-packages if we are running ubuntu-server.
# OEM meta-packages expect the default kernel flavor to be HWE (which
# is only true for ubuntu-desktop).
if self.app.base_model.source.current.variant == "server":
log.debug("not listing OEM meta-packages since we are installing"
" ubuntu-server")
self.model.metapkgs = []
return
apt = self.app.controllers.Mirror.final_apt_configurer
try:
async with apt.overlay() as d:

View File

@ -1707,11 +1707,13 @@ class TestOEM(TestAPI):
resp = await inst.get('/oem', wait=True)
self.assertEqual(expected_pkgs, resp['metapackages'])
async def test_listing_certified(self):
expected_pkgs = ['oem-somerville-tentacool-meta']
async def _test_listing_certified(self, source_id: str,
expected: List[str]):
with patch.dict(os.environ, {'SUBIQUITY_DEBUG': 'has-drivers'}):
async with start_server('examples/simple.json') as inst:
await inst.post('/source', source_id='ubuntu-server')
args = ['--source-catalog', 'examples/mixed-sources.yaml']
config = 'examples/simple.json'
async with start_server(config, extra_args=args) as inst:
await inst.post('/source', source_id=source_id)
names = ['locale', 'keyboard', 'source', 'network', 'proxy',
'mirror', 'storage']
await inst.post('/meta/mark_configured', endpoint_names=names)
@ -1720,7 +1722,19 @@ class TestOEM(TestAPI):
await inst.get('/meta/status', cur='NEEDS_CONFIRMATION')
resp = await inst.get('/oem', wait=True)
self.assertEqual(expected_pkgs, resp['metapackages'])
self.assertEqual(expected, resp['metapackages'])
async def test_listing_certified_ubuntu_server(self):
# Listing of OEM meta-packages is intentionally disabled on
# ubuntu-server.
await self._test_listing_certified(
source_id='ubuntu-server',
expected=[])
async def test_listing_certified_ubuntu_desktop(self):
await self._test_listing_certified(
source_id='ubuntu-desktop',
expected=['oem-somerville-tentacool-meta'])
class TestSource(TestAPI):