Allow tuning timeout for package update

Sometimes package update takes very long. This introduces a parameter
to make the command timeout tunable.

Change-Id: Icf089b50f497f3200e55877894b555e1e84a2d64
This commit is contained in:
Takashi Kajinami 2023-05-31 14:15:01 +09:00
parent 8359663751
commit 0f4c670e3d
3 changed files with 28 additions and 1 deletions

View File

@ -65,6 +65,10 @@
# configured.
# Defaults to false
#
# [*update_timeout*]
# (Optional) Timeout for package update.
# Defaults to 600
#
class openstack_extras::repo::redhat::redhat (
$release = $openstack_extras::repo::redhat::params::release,
$manage_rdo = true,
@ -79,6 +83,7 @@ class openstack_extras::repo::redhat::redhat (
$package_require = false,
$centos_mirror_url = $openstack_extras::repo::redhat::params::centos_mirror_url,
$update_packages = false,
$update_timeout = 600,
) inherits openstack_extras::repo::redhat::params {
validate_legacy(String, 'validate_string', $release)
@ -181,7 +186,7 @@ class openstack_extras::repo::redhat::redhat (
exec { 'yum_update':
command => '/usr/bin/dnf update -y',
refreshonly => true,
timeout => 600,
timeout => $update_timeout,
}
Exec['yum_refresh'] ~> Exec['yum_update'] -> Package <||>

View File

@ -0,0 +1,6 @@
---
features:
- |
The new ``openstack_extras::repo::redhat::redhat::update_timeout``
parameter has been added. This allows tuning timeout for `yum update -y`
(or `dnf update -y`) command.

View File

@ -87,6 +87,22 @@ describe 'openstack_extras::repo::redhat::redhat' do
)}
end
context 'with update_timeout' do
let :params do
{
:update_packages => true,
:update_timeout => 1200,
}
end
it { should contain_exec('yum_update').with(
:command => '/usr/bin/dnf update -y',
:refreshonly => true,
:timeout => 1200,
)}
end
context 'with overridden release' do
let :params do
{