Merge lp:~mvo/snappy/15.04-lp1490574-systemd-type-forking into lp:~snappy-dev/snappy/15.04-deprecated

Proposed by Michael Vogt
Status: Merged
Approved by: Michael Vogt
Approved revision: 470
Merged at revision: 478
Proposed branch: lp:~mvo/snappy/15.04-lp1490574-systemd-type-forking
Merge into: lp:~snappy-dev/snappy/15.04-deprecated
Diff against target: 104 lines (+34/-7)
5 files modified
docs/meta.md (+3/-1)
snappy/click.go (+1/-0)
snappy/click_test.go (+25/-4)
snappy/snapp.go (+1/-0)
systemd/systemd.go (+4/-2)
To merge this branch: bzr merge lp:~mvo/snappy/15.04-lp1490574-systemd-type-forking
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
John Lenton (community) Approve
Review via email: mp+270357@code.launchpad.net

Commit message

Add support for "forking"

Description of the change

Backport of the trunk branch that adds "type: forking" to the services yaml to support daemons that fork with systemd.

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) :
review: Approve
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

Attempt to merge into lp:snappy/15.04 failed due to conflicts:

text conflict in snappy/click.go
text conflict in snappy/click_test.go
text conflict in systemd/systemd.go

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

Attempt to merge into lp:snappy/15.04 failed due to conflicts:

text conflict in snappy/click.go
text conflict in snappy/click_test.go
text conflict in systemd/systemd.go

470. By Michael Vogt

merged lp:snappy/15.04 and resolved conflicts

Revision history for this message
Michael Vogt (mvo) wrote :

