shuffle run loop around
This commit is contained in:
parent
0012c5ff70
commit
caf713d289
|
@ -33,6 +33,9 @@ class SubiquityController(BaseController):
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
super().__init__(app)
|
super().__init__(app)
|
||||||
self.autoinstall_applied = False
|
self.autoinstall_applied = False
|
||||||
|
self.setup_autoinstall()
|
||||||
|
|
||||||
|
def setup_autoinstall(self):
|
||||||
if app.autoinstall_config:
|
if app.autoinstall_config:
|
||||||
ai_data = app.autoinstall_config.get(
|
ai_data = app.autoinstall_config.get(
|
||||||
self.autoinstall_key,
|
self.autoinstall_key,
|
||||||
|
|
|
@ -17,6 +17,7 @@ import asyncio
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import urwid
|
import urwid
|
||||||
|
@ -152,27 +153,40 @@ class Subiquity(Application):
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.opts.autoinstall is not None:
|
|
||||||
with open(self.opts.autoinstall) as fp:
|
|
||||||
self.autoinstall_config = yaml.safe_load(fp)
|
|
||||||
self.controllers.load("Reporting")
|
|
||||||
self.controllers.load("Early")
|
|
||||||
self.controllers.Reporting.start()
|
|
||||||
self.aio_loop.run_until_complete(self.controllers.Early.run())
|
|
||||||
self.new_event_loop()
|
|
||||||
with open(self.opts.autoinstall) as fp:
|
|
||||||
self.autoinstall_config = yaml.safe_load(fp)
|
|
||||||
try:
|
try:
|
||||||
|
if self.opts.autoinstall is not None:
|
||||||
|
with open(self.opts.autoinstall) as fp:
|
||||||
|
self.autoinstall_config = yaml.safe_load(fp)
|
||||||
|
self.controllers.load("Reporting")
|
||||||
|
self.controllers.Reporting.start()
|
||||||
|
self.controllers.load("Error")
|
||||||
|
self.controllers.load("Early")
|
||||||
|
if self.controllers.Early.cmds:
|
||||||
|
self.aio_loop.run_until_complete(
|
||||||
|
self.controllers.Early.run())
|
||||||
|
self.new_event_loop()
|
||||||
|
with open(self.opts.autoinstall) as fp:
|
||||||
|
self.autoinstall_config = yaml.safe_load(fp)
|
||||||
|
for controller in self.controllers.instances:
|
||||||
|
controller.setup_autoinstall()
|
||||||
super().run()
|
super().run()
|
||||||
self.new_event_loop()
|
if self.controllers.Late.cmds:
|
||||||
self.aio_loop.run_until_complete(self.controllers.Late.run())
|
self.new_event_loop()
|
||||||
|
self.aio_loop.run_until_complete(self.controllers.Late.run())
|
||||||
except Exception:
|
except Exception:
|
||||||
print("generating crash report")
|
print("generating crash report")
|
||||||
report = self.make_apport_report(
|
report = self.make_apport_report(
|
||||||
ErrorReportKind.UI, "Installer UI", interrupt=False, wait=True)
|
ErrorReportKind.UI, "Installer UI", interrupt=False, wait=True)
|
||||||
print("report saved to {}".format(report.path))
|
print("report saved to {}".format(report.path))
|
||||||
self._remove_last_screen()
|
Error = getattr(self.controllers, "Error", None)
|
||||||
raise
|
if Error is not None and Error.cmds:
|
||||||
|
self.new_event_loop()
|
||||||
|
self.aio_loop.run_until_complete(Error.run())
|
||||||
|
if self.interactive():
|
||||||
|
self._remove_last_screen()
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
signal.pause()
|
||||||
|
|
||||||
def report_start_event(self, name, description, level="INFO"):
|
def report_start_event(self, name, description, level="INFO"):
|
||||||
self.controllers.Reporting.report_start_event(
|
self.controllers.Reporting.report_start_event(
|
||||||
|
|
Loading…
Reference in New Issue