diff --git a/manifests/init.pp b/manifests/init.pp index 5e5489e..8041188 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -58,6 +58,12 @@ # @param groups # A hash of yum::group instances to manage. # +# @param post_transaction_actions +# A hash of yum::post_transaction_action instances to manage +# +# @param versionlocks +# A hash of yum::versionlock instances to manage +# # @example Enable management of the default repos for a supported OS: # --- # yum::manage_os_default_repos: true @@ -117,6 +123,8 @@ Hash[String, Hash[String, String]] $gpgkeys = {}, String $utils_package_name = 'yum-utils', Stdlib::CreateResources $groups = {} + Stdlib::CreateResources $post_transaction_actions = {} + Stdlib::CreateResources $versionlocks = {} ) { $module_metadata = load_module_metadata($module_name) $supported_operatingsystems = $module_metadata['operatingsystem_support'] @@ -243,4 +251,16 @@ * => $_group_attrs, } } + + $post_transaction_actions.each |$_action, $_action_attrs| { + yum::post_transaction_action { $_action: + * => $_action_attrs, + } + } + + $versionlocks.each |$_lock, $_lock_attrs| { + yum::versionlock { $_lock: + * => $_lock_attrs, + } + } } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index e876a4e..654f006 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -44,6 +44,8 @@ it_behaves_like 'a Yum class' it { is_expected.to have_yumrepo_resource_count(0) } it { is_expected.to have_yum__group_resource_count(0) } + it { is_expected.to have_yum__post_transaction_action_resource_count(0) } + it { is_expected.to have_yum__versionlock_resource_count(0) } end context 'with package_provider yum' do @@ -830,6 +832,40 @@ it { is_expected.to contain_yum__group('Puppet Tools').with_ensure('absent') } it { is_expected.to contain_yum__group('Dev Tools').with_ensure('installed') } end + + context 'when post_transaction_actions parameter is set' do + let(:params) do + { + post_transaction_actions: { + 'touch file for ssh': { + key: 'openssh-*', + state: 'any', + command: 'touch /tmp/openssh-installed', + }, + }, + } + end + + it { is_expected.to contain_yum__post_transaction_action('touch file for ssh').with_key('openssh-*') } + end + + context 'when versionlocks parameter is set' do + let(:params) do + { + versionlocks: { + 'bash': + ensure: 'present', + version: '4.1.2', + release: '9.el8', + epoch: 0, + arch: 'noarch', + }, + }, + } + end + + it { is_expected.to contain_yum__versionlock('bash').with_ensure('present') } + end end end