Merge pull request #924 from mwhudson/lp-1921820-2

more reliably restart client when server restarts
This commit is contained in:
Michael Hudson-Doyle 2021-03-31 13:30:56 +13:00 committed by GitHub
commit 26593f4c16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,3 @@
#!/bin/sh
# snapd will restart snap.subiquity.subiquity-service.service for us,
# but any processes running on the serial lines are created via
# systemd overrides in the installer layer of the squashfs and so need
# restarting separately.
systemctl restart 'serial-subiquity@*.service'
mkdir -p /run/subiquity
touch /run/subiquity/updating

View File

@ -191,7 +191,6 @@ class RefreshController(SubiquityController):
@with_context()
async def start_update(self, context):
open(self.app.state_path('updating'), 'w').close()
change = await self.app.snapd.post(
'v2/snaps/{}'.format(self.snap_name),
{'action': 'refresh'})

View File

@ -118,6 +118,9 @@ class ResponseSet:
return _FakeFileResponse(f)
update_marker_file = '.subiquity/run/subiquity/updating'
class FakeSnapdConnection:
def __init__(self, snap_data_dir, scale_factor):
self.snap_data_dir = snap_data_dir
@ -130,6 +133,8 @@ class FakeSnapdConnection:
def post(self, path, body, **args):
if path == "v2/snaps/subiquity" and body['action'] == 'refresh':
# The post-refresh hook does this in the real world.
open(update_marker_file, 'w').close()
return _FakeMemoryResponse({
"type": "async",
"change": "7",