Merge pull request #644 from mwhudson/moar-restarting

restart subiquity when snap refresh completes
This commit is contained in:
Michael Hudson-Doyle 2020-03-04 16:08:13 +01:00 committed by GitHub
commit bd50b17f3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -90,9 +90,9 @@ class RefreshController(SubiquityController):
except requests.exceptions.RequestException as e:
raise e
if change['status'] == 'Done':
# Will only get here dry run mode as part of the refresh is us
# getting restarted by snapd...
return
# Clearly if we got here we didn't get restarted by
# snapd/systemctl (dry-run mode or logged in via SSH)
self.app.restart()
if change['status'] not in ['Do', 'Doing']:
raise Exception("update failed")
await asyncio.sleep(0.1)

View File

@ -134,6 +134,13 @@ class Subiquity(Application):
else:
super().exit()
def restart(self):
self.urwid_loop.screen.stop()
cmdline = ['snap', 'run', 'subiquity']
if self.opts.dry_run:
cmdline = [sys.executable] + sys.argv
os.execvp(cmdline[0], cmdline)
def make_screen(self):
if self.interactive():
return super().make_screen()

View File

@ -244,8 +244,7 @@ class ErrorReportStretchy(Stretchy):
self.app.debug_shell()
def restart(self, sender):
# We rely on systemd restarting us.
self.app.exit()
self.app.restart()
def view_report(self, sender):
self.app.run_command_in_foreground(["less", self.report.path])