Skip to content

Commit

Permalink
Support camptocamp/systemd 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed May 27, 2021
1 parent 832a3a2 commit 1692fcb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ fixtures:
repo: 'https://github.com/puppetlabs/puppetlabs-selinux_core'
puppet_version: '>= 6.0.0'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
systemd:
repo: 'https://github.com/camptocamp/puppet-systemd'
ref: '2.12.0'
systemd: 'https://github.com/camptocamp/puppet-systemd'
14 changes: 12 additions & 2 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@
content => template('pulpcore/pulpcore-worker@.service.erb'),
}

# In camptocamp/systemd 3.0.0 support for Puppet < 6.1.0 was dropped.
# This means there is no single daemon-reload class anymore. This also means
# there is no more relation that ensures all services are loaded prior to running them.
$metadata = load_module_metadata('systemd')
if SemVer($metadata['version']) >= SemVer('3.0.0') {
$reload_require = undef
} else {
$reload_require = Class['systemd::systemctl::daemon_reload']
}

Integer[1, $pulpcore::worker_count].each |$n| {
service { "pulpcore-worker@${n}.service":
ensure => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
require => Class['systemd::systemctl::daemon_reload'],
require => $reload_require,
subscribe => Systemd::Unit_file['pulpcore-worker@.service'],
}
}
Expand All @@ -44,7 +54,7 @@
service { $worker:
ensure => false,
enable => false,
require => [Systemd::Unit_file['pulpcore-worker@.service'], Class['systemd::systemctl::daemon_reload']],
require => [Systemd::Unit_file['pulpcore-worker@.service'], $reload_require],
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
{
"name": "camptocamp/systemd",
"version_requirement": ">= 2.2.0 < 3.0.0"
"version_requirement": ">= 2.2.0 < 4.0.0"
},
{
"name": "puppet/extlib",
Expand Down

0 comments on commit 1692fcb

Please sign in to comment.