Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[COOK-2183] make adding nginx repo more cross platform

  • Loading branch information...
commit f90be39443118b1621c3efee84077d4c6269ce0f 1 parent c5b6e73
Chris Lundquist authored
Showing with 25 additions and 11 deletions.
  1. +11 −7 attributes/{yum.rb → repo.rb}
  2. +14 −4 recipes/repo.rb
View
18 attributes/yum.rb → attributes/repo.rb
@@ -1,4 +1,3 @@
-
# Cookbook Name:: nginx
# Recipe:: repo
# Author:: Nick Rycar <nrycar@bluebox.net>
@@ -17,10 +16,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-case node['platform']
-when "centos"
- default['nginx']['yum']['url'] = "http://nginx.org/packages/centos/#{node['platform_version'].to_i}/$basearch/"
-else
- default['nginx']['yum']['url'] = "http://nginx.org/packages/rhel/#{node['platform_version'].to_i}/$basearch/"
+case node['platform_family']
+when 'rhel','fedora'
+ case node['platform']
+ when "centos"
+ # See http://wiki.nginx.org/Install
+ default['nginx']['upstream_repository'] = "http://nginx.org/packages/centos/#{node['platform_version'].to_i}/$basearch/"
+ else
+ default['nginx']['upstream_repository'] = "http://nginx.org/packages/rhel/#{node['platform_version'].to_i}/$basearch/"
+ end
+when 'debian'
+ default['nginx']['upstream_repository'] = "http://nginx.org/packages/#{node['platform']}"
end
-
View
18 recipes/repo.rb
@@ -16,8 +16,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-yum_repository "nginx" do
- description "Nginx.org Repository"
- url node['nginx']['yum']['url']
+case node['platform_family']
+when "rhel","fedora"
+ yum_repository "nginx" do
+ description "Nginx.org Repository"
+ url node['nginx']['upstream_repository']
+ end
+when "debian"
+ apt_repository "nginx" do
+ description "Nginx.org Repository"
+ uri node['nginx']['upstream_repository']
+ distribution node['lsb']['codename']
+ components ["nginx"]
+ deb_src true
+ end
end
-
Please sign in to comment.
Something went wrong with that request. Please try again.