Skip to content

Commit

Permalink
Merge pull request voxpupuli#987 from wyardley/add_passenger_version_…
Browse files Browse the repository at this point in the history
…ensure

add passenger_package_ensure parameter to allow pinning passenger version
  • Loading branch information
dhoppe authored Dec 29, 2016
2 parents d57fc07 + d6c757f commit fba9a43
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 35 deletions.
14 changes: 8 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
$package_source = 'nginx',
$package_flavor = undef,
$manage_repo = $::nginx::params::manage_repo,
$passenger_package_ensure = 'present',
### END Package Configuration ###

### START Service Configuation ###
Expand Down Expand Up @@ -267,12 +268,13 @@
### END VALIDATIONS ###

class { '::nginx::package':
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
package_flavor => $package_flavor,
notify => Class['::nginx::service'],
manage_repo => $manage_repo,
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
package_flavor => $package_flavor,
passenger_package_ensure => $passenger_package_ensure,
notify => Class['::nginx::service'],
manage_repo => $manage_repo,
}

include '::nginx::config'
Expand Down
37 changes: 20 additions & 17 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
#
# This class file is not called directly
class nginx::package(
$package_name = $::nginx::params::package_name,
$package_source = 'nginx',
$package_ensure = 'present',
$package_flavor = undef,
$manage_repo = $::nginx::params::manage_repo,
$package_name = $::nginx::params::package_name,
$package_source = 'nginx',
$package_ensure = 'present',
$package_flavor = undef,
$passenger_package_ensure = 'present',
$manage_repo = $::nginx::params::manage_repo,
) {

assert_private()
Expand All @@ -29,22 +30,24 @@
case $::osfamily {
'redhat': {
class { '::nginx::package::redhat':
manage_repo => $manage_repo,
package_source => $package_source,
package_ensure => $package_ensure,
package_name => $package_name,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
manage_repo => $manage_repo,
package_source => $package_source,
package_ensure => $package_ensure,
passenger_package_ensure => $passenger_package_ensure,
package_name => $package_name,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'debian': {
class { '::nginx::package::debian':
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
manage_repo => $manage_repo,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
passenger_package_ensure => $passenger_package_ensure,
manage_repo => $manage_repo,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'Solaris': {
Expand Down
13 changes: 7 additions & 6 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# Sample Usage:
#
# This class file is not called directly
class nginx::package::debian(
$manage_repo = true,
$package_name = 'nginx',
$package_source = 'nginx',
$package_ensure = 'present'
class nginx::package::debian (
$manage_repo = true,
$package_name = 'nginx',
$package_source = 'nginx',
$package_ensure = 'present',
$passenger_package_ensure = 'present'
) {

$distro = downcase($::operatingsystem)
Expand Down Expand Up @@ -58,7 +59,7 @@
Package['apt-transport-https','ca-certificates'] -> Apt::Source['nginx']

package { 'passenger':
ensure => 'present',
ensure => $passenger_package_ensure,
require => Exec['apt_update'],
}

Expand Down
11 changes: 6 additions & 5 deletions manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#
# This class file is not called directly
class nginx::package::redhat (
$manage_repo = true,
$package_ensure = 'present',
$package_name = 'nginx',
$package_source = 'nginx-stable',
$manage_repo = true,
$package_ensure = 'present',
$package_name = 'nginx',
$package_source = 'nginx-stable',
$passenger_package_ensure = 'present',
) {

#Install the CentOS-specific packages on that OS, otherwise assume it's a RHEL
Expand Down Expand Up @@ -84,7 +85,7 @@
}

package { 'passenger':
ensure => present,
ensure => $passenger_package_ensure,
require => Yumrepo['passenger'],
}

Expand Down
10 changes: 9 additions & 1 deletion spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@
end
it { is_expected.to contain_yumrepo('passenger').that_comes_before('Package[nginx]') }
it { is_expected.to contain_yumrepo('nginx-release').that_comes_before('Package[nginx]') }
it { is_expected.to contain_package('passenger') }
it { is_expected.to contain_package('passenger').with('ensure' => 'present') }
end

describe 'installs the requested passenger package version' do
let(:params) { { package_source: 'passenger', passenger_package_ensure: '4.1.0-1.el9' } }

it 'installs specified version exactly' do
is_expected.to contain_package('passenger').with('ensure' => '4.1.0-1.el9')
end
end

context 'manage_repo => false' do
Expand Down

0 comments on commit fba9a43

Please sign in to comment.