Skip to content

Commit

Permalink
Add support for AppStream package installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik-Hansson committed Jul 20, 2021
1 parent fffe7a3 commit dd6797d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
$passenger_package_ensure = 'present',
String[1] $passenger_package_name = $nginx::params::passenger_package_name,
Optional[Stdlib::HTTPUrl] $repo_source = undef,
Optional[Float] $dnfmodule = undef,
### END Package Configuration ###

### START Service Configuation ###
Expand Down
9 changes: 9 additions & 0 deletions manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
$passenger_package_name = $nginx::passenger_package_name
$manage_repo = $nginx::manage_repo
$purge_passenger_repo = $nginx::purge_passenger_repo
$dnfmodule = $nginx::dnfmodule

#Install the CentOS-specific packages on that OS, otherwise assume it's a RHEL
#clone and provide the Red Hat-specific package. This comes into play when not
Expand Down Expand Up @@ -94,6 +95,14 @@
}
}

if $dnfmodule and ($facts['os']['name'] in ['RedHat', 'CentOS', 'VirtuozzoLinux']) and ($facts['os']['release']['major'] in ['8']) {
package { "nginx:${dnfmodule}":
ensure => present,
before => Package['nginx'],
provider => dnfmodule,
}
}

package { 'nginx':
ensure => $package_ensure,
name => $package_name,
Expand Down
18 changes: 18 additions & 0 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,24 @@
end
end

context 'dnfmodule => 1.18' do
let(:params) { { dnfmodule: 1.18 } }

if %w[8].include?(facts.dig(:os, 'release', 'major'))
it { is_expected.to contain_package('nginx') }
it do
is_expected.to contain_package('nginx:1.18').with(
'ensure' => 'present',
'before' => Package['nginx'],
'provider' => 'dnfmodule'
)
end
else
it { is_expected.to contain_package('nginx') }
it { is_expected.not_to contain_package('nginx:1.18') }
end
end

when 'Debian'
context 'using defaults' do
it { is_expected.to contain_package('nginx') }
Expand Down

0 comments on commit dd6797d

Please sign in to comment.