Browse Source

Merge "CentOS: automatical package update after reposities setup"

changes/33/747733/1
Zuul 11 months ago
committed by Gerrit Code Review
parent
commit
49aaf24b4c
  1. 30
      manifests/repo/redhat/redhat.pp
  2. 7
      releasenotes/notes/repo-redhat-update_packages-d52c3fe93e97ac76.yaml

30
manifests/repo/redhat/redhat.pp

@ -69,6 +69,11 @@
# (optional) URL of CentOS mirror.
# Defaults to 'http://mirror.centos.org'
#
# [*update_packages*]
# (optional) Whether to update all packages after yum repositories are
# configured.
# Defaults to false
#
class openstack_extras::repo::redhat::redhat(
$release = $::openstack_extras::repo::redhat::params::release,
$manage_rdo = true,
@ -83,6 +88,7 @@ class openstack_extras::repo::redhat::redhat(
$package_require = false,
$manage_priorities = true,
$centos_mirror_url = 'http://mirror.centos.org',
$update_packages = false,
) inherits openstack_extras::repo::redhat::params {
validate_legacy(String, 'validate_string', $release)
@ -205,14 +211,24 @@ class openstack_extras::repo::redhat::redhat(
}
if ($::operatingsystem == 'Fedora') or (Integer.new($os_major) >= 8) {
exec { 'yum_refresh':
command => '/usr/bin/dnf clean all',
refreshonly => true,
} -> Package <||>
$yum_command = 'dnf'
} else {
exec { 'yum_refresh':
command => '/usr/bin/yum clean all',
$yum_command = 'yum'
}
exec { 'yum_refresh':
command => "/usr/bin/${yum_command} clean all",
refreshonly => true,
}
if $update_packages {
exec { 'yum_update':
command => "/usr/bin/${yum_command} update -y",
refreshonly => true,
} -> Package <||>
}
Exec['yum_refresh'] -> Exec['yum_update'] -> Package <||>
}
else {
Exec['yum_refresh'] -> Package <||>
}
}

7
releasenotes/notes/repo-redhat-update_packages-d52c3fe93e97ac76.yaml

@ -0,0 +1,7 @@
---
features:
- |
The new ``update_package`` parameter has been added to the
``openstack_extras::repo::redhat::redhat`` class. This parameter is set to
false by default, but when it is set to true then all packages are updated
once dnf/yum repositories are configured.
Loading…
Cancel
Save