From bb6e11569a61802417b9789f8dd0a7f6cd86846c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 10 Jan 2022 12:41:00 +0100 Subject: [PATCH] foreman::repo: use the package resource 'ensure' parameter to specify the desired ruby stream Co-authored-by: Ewoud Kohl van Wijngaarden Co-authored-by: pkranenburg --- manifests/repo.pp | 4 ++-- spec/classes/foreman_repo_spec.rb | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index e18658ece..5ef40d810 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -35,8 +35,8 @@ } if $facts['os']['release']['major'] == '8' and ($repo == 'nightly' or versioncmp($repo, '2.5') >= 0) { - package { 'ruby:2.7': - ensure => installed, + package { 'ruby': + ensure => '2.7', enable_only => true, provider => 'dnfmodule', } diff --git a/spec/classes/foreman_repo_spec.rb b/spec/classes/foreman_repo_spec.rb index 718976967..8931e0672 100644 --- a/spec/classes/foreman_repo_spec.rb +++ b/spec/classes/foreman_repo_spec.rb @@ -39,9 +39,9 @@ it do if facts[:operatingsystemmajrelease] == '8' - is_expected.to contain_package('ruby:2.7') + is_expected.to contain_package('ruby').with_ensure('2.7').with_provider('dnfmodule') else - is_expected.not_to contain_package('ruby:2.7') + is_expected.not_to contain_package('ruby') end end end @@ -67,7 +67,7 @@ it { is_expected.not_to contain_package('centos-release-scl-rh') } it do - is_expected.not_to contain_package('ruby:2.7') + is_expected.not_to contain_package('ruby') end end @@ -83,9 +83,9 @@ it do if facts[:operatingsystemmajrelease] == '8' - is_expected.to contain_package('ruby:2.7') + is_expected.to contain_package('ruby').with_ensure('2.7').with_provider('dnfmodule') else - is_expected.not_to contain_package('ruby:2.7') + is_expected.not_to contain_package('ruby') end end end