Showing with 65 additions and 3 deletions.
  1. +2 −0 CHANGELOG
  2. +9 −0 manifests/params.pp
  3. +2 −2 manifests/webhook.pp
  4. +1 −1 metadata.json
  5. +32 −0 spec/classes/webhook_spec.rb
  6. +19 −0 templates/webhook.service.erb
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2.8.0 - Tom linkin
* Support for systemd on EL7 for webhook
2.7.4 - Rob Nelson
* Fix #162 for FOSS ruby 1.8.7 webhook.yaml issues
2.7.3 - esalberg
Expand Down
9 changes: 9 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,13 @@
$mc_application_path = "${plugins_dir}/application"
$mc_http_proxy = undef
$mc_git_ssl_verify = 0

# Service Settings for SystemD in EL7
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '7' {
$webhook_service_file = '/usr/lib/systemd/system/webhook.service'
$webhook_service_template = 'webhook.service.erb'
} else {
$webhook_service_file = '/etc/init.d/webhook'
$webhook_service_template = 'webhook.init.erb'
}
}
4 changes: 2 additions & 2 deletions manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
}

file { 'webhook_init_script':
content => template('r10k/webhook.init.erb'),
path => '/etc/init.d/webhook',
content => template("r10k/${::r10k::params::webhook_service_template}"),
path => $::r10k::params::webhook_service_file,
require => Package['sinatra'],
before => File['webhook_bin'],
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": "https://github.com/acidprime/r10k",
"summary": "Module for setting up dynamic environments using r10k",
"tags": ["git", "pe", "environment", "mcollective"],
"version": "2.7.4",
"version": "2.8.0",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down
32 changes: 32 additions & 0 deletions spec/classes/webhook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,36 @@
)
}
end
context 'Enterprise Linux 7 host with systemd' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemmajrelease => '7',
:operatingsystem => 'Centos',
:is_pe => 'true',
:pe_version => '3.7.0'
}
end
it { should contain_file('webhook_init_script').with(
:path => '/usr/lib/systemd/system/webhook.service',
:content => /\[Unit\]/
)
}
end
context 'Non Enteprise Linux 7 host' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemmajrelease => '6',
:operatingsystem => 'Centos',
:is_pe => 'true',
:pe_version => '3.7.0'
}
end
it { should contain_file('webhook_init_script').with(
:path => '/etc/init.d/webhook',
:content => /#!\/bin\/bash/
)
}
end
end
19 changes: 19 additions & 0 deletions templates/webhook.service.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=R10K Webhook Service
After=syslog.target network.target

[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/webhook
User=<%= @user %>
TimeoutStartSec=90
TimeoutStopSec=30

ExecStart=/usr/local/bin/webhook

KillMode=process

StandardOutput=syslog

[Install]
WantedBy=multi-user.target