Fixed now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'docs/meta.md'
--- docs/meta.md 2015-09-08 06:47:10 +0000
+++ docs/meta.md 2015-09-11 19:56:24 +0000
@@ -46,7 +46,9 @@
46 * `stop`: (optional) the command to stop the service46 * `stop`: (optional) the command to stop the service
47 * `stop-timeout`: (optional) the time in seconds to wait for the47 * `stop-timeout`: (optional) the time in seconds to wait for the
48 service to stop48 service to stop
49 * `poststop`: a command that runs after the service has stopped49 * `poststop`: (optional) a command that runs after the service has stopped
50 * `forking`: (optional) set to "true" if the service calls fork() as
51 part of its startup
50 * `caps`: (optional) list of additional security policies to add.52 * `caps`: (optional) list of additional security policies to add.
51 See `security.md` for details53 See `security.md` for details
52 * `security-template`: (optional) alternate security template to use54 * `security-template`: (optional) alternate security template to use
5355
=== modified file 'snappy/click.go'
--- snappy/click.go 2015-09-08 06:47:10 +0000
+++ snappy/click.go 2015-09-11 19:56:24 +0000
@@ -530,6 +530,7 @@
530 IsFramework: m.Type == SnapTypeFramework,530 IsFramework: m.Type == SnapTypeFramework,
531 IsNetworked: service.Ports != nil && len(service.Ports.External) > 0,531 IsNetworked: service.Ports != nil && len(service.Ports.External) > 0,
532 BusName: service.BusName,532 BusName: service.BusName,
533 Forking: service.Forking,
533 UdevAppName: udevPartName,534 UdevAppName: udevPartName,
534 Socket: service.Socket,535 Socket: service.Socket,
535 SocketFileName: socketFileName,536 SocketFileName: socketFileName,
536537
=== modified file 'snappy/click_test.go'
--- snappy/click_test.go 2015-09-09 07:59:00 +0000
+++ snappy/click_test.go 2015-09-11 19:56:24 +0000
@@ -1200,12 +1200,33 @@
1200[Install]1200[Install]
1201WantedBy=multi-user.target1201WantedBy=multi-user.target
1202`1202`
1203 expectedServiceAppWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target", ".canonical", "canonical", "\n", helpers.UbuntuArchitecture())1203 expectedServiceAppWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target", ".canonical", "canonical", "\n", helpers.UbuntuArchitecture())
1204 expectedNetAppWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target\nAfter=snappy-wait4network.service\nRequires=snappy-wait4network.service", ".canonical", "canonical", "\n", helpers.UbuntuArchitecture())1204 expectedNetAppWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target\nAfter=snappy-wait4network.service\nRequires=snappy-wait4network.service", ".canonical", "canonical", "\n", helpers.UbuntuArchitecture())
1205 expectedServiceFmkWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "Before=ubuntu-snappy.frameworks.target\nAfter=ubuntu-snappy.frameworks-pre.target\nRequires=ubuntu-snappy.frameworks-pre.target", "", "", "BusName=foo.bar.baz\nType=dbus", helpers.UbuntuArchitecture())1205 expectedServiceFmkWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "Before=ubuntu-snappy.frameworks.target\nAfter=ubuntu-snappy.frameworks-pre.target\nRequires=ubuntu-snappy.frameworks-pre.target", "", "", "BusName=foo.bar.baz\nType=dbus", helpers.UbuntuArchitecture())
1206 expectedSocketUsingWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "After=ubuntu-snappy.frameworks.target xkcd-webserver_xkcd-webserver_0.3.4.socket\nRequires=ubuntu-snappy.frameworks.target xkcd-webserver_xkcd-webserver_0.3.4.socket", ".canonical", "canonical", "\n", helpers.UbuntuArchitecture())1206 expectedSocketUsingWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "After=ubuntu-snappy.frameworks.target xkcd-webserver_xkcd-webserver_0.3.4.socket\nRequires=ubuntu-snappy.frameworks.target xkcd-webserver_xkcd-webserver_0.3.4.socket", ".canonical", "canonical", "\n", helpers.UbuntuArchitecture())
1207 expectedTypeForkingFmkWrapper = fmt.Sprintf(expectedServiceWrapperFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target", ".canonical", "canonical", "Type=forking\n", helpers.UbuntuArchitecture())
1207)1208)
12081209
1210func (s *SnapTestSuite) TestSnappyGenerateSnapServiceTypeForking(c *C) {
1211 service := Service{
1212 Name: "xkcd-webserver",
1213 Start: "bin/foo start",
1214 Stop: "bin/foo stop",
1215 PostStop: "bin/foo post-stop",
1216 StopTimeout: DefaultTimeout,
1217 Description: "A fun webserver",
1218 Forking: true,
1219 }
1220 pkgPath := "/apps/xkcd-webserver.canonical/0.3.4/"
1221 aaProfile := "xkcd-webserver.canonical_xkcd-webserver_0.3.4"
1222 m := packageYaml{Name: "xkcd-webserver",
1223 Version: "0.3.4"}
1224
1225 generatedWrapper, err := generateSnapServicesFile(service, pkgPath, aaProfile, &m)
1226 c.Assert(err, IsNil)
1227 c.Assert(generatedWrapper, Equals, expectedTypeForkingFmkWrapper)
1228}
1229
1209func (s *SnapTestSuite) TestSnappyGenerateSnapServiceAppWrapper(c *C) {1230func (s *SnapTestSuite) TestSnappyGenerateSnapServiceAppWrapper(c *C) {
1210 service := Service{1231 service := Service{
1211 Name: "xkcd-webserver",1232 Name: "xkcd-webserver",
12121233
=== modified file 'snappy/snapp.go'
--- snappy/snapp.go 2015-09-08 06:47:10 +0000
+++ snappy/snapp.go 2015-09-11 19:56:24 +0000
@@ -145,6 +145,7 @@
145 PostStop string `yaml:"poststop,omitempty" json:"poststop,omitempty"`145 PostStop string `yaml:"poststop,omitempty" json:"poststop,omitempty"`
146 StopTimeout Timeout `yaml:"stop-timeout,omitempty" json:"stop-timeout,omitempty"`146 StopTimeout Timeout `yaml:"stop-timeout,omitempty" json:"stop-timeout,omitempty"`
147 BusName string `yaml:"bus-name,omitempty" json:"bus-name,omitempty"`147 BusName string `yaml:"bus-name,omitempty" json:"bus-name,omitempty"`
148 Forking bool `yaml:"forking,omitempty" json:"forking,omitempty"`
148149
149 // set to yes if we need to create a systemd socket for this service150 // set to yes if we need to create a systemd socket for this service
150 Socket bool `yaml:"socket,omitempty" json:"socket,omitempty"`151 Socket bool `yaml:"socket,omitempty" json:"socket,omitempty"`
151152
=== modified file 'systemd/systemd.go'
--- systemd/systemd.go 2015-09-09 07:59:00 +0000
+++ systemd/systemd.go 2015-09-11 19:56:24 +0000
@@ -84,6 +84,7 @@
84 IsFramework bool84 IsFramework bool
85 IsNetworked bool85 IsNetworked bool
86 BusName string86 BusName string
87 Forking bool
87 UdevAppName string88 UdevAppName string
88 Socket bool89 Socket bool
89 SocketFileName string90 SocketFileName string
@@ -199,8 +200,9 @@
199{{if .Stop}}ExecStop=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStop}}{{end}}200{{if .Stop}}ExecStop=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStop}}{{end}}
200{{if .PostStop}}ExecStopPost=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathPostStop}}{{end}}201{{if .PostStop}}ExecStopPost=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathPostStop}}{{end}}
201{{if .StopTimeout}}TimeoutStopSec={{.StopTimeout.Seconds}}{{end}}202{{if .StopTimeout}}TimeoutStopSec={{.StopTimeout.Seconds}}{{end}}
202{{if .BusName}}BusName={{.BusName}}{{end}}203{{if .BusName}}BusName={{.BusName}}
203{{if .BusName}}Type=dbus{{end}}204Type=dbus{{else}}{{if .Forking}}Type=forking{{end}}
205{{end}}
204206
205[Install]207[Install]
206WantedBy={{.ServiceSystemdTarget}}208WantedBy={{.ServiceSystemdTarget}}

Subscribers

People subscribed via source and target branches