Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
wrappers/services: RemainAfterExit=yes for oneshot daemons w/ stop cmds #2920
Conversation
ssweeny
added some commits
Feb 22, 2017
zyga
approved these changes
Feb 22, 2017
Looks good to me. Let's get a second review before landing this. I've requested a small change for testing but consider this approved with that change in place.
| @@ -170,7 +170,7 @@ func RemoveSnapServices(s *snap.Info, inter interacter) error { | ||
| func genServiceFile(appInfo *snap.AppInfo) string { | ||
| serviceTemplate := `[Unit] | ||
| -# Auto-generated, DO NO EDIT | ||
| +# Auto-generated, DO NOT EDIT |
| @@ -204,6 +205,17 @@ WantedBy={{.ServicesTarget}} | ||
| restartCond = systemd.RestartOnFailure.String() | ||
| } | ||
| + var remain string | ||
| + if appInfo.Daemon == "oneshot" { |
zyga
Feb 22, 2017
Contributor
Just thinking aloud. Is there any other condition where we would like to have remain-after-exit set?
| + daemon: oneshot | ||
| +` | ||
| + | ||
| + info, err := snap.InfoFromSnapYaml([]byte(yamlText)) |
zyga
Feb 22, 2017
Contributor
We have snaptest.MockYaml from snap/snaptest for this purpose. Please use it here
ssweeny
Feb 22, 2017
Contributor
@zyga Do you mean snaptest.MockSnap? I don't see a MockYaml anywhere.
zyga
Feb 22, 2017
Contributor
Sorry, I meant MockInfo :-) They differ subtly but I think all you need is MockInfo
mvo5
approved these changes
Feb 23, 2017
Looks good, please do merge master into this branch, that should fix the test failure.
chipaca
merged commit e8fc228
into
snapcore:master
Feb 23, 2017
4 of 6 checks passed
xenial-ppc64el
autopkgtest finished (failure)
Details
zesty-amd64
autopkgtest finished (failure)
Details
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
xenial-amd64
autopkgtest finished (success)
Details
xenial-i386
autopkgtest finished (success)
Details
yakkety-amd64
autopkgtest finished (success)
Details
ssweeny
deleted the
ssweeny:fix-oneshot-daemons
branch
Feb 23, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ssweeny commentedFeb 22, 2017
systemd complains if you generate a service file for a oneshot daemon
that also includes an ExecStop directive but doesn't specify
RemainAfterExit=yes. systemd needs this keep track of the service after
the command exits.
Also adds a test for this and fixes a typo in the opening comment of the generated systemd unit file.
Fixes: https://bugs.launchpad.net/snappy/+bug/1647169