Skip to content

Commit

Permalink
Enable Ruby 2.7 when setting up Foreman repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Apr 9, 2021
1 parent 616f172 commit 2a9f9ed
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
8 changes: 8 additions & 0 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
if $configure_scl_repo {
Foreman::Repos['foreman'] -> Package['centos-release-scl-rh']
}

if $facts['os']['release']['major'] == '8' and ($repo == 'nightly' or versioncmp($repo, '2.5') >= 0) {
package { 'ruby:2.7':
ensure => installed,
enable_only => true,
provider => 'dnfmodule',
}
}
}

if $configure_scl_repo {
Expand Down
31 changes: 31 additions & 0 deletions spec/classes/foreman_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
is_expected.not_to contain_package('centos-release-scl-rh')
end
end

it do
if facts[:operatingsystemmajrelease] == '8'
is_expected.to contain_package('ruby:2.7')
else
is_expected.not_to contain_package('ruby:2.7')
end
end
end

describe 'with explicit parameters' do
Expand All @@ -51,6 +59,29 @@
end

it { is_expected.not_to contain_package('centos-release-scl-rh') }

it do
is_expected.not_to contain_package('ruby:2.7')
end
end

describe 'with repo set to 2.5' do
let :params do
{
repo: '2.5',
configure_scl_repo: false
}
end

it { is_expected.to compile.with_all_deps }

it do
if facts[:operatingsystemmajrelease] == '8'
is_expected.to contain_package('ruby:2.7')
else
is_expected.not_to contain_package('ruby:2.7')
end
end
end
end
end
Expand Down

0 comments on commit 2a9f9ed

Please sign in to comment.