apt: use wording final instead of elected to reduce coupling with mirror
The mirror model has the notion of primary candidates, staged primary candidate and elected primary candidate. This is purely specific to the mirror model and does not necessarily make sense from the outside. In code that does not specifically need to know implmentation details of the mirror model, we now prefer the wording "final configuration" over "elected configuration". Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
c5a0b567b4
commit
eb255c6996
|
@ -112,9 +112,9 @@ class AptConfigurer:
|
||||||
self.install_tree: Optional[OverlayMountpoint] = None
|
self.install_tree: Optional[OverlayMountpoint] = None
|
||||||
self.install_mount = None
|
self.install_mount = None
|
||||||
|
|
||||||
def apt_config(self, elected: bool):
|
def apt_config(self, final: bool):
|
||||||
cfg = {}
|
cfg = {}
|
||||||
if elected:
|
if final:
|
||||||
merge_config(cfg,
|
merge_config(cfg,
|
||||||
self.app.base_model.mirror.get_apt_config_elected())
|
self.app.base_model.mirror.get_apt_config_elected())
|
||||||
else:
|
else:
|
||||||
|
@ -123,12 +123,12 @@ class AptConfigurer:
|
||||||
merge_config(cfg, self.app.base_model.proxy.get_apt_config())
|
merge_config(cfg, self.app.base_model.proxy.get_apt_config())
|
||||||
return {'apt': cfg}
|
return {'apt': cfg}
|
||||||
|
|
||||||
async def apply_apt_config(self, context, elected: bool):
|
async def apply_apt_config(self, context, final: bool):
|
||||||
self.configured_tree = await self.mounter.setup_overlay([self.source])
|
self.configured_tree = await self.mounter.setup_overlay([self.source])
|
||||||
|
|
||||||
config_location = os.path.join(
|
config_location = os.path.join(
|
||||||
self.app.root, 'var/log/installer/subiquity-curtin-apt.conf')
|
self.app.root, 'var/log/installer/subiquity-curtin-apt.conf')
|
||||||
generate_config_yaml(config_location, self.apt_config(elected))
|
generate_config_yaml(config_location, self.apt_config(final))
|
||||||
self.app.note_data_for_apport("CurtinAptConfig", config_location)
|
self.app.note_data_for_apport("CurtinAptConfig", config_location)
|
||||||
|
|
||||||
await run_curtin_command(
|
await run_curtin_command(
|
||||||
|
|
|
@ -241,11 +241,11 @@ class MirrorController(SubiquityController):
|
||||||
# recommended. Clients should do a POST request to /mirror with
|
# recommended. Clients should do a POST request to /mirror with
|
||||||
# null as the body instead.
|
# null as the body instead.
|
||||||
await self.find_and_elect_candidate_mirror(self.context)
|
await self.find_and_elect_candidate_mirror(self.context)
|
||||||
await self.apt_configurer.apply_apt_config(self.context, elected=True)
|
await self.apt_configurer.apply_apt_config(self.context, final=True)
|
||||||
|
|
||||||
async def run_mirror_testing(self, output: io.StringIO) -> None:
|
async def run_mirror_testing(self, output: io.StringIO) -> None:
|
||||||
await self.source_configured_event.wait()
|
await self.source_configured_event.wait()
|
||||||
await self.apt_configurer.apply_apt_config(self.context, elected=False)
|
await self.apt_configurer.apply_apt_config(self.context, final=False)
|
||||||
await self.apt_configurer.run_apt_config_check(output)
|
await self.apt_configurer.run_apt_config_check(output)
|
||||||
|
|
||||||
async def wait_config(self):
|
async def wait_config(self):
|
||||||
|
|
|
@ -68,7 +68,7 @@ class TestAptConfigurer(SubiTestCase):
|
||||||
self.astart_sym = "subiquity.server.apt.astart_command"
|
self.astart_sym = "subiquity.server.apt.astart_command"
|
||||||
|
|
||||||
def test_apt_config_noproxy(self):
|
def test_apt_config_noproxy(self):
|
||||||
config = self.configurer.apt_config(elected=True)
|
config = self.configurer.apt_config(final=True)
|
||||||
self.assertNotIn("http_proxy", config["apt"])
|
self.assertNotIn("http_proxy", config["apt"])
|
||||||
self.assertNotIn("https_proxy", config["apt"])
|
self.assertNotIn("https_proxy", config["apt"])
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class TestAptConfigurer(SubiTestCase):
|
||||||
proxy = 'http://apt-cacher-ng:3142'
|
proxy = 'http://apt-cacher-ng:3142'
|
||||||
self.model.proxy.proxy = proxy
|
self.model.proxy.proxy = proxy
|
||||||
|
|
||||||
config = self.configurer.apt_config(elected=True)
|
config = self.configurer.apt_config(final=True)
|
||||||
self.assertEqual(proxy, config["apt"]["http_proxy"])
|
self.assertEqual(proxy, config["apt"]["http_proxy"])
|
||||||
self.assertEqual(proxy, config["apt"]["https_proxy"])
|
self.assertEqual(proxy, config["apt"]["https_proxy"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue