Showing with 138 additions and 85 deletions.
  1. +2 −0 CHANGELOG
  2. +1 −1 README.md
  3. +15 −14 manifests/webhook.pp
  4. +1 −1 metadata.json
  5. +0 −68 spec/classes/webhook.rb
  6. +118 −0 spec/classes/webhook_spec.rb
  7. +1 −1 templates/webhook.yaml.erb
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2.7.4 - Rob Nelson
* Fix #162 for FOSS ruby 1.8.7 webhook.yaml issues
2.7.3 - esalberg
* Regression from 2.7.1
2.7.2 - Federico Voges & Ben ford
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ You can override this by passing the `version` parameter.
| Module Version | r10k Version |
| -------------- | ------------ |
| Next Release | [![Latest Version](https://img.shields.io/gem/v/r10k.svg?style=flat-square)](https://rubygems.org/gems/r10k) |
| v2.7.x | 1.5.0 |
| v2.7.x | 1.5.1 |
| v2.6.5 | 1.4.1 |
| v2.5.4 | 1.4.0 |
| v2.4.4 | 1.3.5 |
Expand Down
29 changes: 15 additions & 14 deletions manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
}

file { '/var/log/webhook':
ensure => 'directory',
owner => $user,
group => $group,
recurse => true,
before => File['webhook_bin'],
ensure => 'directory',
owner => $user,
group => $group,
recurse => true,
before => File['webhook_bin'],
}

file { '/var/run/webhook':
Expand Down Expand Up @@ -48,7 +48,16 @@
}

if $::is_pe == true or $::is_pe == 'true' {
if !defined(Package['sinatra']) {
package { 'sinatra':
ensure => installed,
provider => 'pe_gem',
before => Service['webhook'],
}
}

if versioncmp($::pe_version, '3.7.0') >= 0 {

if !defined(Package['rack']) {
package { 'rack':
ensure => installed,
Expand All @@ -57,14 +66,6 @@
}
}

if !defined(Package['sinatra']) {
package { 'sinatra':
ensure => installed,
provider => 'pe_gem',
before => Service['webhook'],
}
}

# 3.7 does not place the certificate in peadmin's ~
# This places it there as if it was an upgrade
file { 'peadmin-cert.pem':
Expand All @@ -73,7 +74,7 @@
owner => 'peadmin',
group => 'peadmin',
mode => '0644',
content => file('/etc/puppetlabs/puppet/ssl/certs/pe-internal-peadmin-mcollective-client.pem'),
content => file('/etc/puppetlabs/puppet/ssl/certs/pe-internal-peadmin-mcollective-client.pem','/dev/null'),
notify => Service['webhook'],
}
}
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.3",
"version": "2.7.4",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down
68 changes: 0 additions & 68 deletions spec/classes/webhook.rb

This file was deleted.

118 changes: 118 additions & 0 deletions spec/classes/webhook_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
require 'spec_helper'
describe 'r10k::webhook' , :type => 'class' do
context 'Puppet Enterprise 3.7.0 on a RedHat 5 installing webhook' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '5',
:operatingsystem => 'Centos',
:is_pe => 'true',
:pe_version => '3.7.0'
}
end
it { should contain_package('sinatra').with(
'ensure' => 'installed',
'provider' => 'pe_gem'
)
}

it { should contain_package('sinatra').with(
'ensure' => 'installed',
'provider' => 'pe_gem'
)
}
it { should contain_file('peadmin-cert.pem').with(
'path' => '/var/lib/peadmin/.mcollective.d/peadmin-cert.pem',
'ensure' => 'file',
'owner' => 'peadmin',
'group' => 'peadmin',
'mode' => '0644'
)
}
end
context 'Puppet 2.7.0 FOSS on a RedHat 5 installing webhook' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '5',
:operatingsystem => 'Centos',
:puppetversion => '2.7.0'
}
end

it { should contain_package('sinatra').with(
'ensure' => 'installed',
'provider' => 'gem'
)
}

it { should_not contain_package('rack').with(
'ensure' => 'installed'
)
}
end
context 'Puppet FOSS 3.7.1 on a RedHat 5 installing webhook' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '5',
:operatingsystem => 'Centos',
:puppetversion => '3.7.1'
}
end

it { should contain_package('sinatra').with(
'ensure' => 'installed',
'provider' => 'gem'
)
}

it { should contain_package('webrick').with(
'ensure' => 'installed',
'provider' => 'gem'
)
}

it { should contain_package('rack').with(
'ensure' => 'installed',
'provider' => 'gem'
)
}

it { should contain_package('sinatra').with(
'ensure' => 'installed',
'provider' => 'gem'
)
}

it { should contain_package('json').with(
'ensure' => 'installed',
'provider' => 'gem'
)
}

it { should_not contain_file('peadmin-cert.pem').with(
'path' => '/var/lib/peadmin/.mcollective.d/peadmin-cert.pem'
)
}
end
context 'Puppet FOSS 3.2.1 on a RedHat 5 installing webhook' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '5',
:operatingsystem => 'Centos',
:puppetversion => '3.2.1'
}
end
it { should_not contain_package('rack').with(
'ensure' => 'installed',
'provider' => 'gem'
)
}
it { should_not contain_file('peadmin-cert.pem').with(
'path' => '/var/lib/peadmin/.mcollective.d/peadmin-cert.pem'
)
}
end
end
2 changes: 1 addition & 1 deletion templates/webhook.yaml.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= @webhook_hash.select!{ |k,v| v != :undef }.to_yaml %>
<%= @webhook_hash.to_yaml %>