Merge pull request #750 from mwhudson/autoinstall-no-net

fix autoinstall crash with no network
This commit is contained in:
Michael Hudson-Doyle 2020-05-05 16:14:29 +12:00 committed by GitHub
commit 449f459ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 29 deletions

View File

@ -78,7 +78,10 @@ class MirrorController(SubiquityController):
async def apply_autoinstall_config(self, context):
if not self.geoip_enabled:
return
if self.lookup_task.task is None:
return
try:
with context.child('waiting'):
await asyncio.wait_for(self.lookup_task.wait(), 10)
except asyncio.TimeoutError:
pass
@ -90,8 +93,8 @@ class MirrorController(SubiquityController):
self.check_state = CheckState.CHECKING
self.lookup_task.start_sync()
async def lookup(self):
with self.context.child("lookup"):
@with_context()
async def lookup(self, context):
try:
response = await run_in_thread(
requests.get, "https://geoip.ubuntu.com/lookup")