Skip to content
Snippets Groups Projects
Commit f554bcf4 authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

Make sure worker services are enabled

The generator depends on the contents of /etc/softwareheritage/worker, which is
now empty.
parent 2b23dcef
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
# This systemd generator creates dependency symlinks that make all swh-worker
# instances in /etc/softwareheritage/worker/ be started/stopped/reloaded when
# swh-worker.service is started/stopped/reloaded.
set -eu
gendir="$1"
wantdir="$1/swh-worker.service.wants"
swhworkerservice="/etc/systemd/system/swh-worker@.service"
mkdir -p "$wantdir"
for conf in /etc/softwareheritage/worker/*.ini; do
test -e "$conf" || continue
base=$(basename $conf)
instancename=$(basename $base .ini)
ln -s "$swhworkerservice" "$wantdir/swh-worker@$instancename.service"
done
exit 0
......@@ -31,12 +31,7 @@ class profile::swh::deploy::worker::base {
}
file {$systemd_generator:
ensure => 'present',
owner => 'root',
group => 'root',
mode => '0755',
source => 'puppet:///modules/profile/swh/deploy/worker/swh-worker-generator',
ensure => 'absent',
notify => Class['systemd::systemctl::daemon_reload'],
}
}
......@@ -37,13 +37,17 @@ define profile::swh::deploy::worker::instance (
}
if $ensure == 'running' {
service {$service_basename:
ensure => $ensure,
require => [
File[$config_file],
]
}
$service_ensure = 'running'
} else {
$service_ensure = undef
}
service {$service_basename:
ensure => $service_ensure,
enable => true,
require => [
File[$config_file],
]
}
}
default: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment