add controller and application .interactive() methods

This commit is contained in:
Michael Hudson-Doyle 2019-12-20 13:39:54 +13:00
parent e975d187e7
commit 671febc73f
3 changed files with 22 additions and 1 deletions

View File

@ -29,6 +29,15 @@ class SubiquityController(BaseController):
def deserialize(self, state):
self.configured()
def interactive(self):
if not self.app.autoinstall_config:
return True
i_sections = self.app.autoinstall_config.get(
'interactive-sections', [])
if '*' in i_sections or self.autoinstall_key in i_sections:
return True
return False
def configured(self):
"""Let the world know that this controller's model is now configured.
"""
@ -44,7 +53,11 @@ class NoUIController(SubiquityController):
def cancel(self):
pass
def interactive(self):
return False
class RepeatedController(RepeatedController):
pass
def interactive(self):
return self.orig.interactive()

View File

@ -112,6 +112,9 @@ class InstallProgressController(SubiquityController):
self.tb_extractor = TracebackExtractor()
self.curtin_context = None
def interactive(self):
return self.app.interactive()
def start(self):
self.install_task = schedule_task(self.install(self.context))

View File

@ -152,6 +152,11 @@ class Subiquity(Application):
self.controllers.Reporting.report_finish_event(
name, description, status, level)
def interactive(self):
if not self.autoinstall_config:
return True
return bool(self.autoinstall_config.get('interactive-sections'))
def select_initial_screen(self, index):
super().select_initial_screen(index)
for report in self.controllers.Error.reports: