From b2b18db9caef135c0ecd87de3c557d5495336edd Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Wed, 5 Feb 2014 23:36:31 +0100 Subject: [PATCH] Instead of doing some crappy things, we are using the yum cookbook. We do it this way. It avoids complexity and breaking tests. --- metadata.rb | 21 ++++++++++++--------- recipes/rpm.rb | 38 ++++++++------------------------------ 2 files changed, 20 insertions(+), 39 deletions(-) diff --git a/metadata.rb b/metadata.rb index f740cc8..b5ea8b2 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,9 +1,12 @@ -name "ceph" -maintainer "Kyle Bader" -maintainer_email "kyle.bader@dreamhost.com" -license "Apache 2.0" -description "Installs/Configures the Ceph distributed filesystem" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.1.0" -depends "apache2", ">= 1.1.12" -depends "apt" +name "ceph" +maintainer "Kyle Bader" +maintainer_email "kyle.bader@dreamhost.com" +license "Apache 2.0" +description "Installs/Configures the Ceph distributed filesystem" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +version "0.1.0" + +depends "apache2", ">= 1.1.12" +depends "apt" +depends "yum", ">= 3.0" +depends "yum-epel" diff --git a/recipes/rpm.rb b/recipes/rpm.rb index 6496291..1d45679 100644 --- a/recipes/rpm.rb +++ b/recipes/rpm.rb @@ -3,11 +3,7 @@ platform_family = node['platform_family'] case platform_family when "rhel" if node['ceph']['el_add_epel'] == true - # We need to do this since the EPEL - # version might change - version = node['platform_version'].to_i - epel_package = %x[ curl -s http://dl.fedoraproject.org/pub/epel/fullfilelist | grep ^#{version}/#{node['kernel']['machine']}/epel-release ].chomp - system "rpm -U http://dl.fedoraproject.org/pub/epel/#{epel_package}" + include_recipe "yum_epel" end end @@ -18,32 +14,14 @@ end repo = node['ceph'][platform_family][branch]['repository'] -if branch == "dev" - # Instead of using the yum cookbook, - # we do it this way. It avoids a dependency - system "curl -s #{node['ceph'][platform_family]['dev']['repository_key']} > /etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH" - system "cat > /etc/yum.repos.d/ceph.repo << EOF\n" \ - "[ceph]\n" \ - "name=Ceph\n" \ - "baseurl=#{repo}\n" \ - "enabled=1\n" \ - "gpgcheck=1\n" \ - "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH\n" \ - "EOF\n" -else - # This is a stable or testing branch - system "rpm -U #{node['ceph'][platform_family][branch]['repository']}" +yum_repository "ceph" do + baseurl repo + gpgkey node['ceph'][platform_family]['dev']['repository_key'] if branch == "dev" end if node['roles'].include?("ceph-tgt") - repo = node['ceph'][platform_family]['extras']['repository'] - system "curl -s #{node['ceph'][platform_family]['extras']['repository_key']} > /etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH-EXTRAS" - system "cat > /etc/yum.repos.d/ceph.repo << EOF\n" \ - "[ceph]\n" \ - "name=Ceph\n" \ - "baseurl=#{repo}\n" \ - "enabled=1\n" \ - "gpgcheck=1\n" \ - "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH-EXTRAS\n" \ - "EOF\n" + yum_repository "ceph-extra" do + baseurl node['ceph'][platform_family]['extras']['repository'] + gpgkey node['ceph'][platform_family]['extras']['repository_key'] + end end