Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add place to seed post_transaction_actions and versionlocks #329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -116,7 +122,9 @@
Array[String] $repo_exclusions = [],
Hash[String, Hash[String, String]] $gpgkeys = {},
String $utils_package_name = 'yum-utils',
Stdlib::CreateResources $groups = {}
Stdlib::CreateResources $groups = {},
Stdlib::CreateResources $post_transaction_actions = {},
Stdlib::CreateResources $versionlocks = {},
) {
$module_metadata = load_module_metadata($module_name)
$supported_operatingsystems = $module_metadata['operatingsystem_support']
Expand Down Expand Up @@ -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,
}
}
}
36 changes: 36 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading