yum: Add support for repository priority

This commit is contained in:
Ossi Salmi 2013-05-27 00:00:18 +03:00
parent fc8bf5fbba
commit 5ba367a64b
2 changed files with 34 additions and 1 deletions

View file

@ -94,6 +94,30 @@ class yum::plugin::downloadonly {
}
# Install priorities plugin
#
class yum::plugin::priorities {
case $::operatingsystem {
"centos","redhat": {
$package = $::operatingsystemrelease ? {
/^[1-5]/ => "yum-priorities",
default => "yum-plugin-priorities",
}
}
default: {
$package = "yum-plugin-priorities"
}
}
package { "yum-plugin-priorities":
ensure => installed,
name => $package,
}
}
# Common prequisites for yum
#
class yum::common {
@ -153,6 +177,8 @@ class yum::exclude {
# $gpgkey:
# Location where GPG signing key can be found. If not set
# GPG check will be disabled.
# $priority:
# Optional priority for this repository.
#
# === Sample usage
#
@ -162,7 +188,7 @@ class yum::exclude {
# gpgkey => "http://tmz.fedorapeople.org/repo/RPM-GPG-KEY-tmz",
# }
#
define yum::repo($ensure="present", $baseurl="", $mirrorlist="", $descr="", $gpgkey="") {
define yum::repo($ensure="present", $baseurl="", $mirrorlist="", $descr="", $gpgkey="", $priority="") {
tag("bootstrap")
@ -204,6 +230,10 @@ define yum::repo($ensure="present", $baseurl="", $mirrorlist="", $descr="", $gpg
$descr_real = $name
}
if $priority {
include yum::plugin::priorities
}
}
file { "/etc/yum.repos.d/${name}.repo":

View file

@ -12,3 +12,6 @@ gpgkey=<%= @gpgkey_real %>
<% else -%>
gpgcheck=0
<% end -%>
<% if @priority != '' -%>
priority=<%= @priority %>
<% end -%>