From f57fbb248cc8696098acafbdc7802e92c9061026 Mon Sep 17 00:00:00 2001 From: Greg Thornton Date: Sun, 18 Dec 2011 03:08:06 -0600 Subject: [PATCH] Import yum version 0.5.2 --- cookbooks/yum/README.md | 8 ++++++-- cookbooks/yum/metadata.json | 4 ++-- cookbooks/yum/metadata.rb | 2 +- cookbooks/yum/recipes/epel.rb | 11 +++++++++-- cookbooks/yum/recipes/ius.rb | 10 +++++++++- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/cookbooks/yum/README.md b/cookbooks/yum/README.md index c14a44a..4208b32 100644 --- a/cookbooks/yum/README.md +++ b/cookbooks/yum/README.md @@ -8,10 +8,14 @@ Based on the work done by Eric Wolfe and Charles Duffy on the yumrepo cookbook. Changes ======= +## v0.5.2: + +* [COOK-825] - epel and ius `remote_file` should notify the `rpm_package` to install + ## v0.5.0: -* COOK-675: add recipe for handling EPEL repository -* COOK-722: add recipe for handling IUS repository +* [COOK-675] - add recipe for handling EPEL repository +* [COOK-722] - add recipe for handling IUS repository ## v.0.1.2: diff --git a/cookbooks/yum/metadata.json b/cookbooks/yum/metadata.json index e4e2769..1bd20e1 100644 --- a/cookbooks/yum/metadata.json +++ b/cookbooks/yum/metadata.json @@ -1,7 +1,7 @@ { "name": "yum", "description": "A fabulous new cookbook", - "long_description": "Description\n===========\n\nConfigures various YUM components on Red Hat-like systems. Includes LWRP for managing repositories and their GPG keys.\n\nBased on the work done by Eric Wolfe and Charles Duffy on the yumrepo cookbook. http://github.com/atomic-penguin/cookbooks/tree/yumrepo/yumrepo\n\nChanges\n=======\n\n## v0.5.0:\n\n* COOK-675: add recipe for handling EPEL repository\n* COOK-722: add recipe for handling IUS repository\n\n## v.0.1.2:\n\n* Remove yum update in default recipe, that doesn't update caches, it updates packages installed.\n\nRequirements\n============\nRHEL, CentOS or Scientific Linux 5.x or newer. It has not been tested on other platforms or earlier versions. RHEL 6 support is untested (testing and patches are welcome).\n\nAttributes\n==========\n\n* `node['yum']['epel_release']` - Set the epel release version based on `node['platform_version']`.\n* `node['yum']['ius_release']` - Set the IUS release to install.\n\nRecipes\n=======\n\ndefault\n-------\nThe default recipe runs `yum update` during the Compile Phase of the Chef run to ensure that the system's package cache is updated with the latest. It is recommended that this recipe appear first in a node's run list (directly or through a role) to ensure that when installing packages, Chef will be able to download the latest version available on the remote YUM repository.\n\nyum\n---\nManages the configuration of the `/etc/yum.conf` via attributes.\n\nepel\n----\n\nInstalls the EPEL repository via RPM. Uses the `node['yum']['epel_release']` attribute to select the right version of the repository package to install. Also uses the node's platform version (as an integer) for the major release of EL.\n\nius\n----\n\nInstalls the [IUS Community repositories](http://iuscommunity.org/Repos) via RPM. Uses the `node['yum']['ius_release']` attribute to select the right versino of the package to install.\n\nThe IUS repository requires EPEL, and the recipe includes `yum::epel` to install this.\n\nResources/Providers\n===================\n\nkey\n---\nThis LWRP handles importing GPG keys for YUM repositories. Keys can be imported by the `url` parameter or placed in `/etc/pki/rpm-gpg/` by a recipe and then installed with the LWRP without passing the URL.\n\n# Actions\n- :add: installs the GPG key into `/etc/pki/rpm-gpg/`\n- :remove: removes the GPG key from `/etc/pki/rpm-gpg/`\n\n# Attribute Parameters\n\n- key: name attribute. The name of the GPG key to install.\n- url: if the key needs to be downloaded, the URL providing the download.\n\n# Example\n\n``` ruby\n# add the Zenoss GPG key\nyum_key \"RPM-GPG-KEY-zenoss\" do\n url \"http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss\"\n action :add\nend\n \n# remove Zenoss GPG key\nyum_key \"RPM-GPG-KEY-zenoss\" do\n action :remove\nend\n```\n\nrepository\n----------\nThis LWRP provides an easy way to manage additional YUM repositories. GPG keys can be managed with the `key` LWRP.\n\n# Actions\n\n- :add: creates a repository file and builds the repository listing\n- :remove: removes the repository file\n\n# Attribute Parameters\n\n- repo_name: name attribute. The name of the channel to discover\n- description. The description of the repository\n- url: The URL providing the packages\n- mirrorlist: Default is `false`, if `true` the `url` is considered a list of mirrors\n- key: Optional, the name of the GPG key file installed by the `key` LWRP.\n\n- enabled: Default is `1`, set to `0` if the repository is disabled.\n- type: Optional, alternate type of repository\n- failovermethod: Optional, failovermethod\n- bootstrapurl: Optional, bootstrapurl\n\n# Example\n\n``` ruby\n# add the Zenoss repository\nyum_repository \"zenoss\" do\n name \"Zenoss Stable repo\"\n url \"http://dev.zenoss.com/yum/stable/\"\n key \"RPM-GPG-KEY-zenoss\"\n action :add\nend\n \n# remove Zenoss repo\nyum_repository \"zenoss\" do\n action :remove\nend\n```\n\nUsage\n=====\n\nPut `recipe[yum]` first in the run list to ensure `yum update` is run before other recipes. You can manage GPG keys either with cookbook_file in a recipe if you want to package it with a cookbook or use the `url` parameter of the `key` LWRP.\n\nLicense and Author\n==================\n\nAuthor:: Eric G. Wolfe\nAuthor:: Matt Ray ()\nAuthor:: Joshua Timberman ()\n\nCopyright:: 2010 Tippr Inc.\nCopyright:: 2011 Eric G. Wolfe\nCopyright:: 2011 Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", + "long_description": "Description\n===========\n\nConfigures various YUM components on Red Hat-like systems. Includes LWRP for managing repositories and their GPG keys.\n\nBased on the work done by Eric Wolfe and Charles Duffy on the yumrepo cookbook. http://github.com/atomic-penguin/cookbooks/tree/yumrepo/yumrepo\n\nChanges\n=======\n\n## v0.5.2:\n\n* [COOK-825] - epel and ius `remote_file` should notify the `rpm_package` to install\n\n## v0.5.0:\n\n* [COOK-675] - add recipe for handling EPEL repository\n* [COOK-722] - add recipe for handling IUS repository\n\n## v.0.1.2:\n\n* Remove yum update in default recipe, that doesn't update caches, it updates packages installed.\n\nRequirements\n============\nRHEL, CentOS or Scientific Linux 5.x or newer. It has not been tested on other platforms or earlier versions. RHEL 6 support is untested (testing and patches are welcome).\n\nAttributes\n==========\n\n* `node['yum']['epel_release']` - Set the epel release version based on `node['platform_version']`.\n* `node['yum']['ius_release']` - Set the IUS release to install.\n\nRecipes\n=======\n\ndefault\n-------\nThe default recipe runs `yum update` during the Compile Phase of the Chef run to ensure that the system's package cache is updated with the latest. It is recommended that this recipe appear first in a node's run list (directly or through a role) to ensure that when installing packages, Chef will be able to download the latest version available on the remote YUM repository.\n\nyum\n---\nManages the configuration of the `/etc/yum.conf` via attributes.\n\nepel\n----\n\nInstalls the EPEL repository via RPM. Uses the `node['yum']['epel_release']` attribute to select the right version of the repository package to install. Also uses the node's platform version (as an integer) for the major release of EL.\n\nius\n----\n\nInstalls the [IUS Community repositories](http://iuscommunity.org/Repos) via RPM. Uses the `node['yum']['ius_release']` attribute to select the right versino of the package to install.\n\nThe IUS repository requires EPEL, and the recipe includes `yum::epel` to install this.\n\nResources/Providers\n===================\n\nkey\n---\nThis LWRP handles importing GPG keys for YUM repositories. Keys can be imported by the `url` parameter or placed in `/etc/pki/rpm-gpg/` by a recipe and then installed with the LWRP without passing the URL.\n\n# Actions\n- :add: installs the GPG key into `/etc/pki/rpm-gpg/`\n- :remove: removes the GPG key from `/etc/pki/rpm-gpg/`\n\n# Attribute Parameters\n\n- key: name attribute. The name of the GPG key to install.\n- url: if the key needs to be downloaded, the URL providing the download.\n\n# Example\n\n``` ruby\n# add the Zenoss GPG key\nyum_key \"RPM-GPG-KEY-zenoss\" do\n url \"http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss\"\n action :add\nend\n \n# remove Zenoss GPG key\nyum_key \"RPM-GPG-KEY-zenoss\" do\n action :remove\nend\n```\n\nrepository\n----------\nThis LWRP provides an easy way to manage additional YUM repositories. GPG keys can be managed with the `key` LWRP.\n\n# Actions\n\n- :add: creates a repository file and builds the repository listing\n- :remove: removes the repository file\n\n# Attribute Parameters\n\n- repo_name: name attribute. The name of the channel to discover\n- description. The description of the repository\n- url: The URL providing the packages\n- mirrorlist: Default is `false`, if `true` the `url` is considered a list of mirrors\n- key: Optional, the name of the GPG key file installed by the `key` LWRP.\n\n- enabled: Default is `1`, set to `0` if the repository is disabled.\n- type: Optional, alternate type of repository\n- failovermethod: Optional, failovermethod\n- bootstrapurl: Optional, bootstrapurl\n\n# Example\n\n``` ruby\n# add the Zenoss repository\nyum_repository \"zenoss\" do\n name \"Zenoss Stable repo\"\n url \"http://dev.zenoss.com/yum/stable/\"\n key \"RPM-GPG-KEY-zenoss\"\n action :add\nend\n \n# remove Zenoss repo\nyum_repository \"zenoss\" do\n action :remove\nend\n```\n\nUsage\n=====\n\nPut `recipe[yum]` first in the run list to ensure `yum update` is run before other recipes. You can manage GPG keys either with cookbook_file in a recipe if you want to package it with a cookbook or use the `url` parameter of the `key` LWRP.\n\nLicense and Author\n==================\n\nAuthor:: Eric G. Wolfe\nAuthor:: Matt Ray ()\nAuthor:: Joshua Timberman ()\n\nCopyright:: 2010 Tippr Inc.\nCopyright:: 2011 Eric G. Wolfe\nCopyright:: 2011 Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", "maintainer": "Opscode, Inc.", "maintainer_email": "cookbooks@opscode.com", "license": "Apache 2.0", @@ -56,5 +56,5 @@ "yum": "Runs 'yum update' during compile phase", "yum::yum": "manages yum configuration" }, - "version": "0.5.0" + "version": "0.5.2" } \ No newline at end of file diff --git a/cookbooks/yum/metadata.rb b/cookbooks/yum/metadata.rb index 94de6a0..1e07d07 100644 --- a/cookbooks/yum/metadata.rb +++ b/cookbooks/yum/metadata.rb @@ -2,7 +2,7 @@ maintainer_email "cookbooks@opscode.com" license "Apache 2.0" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.5.0" +version "0.5.2" recipe "yum", "Runs 'yum update' during compile phase" recipe "yum::yum", "manages yum configuration" diff --git a/cookbooks/yum/recipes/epel.rb b/cookbooks/yum/recipes/epel.rb index ccc3cff..171bc47 100644 --- a/cookbooks/yum/recipes/epel.rb +++ b/cookbooks/yum/recipes/epel.rb @@ -25,10 +25,17 @@ remote_file "#{Chef::Config[:file_cache_path]}/epel-release-#{epel}.noarch.rpm" do source "http://download.fedoraproject.org/pub/epel/#{major}/i386/epel-release-#{epel}.noarch.rpm" - not_if "rpm -qa | grep -qx '^epel-release-#{epel}.noarch$'" + not_if "rpm -qa | egrep -qx 'epel-release-#{epel}(|.noarch)'" + notifies :install, "rpm_package[epel-release]", :immediately end - rpm_package "epel-release" do source "#{Chef::Config[:file_cache_path]}/epel-release-#{epel}.noarch.rpm" + only_if {::File.exists?("#{Chef::Config[:file_cache_path]}/epel-release-#{epel}.noarch.rpm")} + action :nothing +end + +file "epel-release-cleanup" do + path "#{Chef::Config[:file_cache_path]}/epel-release-#{epel}.noarch.rpm" + action :delete end diff --git a/cookbooks/yum/recipes/ius.rb b/cookbooks/yum/recipes/ius.rb index 5c0dd18..b597956 100644 --- a/cookbooks/yum/recipes/ius.rb +++ b/cookbooks/yum/recipes/ius.rb @@ -24,9 +24,17 @@ remote_file "#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm" do source "http://dl.iuscommunity.org/pub/ius/stable/Redhat/#{major}/i386/ius-release-#{ius}.ius.el#{major}.noarch.rpm" - not_if "rpm -qa | grep -qx 'ius-release-#{ius}'" + not_if "rpm -qa | grep -q '^ius-release-#{ius}'" + notifies :install, "rpm_package[ius-release]", :immediately end rpm_package "ius-release" do source "#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm" + only_if {::File.exists?("#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm")} + action :nothing +end + +file "ius-release-cleanup" do + path "#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm" + action :delete end