diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index bf25aac1..8181bfe1 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -56,8 +56,8 @@ class FilesystemController(ControllerPolicy): curtin_write_storage_actions(actions=actions) log.info("Generating post-install config") curtin_write_postinst_config() + urwid.emit_signal(self.signal, 'installprogress:do-initial-install') urwid.emit_signal(self.signal, 'identity:show') - # self.install_progress() # Filesystem/Disk partition ----------------------------------------------- def disk_partition(self, disk): diff --git a/subiquity/controllers/installprogress.py b/subiquity/controllers/installprogress.py index a5feaef3..7f13c9bf 100644 --- a/subiquity/controllers/installprogress.py +++ b/subiquity/controllers/installprogress.py @@ -29,57 +29,44 @@ class InstallProgressController(ControllerPolicy): self.signal = signal self.opts = opts self.model = InstallProgressModel() - self.progress_output_w = ProgressOutput( - self.signal, - "Waiting...") @coroutine - def run_curtin(self): - try: - yield utils.run_command_async( - "/usr/local/bin/curtin_wrap.sh", - self.install_progress_status) - except Exception as e: - # TODO: Implement an Error View/Controller for displaying - # exceptions rather than kicking out of installer. - log.error("Problem running curtin_wrap: {}".format(e)) + def curtin_dispatch(self): + if self.opts.dry_run: + log.debug("Install Progress: Curtin dispatch dry-run") + yield utils.run_command_async("cat /var/log/syslog", + log.debug) + else: + try: + yield utils.run_command_async("/usr/local/bin/curtin_wrap.sh", + log.debug) + except: + log.error("Problem with curtin dispatch run") + raise Exception("Problem with curtin dispatch run") @coroutine - def run_test_curtin(self): - """ testing streaming output - """ - self.install_progress_status("Starting run") - yield utils.run_command_async( - "cat /var/log/syslog", - self.install_progress_status) - log.debug("done") - return - - def install_progress(self): - title = ("Installing system") - excerpt = ("Please wait for the installation " - "to finish before rebooting.") - footer = ("Thank you for using Ubuntu!") - self.ui.set_header(title, excerpt) - self.ui.set_footer(footer) - self.ui.set_body(ProgressView(self.signal, self.progress_output_w)) + def initial_install(self): + # title = ("Installing system") + # excerpt = ("Please wait for the installation " + # "to finish before rebooting.") + # footer = ("Thank you for using Ubuntu!") + # self.ui.set_header(title, excerpt) + # self.ui.set_footer(footer) + # self.ui.set_body(ProgressView(self.signal, self.progress_output_w)) if self.opts.dry_run: log.debug("Filesystem: this is a dry-run") - banner = [ - "**** DRY_RUN ****", - "NOT calling:" - "subprocess.check_call(/usr/local/bin/curtin_wrap.sh)" - "", - "", - "Press (Q) to Quit." - ] - self.install_progress_status("\n".join(banner)) - # XXX: Test routine to verify the callback streaming - # self.run_test_curtin() + # banner = [ + # "**** DRY_RUN ****", + # "NOT calling:" + # "subprocess.check_call(/usr/local/bin/curtin_wrap.sh)" + # "", + # "", + # "Press (Q) to Quit." + # ] + # self.install_progress_status("\n".join(banner)) + yield utils.run_command_async("cat /var/log/syslog", + log.debug) else: log.debug("filesystem: this is the *real* thing") - self.run_curtin() - - def install_progress_status(self, data): - self.progress_output_w.set_text(data) - self.signal.emit_signal('refresh') + yield utils.run_command_async( + "/usr/local/bin/curtin_wrap.sh", log.debug) diff --git a/subiquity/models/installprogress.py b/subiquity/models/installprogress.py index 8b1256f5..2fa0d1dd 100644 --- a/subiquity/models/installprogress.py +++ b/subiquity/models/installprogress.py @@ -29,8 +29,11 @@ class InstallProgressModel(ModelPolicy): signals = [ ("Installprogress view", - 'installprogress:show', - 'install_progress') + 'installprogress:do-initial-install', + 'initial_install'), + ("Run once curtin commands", + 'installprogress:curtin-dispatch', + 'curtin_dispatch') ] installprogress_menu = [] diff --git a/subiquity/ui/views/identity.py b/subiquity/ui/views/identity.py index 76a5d7ae..cc198d71 100644 --- a/subiquity/ui/views/identity.py +++ b/subiquity/ui/views/identity.py @@ -96,7 +96,7 @@ class IdentityView(ViewPolicy): "confirm_password": self.confirm_password.value } log.debug("User input: {}".format(result)) - emit_signal(self.signal, 'installprogress:show') + emit_signal(self.signal, 'installprogress:curtin-dispatch') def cancel(self, button): self.signal.emit_signal("quit")