Skip to content

Commit

Permalink
Pin sinatra gem
Browse files Browse the repository at this point in the history
Sinatra 2.0.0 was released on the 7th of May 2017.  It requires rack ~>
2.0 and *that* requires ruby 2.2.  Puppet 4 AIO ships with ruby 2.1, so
pin sinatra to prevent errors like.

```
Error: Execution of '/opt/puppetlabs/puppet/bin/gem install --no-rdoc
--no-ri sinatra' returned 1: ERROR:  Error installing sinatra:
        rack requires Ruby version >= 2.2.2.
```

Fixes #140
  • Loading branch information
alexjfisher committed May 9, 2017
1 parent eef5801 commit 312e759
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ class { '::r10k::webhook':
}
```

### Webhook sinatra gem installation

By default, the `r10k::webhook::package` class uses the `puppet_gem` provider to install the latest ruby 2.1 compatible version of sinatra ('~> 1.0').
If you are overriding `r10k::webhook::package::provider`, you will also need to override `r10k::webhook::package::sinatra_version`.

### Webhook Slack notifications

You can enable Slack notifications for the webhook. You will need a
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
$webhook_configfile_mode = '0644'
$webhook_ignore_environments = []
$webhook_mco_arguments = undef
$webhook_sinatra_version = '~> 1.0' # Sinatra 2 requires rack 2 which in turn requires ruby 2.2. Puppet 4 AIO ships with ruby 2.1

# Service Settings for SystemD in EL7
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '7' {
Expand Down
7 changes: 4 additions & 3 deletions manifests/webhook/package.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Private class, do not include it directly.
# Installs the webhook packages
class r10k::webhook::package (
$is_pe_server = $r10k::params::is_pe_server,
$provider = $r10k::params::provider,
$is_pe_server = $r10k::params::is_pe_server,
$provider = $r10k::params::provider,
$sinatra_version = $r10k::params::webhook_sinatra_version,
) inherits r10k::params {
if !defined(Package['sinatra']) {
package { 'sinatra':
ensure => installed,
ensure => $sinatra_version,
provider => $provider,
before => Service['webhook'],
}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/webhook/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

it do
is_expected.to contain_package('sinatra').with(
ensure: 'installed',
ensure: '~> 1.0',
provider: 'puppet_gem'
)
end
Expand All @@ -36,7 +36,7 @@
)
end

it { is_expected.to contain_package('sinatra').with(ensure: 'installed') }
it { is_expected.to contain_package('sinatra').with(ensure: '~> 1.0') }
it { is_expected.to contain_package('webrick').with(ensure: 'installed') }
it { is_expected.to contain_package('json').with(ensure: 'installed') }
end
Expand Down
7 changes: 1 addition & 6 deletions spec/classes/webhook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
)
end

it do
is_expected.to contain_package('sinatra').with(
ensure: 'installed',
provider: 'puppet_gem'
)
end
it { is_expected.to contain_class('r10k::webhook::package') }
it { is_expected.not_to contain_file('peadmin-cert.pem').with(path: '/var/lib/peadmin/.mcollective.d/peadmin-cert.pem') }
end
end
Expand Down

0 comments on commit 312e759

Please sign in to comment.