summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-01-09 08:14:14 -0800
committerGitHub <noreply@github.com>2017-01-09 08:14:14 -0800
commit70d9e0753ebd5c7ac75b538afa92a28494b3d23b (patch)
tree525fa16663ff896be800c5aa60a196b22eaecdb6
parent5c8645469f79ab033542d735b2337e3355337d4e (diff)
parent09562d95c08570bf5a986c2beaa7604703fa6e3b (diff)
downloadchef-70d9e0753ebd5c7ac75b538afa92a28494b3d23b.tar.gz
Merge pull request #5708 from chef/update_yum
yum_repository: Allow baseurl to be an array & allow fastestmirror_enabled false
-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