CentOS: automatical package update after reposities setup
Change-Id: Iec248a80c430f3b10a34886f28aa8bc791c9f806
This commit is contained in:
parent
064e4dbb55
commit
0245bebbbf
@ -69,6 +69,11 @@
|
|||||||
# (optional) URL of CentOS mirror.
|
# (optional) URL of CentOS mirror.
|
||||||
# Defaults to 'http://mirror.centos.org'
|
# 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(
|
class openstack_extras::repo::redhat::redhat(
|
||||||
$release = $::openstack_extras::repo::redhat::params::release,
|
$release = $::openstack_extras::repo::redhat::params::release,
|
||||||
$manage_rdo = true,
|
$manage_rdo = true,
|
||||||
@ -83,6 +88,7 @@ class openstack_extras::repo::redhat::redhat(
|
|||||||
$package_require = false,
|
$package_require = false,
|
||||||
$manage_priorities = true,
|
$manage_priorities = true,
|
||||||
$centos_mirror_url = 'http://mirror.centos.org',
|
$centos_mirror_url = 'http://mirror.centos.org',
|
||||||
|
$update_packages = false,
|
||||||
) inherits openstack_extras::repo::redhat::params {
|
) inherits openstack_extras::repo::redhat::params {
|
||||||
|
|
||||||
validate_legacy(String, 'validate_string', $release)
|
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) {
|
if ($::operatingsystem == 'Fedora') or (Integer.new($os_major) >= 8) {
|
||||||
exec { 'yum_refresh':
|
$yum_command = 'dnf'
|
||||||
command => '/usr/bin/dnf clean all',
|
|
||||||
refreshonly => true,
|
|
||||||
} -> Package <||>
|
|
||||||
} else {
|
} else {
|
||||||
|
$yum_command = 'yum'
|
||||||
|
}
|
||||||
|
|
||||||
exec { 'yum_refresh':
|
exec { 'yum_refresh':
|
||||||
command => '/usr/bin/yum clean all',
|
command => "/usr/bin/${yum_command} clean all",
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
} -> Package <||>
|
}
|
||||||
|
|
||||||
|
if $update_packages {
|
||||||
|
exec { 'yum_update':
|
||||||
|
command => "/usr/bin/${yum_command} update -y",
|
||||||
|
refreshonly => true,
|
||||||
|
}
|
||||||
|
Exec['yum_refresh'] -> Exec['yum_update'] -> Package <||>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Exec['yum_refresh'] -> Package <||>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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…
Reference in New Issue
Block a user