Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/customservice/manifests/supervisor.pp

Issue 29329307: Issue 3211 - Integrate customservice::supervisor with notification daemon (Closed)
Left Patch Set: Issue 3211 - Address feedback from codereview Created Oct. 21, 2015, 12:08 p.m.
Right Patch Set: Issue 3211 - Address feedback from codereview Created Oct. 26, 2015, 12:14 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | modules/notificationserver/manifests/init.pp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 # == Type: customservice::supervisor
2 #
3 # Periodically check for and revive dead service processes.
4 #
5 # === Parameters:
6 #
7 # [*ensure*]
8 # Whether to ensure the service record being 'present' or not within
9 # the list of services recognized by the supervisor.
10 #
11 # [*name*]
12 # The $name of the service, matching it's name in the init system, i.e.
13 # the init-script's basename. Defaults to $title.
14 #
15 # [*pidfile*]
16 # The path to the process ID file associated with the service, if present.
17 #
18 # === Examples:
19 #
20 # customservice::supervisor {'example':
21 # name => 'sshd',
22 # ensure => 'present',
23 # }
24 #
25 # customservice::supervisor {'spawn-fcgi':
26 # pidfile => '/var/run/500-example_spawn-fcgi.pid',
27 # }
28 #
29 define customservice::supervisor (
30 $ensure = 'present',
31 $pidfile = "/var/run/$name.pid"
32 ) {
33
34 include sitescripts
35
36 $config = '/etc/customservice_supervisor.ini'
37 $module = 'sitescripts.management.bin.start_services'
38 $target = 'customservice::supervisor'
39
40 ensure_resource('concat', $target, {
41 path => $config,
42 })
43
44 ensure_resource('concat::fragment', $target, {
45 content => "[keep_alive_services]\n",
46 order => 0,
47 target => $target,
48 })
49
50 ensure_resource('cron', $target, {
51 command => "SITESCRIPTS_CONFIG=$config python -m $module",
52 environment => concat(hiera('cron::environment', []), [
53 'PYTHONPATH=/opt/sitescripts',
54 ]),
55 require => [
56 Class['sitescripts'],
57 Concat::Fragment[$target],
58 ],
59 })
60
61 concat::fragment {"$target#$name":
62 content => "$name = $pidfile\n",
63 ensure => $ensure ? {
64 /^(absent|purged)$/ => 'absent',
65 default => 'present',
66 },
67 order => 1,
68 target => $target,
69 }
70 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld