Merge lp:~jamesodhunt/snappy/systemd-unit-fixes into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by James Hunt
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 274
Merged at revision: 274
Proposed branch: lp:~jamesodhunt/snappy/systemd-unit-fixes
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 38 lines (+13/-7)
1 file modified
snappy/click.go (+13/-7)
To merge this branch: bzr merge lp:~jamesodhunt/snappy/systemd-unit-fixes
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Review via email: mp+254434@code.launchpad.net

Commit message

Use correct systemd unit directive ExecStopPost (instead of ExecPostStop)

Description of the change

The current systemd units that get generated are invalid:

* generateSnapServicesFile():
  - Fix incorrect unit directive (ExecStopPost=, not ExecPostStop=).
  - Specify full paths for ExecStop= and ExecStopPost= to ensure unit is
    valid.

Ideally, we should probably check them for validity using systemd-verify. If snappy doesn't do this, we should atleast add a check to lp:snappy/selftest for the installed apps.

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

Thanks, good catch.

I'm much in favor of using systemd-verify - it seems its systemd-analyize verify nowdays(?)

review: Approve
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~jamesodhunt/snappy/systemd-unit-fixes into lp:snappy failed. Below is the output from the failed tests.

Checking formatting
Installing godeps
Install golint
Obtaining dependencies
update code.google.com/p/go.crypto failed; trying to fetch newer version
update github.com/blakesmith/ar failed; trying to fetch newer version
code.google.com/p/go.crypto now at 69e2a90ed92d03812364aeb947b7068dc42e561e
update github.com/cheggaaa/pb failed; trying to fetch newer version
github.com/blakesmith/ar now at c9a977dd0cc1392b023382c7bfa5a22af8d3b730
update github.com/jessevdk/go-flags failed; trying to fetch newer version
github.com/cheggaaa/pb now at e8c7cc515bfde3e267957a3b110080ceed51354e
update github.com/juju/loggo failed; trying to fetch newer version
github.com/jessevdk/go-flags now at 15347ef417a300349807983f15af9e65cd2e1b3a
update github.com/mvo5/goconfigparser failed; trying to fetch newer version
github.com/juju/loggo now at 4c7cbce140ca070eeb59a28f4bf9507e511711f9
update gopkg.in/yaml.v2 failed; trying to fetch newer version
github.com/mvo5/goconfigparser now at 26426272dda20cc76aa1fa44286dc743d2972fe8
update launchpad.net/gocheck failed; trying to fetch newer version
gopkg.in/yaml.v2 now at 49c95bdc21843256fb6c4e0d370a05f24a0bf213
7 repositories updated; 1 failed

# we always run in a fresh dir in tarmac
export GOPATH=$(mktemp -d)
trap 'rm -rf "$GOPATH"' EXIT

# this is a hack, but not sure tarmac is golang friendly
mkdir -p $GOPATH/src/launchpad.net/snappy
cp -a . $GOPATH/src/launchpad.net/snappy/
cd $GOPATH/src/launchpad.net/snappy

./run-checks

LANG=C

if which goctest >/dev/null; then
    goctest="goctest"
else
    goctest="go test"
fi

echo Checking formatting
fmt=$(gofmt -l .)

if [ -n "$fmt" ]; then
    echo "Formatting wrong in following files"
    echo $fmt
    exit 1
fi

echo Installing godeps
go get launchpad.net/godeps
export PATH=$PATH:$GOPATH/bin

echo Install golint
go get github.com/golang/lint/golint
export PATH=$PATH:$GOPATH/bin

echo Obtaining dependencies
godeps -u dependencies.tsv
godeps: cannot update "/tmp/tmp.0iqoCNv74W/src/launchpad.net/gocheck": # cd .; bzr branch https://launchpad.net/gocheck /tmp/tmp.0iqoCNv74W/src/launchpad.net/gocheck
bzr: ERROR: Invalid http response for http://bazaar.launchpad.net/~niemeyer/gocheck/trunk/.bzr/branch-format: Unable to handle http code 503: Service Temporarily Unavailable
package launchpad.net/gocheck: exit status 3

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy/click.go'
2--- snappy/click.go 2015-03-27 11:36:27 +0000
3+++ snappy/click.go 2015-03-27 17:38:26 +0000
4@@ -409,8 +409,8 @@
5 WorkingDirectory={{.AppPath}}
6 Environment="SNAPP_APP_PATH={{.AppPath}}" "SNAPP_APP_DATA_PATH=/var/lib{{.AppPath}}" "SNAPP_APP_USER_DATA_PATH=%h{{.AppPath}}" "SNAP_APP_PATH={{.AppPath}}" "SNAP_APP_DATA_PATH=/var/lib{{.AppPath}}" "SNAP_APP_USER_DATA_PATH=%h{{.AppPath}}" "SNAP_APP={{.AppTriple}}"
7 AppArmorProfile={{.AaProfile}}
8-{{if .Stop}}ExecStop={{.Stop}}{{end}}
9-{{if .PostStop}}ExecPostStop={{.PostStop}}{{end}}
10+{{if .Stop}}ExecStop={{.FullPathStop}}{{end}}
11+{{if .PostStop}}ExecStopPost={{.FullPathPostStop}}{{end}}
12 {{if .StopTimeout}}TimeoutStopSec={{.StopTimeout}}{{end}}
13
14 [Install]
15@@ -421,12 +421,18 @@
16 wrapperData := struct {
17 packageYaml
18 Service
19- AppPath string
20- AaProfile string
21- FullPathStart string
22- AppTriple string
23+ AppPath string
24+ AaProfile string
25+ FullPathStart string
26+ FullPathStop string
27+ FullPathPostStop string
28+ AppTriple string
29 }{
30- *m, service, baseDir, aaProfile, filepath.Join(baseDir, service.Start), fmt.Sprintf("%s_%s_%s", m.Name, service.Name, m.Version),
31+ *m, service, baseDir, aaProfile,
32+ filepath.Join(baseDir, service.Start),
33+ filepath.Join(baseDir, service.Stop),
34+ filepath.Join(baseDir, service.PostStop),
35+ fmt.Sprintf("%s_%s_%s", m.Name, service.Name, m.Version),
36 }
37 if err := t.Execute(&templateOut, wrapperData); err != nil {
38 // this can never happen, except we forget a variable

Subscribers

People subscribed via source and target branches