• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: Commit

Grid環境構築用のChefリポジトリです。


Commit MetaInfo

Revisión45a789f5b33d8790a3096813cd98afb0f9761813 (tree)
Tiempo2013-06-05 22:11:55
Autorwhitestar <whitestar@gaea...>
Commiterwhitestar

Log Message

Import yum version 2.2.2

Cambiar Resumen

Diferencia incremental

--- /dev/null
+++ b/cookbooks/yum/.gitignore
@@ -0,0 +1,14 @@
1+.vagrant
2+Berksfile.lock
3+Gemfile.lock
4+*~
5+*#
6+.#*
7+\#*#
8+.*.sw[a-z]
9+*.un~
10+.bundle
11+.cache
12+.kitchen
13+bin
14+.kitchen.local.yml
--- /dev/null
+++ b/cookbooks/yum/.kitchen.yml
@@ -0,0 +1,22 @@
1+---
2+driver_plugin: vagrant
3+platforms:
4+- name: centos-6.4
5+ driver_config:
6+ box: opscode-centos-6.4
7+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
8+ require_chef_omnibus: true
9+ run_list:
10+- name: centos-5.9
11+ driver_config:
12+ box: opscode-centos-5.9
13+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
14+ require_chef_omnibus: true
15+ run_list:
16+
17+suites:
18+- name: test
19+ run_list:
20+ - recipe[minitest-handler]
21+ - recipe[yum::test]
22+ attributes: {}
--- /dev/null
+++ b/cookbooks/yum/Berksfile
@@ -0,0 +1,7 @@
1+site :opscode
2+
3+metadata
4+
5+group :integration do
6+ cookbook "minitest-handler"
7+end
--- /dev/null
+++ b/cookbooks/yum/CHANGELOG.md
@@ -0,0 +1,97 @@
1+## v2.2.2:
2+
3+### Improvement
4+
5+- [COOK-2741]: yum::elrepo
6+- [COOK-2946]: update tests, test kitchen support in yum cookbook
7+
8+### Bug
9+
10+- [COOK-2639]: Yum cookbook - epel - always assumes url is a mirror list
11+- [COOK-2663]: Yum should allow metadata_expire setting in repo file
12+- [COOK-2751]: Update yum.ius_release version to 1.0-11
13+
14+## v2.2.0:
15+
16+* [COOK-2189] - yum::ius failed on install (caused from rpm dependency)
17+* [COOK-2196] - Make includepkgs and exclude configurable for each repos
18+* [COOK-2244] - Allow configuring caching using attributes
19+* [COOK-2399] - yum cookbook LWRPs fail FoodCritic
20+* [COOK-2519] - Add priority option to Yum repo files
21+* [COOK-2593] - allow integer or string for yum priority
22+* [COOK-2643] - don't use conditional attribute for `yum_key` `remote_file`
23+
24+## v2.1.0:
25+
26+* [COOK-2045] - add remi repository recipe
27+* [COOK-2121] - add `:create` action to `yum_repository`
28+
29+## v2.0.6:
30+
31+* [COOK-2037] - minor style fixes
32+* [COOK-2038] - updated README
33+
34+## v2.0.4:
35+
36+* [COOK-1908] - unable to install repoforge on CentOS 6 32 bit
37+
38+## v2.0.2:
39+
40+* [COOK-1758] - Add default action for repository resource
41+
42+## v2.0.0:
43+
44+This version changes the behavior of the EPEL recipe (most commonly
45+used in other Opscode cookbooks) on Amazon, and removes an attribute,
46+`node['yum']['epel_release']`. See the README for details.
47+
48+* [COOK-1772] - Simplify management of EPEL with LWRP
49+
50+## v1.0.0:
51+
52+`mirrorlist` in the `yum_repository` LWRP must be set to the mirror
53+list URI to use rather than setting it to true. See README.md.
54+
55+* [COOK-1088] - use dl.fedoraproject.org for EPEL to prevent redirects
56+* [COOK-1653] - fix mirrorlist
57+* [COOK-1710] - support http proxy
58+* [COOK-1722] - update IUS version
59+
60+## v0.8.2:
61+
62+* [COOK-1521] - add :update action to `yum_repository`
63+
64+## v0.8.0:
65+
66+* [COOK-1204] - Make 'add' default action for yum_repository
67+* [COOK-1351] - option to not make the yum cache (via attribute)
68+* [COOK-1353] - x86_64 centos path fixes
69+* [COOK-1414] - recipe for repoforge
70+
71+
72+## v0.6.2:
73+
74+* Updated README to remove git diff artifacts.
75+
76+## v0.6.0:
77+
78+* Default action for the yum_repository LWRP is now add.
79+* [COOK-1227] - clear Chefs internal cache after adding new yum repo
80+* [COOK-1262] - yum::epel should enable existing repo on Amazon Linux
81+* [COOK-1272], [COOK-1302] - update RPM file for CentOS / RHEL 6
82+* [COOK-1330] - update cookbook documentation on excludes for yum
83+* [COOK-1346] - retry remote_file for EPEL in case we get an FTP mirror
84+
85+
86+## v0.5.2:
87+
88+* [COOK-825] - epel and ius `remote_file` should notify the `rpm_package` to install
89+
90+## v0.5.0:
91+
92+* [COOK-675] - add recipe for handling EPEL repository
93+* [COOK-722] - add recipe for handling IUS repository
94+
95+## v.0.1.2:
96+
97+* Remove yum update in default recipe, that doesn't update caches, it updates packages installed.
--- /dev/null
+++ b/cookbooks/yum/CONTRIBUTING.md
@@ -0,0 +1,257 @@
1+# Contributing to Opscode Cookbooks
2+
3+We are glad you want to contribute to Opscode Cookbooks! The first
4+step is the desire to improve the project.
5+
6+You can find the answers to additional frequently asked questions
7+[on the wiki](http://wiki.opscode.com/display/chef/How+to+Contribute).
8+
9+You can find additional information about
10+[contributing to cookbooks](http://wiki.opscode.com/display/chef/How+to+Contribute+to+Opscode+Cookbooks)
11+on the wiki as well.
12+
13+## Quick-contribute
14+
15+* Create an account on our [bug tracker](http://tickets.opscode.com)
16+* Sign our contributor agreement (CLA)
17+[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L)
18+(keep reading if you're contributing on behalf of your employer)
19+* Create a ticket for your change on the
20+ [bug tracker](http://tickets.opscode.com)
21+* Link to your patch as a rebased git branch or pull request from the
22+ ticket
23+* Resolve the ticket as fixed
24+
25+We regularly review contributions and will get back to you if we have
26+any suggestions or concerns.
27+
28+## The Apache License and the CLA/CCLA
29+
30+Licensing is very important to open source projects, it helps ensure
31+the software continues to be available under the terms that the author
32+desired. Chef uses the Apache 2.0 license to strike a balance between
33+open contribution and allowing you to use the software however you
34+would like to.
35+
36+The license tells you what rights you have that are provided by the
37+copyright holder. It is important that the contributor fully
38+understands what rights they are licensing and agrees to them.
39+Sometimes the copyright holder isn't the contributor, most often when
40+the contributor is doing work for a company.
41+
42+To make a good faith effort to ensure these criteria are met, Opscode
43+requires a Contributor License Agreement (CLA) or a Corporate
44+Contributor License Agreement (CCLA) for all contributions. This is
45+without exception due to some matters not being related to copyright
46+and to avoid having to continually check with our lawyers about small
47+patches.
48+
49+It only takes a few minutes to complete a CLA, and you retain the
50+copyright to your contribution.
51+
52+You can complete our contributor agreement (CLA)
53+[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L).
54+If you're contributing on behalf of your employer, have your employer
55+fill out our
56+[Corporate CLA](https://secure.echosign.com/public/hostedForm?formid=PIE6C7AX856)
57+instead.
58+
59+## Ticket Tracker (JIRA)
60+
61+The [ticket tracker](http://tickets.opscode.com) is the most important
62+documentation for the code base. It provides significant historical
63+information, such as:
64+
65+* Which release a bug fix is included in
66+* Discussion regarding the design and merits of features
67+* Error output to aid in finding similar bugs
68+
69+Each ticket should aim to fix one bug or add one feature.
70+
71+## Using git
72+
73+You can get a quick copy of the repository for this cookbook by
74+running `git clone
75+git://github.com/opscode-coobkooks/COOKBOOKNAME.git`.
76+
77+For collaboration purposes, it is best if you create a Github account
78+and fork the repository to your own account. Once you do this you will
79+be able to push your changes to your Github repository for others to
80+see and use.
81+
82+If you have another repository in your GitHub account named the same
83+as the cookbook, we suggest you suffix the repository with -cookbook.
84+
85+### Branches and Commits
86+
87+You should submit your patch as a git branch named after the ticket,
88+such as COOK-1337. This is called a _topic branch_ and allows users to
89+associate a branch of code with the ticket.
90+
91+It is a best practice to have your commit message have a _summary
92+line_ that includes the ticket number, followed by an empty line and
93+then a brief description of the commit. This also helps other
94+contributors understand the purpose of changes to the code.
95+
96+ [COOK-1757] - platform_family and style
97+
98+ * use platform_family for platform checking
99+ * update notifies syntax to "resource_type[resource_name]" instead of
100+ resources() lookup
101+ * COOK-692 - delete config files dropped off by packages in conf.d
102+ * dropped debian 4 support because all other platforms have the same
103+ values, and it is older than "old stable" debian release
104+
105+Remember that not all users use Chef in the same way or on the same
106+operating systems as you, so it is helpful to be clear about your use
107+case and change so they can understand it even when it doesn't apply
108+to them.
109+
110+### Github and Pull Requests
111+
112+All of Opscode's open source cookbook projects are available on
113+[Github](http://www.github.com/opscode-cookbooks).
114+
115+We don't require you to use Github, and we will even take patch diffs
116+attached to tickets on the tracker. However Github has a lot of
117+convenient features, such as being able to see a diff of changes
118+between a pull request and the main repository quickly without
119+downloading the branch.
120+
121+If you do choose to use a pull request, please provide a link to the
122+pull request from the ticket __and__ a link to the ticket from the
123+pull request. Because pull requests only have two states, open and
124+closed, we can't easily filter pull requests that are waiting for a
125+reply from the author for various reasons.
126+
127+### More information
128+
129+Additional help with git is available on the
130+[Working with Git](http://wiki.opscode.com/display/chef/Working+with+Git)
131+wiki page.
132+
133+## Functional and Unit Tests
134+
135+This cookbook is set up to run tests under
136+[Opscode's test-kitchen](https://github.com/opscode/test-kitchen). It
137+uses minitest-chef to run integration tests after the node has been
138+converged to verify that the state of the node.
139+
140+Test kitchen should run completely without exception using the default
141+[baseboxes provided by Opscode](https://github.com/opscode/bento).
142+Because Test Kitchen creates VirtualBox machines and runs through
143+every configuration in the Kitchenfile, it may take some time for
144+these tests to complete.
145+
146+If your changes are only for a specific recipe, run only its
147+configuration with Test Kitchen. If you are adding a new recipe, or
148+other functionality such as a LWRP or definition, please add
149+appropriate tests and ensure they run with Test Kitchen.
150+
151+If any don't pass, investigate them before submitting your patch.
152+
153+Any new feature should have unit tests included with the patch with
154+good code coverage to help protect it from future changes. Similarly,
155+patches that fix a bug or regression should have a _regression test_.
156+Simply put, this is a test that would fail without your patch but
157+passes with it. The goal is to ensure this bug doesn't regress in the
158+future. Consider a regular expression that doesn't match a certain
159+pattern that it should, so you provide a patch and a test to ensure
160+that the part of the code that uses this regular expression works as
161+expected. Later another contributor may modify this regular expression
162+in a way that breaks your use cases. The test you wrote will fail,
163+signalling to them to research your ticket and use case and accounting
164+for it.
165+
166+If you need help writing tests, please ask on the Chef Developer's
167+mailing list, or the #chef-hacking IRC channel.
168+
169+## Code Review
170+
171+Opscode regularly reviews code contributions and provides suggestions
172+for improvement in the code itself or the implementation.
173+
174+We find contributions by searching the ticket tracker for _resolved_
175+tickets with a status of _fixed_. If we have feedback we will reopen
176+the ticket and you should resolve it again when you've made the
177+changes or have a response to our feedback. When we believe the patch
178+is ready to be merged, we will tag the _Code Reviewed_ field with
179+_Reviewed_.
180+
181+Depending on the project, these tickets are then merged within a week
182+or two, depending on the current release cycle.
183+
184+## Release Cycle
185+
186+The versioning for Opscode Cookbook projects is X.Y.Z.
187+
188+* X is a major release, which may not be fully compatible with prior
189+ major releases
190+* Y is a minor release, which adds both new features and bug fixes
191+* Z is a patch release, which adds just bug fixes
192+
193+A released version of a cookbook will end in an even number, e.g.
194+"1.2.4" or "0.8.0". When development for the next version of the
195+cookbook begins, the "Z" patch number is incremented to the next odd
196+number, however the next release of the cookbook may be a major or
197+minor incrementing version.
198+
199+Releases of Opscode's cookbooks are usually announced on the Chef user
200+mailing list. Releases of several cookbooks may be batched together
201+and announced on the [Opscode Blog](http://www.opscode.com/blog).
202+
203+## Working with the community
204+
205+These resources will help you learn more about Chef and connect to
206+other members of the Chef community:
207+
208+* [chef](http://lists.opscode.com/sympa/info/chef) and
209+ [chef-dev](http://lists.opscode.com/sympa/info/chef-dev) mailing
210+ lists
211+* #chef and #chef-hacking IRC channels on irc.freenode.net
212+* [Community Cookbook site](http://community.opscode.com)
213+* [Chef wiki](http://wiki.opscode.com/display/chef)
214+* Opscode Chef [product page](http://www.opscode.com/chef)
215+
216+
217+## Cookbook Contribution Do's and Don't's
218+
219+Please do include tests for your contribution. If you need help, ask
220+on the
221+[chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev)
222+or the
223+[#chef-hacking IRC channel](http://community.opscode.com/chat/chef-hacking).
224+Not all platforms that a cookbook supports may be supported by Test
225+Kitchen. Please provide evidence of testing your contribution if it
226+isn't trivial so we don't have to duplicate effort in testing. Chef
227+10.14+ "doc" formatted output is sufficient.
228+
229+Please do indicate new platform (families) or platform versions in the
230+commit message, and update the relevant ticket.
231+
232+If a contribution adds new platforms or platform versions, indicate
233+such in the body of the commit message(s), and update the relevant
234+COOK ticket. When writing commit messages, it is helpful for others if
235+you indicate the COOK ticket. For example:
236+
237+ git commit -m '[COOK-1041] - Updated pool resource to correctly
238+ delete.'
239+
240+Please do use [foodcritic](http://acrmp.github.com/foodcritic) to
241+lint-check the cookbook. Except FC007, it should pass all correctness
242+rules. FC007 is okay as long as the dependent cookbooks are *required*
243+for the default behavior of the cookbook, such as to support an
244+uncommon platform, secondary recipe, etc.
245+
246+Please do ensure that your changes do not break or modify behavior for
247+other platforms supported by the cookbook. For example if your changes
248+are for Debian, make sure that they do not break on CentOS.
249+
250+Please do not modify the version number in the metadata.rb, Opscode
251+will select the appropriate version based on the release cycle
252+information above.
253+
254+Please do not update the CHANGELOG.md for a new version. Not all
255+changes to a cookbook may be merged and released in the same versions.
256+Opscode will update the CHANGELOG.md when releasing a new version of
257+the cookbook.
--- /dev/null
+++ b/cookbooks/yum/LICENSE
@@ -0,0 +1,201 @@
1+ Apache License
2+ Version 2.0, January 2004
3+ http://www.apache.org/licenses/
4+
5+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+1. Definitions.
8+
9+ "License" shall mean the terms and conditions for use, reproduction,
10+ and distribution as defined by Sections 1 through 9 of this document.
11+
12+ "Licensor" shall mean the copyright owner or entity authorized by
13+ the copyright owner that is granting the License.
14+
15+ "Legal Entity" shall mean the union of the acting entity and all
16+ other entities that control, are controlled by, or are under common
17+ control with that entity. For the purposes of this definition,
18+ "control" means (i) the power, direct or indirect, to cause the
19+ direction or management of such entity, whether by contract or
20+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21+ outstanding shares, or (iii) beneficial ownership of such entity.
22+
23+ "You" (or "Your") shall mean an individual or Legal Entity
24+ exercising permissions granted by this License.
25+
26+ "Source" form shall mean the preferred form for making modifications,
27+ including but not limited to software source code, documentation
28+ source, and configuration files.
29+
30+ "Object" form shall mean any form resulting from mechanical
31+ transformation or translation of a Source form, including but
32+ not limited to compiled object code, generated documentation,
33+ and conversions to other media types.
34+
35+ "Work" shall mean the work of authorship, whether in Source or
36+ Object form, made available under the License, as indicated by a
37+ copyright notice that is included in or attached to the work
38+ (an example is provided in the Appendix below).
39+
40+ "Derivative Works" shall mean any work, whether in Source or Object
41+ form, that is based on (or derived from) the Work and for which the
42+ editorial revisions, annotations, elaborations, or other modifications
43+ represent, as a whole, an original work of authorship. For the purposes
44+ of this License, Derivative Works shall not include works that remain
45+ separable from, or merely link (or bind by name) to the interfaces of,
46+ the Work and Derivative Works thereof.
47+
48+ "Contribution" shall mean any work of authorship, including
49+ the original version of the Work and any modifications or additions
50+ to that Work or Derivative Works thereof, that is intentionally
51+ submitted to Licensor for inclusion in the Work by the copyright owner
52+ or by an individual or Legal Entity authorized to submit on behalf of
53+ the copyright owner. For the purposes of this definition, "submitted"
54+ means any form of electronic, verbal, or written communication sent
55+ to the Licensor or its representatives, including but not limited to
56+ communication on electronic mailing lists, source code control systems,
57+ and issue tracking systems that are managed by, or on behalf of, the
58+ Licensor for the purpose of discussing and improving the Work, but
59+ excluding communication that is conspicuously marked or otherwise
60+ designated in writing by the copyright owner as "Not a Contribution."
61+
62+ "Contributor" shall mean Licensor and any individual or Legal Entity
63+ on behalf of whom a Contribution has been received by Licensor and
64+ subsequently incorporated within the Work.
65+
66+2. Grant of Copyright License. Subject to the terms and conditions of
67+ this License, each Contributor hereby grants to You a perpetual,
68+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69+ copyright license to reproduce, prepare Derivative Works of,
70+ publicly display, publicly perform, sublicense, and distribute the
71+ Work and such Derivative Works in Source or Object form.
72+
73+3. Grant of Patent License. Subject to the terms and conditions of
74+ this License, each Contributor hereby grants to You a perpetual,
75+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76+ (except as stated in this section) patent license to make, have made,
77+ use, offer to sell, sell, import, and otherwise transfer the Work,
78+ where such license applies only to those patent claims licensable
79+ by such Contributor that are necessarily infringed by their
80+ Contribution(s) alone or by combination of their Contribution(s)
81+ with the Work to which such Contribution(s) was submitted. If You
82+ institute patent litigation against any entity (including a
83+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84+ or a Contribution incorporated within the Work constitutes direct
85+ or contributory patent infringement, then any patent licenses
86+ granted to You under this License for that Work shall terminate
87+ as of the date such litigation is filed.
88+
89+4. Redistribution. You may reproduce and distribute copies of the
90+ Work or Derivative Works thereof in any medium, with or without
91+ modifications, and in Source or Object form, provided that You
92+ meet the following conditions:
93+
94+ (a) You must give any other recipients of the Work or
95+ Derivative Works a copy of this License; and
96+
97+ (b) You must cause any modified files to carry prominent notices
98+ stating that You changed the files; and
99+
100+ (c) You must retain, in the Source form of any Derivative Works
101+ that You distribute, all copyright, patent, trademark, and
102+ attribution notices from the Source form of the Work,
103+ excluding those notices that do not pertain to any part of
104+ the Derivative Works; and
105+
106+ (d) If the Work includes a "NOTICE" text file as part of its
107+ distribution, then any Derivative Works that You distribute must
108+ include a readable copy of the attribution notices contained
109+ within such NOTICE file, excluding those notices that do not
110+ pertain to any part of the Derivative Works, in at least one
111+ of the following places: within a NOTICE text file distributed
112+ as part of the Derivative Works; within the Source form or
113+ documentation, if provided along with the Derivative Works; or,
114+ within a display generated by the Derivative Works, if and
115+ wherever such third-party notices normally appear. The contents
116+ of the NOTICE file are for informational purposes only and
117+ do not modify the License. You may add Your own attribution
118+ notices within Derivative Works that You distribute, alongside
119+ or as an addendum to the NOTICE text from the Work, provided
120+ that such additional attribution notices cannot be construed
121+ as modifying the License.
122+
123+ You may add Your own copyright statement to Your modifications and
124+ may provide additional or different license terms and conditions
125+ for use, reproduction, or distribution of Your modifications, or
126+ for any such Derivative Works as a whole, provided Your use,
127+ reproduction, and distribution of the Work otherwise complies with
128+ the conditions stated in this License.
129+
130+5. Submission of Contributions. Unless You explicitly state otherwise,
131+ any Contribution intentionally submitted for inclusion in the Work
132+ by You to the Licensor shall be under the terms and conditions of
133+ this License, without any additional terms or conditions.
134+ Notwithstanding the above, nothing herein shall supersede or modify
135+ the terms of any separate license agreement you may have executed
136+ with Licensor regarding such Contributions.
137+
138+6. Trademarks. This License does not grant permission to use the trade
139+ names, trademarks, service marks, or product names of the Licensor,
140+ except as required for reasonable and customary use in describing the
141+ origin of the Work and reproducing the content of the NOTICE file.
142+
143+7. Disclaimer of Warranty. Unless required by applicable law or
144+ agreed to in writing, Licensor provides the Work (and each
145+ Contributor provides its Contributions) on an "AS IS" BASIS,
146+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147+ implied, including, without limitation, any warranties or conditions
148+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149+ PARTICULAR PURPOSE. You are solely responsible for determining the
150+ appropriateness of using or redistributing the Work and assume any
151+ risks associated with Your exercise of permissions under this License.
152+
153+8. Limitation of Liability. In no event and under no legal theory,
154+ whether in tort (including negligence), contract, or otherwise,
155+ unless required by applicable law (such as deliberate and grossly
156+ negligent acts) or agreed to in writing, shall any Contributor be
157+ liable to You for damages, including any direct, indirect, special,
158+ incidental, or consequential damages of any character arising as a
159+ result of this License or out of the use or inability to use the
160+ Work (including but not limited to damages for loss of goodwill,
161+ work stoppage, computer failure or malfunction, or any and all
162+ other commercial damages or losses), even if such Contributor
163+ has been advised of the possibility of such damages.
164+
165+9. Accepting Warranty or Additional Liability. While redistributing
166+ the Work or Derivative Works thereof, You may choose to offer,
167+ and charge a fee for, acceptance of support, warranty, indemnity,
168+ or other liability obligations and/or rights consistent with this
169+ License. However, in accepting such obligations, You may act only
170+ on Your own behalf and on Your sole responsibility, not on behalf
171+ of any other Contributor, and only if You agree to indemnify,
172+ defend, and hold each Contributor harmless for any liability
173+ incurred by, or claims asserted against, such Contributor by reason
174+ of your accepting any such warranty or additional liability.
175+
176+END OF TERMS AND CONDITIONS
177+
178+APPENDIX: How to apply the Apache License to your work.
179+
180+ To apply the Apache License to your work, attach the following
181+ boilerplate notice, with the fields enclosed by brackets "[]"
182+ replaced with your own identifying information. (Don't include
183+ the brackets!) The text should be enclosed in the appropriate
184+ comment syntax for the file format. We also recommend that a
185+ file or class name and description of purpose be included on the
186+ same "printed page" as the copyright notice for easier
187+ identification within third-party archives.
188+
189+Copyright [yyyy] [name of copyright owner]
190+
191+Licensed under the Apache License, Version 2.0 (the "License");
192+you may not use this file except in compliance with the License.
193+You may obtain a copy of the License at
194+
195+ http://www.apache.org/licenses/LICENSE-2.0
196+
197+Unless required by applicable law or agreed to in writing, software
198+distributed under the License is distributed on an "AS IS" BASIS,
199+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200+See the License for the specific language governing permissions and
201+limitations under the License.
--- /dev/null
+++ b/cookbooks/yum/README.md
@@ -0,0 +1,270 @@
1+# Description
2+
3+Configures various YUM components on Red Hat-like systems. Includes
4+LWRP for managing repositories and their GPG keys.
5+
6+Based on the work done by Eric Wolfe and Charles Duffy on the
7+[yumrepo](https://github.com/atomic-penguin/cookbook-yumrepo) cookbook.
8+
9+# Requirements
10+
11+Red Hat Enterprise Linux 5, and 6 distributions within this platform
12+family.
13+
14+# Attributes
15+
16+* `yum['exclude']`
17+ - An array containing a list of packages to exclude from updates or
18+ installs. Wildcards and shell globs are supported.
19+ - Defaults to an empty exclude list.
20+
21+* `yum['installonlypkgs']`
22+ - An array containing a list of packages which should only be
23+ installed, never updated.
24+ - Defaults to an empty install-only list.
25+
26+* `yum['ius_release']`
27+ - Set the IUS release to install.
28+ - Defaults to the current release of the IUS repo.
29+
30+* `yum['repoforge_release']`
31+ - Set the RepoForge release to install.
32+ - Defaults to the current release of the repoforge repo.
33+
34+EPEL attributes used in the `yum::epel` recipe, see
35+`attributes/epel.rb` for default values:
36+
37+* `yum['epel']['key']`
38+ - Name of the GPG key used for the repo.
39+
40+* `yum['epel']['baseurl']`
41+ - Base URL to an EPEL mirror.
42+
43+* `yum['epel']['url']`
44+ - URL to the EPEL mirrorlist.
45+
46+* `yum['epel']['key_url']`
47+ - URL to the GPG key for the repo.
48+
49+* `yum['epel']['includepkgs']`
50+ - list of packages you want to use for the repo.
51+
52+* `yum['epel']['exclude']`
53+ - list of packages you do NOT want to use for the repo.
54+
55+The `node['yum']['epel_release']` attribute is removed, see the __epel__
56+recipe information below.
57+
58+remi attributes used in the `yum::remi` recipe, see
59+`attributes/remi.rb` for default values:
60+
61+* `yum['remi']['key']`
62+ - Name of the GPG key used for the repo.
63+
64+* `yum['remi']['url']`
65+ - URL to the remi mirrorlist.
66+
67+* `yum['remi']['key_url']`
68+ - URL to the GPG key for the repo.
69+
70+* `yum['remi']['includepkgs']`
71+ - list of packages you want to use for the repo.
72+
73+* `yum['remi']['exclude']`
74+ - list of packages you do NOT want to use for the repo.
75+
76+Proxy settings used in yum.conf on RHEL family 5 and 6:
77+
78+* `yum['proxy']`
79+ - Set the URL for an HTTP proxy
80+ - None of the proxy settings are used if this is an empty string
81+ (default)
82+
83+* `yum['proxy_username']`
84+ - Set the username for the proxy
85+ - not used if `yum['proxy']` above is an empty string
86+
87+* `yum['proxy_password']`
88+ - Set the password for the proxy
89+ - not used if `yum['proxy']` above is an empty string
90+
91+# Recipes
92+
93+## default
94+
95+The default recipe does nothing.
96+
97+## yum
98+
99+Manages the configuration of the `/etc/yum.conf` via attributes. See
100+the aforementioned Array attributes `yum['exclude']` and
101+`yum['installonlypkgs']`.
102+
103+## epel
104+
105+Uses the `yum_key` and `yum_repository` resources from this cookbook
106+are used to manage the main EPEL repository. If you need other EPEL
107+repositories (source, debug-info), use the `yum_repository` LWRP in
108+your own cookbook where those packages are required. The recipe will
109+use the `yum['epel']` attributes (see above) to configure the key, url
110+and download the GPG key for the repo. The defaults are detected by
111+platform and version and should just work without modification in most
112+use cases.
113+
114+On all platforms except Amazon, the action is to add the repository.
115+On Amazon, the action is add and update.
116+
117+Amazon Linux has the EPEL repositories already added in the AMI. In
118+previous versions of this cookbook, they were enabled with
119+`yum-config-manager`, however in the current version, we manage the
120+repository using the LWRP. The main difference is that the source and
121+debuginfo repositories are not available, but if they're needed, add
122+them using the `yum_repository` LWRP in your own cookbook(s).
123+
124+## ius
125+
126+Installs the [IUS Community repositories](http://iuscommunity.org/Repos)
127+via RPM. Uses the `node['yum']['ius_release']` attribute to select the
128+right version of the package to install.
129+
130+The IUS repository requires EPEL, and includes `yum::epel` as a
131+dependency.
132+
133+## repoforge
134+
135+Installs the [RepoForge repositories](http://repoforge.org/)
136+via RPM. Uses the `node['yum']['repoforge_release']` attribute to select the
137+right version of the package to install.
138+
139+The RepoForge repository requires EPEL, and includes `yum::epel` as a
140+dependency.
141+
142+## remi
143+
144+Install the [Les RPM de Remi - Repository](http://rpms.famillecollet.com/)
145+with the `yum_key` and `yum_repository` resources from this cookbook
146+are used to manage the remi repository. Use the `yum['remi']`
147+attributes (see above) to configure the key, url and download the GPG
148+key for the repo. The defaults are detected by platform and should
149+just work without modification in most use cases.
150+
151+# Resources/Providers
152+
153+## key
154+
155+This LWRP handles importing GPG keys for YUM repositories. Keys can be
156+imported by the `url` parameter or placed in `/etc/pki/rpm-gpg/` by a
157+recipe and then installed with the LWRP without passing the URL.
158+
159+### Actions
160+
161+- :add: installs the GPG key into `/etc/pki/rpm-gpg/`
162+- :remove: removes the GPG key from `/etc/pki/rpm-gpg/`
163+
164+#### Attribute Parameters
165+
166+- key: name attribute. The name of the GPG key to install.
167+- url: if the key needs to be downloaded, the URL providing the download.
168+
169+#### Example
170+
171+``` ruby
172+# add the Zenoss GPG key
173+yum_key "RPM-GPG-KEY-zenoss" do
174+ url "http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss"
175+ action :add
176+end
177+
178+# remove Zenoss GPG key
179+yum_key "RPM-GPG-KEY-zenoss" do
180+ action :remove
181+end
182+```
183+
184+### repository
185+
186+This LWRP provides an easy way to manage additional YUM repositories.
187+GPG keys can be managed with the `key` LWRP. The LWRP automatically
188+updates the package management cache upon the first run, when a new
189+repo is added.
190+
191+#### Actions
192+
193+- :create: creates a repository file and builds the repository listing
194+- :add: runs create action if repository file is missing (default)
195+- :remove: removes the repository file
196+- :update: updates the repository
197+
198+#### Attribute Parameters
199+
200+- repo_name: name attribute. The name of the channel to discover
201+- description. The description of the repository
202+- url: The URL providing the packages, used for baseurl in the config
203+- mirrorlist: Set this as a string containing the URI to the
204+ mirrorlist, start with "http://", "ftp://", "file://"; use "file://"
205+ if the mirrorlist is a text file on the system.
206+- key: Optional, the name of the GPG key file installed by the `key`
207+ LWRP.
208+- enabled: Default is `1`, set to `0` if the repository is disabled.
209+- type: Optional, alternate type of repository
210+- failovermethod: Optional, failovermethod
211+- bootstrapurl: Optional, bootstrapurl
212+- make_cache: Optional, Default is `true`, if `false` then `yum -q
213+ makecache` will not be ran
214+
215+*Note*: When using both url (to set baseurl) and mirrorlist, it is probably a
216+good idea to also install the fastestmirror plugin, and use
217+failovermethod "priority".
218+
219+### Example
220+
221+``` ruby
222+# add the Zenoss repository
223+yum_repository "zenoss" do
224+ repo_name "zenoss"
225+ description "Zenoss Stable repo"
226+ url "http://dev.zenoss.com/yum/stable/"
227+ key "RPM-GPG-KEY-zenoss"
228+ action :add
229+end
230+
231+# remove Zenoss repo
232+yum_repository "zenoss" do
233+ action :remove
234+end
235+```
236+
237+# Usage
238+
239+Put `recipe[yum::yum]` in the run list to ensure yum is configured
240+correctly for your environment within your Chef run.
241+
242+Use the `yum::epel` recipe to enable EPEL, or the `yum::ius` recipe to
243+enable IUS, or the `yum::repoforge` recipe to enable RepoForge, or the
244+`yum::remi` recipe to enable remi per __Recipes__ section above.
245+
246+You can manage GPG keys either with cookbook_file in a recipe if you
247+want to package it with a cookbook or use the `url` parameter of the
248+`key` LWRP.
249+
250+# License and Author
251+
252+- Author:: Eric G. Wolfe
253+- Author:: Matt Ray (<matt@opscode.com>)
254+- Author:: Joshua Timberman (<joshua@opscode.com>)
255+
256+- Copyright:: 2010 Tippr Inc.
257+- Copyright:: 2011 Eric G. Wolfe
258+- Copyright:: 2011-2012 Opscode, Inc.
259+
260+Licensed under the Apache License, Version 2.0 (the "License");
261+you may not use this file except in compliance with the License.
262+You may obtain a copy of the License at
263+
264+ http://www.apache.org/licenses/LICENSE-2.0
265+
266+Unless required by applicable law or agreed to in writing, software
267+distributed under the License is distributed on an "AS IS" BASIS,
268+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269+See the License for the specific language governing permissions and
270+limitations under the License.
--- /dev/null
+++ b/cookbooks/yum/attributes/default.rb
@@ -0,0 +1,30 @@
1+#
2+# Cookbook Name:: yum
3+# Attributes:: default
4+#
5+# Copyright 2011, Eric G. Wolfe
6+# Copyright 2011, Opscode, Inc.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+#
20+
21+# Example: override.yum.exclude = "kernel* compat-glibc*"
22+default['yum']['exclude'] = Array.new
23+default['yum']['installonlypkgs'] = Array.new
24+default['yum']['ius_release'] = '1.0-11'
25+default['yum']['repoforge_release'] = '0.5.2-2'
26+default['yum']['proxy'] = ''
27+default['yum']['proxy_username'] = ''
28+default['yum']['proxy_password'] = ''
29+default['yum']['cachedir'] = '/var/cache/yum'
30+default['yum']['keepcache'] = 0
--- /dev/null
+++ b/cookbooks/yum/attributes/elrepo.rb
@@ -0,0 +1,24 @@
1+#
2+# Cookbook Name:: yum
3+# Attributes:: elrepo
4+#
5+# Copyright 2013, Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+default['yum']['elrepo']['url'] = "http://elrepo.org/mirrors-elrepo.el#{node['platform_version'].to_i}"
21+default['yum']['elrepo']['key'] = "RPM-GPG-KEY-elrepo.org"
22+default['yum']['elrepo']['key_url'] = "http://elrepo.org/#{node['yum']['elrepo']['key']}"
23+default['yum']['elrepo']['includepkgs'] = nil
24+default['yum']['elrepo']['exclude'] = nil
--- /dev/null
+++ b/cookbooks/yum/attributes/epel.rb
@@ -0,0 +1,39 @@
1+#
2+# Cookbook Name:: yum
3+# Attributes:: epel
4+#
5+# Copyright 2011, Eric G. Wolfe
6+# Copyright 2011, Opscode, Inc.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+#
20+
21+case node['platform']
22+when "amazon"
23+ default['yum']['epel']['url'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch"
24+ default['yum']['epel']['baseurl'] = ""
25+ default['yum']['epel']['key'] = "RPM-GPG-KEY-EPEL-6"
26+else
27+ default['yum']['epel']['url'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node['platform_version'].to_i}&arch=$basearch"
28+ default['yum']['epel']['baseurl'] = ""
29+
30+ if node['platform_version'].to_i >= 6
31+ default['yum']['epel']['key'] = "RPM-GPG-KEY-EPEL-6"
32+ else
33+ default['yum']['epel']['key'] = "RPM-GPG-KEY-EPEL"
34+ end
35+end
36+
37+default['yum']['epel']['key_url'] = "http://download.fedoraproject.org/pub/epel/#{node['yum']['epel']['key']}"
38+default['yum']['epel']['includepkgs'] = nil
39+default['yum']['epel']['exclude'] = nil
--- /dev/null
+++ b/cookbooks/yum/attributes/remi.rb
@@ -0,0 +1,30 @@
1+#
2+# Cookbook Name:: yum
3+# Attributes:: remi
4+#
5+# Copyright 2011, Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+case node['platform']
21+when "fedora"
22+ default['yum']['remi']['url'] = "http://rpms.famillecollet.com/fedora/#{node['platform_version'].to_i}/remi/mirror"
23+else
24+ default['yum']['remi']['url'] = "http://rpms.famillecollet.com/enterprise/#{node['platform_version'].to_i}/remi/mirror"
25+end
26+
27+default['yum']['remi']['key'] = "RPM-GPG-KEY-remi"
28+default['yum']['remi']['key_url'] = "http://rpms.famillecollet.com/#{node['yum']['remi']['key']}"
29+default['yum']['remi']['includepkgs'] = nil
30+default['yum']['remi']['exclude'] = nil
--- /dev/null
+++ b/cookbooks/yum/files/default/tests/minitest/default_test.rb
@@ -0,0 +1,28 @@
1+#
2+# Cookbook Name:: yum
3+# Recipe:: default
4+#
5+# Copyright 2013, Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+require File.expand_path('../support/helpers', __FILE__)
21+
22+describe "yum::default" do
23+ include Helpers::YumTest
24+
25+ it "Default recipe does nothing, so default_test does nothing" do
26+ pending
27+ end
28+end
--- /dev/null
+++ b/cookbooks/yum/files/default/tests/minitest/support/helpers.rb
@@ -0,0 +1,37 @@
1+#
2+# Cookbook Name:: yum_test
3+# Recipe:: default
4+#
5+# Copyright 2013, Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+module Helpers
21+ module YumTest
22+ require 'chef/mixin/shell_out'
23+ include Chef::Mixin::ShellOut
24+ include MiniTest::Chef::Assertions
25+ include MiniTest::Chef::Context
26+ include MiniTest::Chef::Resources
27+
28+ # This isn't the most efficient thing in the world, but it works
29+ # reliably as yum will only return the repos that are actually
30+ # enabled. It would probably be more efficient, since we're at the
31+ # end of the successful run, to cache the output to a file and
32+ # inspect its contents.
33+ def repo_enabled(repo)
34+ shell_out("yum repolist enabled --verbose | grep Repo-id").stdout.include?(repo)
35+ end
36+ end
37+end
--- /dev/null
+++ b/cookbooks/yum/files/default/tests/minitest/test_test.rb
@@ -0,0 +1,66 @@
1+#
2+# Cookbook Name:: yum
3+#
4+# Copyright 2013, Opscode, Inc.
5+#
6+# Licensed under the Apache License, Version 2.0 (the "License");
7+# you may not use this file except in compliance with the License.
8+# You may obtain a copy of the License at
9+#
10+# http://www.apache.org/licenses/LICENSE-2.0
11+#
12+# Unless required by applicable law or agreed to in writing, software
13+# distributed under the License is distributed on an "AS IS" BASIS,
14+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+# See the License for the specific language governing permissions and
16+# limitations under the License.
17+#
18+
19+require File.expand_path('../support/helpers', __FILE__)
20+
21+describe "yum::test" do
22+ # helpers includes the repo_enabled method used to test that repos
23+ # are in fact enabled.
24+ include Helpers::YumTest
25+
26+ describe "elrepo" do
27+ it "enables the elrepo repository" do
28+ assert(repo_enabled("elrepo"))
29+ end
30+ end
31+
32+ describe "epel" do
33+ it "enables the epel repository" do
34+ assert(repo_enabled("epel"))
35+ end
36+ end
37+
38+ describe "ius" do
39+ it "enables the ius repository" do
40+ assert(repo_enabled("ius"))
41+ end
42+ end
43+
44+ describe "remi" do
45+ it "enables the remi repository" do
46+ assert(repo_enabled("remi"))
47+ end
48+ end
49+
50+ describe "repoforge" do
51+ it "enables the repoforge repository" do
52+ assert(repo_enabled("rpmforge"))
53+ end
54+ end
55+
56+ describe "cook-2121" do
57+
58+ it 'doesnt update the zenos-add.repo file if it exists' do
59+ assert File.zero?('/etc/yum.repos.d/zenoss-add.repo')
60+ end
61+
62+ it 'updates the zenoss-create file' do
63+ file('/etc/yum.repos.d/zenoss-create.repo').must_match %r[baseurl=http://dev.zenoss.com/yum/stable/]
64+ end
65+ end
66+end
--- /dev/null
+++ b/cookbooks/yum/metadata.json
@@ -0,0 +1,100 @@
1+{
2+ "name": "yum",
3+ "description": "A fabulous new cookbook",
4+ "long_description": "# Description\n\nConfigures various YUM components on Red Hat-like systems. Includes\nLWRP for managing repositories and their GPG keys.\n\nBased on the work done by Eric Wolfe and Charles Duffy on the\n[yumrepo](https://github.com/atomic-penguin/cookbook-yumrepo) cookbook.\n\n# Requirements\n\nRed Hat Enterprise Linux 5, and 6 distributions within this platform\nfamily.\n\n# Attributes\n\n* `yum['exclude']`\n - An array containing a list of packages to exclude from updates or\n installs. Wildcards and shell globs are supported.\n - Defaults to an empty exclude list.\n\n* `yum['installonlypkgs']`\n - An array containing a list of packages which should only be\n installed, never updated.\n - Defaults to an empty install-only list.\n\n* `yum['ius_release']`\n - Set the IUS release to install.\n - Defaults to the current release of the IUS repo.\n\n* `yum['repoforge_release']`\n - Set the RepoForge release to install.\n - Defaults to the current release of the repoforge repo.\n\nEPEL attributes used in the `yum::epel` recipe, see\n`attributes/epel.rb` for default values:\n\n* `yum['epel']['key']`\n - Name of the GPG key used for the repo.\n\n* `yum['epel']['baseurl']`\n - Base URL to an EPEL mirror.\n\n* `yum['epel']['url']`\n - URL to the EPEL mirrorlist.\n\n* `yum['epel']['key_url']`\n - URL to the GPG key for the repo.\n\n* `yum['epel']['includepkgs']`\n - list of packages you want to use for the repo.\n\n* `yum['epel']['exclude']`\n - list of packages you do NOT want to use for the repo.\n\nThe `node['yum']['epel_release']` attribute is removed, see the __epel__\nrecipe information below.\n\nremi attributes used in the `yum::remi` recipe, see\n`attributes/remi.rb` for default values:\n\n* `yum['remi']['key']`\n - Name of the GPG key used for the repo.\n\n* `yum['remi']['url']`\n - URL to the remi mirrorlist.\n\n* `yum['remi']['key_url']`\n - URL to the GPG key for the repo.\n\n* `yum['remi']['includepkgs']`\n - list of packages you want to use for the repo.\n\n* `yum['remi']['exclude']`\n - list of packages you do NOT want to use for the repo.\n\nProxy settings used in yum.conf on RHEL family 5 and 6:\n\n* `yum['proxy']`\n - Set the URL for an HTTP proxy\n - None of the proxy settings are used if this is an empty string\n (default)\n\n* `yum['proxy_username']`\n - Set the username for the proxy\n - not used if `yum['proxy']` above is an empty string\n\n* `yum['proxy_password']`\n - Set the password for the proxy\n - not used if `yum['proxy']` above is an empty string\n\n# Recipes\n\n## default\n\nThe default recipe does nothing.\n\n## yum\n\nManages the configuration of the `/etc/yum.conf` via attributes. See\nthe aforementioned Array attributes `yum['exclude']` and\n`yum['installonlypkgs']`.\n\n## epel\n\nUses the `yum_key` and `yum_repository` resources from this cookbook\nare used to manage the main EPEL repository. If you need other EPEL\nrepositories (source, debug-info), use the `yum_repository` LWRP in\nyour own cookbook where those packages are required. The recipe will\nuse the `yum['epel']` attributes (see above) to configure the key, url\nand download the GPG key for the repo. The defaults are detected by\nplatform and version and should just work without modification in most\nuse cases.\n\nOn all platforms except Amazon, the action is to add the repository.\nOn Amazon, the action is add and update.\n\nAmazon Linux has the EPEL repositories already added in the AMI. In\nprevious versions of this cookbook, they were enabled with\n`yum-config-manager`, however in the current version, we manage the\nrepository using the LWRP. The main difference is that the source and\ndebuginfo repositories are not available, but if they're needed, add\nthem using the `yum_repository` LWRP in your own cookbook(s).\n\n## ius\n\nInstalls the [IUS Community repositories](http://iuscommunity.org/Repos)\nvia RPM. Uses the `node['yum']['ius_release']` attribute to select the\nright version of the package to install.\n\nThe IUS repository requires EPEL, and includes `yum::epel` as a\ndependency.\n\n## repoforge\n\nInstalls the [RepoForge repositories](http://repoforge.org/)\nvia RPM. Uses the `node['yum']['repoforge_release']` attribute to select the\nright version of the package to install.\n\nThe RepoForge repository requires EPEL, and includes `yum::epel` as a\ndependency.\n\n## remi\n\nInstall the [Les RPM de Remi - Repository](http://rpms.famillecollet.com/)\nwith the `yum_key` and `yum_repository` resources from this cookbook\nare used to manage the remi repository. Use the `yum['remi']`\nattributes (see above) to configure the key, url and download the GPG\nkey for the repo. The defaults are detected by platform and should\njust work without modification in most use cases.\n\n# Resources/Providers\n\n## key\n\nThis LWRP handles importing GPG keys for YUM repositories. Keys can be\nimported by the `url` parameter or placed in `/etc/pki/rpm-gpg/` by a\nrecipe and then installed with the LWRP without passing the URL.\n\n### Actions\n\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\n### repository\n\nThis LWRP provides an easy way to manage additional YUM repositories.\nGPG keys can be managed with the `key` LWRP. The LWRP automatically\nupdates the package management cache upon the first run, when a new\nrepo is added.\n\n#### Actions\n\n- :create: creates a repository file and builds the repository listing\n- :add: runs create action if repository file is missing (default)\n- :remove: removes the repository file\n- :update: updates the repository\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, used for baseurl in the config\n- mirrorlist: Set this as a string containing the URI to the\n mirrorlist, start with \"http://\", \"ftp://\", \"file://\"; use \"file://\"\n if the mirrorlist is a text file on the system.\n- key: Optional, the name of the GPG key file installed by the `key`\n LWRP.\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- make_cache: Optional, Default is `true`, if `false` then `yum -q\n makecache` will not be ran\n\n*Note*: When using both url (to set baseurl) and mirrorlist, it is probably a\ngood idea to also install the fastestmirror plugin, and use\nfailovermethod \"priority\".\n\n### Example\n\n``` ruby\n# add the Zenoss repository\nyum_repository \"zenoss\" do\n repo_name \"zenoss\"\n description \"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\n# Usage\n\nPut `recipe[yum::yum]` in the run list to ensure yum is configured\ncorrectly for your environment within your Chef run.\n\nUse the `yum::epel` recipe to enable EPEL, or the `yum::ius` recipe to\nenable IUS, or the `yum::repoforge` recipe to enable RepoForge, or the\n`yum::remi` recipe to enable remi per __Recipes__ section above.\n\nYou can manage GPG keys either with cookbook_file in a recipe if you\nwant to package it with a cookbook or use the `url` parameter of the\n`key` LWRP.\n\n# License and Author\n\n- Author:: Eric G. Wolfe\n- Author:: Matt Ray (<matt@opscode.com>)\n- Author:: Joshua Timberman (<joshua@opscode.com>)\n\n- Copyright:: 2010 Tippr Inc.\n- Copyright:: 2011 Eric G. Wolfe\n- Copyright:: 2011-2012 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",
5+ "maintainer": "Opscode, Inc.",
6+ "maintainer_email": "cookbooks@opscode.com",
7+ "license": "Apache 2.0",
8+ "platforms": {
9+ "redhat": ">= 5.0",
10+ "centos": ">= 5.0",
11+ "scientific": ">= 5.0",
12+ "amazon": ">= 5.0"
13+ },
14+ "dependencies": {
15+ },
16+ "recommendations": {
17+ },
18+ "suggestions": {
19+ },
20+ "conflicting": {
21+ },
22+ "providing": {
23+ },
24+ "replacing": {
25+ },
26+ "attributes": {
27+ "yum/exclude": {
28+ "display_name": "yum.conf exclude",
29+ "description": "List of packages to exclude from updates or installs. This should be an array. Shell globs using wildcards (eg. * and ?) are allowed.",
30+ "required": "optional",
31+ "choice": [
32+
33+ ],
34+ "calculated": false,
35+ "type": "string",
36+ "recipes": [
37+
38+ ]
39+ },
40+ "yum/installonlypkgs": {
41+ "display_name": "yum.conf installonlypkgs",
42+ "description": "List of packages that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-smp, kernel-bigmem, kernel-enterprise, kernel-debug, kernel-unsupported.",
43+ "required": "optional",
44+ "choice": [
45+
46+ ],
47+ "calculated": false,
48+ "type": "string",
49+ "recipes": [
50+
51+ ]
52+ },
53+ "yum/proxy": {
54+ "display_name": "yum.conf proxy",
55+ "description": "Set the http URL for proxy to use in yum.conf",
56+ "required": "optional",
57+ "choice": [
58+
59+ ],
60+ "calculated": false,
61+ "type": "string",
62+ "recipes": [
63+
64+ ]
65+ },
66+ "yum/proxy_username": {
67+ "display_name": "yum.conf proxy_username",
68+ "description": "Set the proxy_username to use for yum.conf",
69+ "required": "optional",
70+ "choice": [
71+
72+ ],
73+ "calculated": false,
74+ "type": "string",
75+ "recipes": [
76+
77+ ]
78+ },
79+ "yum/proxy_password": {
80+ "display_name": "yum.conf proxy_password",
81+ "description": "Set the proxy_password to use for yum.conf",
82+ "required": "optional",
83+ "choice": [
84+
85+ ],
86+ "calculated": false,
87+ "type": "string",
88+ "recipes": [
89+
90+ ]
91+ }
92+ },
93+ "groupings": {
94+ },
95+ "recipes": {
96+ "yum": "Empty recipe.",
97+ "yum::yum": "Manages yum configuration"
98+ },
99+ "version": "2.2.2"
100+}
\ No newline at end of file
--- /dev/null
+++ b/cookbooks/yum/metadata.rb
@@ -0,0 +1,37 @@
1+name "yum"
2+maintainer "Opscode, Inc."
3+maintainer_email "cookbooks@opscode.com"
4+license "Apache 2.0"
5+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6+version "2.2.2"
7+recipe "yum", "Empty recipe."
8+recipe "yum::yum", "Manages yum configuration"
9+
10+%w{ redhat centos scientific amazon }.each do |os|
11+ supports os, ">= 5.0"
12+end
13+
14+attribute "yum/exclude",
15+ :display_name => "yum.conf exclude",
16+ :description => "List of packages to exclude from updates or installs. This should be an array. Shell globs using wildcards (eg. * and ?) are allowed.",
17+ :required => "optional"
18+
19+attribute "yum/installonlypkgs",
20+ :display_name => "yum.conf installonlypkgs",
21+ :description => "List of packages that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-smp, kernel-bigmem, kernel-enterprise, kernel-debug, kernel-unsupported.",
22+ :required => "optional"
23+
24+attribute "yum/proxy",
25+ :display_name => "yum.conf proxy",
26+ :description => "Set the http URL for proxy to use in yum.conf",
27+ :required => "optional"
28+
29+attribute "yum/proxy_username",
30+ :display_name => "yum.conf proxy_username",
31+ :description => "Set the proxy_username to use for yum.conf",
32+ :required => "optional"
33+
34+attribute "yum/proxy_password",
35+ :display_name => "yum.conf proxy_password",
36+ :description => "Set the proxy_password to use for yum.conf",
37+ :required => "optional"
--- /dev/null
+++ b/cookbooks/yum/providers/key.rb
@@ -0,0 +1,79 @@
1+#
2+# Cookbook Name:: yum
3+# Provider:: key
4+#
5+# Copyright 2010, Tippr Inc.
6+# Copyright 2011, Opscode, Inc.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+#
20+
21+def whyrun_supported?
22+ true
23+end
24+
25+action :add do
26+ unless ::File.exists?("/etc/pki/rpm-gpg/#{new_resource.key}")
27+ Chef::Log.info "Adding #{new_resource.key} GPG key to /etc/pki/rpm-gpg/"
28+
29+ if node['platform_version'].to_i <= 5
30+ package "gnupg"
31+ elsif node['platform_version'].to_i >= 6
32+ package "gnupg2"
33+ end
34+
35+ execute "import-rpm-gpg-key-#{new_resource.key}" do
36+ command "rpm --import /etc/pki/rpm-gpg/#{new_resource.key}"
37+ action :nothing
38+ not_if <<-EOH
39+ function packagenames_for_keyfile() {
40+ local filename="$1"
41+ gpg \
42+ --with-fingerprint \
43+ --with-colons \
44+ --fixed-list-mode \
45+ "$filename" \
46+ | gawk -F: '/^pub/ { print tolower(sprintf("gpg-pubkey-%s-%x\\n", substr($5, length($5)-8+1), $6)) }'
47+ }
48+
49+ for pkgname in $(packagenames_for_keyfile "/etc/pki/rpm-gpg/#{new_resource.key}"); do
50+ if [[ $pkgname ]] && ! rpm -q $pkgname ; then
51+ exit 1;
52+ fi;
53+ done
54+
55+ exit 0
56+ EOH
57+ end
58+
59+ #download the file if necessary
60+ unless new_resource.url.nil?
61+ remote_file "/etc/pki/rpm-gpg/#{new_resource.key}" do
62+ source new_resource.url
63+ mode "0644"
64+ notifies :run, "execute[import-rpm-gpg-key-#{new_resource.key}]", :immediately
65+ end
66+ end
67+
68+ end
69+end
70+
71+action :remove do
72+ if ::File.exists?("/etc/pki/rpm-gpg/#{new_resource.key}")
73+ Chef::Log.info "Removing #{new_resource.key} key from /etc/pki/rpm-gpg/"
74+ file "/etc/pki/rpm-gpg/#{new_resource.key}" do
75+ action :delete
76+ end
77+ new_resource.updated_by_last_action(true)
78+ end
79+end
--- /dev/null
+++ b/cookbooks/yum/providers/repository.rb
@@ -0,0 +1,124 @@
1+#
2+# Cookbook Name:: yum
3+# Provider:: repository
4+#
5+# Copyright 2010, Tippr Inc.
6+# Copyright 2011, Opscode, Inc..
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+#
20+
21+# note that deletion does not remove GPG keys, either from the repo or
22+# /etc/pki/rpm-gpg; this is a design decision.
23+
24+def whyrun_supported?
25+ true
26+end
27+
28+action :add do
29+ unless ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
30+ Chef::Log.info "Adding #{new_resource.repo_name} repository to /etc/yum.repos.d/#{new_resource.repo_name}.repo"
31+ repo_config
32+ end
33+end
34+
35+action :create do
36+ Chef::Log.info "Adding and updating #{new_resource.repo_name} repository in /etc/yum.repos.d/#{new_resource.repo_name}.repo"
37+ repo_config
38+end
39+
40+action :remove do
41+ if ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
42+ Chef::Log.info "Removing #{new_resource.repo_name} repository from /etc/yum.repos.d/"
43+ file "/etc/yum.repos.d/#{new_resource.repo_name}.repo" do
44+ action :delete
45+ end
46+ new_resource.updated_by_last_action(true)
47+ end
48+end
49+
50+action :update do
51+ repos ||= {}
52+ # If the repo is already enabled/disabled as per the resource, we don't want to converge the template resource.
53+ if ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
54+ ::File.open("/etc/yum.repos.d/#{new_resource.repo_name}.repo") do |file|
55+ repo_name ||= nil
56+ file.each_line do |line|
57+ case line
58+ when /^\[(\S+)\]/
59+ repo_name = $1
60+ repos[repo_name] ||= {}
61+ when /^(\S+?)=(.*)$/
62+ param, value = $1, $2
63+ repos[repo_name][param] = value
64+ else
65+ end
66+ end
67+ end
68+ else
69+ Chef::Log.error "Repo /etc/yum.repos.d/#{new_resource.repo_name}.repo does not exist, you must create it first"
70+ end
71+ if repos[new_resource.repo_name]['enabled'].to_i != new_resource.enabled
72+ Chef::Log.info "Updating #{new_resource.repo_name} repository in /etc/yum.repos.d/#{new_resource.repo_name}.repo (setting enabled=#{new_resource.enabled})"
73+ repo_config
74+ else
75+ Chef::Log.debug "Repository /etc/yum.repos.d/#{new_resource.repo_name}.repo is already set to enabled=#{new_resource.enabled}, skipping"
76+ end
77+end
78+
79+private
80+
81+def repo_config
82+ #import the gpg key. If it needs to be downloaded or imported from a cookbook
83+ #that can be done in the calling recipe
84+ if new_resource.key then
85+ yum_key new_resource.key
86+ end
87+ #get the metadata
88+ execute "yum-makecache" do
89+ command "yum -q makecache"
90+ action :nothing
91+ end
92+ #reload internal Chef yum cache
93+ ruby_block "reload-internal-yum-cache" do
94+ block do
95+ Chef::Provider::Package::Yum::YumCache.instance.reload
96+ end
97+ action :nothing
98+ end
99+ #write out the file
100+ template "/etc/yum.repos.d/#{new_resource.repo_name}.repo" do
101+ cookbook "yum"
102+ source "repo.erb"
103+ mode "0644"
104+ variables({
105+ :repo_name => new_resource.repo_name,
106+ :description => new_resource.description,
107+ :url => new_resource.url,
108+ :mirrorlist => new_resource.mirrorlist,
109+ :key => new_resource.key,
110+ :enabled => new_resource.enabled,
111+ :type => new_resource.type,
112+ :failovermethod => new_resource.failovermethod,
113+ :bootstrapurl => new_resource.bootstrapurl,
114+ :includepkgs => new_resource.includepkgs,
115+ :exclude => new_resource.exclude,
116+ :priority => new_resource.priority,
117+ :metadata_expire => new_resource.metadata_expire
118+ })
119+ if new_resource.make_cache
120+ notifies :run, "execute[yum-makecache]", :immediately
121+ notifies :create, "ruby_block[reload-internal-yum-cache]", :immediately
122+ end
123+ end
124+end
--- /dev/null
+++ b/cookbooks/yum/recipes/default.rb
@@ -0,0 +1,18 @@
1+#
2+# Cookbook Name:: yum
3+# Recipe:: default
4+#
5+# Copyright 2011, Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
--- /dev/null
+++ b/cookbooks/yum/recipes/elrepo.rb
@@ -0,0 +1,31 @@
1+#
2+# Cookbook Name:: yum
3+# Recipe:: elrepo
4+#
5+# Copyright:: Copyright (c) 2013 Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+
19+yum_key node['yum']['elrepo']['key'] do
20+ url node['yum']['elrepo']['key_url']
21+ action :add
22+end
23+
24+yum_repository "elrepo" do
25+ description "ELRepo.org Community Enterprise Linux Extras Repository"
26+ key node['yum']['elrepo']['key']
27+ mirrorlist node['yum']['elrepo']['url']
28+ includepkgs node['yum']['elrepo']['includepkgs']
29+ exclude node['yum']['elrepo']['exclude']
30+ action :create
31+end
--- /dev/null
+++ b/cookbooks/yum/recipes/epel.rb
@@ -0,0 +1,35 @@
1+#
2+# Author:: Joshua Timberman (<joshua@opscode.com>)
3+# Cookbook Name:: yum
4+# Recipe:: epel
5+#
6+# Copyright:: Copyright (c) 2011 Opscode, Inc.
7+# Copyright 2010, Eric G. Wolfe
8+# Copyright 2010, Tippr Inc.
9+#
10+# Licensed under the Apache License, Version 2.0 (the "License");
11+# you may not use this file except in compliance with the License.
12+# You may obtain a copy of the License at
13+#
14+# http://www.apache.org/licenses/LICENSE-2.0
15+#
16+# Unless required by applicable law or agreed to in writing, software
17+# distributed under the License is distributed on an "AS IS" BASIS,
18+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+# See the License for the specific language governing permissions and
20+# limitations under the License.
21+
22+yum_key node['yum']['epel']['key'] do
23+ url node['yum']['epel']['key_url']
24+ action :add
25+end
26+
27+yum_repository "epel" do
28+ description "Extra Packages for Enterprise Linux"
29+ key node['yum']['epel']['key']
30+ url node['yum']['epel']['baseurl']
31+ mirrorlist node['yum']['epel']['url']
32+ includepkgs node['yum']['epel']['includepkgs']
33+ exclude node['yum']['epel']['exclude']
34+ action platform?('amazon') ? [:add, :update] : :create
35+end
--- /dev/null
+++ b/cookbooks/yum/recipes/ius.rb
@@ -0,0 +1,42 @@
1+#
2+# Author:: Joshua Timberman (<joshua@opscode.com>)
3+# Cookbook Name:: yum
4+# Recipe:: ius
5+#
6+# Copyright:: Copyright (c) 2011 Opscode, Inc.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+
20+include_recipe "yum::epel"
21+
22+package "epel-release"
23+
24+major = node['platform_version'].to_i
25+ius = node['yum']['ius_release']
26+
27+remote_file "#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm" do
28+ source "http://dl.iuscommunity.org/pub/ius/stable/Redhat/#{major}/i386/ius-release-#{ius}.ius.el#{major}.noarch.rpm"
29+ not_if "rpm -qa | grep -q '^ius-release-#{ius}'"
30+ notifies :install, "rpm_package[ius-release]", :immediately
31+end
32+
33+rpm_package "ius-release" do
34+ source "#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm"
35+ only_if { ::File.exists?("#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm") }
36+ action :nothing
37+end
38+
39+file "ius-release-cleanup" do
40+ path "#{Chef::Config[:file_cache_path]}/ius-release-#{ius}.ius.el#{major}.noarch.rpm"
41+ action :delete
42+end
--- /dev/null
+++ b/cookbooks/yum/recipes/remi.rb
@@ -0,0 +1,35 @@
1+#
2+# Author:: Takeshi KOMIYA (<i.tkomiya@gmail.com>)
3+# Cookbook Name:: yum
4+# Recipe:: remi
5+#
6+# Copyright:: Copyright (c) 2011 Opscode, Inc.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+
20+include_recipe "yum::epel"
21+
22+yum_key node['yum']['remi']['key'] do
23+ url node['yum']['remi']['key_url']
24+ action :add
25+end
26+
27+yum_repository "remi" do
28+ description "Les RPM de remi pour Enterprise Linux #{node['platform_version']} - $basearch"
29+ key node['yum']['remi']['key']
30+ mirrorlist node['yum']['remi']['url']
31+ failovermethod "priority"
32+ includepkgs node['yum']['remi']['includepkgs']
33+ exclude node['yum']['remi']['exclude']
34+ action :create
35+end
--- /dev/null
+++ b/cookbooks/yum/recipes/repoforge.rb
@@ -0,0 +1,41 @@
1+#
2+# Author:: Eric Edgar (<rocketman110@gmail.com>)
3+# Cookbook Name:: yum
4+# Recipe:: repoforge
5+#
6+# Copyright:: Copyright (c) 2012-2013 Opscode, Inc.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+
20+include_recipe "yum::epel"
21+
22+major = platform?("amazon") ? 6 : node['platform_version'].to_i
23+arch = (node['kernel']['machine'] == "i686" && major == 5) ? "i386" : node['kernel']['machine']
24+repoforge = node['yum']['repoforge_release']
25+
26+remote_file "#{Chef::Config[:file_cache_path]}/rpmforge-release-#{repoforge}.el#{major}.rf.#{arch}.rpm" do
27+ source "http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-#{repoforge}.el#{major}.rf.#{arch}.rpm"
28+ not_if "rpm -qa | grep -q '^rpmforge-release-#{repoforge}'"
29+ notifies :install, "rpm_package[rpmforge-release]", :immediately
30+end
31+
32+rpm_package "rpmforge-release" do
33+ source "#{Chef::Config[:file_cache_path]}/rpmforge-release-#{repoforge}.el#{major}.rf.#{arch}.rpm"
34+ only_if { ::File.exists?("#{Chef::Config[:file_cache_path]}/rpmforge-release-#{repoforge}.el#{major}.rf.#{arch}.rpm") }
35+ action :install
36+end
37+
38+file "repoforge-release-cleanup" do
39+ path "#{Chef::Config[:file_cache_path]}/rpmforge-release-#{repoforge}.el#{major}.rf.#{arch}.rpm"
40+ action :delete
41+end
--- /dev/null
+++ b/cookbooks/yum/recipes/test.rb
@@ -0,0 +1,39 @@
1+#
2+# Cookbook:: yum
3+# Recipe:: test
4+#
5+# Author:: Joshua Timberman <joshua@opscode.com>
6+# Copyright:: Copyright (c) 2013, Opscode, Inc <legal@opscode.com>
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+#
20+
21+include_recipe "yum::epel"
22+include_recipe "yum::elrepo"
23+include_recipe "yum::ius"
24+include_recipe "yum::repoforge"
25+include_recipe "yum::yum"
26+include_recipe "yum::remi"
27+
28+%w{add create}.each do |act|
29+ file "/etc/yum.repos.d/zenoss-#{act}.repo" do
30+ action :create
31+ end
32+
33+ yum_repository "zenoss-#{act}" do
34+ description "Zenoss Stable repo"
35+ url "http://dev.zenoss.com/yum/stable/"
36+ key "RPM-GPG-KEY-zenoss"
37+ action act.to_sym
38+ end
39+end
--- /dev/null
+++ b/cookbooks/yum/recipes/yum.rb
@@ -0,0 +1,23 @@
1+#
2+# Cookbook Name:: yum
3+# Recipe:: yum
4+#
5+# Copyright 2011, Eric G. Wolfe
6+# Copyright 2011, Opscode, Inc.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License");
9+# you may not use this file except in compliance with the License.
10+# You may obtain a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS,
16+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+# See the License for the specific language governing permissions and
18+# limitations under the License.
19+#
20+
21+template "/etc/yum.conf" do
22+ source "yum-rhel#{node['platform_version'].to_i}.conf.erb"
23+end
--- /dev/null
+++ b/cookbooks/yum/resources/key.rb
@@ -0,0 +1,29 @@
1+#
2+# Cookbook Name:: yum
3+# Resource:: key
4+#
5+# Copyright 2011, Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+actions :add, :remove
21+default_action :add
22+
23+attribute :key, :kind_of => String, :name_attribute => true
24+attribute :url, :kind_of => String, :default => nil
25+
26+def initialize(*args)
27+ super
28+ @action = :add
29+end
--- /dev/null
+++ b/cookbooks/yum/resources/repository.rb
@@ -0,0 +1,41 @@
1+#
2+# Cookbook Name:: yum
3+# Resource:: repository
4+#
5+# Copyright 2011, Opscode, Inc.
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+actions :add, :remove, :update, :create
21+
22+#name of the repo, used for .repo filename
23+attribute :repo_name, :kind_of => String, :name_attribute => true
24+attribute :description, :kind_of => String #long description
25+attribute :url, :kind_of => String, :default => ""
26+attribute :mirrorlist, :default => false
27+attribute :key, :kind_of => String, :default => nil
28+attribute :enabled, :default => 1
29+attribute :type, :kind_of => String, :default => nil
30+attribute :failovermethod, :kind_of => String, :default => nil
31+attribute :bootstrapurl, :kind_of => String, :default => nil
32+attribute :make_cache, :kind_of => [TrueClass, FalseClass], :default => true
33+attribute :includepkgs, :kind_of => String, :default => nil
34+attribute :exclude, :kind_of => String, :default => nil
35+attribute :priority, :kind_of => [Integer, String], :default => nil
36+attribute :metadata_expire, :kind_of => [Integer, String], :default => nil
37+
38+def initialize(*args)
39+ super
40+ @action = :add
41+end
--- /dev/null
+++ b/cookbooks/yum/templates/default/repo.erb
@@ -0,0 +1,38 @@
1+# Generated by Chef for <%= node['fqdn'] %>
2+# Local modifications will be overwritten.
3+[<%= @repo_name %>]
4+name=<%= @description %>
5+<% if @type %>
6+type=<%= @type %>
7+<% end %>
8+<% unless @url.empty? -%>
9+baseurl=<%= @url %>
10+<% end -%>
11+<% if @mirrorlist %>
12+mirrorlist=<%= @mirrorlist %>
13+<% end %>
14+<% if @key %>
15+gpgcheck=1
16+gpgkey=file:///etc/pki/rpm-gpg/<%= @key %>
17+<% else %>
18+gpgcheck=0
19+<% end %>
20+enabled=<%= @enabled %>
21+<% if @failovermethod %>
22+failovermethod=<%= @failovermethod %>
23+<% end %>
24+<% if @bootstrapurl %>
25+bootstrapurl=<%= @bootstrapurl %>
26+<% end %>
27+<% if @includepkgs %>
28+includepkgs=<%= @includepkgs %>
29+<% end %>
30+<% if @exclude %>
31+exclude=<%= @exclude %>
32+<% end %>
33+<% if @priority %>
34+priority=<%= @priority %>
35+<% end %>
36+<% if @metadata_expire %>
37+metadata_expire=<%= @metadata_expire%>
38+<% end %>
--- /dev/null
+++ b/cookbooks/yum/templates/default/yum-rhel5.conf.erb
@@ -0,0 +1,33 @@
1+# Generated by Chef for <%= node['fqdn'] %>
2+# Local modifications will be overwritten.
3+[main]
4+cachedir=<%= node['yum']['cachedir'] %>
5+keepcache=<%= node['yum']['keepcache'] %>
6+debuglevel=2
7+logfile=/var/log/yum.log
8+distroverpkg=redhat-release
9+tolerant=1
10+exactarch=1
11+obsoletes=1
12+gpgcheck=1
13+plugins=1
14+<%- unless node['yum']['exclude'].empty? %>
15+exclude=<%= node['yum']['exclude'].join(" ") %>
16+<%- end %>
17+<%- unless node['yum']['installonlypkgs'].empty? %>
18+installonlypkgs=<%= node['yum']['installonlypkgs'].join(" ") %>
19+<%- end %>
20+<%- unless node['yum']['proxy'].empty? %>
21+proxy=<%= node['yum']['proxy'] %>
22+proxy_username=<%= node['yum']['proxy_username'] %>
23+proxy_password=<%= node['yum']['proxy_password'] %>
24+<%- end %>
25+
26+# Note: yum-RHN-plugin doesn't honor this.
27+metadata_expire=1h
28+
29+# Default.
30+# installonly_limit = 3
31+
32+# PUT YOUR REPOS HERE OR IN separate files named file.repo
33+# in /etc/yum.repos.d
--- /dev/null
+++ b/cookbooks/yum/templates/default/yum-rhel6.conf.erb
@@ -0,0 +1,36 @@
1+# Generated by Chef for <%= node['fqdn'] %>
2+# Local modifications will be overwritten.
3+[main]
4+cachedir=<%= node['yum']['cachedir'] %>/$basearch/$releasever
5+keepcache=<%= node['yum']['keepcache'] %>
6+debuglevel=2
7+logfile=/var/log/yum.log
8+exactarch=1
9+obsoletes=1
10+gpgcheck=1
11+plugins=1
12+installonly_limit=3
13+<%- unless node['yum']['exclude'].empty? %>
14+exclude=<%= node['yum']['exclude'].join(" ") %>
15+<%- end %>
16+<%- unless node['yum']['installonlypkgs'].empty? %>
17+installonlypkgs=<%= node['yum']['installonlypkgs'].join(" ") %>
18+<%- end %>
19+<%- unless node['yum']['proxy'].empty? %>
20+proxy=<%= node['yum']['proxy'] %>
21+proxy_username=<%= node['yum']['proxy_username'] %>
22+proxy_password=<%= node['yum']['proxy_password'] %>
23+<%- end %>
24+
25+# This is the default, if you make this bigger yum won't see if the metadata
26+# is newer on the remote and so you'll "gain" the bandwidth of not having to
27+# download the new metadata and "pay" for it by yum not having correct
28+# information.
29+# It is esp. important, to have correct metadata, for distributions like
30+# Fedora which don't keep old packages around. If you don't like this checking
31+# interupting your command line usage, it's much better to have something
32+# manually check the metadata once an hour (yum-updatesd will do this).
33+# metadata_expire=90m
34+
35+# PUT YOUR REPOS HERE OR IN separate files named file.repo
36+# in /etc/yum.repos.d
Show on old repository browser