summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-01-05 14:00:04 -0800
committerTim Smith <tsmith@chef.io>2017-01-05 14:00:04 -0800
commit09562d95c08570bf5a986c2beaa7604703fa6e3b (patch)
treea09019686602cb5c975fc18db9dfa793939d519b /lib
parentf5485214aab01573b175d607ff528edf9e16c085 (diff)
downloadchef-09562d95c08570bf5a986c2beaa7604703fa6e3b.tar.gz
yum_repostiroy: Allow baseurl to be an array & allow fastestmirror_enabled falseupdate_yum
Port two fixes that were made the yum cookbook yum_repository provider. https://github.com/chef-cookbooks/yum/pull/165 https://github.com/chef-cookbooks/yum/pull/162 Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/support/yum_repo.erb13
-rw-r--r--lib/chef/resource/yum_repository.rb2
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/chef/provider/support/yum_repo.erb b/lib/chef/provider/support/yum_repo.erb
index 7d9a2d09e2..6f1325573d 100644
--- a/lib/chef/provider/support/yum_repo.erb
+++ b/lib/chef/provider/support/yum_repo.erb
@@ -4,8 +4,13 @@
[<%= @config.repositoryid %>]
name=<%= @config.description %>
<% if @config.baseurl %>
-baseurl=<%= @config.baseurl %>
-<% end %>
+baseurl=<%= case @config.baseurl
+ when Array
+ @config.baseurl.join("\n")
+ else
+ @config.baseurl
+ end %>
+<% end -%>
<% if @config.cost %>
cost=<%= @config.cost %>
<% end %>
@@ -24,7 +29,9 @@ exclude=<%= @config.exclude %>
failovermethod=<%= @config.failovermethod %>
<% end %>
<% if @config.fastestmirror_enabled %>
-fastestmirror_enabled=<%= @config.fastestmirror_enabled %>
+fastestmirror_enabled=1
+<% else %>
+fastestmirror_enabled=0
<% end %>
<% if @config.gpgcheck %>
gpgcheck=1
diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb
index 1c215b51ff..0d6c3472c0 100644
--- a/lib/chef/resource/yum_repository.rb
+++ b/lib/chef/resource/yum_repository.rb
@@ -25,7 +25,7 @@ class Chef
provides :yum_repository
# http://linux.die.net/man/5/yum.conf
- property :baseurl, String, regex: /.*/
+ property :baseurl, [String, Array], regex: /.*/
property :cost, String, regex: /^\d+$/
property :clean_headers, [TrueClass, FalseClass], default: false # deprecated
property :clean_metadata, [TrueClass, FalseClass], default: true