Merge lp:~mterry/snappy/systemd-restart into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 487
Merged at revision: 492
Proposed branch: lp:~mterry/snappy/systemd-restart
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 35 lines (+3/-0)
3 files modified
snappy/click_test.go (+1/-0)
systemd/systemd.go (+1/-0)
systemd/systemd_test.go (+1/-0)
To merge this branch: bzr merge lp:~mterry/snappy/systemd-restart
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve
Michael Vogt (community) Approve
Review via email: mp+261266@code.launchpad.net

Commit message

Set all app services to restart on failure.

Description of the change

Set all app services to restart on failure.

See http://www.freedesktop.org/software/systemd/man/systemd.service.html for how systemd treats Restart=on-failure.

There was talk on the snappy-app-devel mailing list about not using this key for dbus-activated services. But we don't support those right now.

(We do use the Type=dbus property, but that doesn't mean it's an dbus-activated service -- for that, we'd need to drop the [Install] section and add SystemdService= to the dbus service file. I believe... I'm not an expert with systemd.)

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks a bunch! This looks good.

review: Approve
Revision history for this message
Martin Pitt (pitti) wrote :

LGTM.

For D-Bus services, these indeed don't have an [Install], but Type=dbus and BusName=org.bla.foo instead. For those we indeed shouldn't have a Restart=, but having it is not the end of the world (mostly just an optimization problem).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'snappy/click_test.go'
--- snappy/click_test.go 2015-06-03 14:03:45 +0000
+++ snappy/click_test.go 2015-06-05 18:36:45 +0000
@@ -1162,6 +1162,7 @@
11621162
1163[Service]1163[Service]
1164ExecStart=/usr/bin/ubuntu-core-launcher xkcd-webserver%s xkcd-webserver%[2]s_xkcd-webserver_0.3.4 /apps/xkcd-webserver%[2]s/0.3.4/bin/foo start1164ExecStart=/usr/bin/ubuntu-core-launcher xkcd-webserver%s xkcd-webserver%[2]s_xkcd-webserver_0.3.4 /apps/xkcd-webserver%[2]s/0.3.4/bin/foo start
1165Restart=on-failure
1165WorkingDirectory=/apps/xkcd-webserver%[2]s/0.3.4/1166WorkingDirectory=/apps/xkcd-webserver%[2]s/0.3.4/
1166Environment="SNAP_APP=xkcd-webserver_xkcd-webserver_0.3.4" "TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "TEMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAP_APP_PATH=/apps/xkcd-webserver%[2]s/0.3.4/" "SNAP_APP_DATA_PATH=/var/lib/apps/xkcd-webserver%[2]s/0.3.4/" "SNAP_APP_TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAP_NAME=xkcd-webserver" "SNAP_VERSION=0.3.4" "SNAP_ORIGIN=%[3]s" "SNAP_FULLNAME=xkcd-webserver%[2]s" "SNAP_ARCH=%[5]s" "SNAP_APP_USER_DATA_PATH=%%h/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_PATH=/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_DATA_PATH=/var/lib/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAPPY_APP_ARCH=%[5]s" "SNAPP_APP_USER_DATA_PATH=%%h/apps/xkcd-webserver%[2]s/0.3.4/"1167Environment="SNAP_APP=xkcd-webserver_xkcd-webserver_0.3.4" "TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "TEMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAP_APP_PATH=/apps/xkcd-webserver%[2]s/0.3.4/" "SNAP_APP_DATA_PATH=/var/lib/apps/xkcd-webserver%[2]s/0.3.4/" "SNAP_APP_TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAP_NAME=xkcd-webserver" "SNAP_VERSION=0.3.4" "SNAP_ORIGIN=%[3]s" "SNAP_FULLNAME=xkcd-webserver%[2]s" "SNAP_ARCH=%[5]s" "SNAP_APP_USER_DATA_PATH=%%h/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_PATH=/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_DATA_PATH=/var/lib/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAPPY_APP_ARCH=%[5]s" "SNAPP_APP_USER_DATA_PATH=%%h/apps/xkcd-webserver%[2]s/0.3.4/"
1167ExecStop=/usr/bin/ubuntu-core-launcher xkcd-webserver%[2]s xkcd-webserver%[2]s_xkcd-webserver_0.3.4 /apps/xkcd-webserver%[2]s/0.3.4/bin/foo stop1168ExecStop=/usr/bin/ubuntu-core-launcher xkcd-webserver%[2]s xkcd-webserver%[2]s_xkcd-webserver_0.3.4 /apps/xkcd-webserver%[2]s/0.3.4/bin/foo stop
11681169
=== modified file 'systemd/systemd.go'
--- systemd/systemd.go 2015-06-03 14:01:51 +0000
+++ systemd/systemd.go 2015-06-05 18:36:45 +0000
@@ -181,6 +181,7 @@
181181
182[Service]182[Service]
183ExecStart=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStart}}183ExecStart=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStart}}
184Restart=on-failure
184WorkingDirectory={{.AppPath}}185WorkingDirectory={{.AppPath}}
185Environment="SNAP_APP={{.AppTriple}}" {{.EnvVars}}186Environment="SNAP_APP={{.AppTriple}}" {{.EnvVars}}
186{{if .Stop}}ExecStop=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStop}}{{end}}187{{if .Stop}}ExecStop=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStop}}{{end}}
187188
=== modified file 'systemd/systemd_test.go'
--- systemd/systemd_test.go 2015-06-03 14:03:45 +0000
+++ systemd/systemd_test.go 2015-06-05 18:36:45 +0000
@@ -155,6 +155,7 @@
155155
156[Service]156[Service]
157ExecStart=/usr/bin/ubuntu-core-launcher app%[2]s aa-profile /apps/app%[2]s/1.0/bin/start157ExecStart=/usr/bin/ubuntu-core-launcher app%[2]s aa-profile /apps/app%[2]s/1.0/bin/start
158Restart=on-failure
158WorkingDirectory=/apps/app%[2]s/1.0/159WorkingDirectory=/apps/app%[2]s/1.0/
159Environment="SNAP_APP=app_service_1.0" "TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "TEMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAP_APP_PATH=/apps/app%[2]s/1.0/" "SNAP_APP_DATA_PATH=/var/lib/apps/app%[2]s/1.0/" "SNAP_APP_TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAP_NAME=app" "SNAP_VERSION=1.0" "SNAP_ORIGIN=%[3]s" "SNAP_FULLNAME=app%[2]s" "SNAP_ARCH=%[5]s" "SNAP_APP_USER_DATA_PATH=%%h/apps/app%[2]s/1.0/" "SNAPP_APP_PATH=/apps/app%[2]s/1.0/" "SNAPP_APP_DATA_PATH=/var/lib/apps/app%[2]s/1.0/" "SNAPP_APP_TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAPPY_APP_ARCH=%[5]s" "SNAPP_APP_USER_DATA_PATH=%%h/apps/app%[2]s/1.0/"160Environment="SNAP_APP=app_service_1.0" "TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "TEMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAP_APP_PATH=/apps/app%[2]s/1.0/" "SNAP_APP_DATA_PATH=/var/lib/apps/app%[2]s/1.0/" "SNAP_APP_TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAP_NAME=app" "SNAP_VERSION=1.0" "SNAP_ORIGIN=%[3]s" "SNAP_FULLNAME=app%[2]s" "SNAP_ARCH=%[5]s" "SNAP_APP_USER_DATA_PATH=%%h/apps/app%[2]s/1.0/" "SNAPP_APP_PATH=/apps/app%[2]s/1.0/" "SNAPP_APP_DATA_PATH=/var/lib/apps/app%[2]s/1.0/" "SNAPP_APP_TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAPPY_APP_ARCH=%[5]s" "SNAPP_APP_USER_DATA_PATH=%%h/apps/app%[2]s/1.0/"
160ExecStop=/usr/bin/ubuntu-core-launcher app%[2]s aa-profile /apps/app%[2]s/1.0/bin/stop161ExecStop=/usr/bin/ubuntu-core-launcher app%[2]s aa-profile /apps/app%[2]s/1.0/bin/stop

Subscribers

People subscribed via source and target branches