Merge pull request #644 from mwhudson/moar-restarting
restart subiquity when snap refresh completes
This commit is contained in:
commit
bd50b17f3c
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue