Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: travis-ci/travis-cookbooks
...
head fork: chef/travis-cookbooks
compare: test-kitchen
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 38 files changed
  • 0 commit comments
  • 1 contributor
Showing with 1,518 additions and 190 deletions.
  1. +1 −1  ci_environment/ant/metadata.rb
  2. +1 −6 ci_environment/ant/recipes/default.rb
  3. +1 −1  ci_environment/git/metadata.rb
  4. +8 −0 ci_environment/git/recipes/default.rb
  5. +16 −0 ci_environment/java/CHANGELOG.md
  6. +29 −0 ci_environment/java/CONTRIBUTING
  7. +201 −0 ci_environment/java/LICENSE
  8. +142 −42 ci_environment/java/README.md
  9. +29 −6 ci_environment/java/attributes/default.rb
  10. +0 −11 ci_environment/java/files/default/java.seed
  11. +42 −0 ci_environment/java/metadata.json
  12. +5 −5 ci_environment/java/metadata.rb
  13. +158 −0 ci_environment/java/providers/ark.rb
  14. +0 −40 ci_environment/java/recipes/default.rb
  15. +55 −20 ci_environment/java/recipes/openjdk.rb
  16. +64 −0 ci_environment/java/recipes/oracle.rb
  17. +48 −0 ci_environment/java/recipes/oracle_i386.rb
  18. +0 −49 ci_environment/java/recipes/sun.rb
  19. +37 −0 ci_environment/java/resources/ark.rb
  20. +11 −7 ci_environment/libncurses/recipes/default.rb
  21. +2 −0  ci_environment/libqt4/recipes/default.rb
  22. +1 −1  ci_environment/travis_build_environment/templates/default/root/dot_bashrc.sh
  23. +1 −1  ci_environment/travis_build_environment/templates/default/vagrant/dot_bashrc.sh
  24. +153 −0 ci_environment/yum/README.md
  25. +33 −0 ci_environment/yum/attributes/default.rb
  26. +60 −0 ci_environment/yum/metadata.json
  27. +21 −0 ci_environment/yum/metadata.rb
  28. +74 −0 ci_environment/yum/providers/key.rb
  29. +65 −0 ci_environment/yum/providers/repository.rb
  30. +18 −0 ci_environment/yum/recipes/default.rb
  31. +41 −0 ci_environment/yum/recipes/epel.rb
  32. +40 −0 ci_environment/yum/recipes/ius.rb
  33. +23 −0 ci_environment/yum/recipes/yum.rb
  34. +23 −0 ci_environment/yum/resources/key.rb
  35. +31 −0 ci_environment/yum/resources/repository.rb
  36. +25 −0 ci_environment/yum/templates/default/repo.erb
  37. +28 −0 ci_environment/yum/templates/default/yum-rhel5.conf.erb
  38. +31 −0 ci_environment/yum/templates/default/yum-rhel6.conf.erb
View
2  ci_environment/ant/metadata.rb
@@ -4,7 +4,7 @@
description "Installs/Configures ant"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.10.1"
-%w{ java jpackage }.each do |cb|
+%w{ java }.each do |cb|
depends cb
end
%w{ debian ubuntu centos redhat fedora }.each do |os|
View
7 ci_environment/ant/recipes/default.rb
@@ -19,17 +19,12 @@
include_recipe "java"
-case node.platform
-when "centos","redhat","fedora"
- include_recipe "jpackage"
-end
-
ant_pkgs = value_for_platform(
["debian","ubuntu",] => {
"default" => ["ant","ant-contrib","ivy"]
},
["centos","redhat","fedora" ] => {
- "default" => ["ant","ant-contrib","ivy"]
+ "default" => ["ant","ant-contrib"]
},
"default" => ["ant","ant-contrib","ivy"]
)
View
2  ci_environment/git/metadata.rb
@@ -10,6 +10,6 @@
supports os
end
-%w{ runit }.each do |cb|
+%w{ runit yum }.each do |cb|
depends cb
end
View
8 ci_environment/git/recipes/default.rb
@@ -63,4 +63,12 @@
not_if "which git"
end
end # each
+when "centos","redhat","scientific","fedora"
+ case node[:platform_version].to_i
+ when 5
+ include_recipe "yum::epel"
+ end
+ package "git"
+else
+ package "git"
end # case
View
16 ci_environment/java/CHANGELOG.md
@@ -0,0 +1,16 @@
+## v1.5.0:
+
+* [COOK-1146] - Oracle now prevents download of JDK via non-browser
+* [COOK-1114] - fix File.exists?
+
+## v1.4.2:
+
+* [COOK-1051] - fix attributes typo and platform case switch
+ consistency
+
+## v1.4.0:
+
+* [COOK-858] - numerous updates: handle jdk6 and 7, switch from sun to
+ oracle, make openjdk default, add `java_ark` LWRP.
+* [COOK-942] - FreeBSD support
+* [COOK-520] - ArchLinux support
View
29 ci_environment/java/CONTRIBUTING
@@ -0,0 +1,29 @@
+If you would like to contribute, please open a ticket in JIRA:
+
+* http://tickets.opscode.com
+
+Create the ticket in the COOK project and use the cookbook name as the
+component.
+
+For all code contributions, we ask that contributors sign a
+contributor license agreement (CLA). Instructions may be found here:
+
+* http://wiki.opscode.com/display/chef/How+to+Contribute
+
+When contributing changes to individual cookbooks, please do not
+modify the version number in the metadata.rb. Also please do not
+update the CHANGELOG.md for a new version. Not all changes to a
+cookbook may be merged and released in the same versions. Opscode will
+handle the version updates during the release process. You are welcome
+to correct typos or otherwise make updates to documentation in the
+README.
+
+If a contribution adds new platforms or platform versions, indicate
+such in the body of the commit message(s), and update the relevant
+COOK ticket. When writing commit messages, it is helpful for others if
+you indicate the COOK ticket. For example:
+
+ git commit -m '[COOK-1041] Updated pool resource to correctly delete.'
+
+In the ticket itself, it is also helpful if you include log output of
+a successful Chef run, but this is not absolutely required.
View
201 ci_environment/java/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
View
184 ci_environment/java/README.md
@@ -1,9 +1,40 @@
Description
===========
-Installs a Java. Uses OpenJDK by default but supports installation of the Sun's Java.
+Installs a Java. Uses OpenJDK by default but supports installation of Oracle's JDK.
+
+This cookbook also provides the `java_ark` LWRP which other java
+cookbooks can use to install java-related applications from binary
+packages.
+
+The `java_ark` LWPR may move to its own cookbook at some point in the
+future as its functionality is useful for other purposes.
+
+**IMPORTANT NOTE** As of 26 March 2012 you can no longer directly download
+the JDK from Oracle's website without using a full-fledged browser.
+For that reason, the java::oracle recipe forces you to set up a
+private repository accessible by HTTP. It is best to override the
+dummy URL using a role.
+
+Example
+
+roles/base.rb
+
+ normal_attributes(
+ :java => {
+ :jdk => {
+ "6" => {
+ :x86_64 => {
+ :url => "http://hqlprrepo01.hq.un.fao.org/corporate/jdk-6u30-linux-x64.bin"
+ }
+ }
+ }
+ }
+ )
+
+You are most encouraged to voice your complaints to Oracle and/or
+switch to OpenJDK.
----
Requirements
============
@@ -11,71 +42,139 @@ Platform
--------
* Debian, Ubuntu
-* CentOS, Red Hat, Fedora
-
-Cookbooks
----------
-
-* apt
+* CentOS, Red Hat, Fedora, Scientific, Amazon
+* ArchLinux
+* FreeBSD
----
Attributes
==========
-* `node["java"]["install_flavor"]` - Flavor of JVM you would like installed (`sun` or `openjdk`), default `openjdk`.
+See `attributes/default.rb` for default values.
+
+* `node["java"]["install_flavor"]` - Flavor of JVM you would like installed (`oracle` or `openjdk`), default `openjdk`.
+* `node['java']['java_home']` - Default location of the "`$JAVA_HOME`".
+* `node['java']['tarball']` - name of the tarball to retrieve from your corporate repository default `jdk1.6.0_29_i386.tar.gz`
+* `node['java']['tarball_checksum']` - checksum for the tarball, if you use a different tarball, you also need to create a new sha256 checksum
+* `node['java']['jdk']` - version and architecture specific attributes
+ for setting the URL on Oracle's site for the JDK, and the checksum
+ of the .tar.gz.
----
Recipes
=======
default
-------
-Include the default recipe in a run list, to get `java`. By default the `openjdk` flavor of Java is installed, but this can be changed by using the `install_flavor` attribute.
+Include the default recipe in a run list, to get `java`. By default
+the `openjdk` flavor of Java is installed, but this can be changed by
+using the `install_flavor` attribute.
+
+OpenJDK is the default because of licensing changes made upstream by
+Oracle. See notes on the `oracle` recipe below.
openjdk
-------
This recipe installs the `openjdk` flavor of Java.
-sun
----
-
-This recipe installs the `sun` flavor of Java.
-
-On Debian and Ubuntu systems the recipe will add the correct apt repository (`non-free` on Debian or `partner` on Ubuntu), pre-seed the package and update java alternatives.
-
-On Red Hat flavored Linux (RHEL, CentOS, Fedora), the installation of the Sun flavor of Java is slightly more complicated as the `rpm` package is not readily available in any public Yum repository. The Sun JDK `rpm` package can be downloaded directly from Sun but comes wrapped as a compressed bin file. After the file has been downloaded, decompressed and license accepted the `rpm` package (names something like `jdk-6u25-ea-linux-amd64.rpm`) can be retrieved by this recipe using the `remote_file` or `cookbook_file` resources. The recipe will choose the correct resource based on the existence (or non-existence) of the `node['sun']['rpm_url']` attribute. See below for an example role using this attribute in the proper way. If you would like to deliver the `rpm` package file as part of this cookbook place the `rpm` package file in the `files/default` directory and the cookbook will retrieve the file during installation.
+oracle
+------
+
+This recipe installs the `oracle` flavor of Java. This recipe does not
+use distribution packages as Oracle changed the licensing terms with
+JDK 1.6u27 and prohibited the practice for both the debian and EL worlds.
+
+For both debian and centos/rhel, this recipe pulls the binary
+distribution from the Oracle website, and installs it in the default
+JAVA_HOME for each distribution. For debian/ubuntu, this is
+/usr/lib/jvm/default-java. For Centos/RHEL, this is /usr/lib/jvm/java
+
+After putting the binaries in place, the oracle recipe updates
+/usr/bin/java to point to the installed JDK using the
+`update-alternatives` script
+
+oracle_i386
+-----------
+
+This recipe installs the 32-bit Java virtual machine without setting
+it as the default. This can be useful if you have applications on the
+same machine that require different versions of the JVM.
+
+Resources/Providers
+===================
+
+This LWRP provides an easy way to manage java applications. It uses
+the LWRP arkive (deliberately misspelled). It is an arkive and not an
+"archive" because the `java_ark` lwrp is not the same as a java
+archive or "jar". Essentially, you provide the `java_ark` with the URL
+to a tarball and the commands within the extracted result that you
+want symlinked to /usr/bin/
+
+The `java_ark` LWPR may move to its own cookbook at some point in the
+future as its functionality is useful for other purposes.
+
+By default, the extracted directory is extracted to
+`app_root/extracted_dir_name` and symlinked to `app_root/default`
+
+# Actions
+
+- `:install`: extracts the tarball and makes necessary symlinks
+- `:remove`: removes the tarball and run update-alternatives for all
+ symlinked `bin_cmds`
+
+# Attribute Parameters
+
+- `url`: path to tarball, .tar.gz, .bin (oracle-specific), and .zip
+ currently supported
+- `checksum`: sha256 checksum, not used for security but avoid
+ redownloading the archive on each chef-client run
+- `app_home`: the default for installations of this type of
+ application, for example, `/usr/lib/tomcat/default`. If your
+ application is not set to the default, it will be placed at the same
+ level in the directory hierarchy but the directory name will be
+ `app_root/extracted_directory_name + "_alt"`
+- `app_home_mode`: file mode for app_home, is an integer
+- `bin_cmds`: array of binary commands that should be symlinked to
+ /usr/bin, examples are mvn, java, javac, etc. These cmds must be in
+ the bin/ subdirectory of the extracted folder. Will be ignored if this
+ java_ark is not the default
+- `owner`: owner of extracted directory, set to "root" by default
+- `default`: whether this the default installation of this package,
+ boolean true or false
+
+
+# Examples
+
+ # install jdk6 from Oracle
+ java_ark "jdk" do
+ url 'http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64.bin'
+ checksum 'a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365'
+ app_home '/usr/local/java/default'
+ bin_cmds ["java", "javac"]
+ action :install
+ end
+
+ # installs maven2
+ java_ark "maven2" do
+ url "http://www.apache.org/dist/maven/binaries/apache-maven-2.2.1-bin.tar.gz"
+ checksum "b9a36559486a862abfc7fb2064fd1429f20333caae95ac51215d06d72c02d376"
+ app_home "/usr/local/maven/default"
+ bin_cmds ["mvn"]
+ action :install
+ end
----
Usage
=====
-Simply include the `java` recipe where ever you would like Java installed.
-
-To install Sun flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role:
-
- name "java"
- description "Install Sun Java on Ubuntu"
- override_attributes(
- "java" => {
- "install_flavor" => "sun"
- }
- )
- run_list(
- "recipe[java]"
- )
+Simply include the `java` recipe where ever you would like Java installed.
-On RedHat flavored Linux be sure to set the `rpm_url` and `rpm_checksum` attributes if you placed the `rpm` file on a remote server:
+To install Oracle flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role:
name "java"
- description "Install Sun Java on CentOS"
+ description "Install Oracle Java on Ubuntu"
override_attributes(
"java" => {
- "install_flavor" => "sun",
- "version" => "6u25",
- "rpm_url" => "https://mycompany.s3.amazonaws.com/sun_jdk",
- "rpm_checksum" => "c473e3026f991e617710bad98f926435959303fe084a5a31140ad5ad75d7bf13"
+ "install_flavor" => "oracle"
}
)
run_list(
@@ -86,8 +185,9 @@ License and Author
==================
Author:: Seth Chisamore (<schisamo@opscode.com>)
+Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
-Copyright:: 2008-2011, Opscode, Inc
+Copyright:: 2008-2012, Opscode, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
View
35 ci_environment/java/attributes/default.rb
@@ -1,7 +1,7 @@
#
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: java
-# Attributes:: default
+# Attributes:: default
#
# Copyright 2010, Opscode, Inc.
#
@@ -17,13 +17,36 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# default jdk attributes
default['java']['install_flavor'] = "openjdk"
+default['java']['jdk_version'] = '6'
+default['java']['arch'] = kernel['machine'] =~ /x86_64/ ? "x86_64" : "i586"
case platform
-when "centos","redhat","fedora"
- default['java']['version'] = "6u25"
- default['java']['arch'] = kernel['machine'] =~ /x86_64/ ? "amd64" : "i586"
- set['java']['java_home'] = "/usr/lib/jvm/java"
+when "centos","redhat","fedora","scientific","amazon"
+ default['java']['java_home'] = "/usr/lib/jvm/java"
+when "freebsd"
+ default['java']['java_home'] = "/usr/local/openjdk#{java['jdk_version']}"
+when "arch"
+ default['java']['java_home'] = "/usr/lib/jvm/java-#{java['jdk_version']}-openjdk"
else
- set['java']['java_home'] = "/usr/lib/jvm/default-java"
+ default['java']['java_home'] = "/usr/lib/jvm/default-java"
end
+
+# jdk6 attributes
+# x86_64
+default['java']['jdk']['6']['x86_64']['url'] = 'http://download.example.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-linux-x64.bin'
+default['java']['jdk']['6']['x86_64']['checksum'] = '928220f4e46c5dabef0440791c48023945629d8a23998e072157e04960d8a759'
+
+# i586
+default['java']['jdk']['6']['i586']['url'] = 'http://download.example.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-linux-i586.bin'
+default['java']['jdk']['6']['i586']['checksum'] = 'b551be83a690bc9fec0107d9aa4f828cd47e150fa54cbedbfa8f80c99e2f18b5'
+
+# jdk7 attributes
+# x86_64
+default['java']['jdk']['7']['x86_64']['url'] = 'http://download.example.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-x64.tar.gz'
+default['java']['jdk']['7']['x86_64']['checksum'] = '411a204122c5e45876d6edae1a031b718c01e6175833740b406e8aafc37bc82d'
+
+# i586
+default['java']['jdk']['7']['i586']['url'] = 'http://download.example.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz'
+default['java']['jdk']['7']['i586']['checksum'] = '74faad48fef2c368276dbd1fd6c02520b0e9ebdcb1621916c1af345fc3ba65d1'
View
11 ci_environment/java/files/default/java.seed
@@ -1,11 +0,0 @@
-sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
-sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
-sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
-sun-java6-jre sun-java6-jre/stopthread boolean true
-sun-java6-jre sun-java6-jre/jcepolicy note
-sun-java6-bin shared/error-sun-dlj-v1-1 error
-sun-java6-jdk shared/error-sun-dlj-v1-1 error
-sun-java6-jre shared/error-sun-dlj-v1-1 error
-sun-java6-bin shared/present-sun-dlj-v1-1 note
-sun-java6-jdk shared/present-sun-dlj-v1-1 note
-sun-java6-jre shared/present-sun-dlj-v1-1 note
View
42 ci_environment/java/metadata.json
@@ -0,0 +1,42 @@
+{
+ "name": "java",
+ "description": "Installs Java runtime.",
+ "long_description": "Description\n===========\n\nInstalls a Java. Uses OpenJDK by default but supports installation of Oracle's JDK.\n\nThis cookbook also provides the `java_ark` LWRP which other java\ncookbooks can use to install java-related applications from binary\npackages.\n\nThe `java_ark` LWPR may move to its own cookbook at some point in the\nfuture as its functionality is useful for other purposes.\n\n**IMPORTANT NOTE** As of 26 March 2012 you can no longer directly download\nthe JDK from Oracle's website without using a full-fledged browser.\nFor that reason, the java::oracle recipe forces you to set up a\nprivate repository accessible by HTTP. It is best to override the\ndummy URL using a role.\n\nExample\n\nroles/base.rb\n\n normal_attributes(\n :java => {\n :jdk => {\n \"6\" => {\n :x86_64 => {\n :url => \"http://hqlprrepo01.hq.un.fao.org/corporate/jdk-6u30-linux-x64.bin\"\n }\n }\n }\n }\n )\n\nYou are most encouraged to voice your complaints to Oracle and/or\nswitch to OpenJDK.\n\nRequirements\n============\n\nPlatform\n--------\n\n* Debian, Ubuntu\n* CentOS, Red Hat, Fedora, Scientific, Amazon\n* ArchLinux\n* FreeBSD\n\nAttributes\n==========\n\nSee `attributes/default.rb` for default values.\n\n* `node[\"java\"][\"install_flavor\"]` - Flavor of JVM you would like installed (`oracle` or `openjdk`), default `openjdk`.\n* `node['java']['java_home']` - Default location of the \"`$JAVA_HOME`\".\n* `node['java']['tarball']` - name of the tarball to retrieve from your corporate repository default `jdk1.6.0_29_i386.tar.gz`\n* `node['java']['tarball_checksum']` - checksum for the tarball, if you use a different tarball, you also need to create a new sha256 checksum\n* `node['java']['jdk']` - version and architecture specific attributes\n for setting the URL on Oracle's site for the JDK, and the checksum\n of the .tar.gz.\n\nRecipes\n=======\n\ndefault\n-------\n\nInclude the default recipe in a run list, to get `java`. By default\nthe `openjdk` flavor of Java is installed, but this can be changed by\nusing the `install_flavor` attribute.\n\nOpenJDK is the default because of licensing changes made upstream by\nOracle. See notes on the `oracle` recipe below.\n\nopenjdk\n-------\n\nThis recipe installs the `openjdk` flavor of Java.\n\noracle\n------\n\nThis recipe installs the `oracle` flavor of Java. This recipe does not\nuse distribution packages as Oracle changed the licensing terms with\nJDK 1.6u27 and prohibited the practice for both the debian and EL worlds.\n\nFor both debian and centos/rhel, this recipe pulls the binary\ndistribution from the Oracle website, and installs it in the default\nJAVA_HOME for each distribution. For debian/ubuntu, this is\n/usr/lib/jvm/default-java. For Centos/RHEL, this is /usr/lib/jvm/java\n\nAfter putting the binaries in place, the oracle recipe updates\n/usr/bin/java to point to the installed JDK using the\n`update-alternatives` script\n\noracle_i386\n-----------\n\nThis recipe installs the 32-bit Java virtual machine without setting\nit as the default. This can be useful if you have applications on the\nsame machine that require different versions of the JVM.\n\nResources/Providers\n===================\n\nThis LWRP provides an easy way to manage java applications. It uses\nthe LWRP arkive (deliberately misspelled). It is an arkive and not an\n\"archive\" because the `java_ark` lwrp is not the same as a java\narchive or \"jar\". Essentially, you provide the `java_ark` with the URL\nto a tarball and the commands within the extracted result that you\nwant symlinked to /usr/bin/\n\nThe `java_ark` LWPR may move to its own cookbook at some point in the\nfuture as its functionality is useful for other purposes.\n\nBy default, the extracted directory is extracted to\n`app_root/extracted_dir_name` and symlinked to `app_root/default`\n\n# Actions\n\n- `:install`: extracts the tarball and makes necessary symlinks\n- `:remove`: removes the tarball and run update-alternatives for all\n symlinked `bin_cmds`\n\n# Attribute Parameters\n\n- `url`: path to tarball, .tar.gz, .bin (oracle-specific), and .zip\n currently supported\n- `checksum`: sha256 checksum, not used for security but avoid\n redownloading the archive on each chef-client run\n- `app_home`: the default for installations of this type of\n application, for example, `/usr/lib/tomcat/default`. If your\n application is not set to the default, it will be placed at the same\n level in the directory hierarchy but the directory name will be\n `app_root/extracted_directory_name + \"_alt\"`\n- `app_home_mode`: file mode for app_home, is an integer\n- `bin_cmds`: array of binary commands that should be symlinked to\n /usr/bin, examples are mvn, java, javac, etc. These cmds must be in\n the bin/ subdirectory of the extracted folder. Will be ignored if this\n java_ark is not the default\n- `owner`: owner of extracted directory, set to \"root\" by default\n- `default`: whether this the default installation of this package,\n boolean true or false\n\n\n# Examples\n\n # install jdk6 from Oracle\n java_ark \"jdk\" do\n url 'http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64.bin'\n checksum 'a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365'\n app_home '/usr/local/java/default'\n bin_cmds [\"java\", \"javac\"]\n action :install\n end\n\n # installs maven2\n java_ark \"maven2\" do\n url \"http://www.apache.org/dist/maven/binaries/apache-maven-2.2.1-bin.tar.gz\"\n checksum \"b9a36559486a862abfc7fb2064fd1429f20333caae95ac51215d06d72c02d376\"\n app_home \"/usr/local/maven/default\"\n bin_cmds [\"mvn\"]\n action :install\n end\n\nUsage\n=====\n\nSimply include the `java` recipe where ever you would like Java installed.\n\nTo install Oracle flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role:\n\n name \"java\"\n description \"Install Oracle Java on Ubuntu\"\n override_attributes(\n \"java\" => {\n \"install_flavor\" => \"oracle\"\n }\n )\n run_list(\n \"recipe[java]\"\n )\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore (<schisamo@opscode.com>)\nAuthor:: Bryan W. Berry (<bryan.berry@gmail.com>)\n\nCopyright:: 2008-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",
+ "maintainer": "Opscode, Inc.",
+ "maintainer_email": "cookbooks@opscode.com",
+ "license": "Apache 2.0",
+ "platforms": {
+ "debian": ">= 0.0.0",
+ "ubuntu": ">= 0.0.0",
+ "centos": ">= 0.0.0",
+ "redhat": ">= 0.0.0",
+ "scientific": ">= 0.0.0",
+ "fedora": ">= 0.0.0",
+ "amazon": ">= 0.0.0",
+ "arch": ">= 0.0.0",
+ "freebsd": ">= 0.0.0"
+ },
+ "dependencies": {
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "groupings": {
+ },
+ "recipes": {
+ "java": "Installs Java runtime",
+ "java::openjdk": "Installs the OpenJDK flavor of Java",
+ "java::oracle": "Installs the Oracle flavor of Java",
+ "java::oracle_i386": "Installs the 32-bit jvm without setting it as the default"
+ },
+ "version": "1.5.0"
+}
View
10 ci_environment/java/metadata.rb
@@ -3,14 +3,14 @@
license "Apache 2.0"
description "Installs Java runtime."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "1.1"
-
-depends "apt"
+version "1.5.0"
recipe "java", "Installs Java runtime"
recipe "java::openjdk", "Installs the OpenJDK flavor of Java"
-recipe "java::sun", "Installs the Sun flavor of Java"
+recipe "java::oracle", "Installs the Oracle flavor of Java"
+recipe "java::oracle_i386", "Installs the 32-bit jvm without setting it as the default"
+
-%w{ debian ubuntu centos redhat fedora }.each do |os|
+%w{ debian ubuntu centos redhat scientific fedora amazon arch freebsd }.each do |os|
supports os
end
View
158 ci_environment/java/providers/ark.rb
@@ -0,0 +1,158 @@
+#
+# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
+# Cookbook Name:: java
+# Provider:: ark
+#
+# Copyright 2011, Bryan w. Berry
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+def parse_app_dir_name url
+ file_name = url.split('/')[-1]
+ # funky logic to parse oracle's non-standard naming convention
+ # for jdk1.6
+ if file_name =~ /^(jre|jdk).*$/
+ major_num = file_name.scan(/\d/)[0]
+ update_num = file_name.scan(/\d+/)[1]
+ # pad a single digit number with a zero
+ if update_num.length < 2
+ update_num = "0" + update_num
+ end
+ package_name = file_name.scan(/[a-z]+/)[0]
+ app_dir_name = "#{package_name}1.#{major_num}.0_#{update_num}"
+ else
+ app_dir_name = file_name.split(/(.tar.gz|.zip)/)[0]
+ app_dir_name = app_dir_name.split("-bin")[0]
+ end
+ [app_dir_name, file_name]
+end
+
+action :install do
+ app_dir_name, tarball_name = parse_app_dir_name(new_resource.url)
+ app_root = new_resource.app_home.split('/')[0..-2].join('/')
+ app_dir = app_root + '/' + app_dir_name
+
+ unless new_resource.default
+ Chef::Log.debug("processing alternate jdk")
+ app_dir = app_dir + "_alt"
+ app_home = app_dir
+ else
+ app_home = new_resource.app_home
+ end
+
+ unless ::File.exists?(app_dir)
+ Chef::Log.info "Adding #{new_resource.name} to #{app_dir}"
+ require 'fileutils'
+
+ unless ::File.exists?(app_root)
+ FileUtils.mkdir app_root, :mode => new_resource.app_home_mode
+ FileUtils.chown new_resource.owner, new_resource.owner, app_root
+ end
+
+ r = remote_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do
+ source new_resource.url
+ checksum new_resource.checksum
+ mode 0755
+ action :nothing
+ end
+ r.run_action(:create_if_missing)
+
+ require 'tmpdir'
+
+ tmpdir = Dir.mktmpdir
+ case tarball_name
+ when /^.*\.bin/
+ cmd = Chef::ShellOut.new(
+ %Q[ cd "#{tmpdir}";
+ cp "#{Chef::Config[:file_cache_path]}/#{tarball_name}" . ;
+ bash ./#{tarball_name} -noregister
+ ] ).run_command
+ unless cmd.exitstatus == 0
+ Chef::Application.fatal!("Failed to extract file #{tarball_name}!")
+ end
+ when /^.*\.zip/
+ cmd = Chef::ShellOut.new(
+ %Q[ unzip "#{Chef::Config[:file_cache_path]}/#{tarball_name}" -d "#{tmpdir}" ]
+ ).run_command
+ unless cmd.exitstatus == 0
+ Chef::Application.fatal!("Failed to extract file #{tarball_name}!")
+ end
+ when /^.*\.tar.gz/
+ cmd = Chef::ShellOut.new(
+ %Q[ tar xvzf "#{Chef::Config[:file_cache_path]}/#{tarball_name}" -C "#{tmpdir}" ]
+ ).run_command
+ unless cmd.exitstatus == 0
+ Chef::Application.fatal!("Failed to extract file #{tarball_name}!")
+ end
+ end
+
+ cmd = Chef::ShellOut.new(
+ %Q[ mv "#{tmpdir}/#{app_dir_name}" "#{app_dir}" ]
+ ).run_command
+ unless cmd.exitstatus == 0
+ Chef::Application.fatal!(%Q[ Command \' mv "#{tmpdir}/#{app_dir_name}" "#{app_dir}" \' failed ])
+ end
+ FileUtils.rm_r tmpdir
+ new_resource.updated_by_last_action(true)
+ end
+
+ #update-alternatives
+ if new_resource.default
+ Chef::Log.debug "app_home is #{app_home} and app_dir is #{app_dir}"
+ current_link = ::File.symlink?(app_home) ? ::File.readlink(app_home) : nil
+ if current_link != app_dir
+ Chef::Log.debug "symlinking #{app_dir} to #{app_home}"
+ FileUtils.rm_f app_home
+ FileUtils.ln_sf app_dir, app_home
+ end
+ if new_resource.bin_cmds
+ new_resource.bin_cmds.each do |cmd|
+ if ::File.exists? "/usr/bin/#{cmd}"
+ current_bin_link = ::File.readlink("/usr/bin/#{cmd}")
+ else
+ current_bin_link = false
+ end
+ should_be_link = "#{app_home}/bin/#{cmd}"
+ if current_bin_link != should_be_link
+ cmd = Chef::ShellOut.new(
+ %Q[ update-alternatives --install /usr/bin/#{cmd} #{cmd} #{app_home}/bin/#{cmd} 1;
+ update-alternatives --set #{cmd} #{app_home}/bin/#{cmd} ]
+ ).run_command
+ unless cmd.exitstatus == 0
+ Chef::Application.fatal!(%Q[ update alternatives failed ])
+ end
+ end
+ end
+ end
+ end
+end
+
+action :remove do
+ app_dir_name, tarball_name = parse_app_dir_name(new_resource.url)
+ app_root = new_resource.app_home.split('/')[0..-2].join('/')
+ app_dir = app_root + '/' + app_dir_name
+
+ if ::File.exists?(app_dir)
+ new_resource.bin_cmds.each do |cmd|
+ cmd = execute "update_alternatives" do
+ command "update-alternatives --remove #{cmd} #{app_dir} "
+ returns [0,2]
+ action :nothing
+ end
+ cmd.run_action(:run)
+ end
+ Chef::Log.info "Removing #{new_resource.name} at #{app_dir}"
+ FileUtils.rm_rf app_dir
+ new_resource.updated_by_last_action(true)
+ end
+end
View
40 ci_environment/java/recipes/default.rb
@@ -18,44 +18,4 @@
# limitations under the License.
#
-case node['platform']
-when "ubuntu"
- apt_repository "ubuntu-partner" do
- uri "http://archive.canonical.com/ubuntu"
- distribution node['lsb']['codename']
- components ['partner']
- action :add
- end
- # update-java-alternatives doesn't work with only sun java installed
- node.set['java']['java_home'] = "/usr/lib/jvm/java-6-sun"
-
-when "debian"
- apt_repository "debian-non-free" do
- uri "http://http.us.debian.org/debian"
- distribution "stable"
- components ['main','contrib','non-free']
- action :add
- end
- # update-java-alternatives doesn't work with only sun java installed
- node.set['java']['java_home'] = "/usr/lib/jvm/java-6-sun"
-when "centos", "redhat", "fedora"
- pkgs.each do |pkg|
- if node['java'].attribute?('rpm_url')
- remote_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
- source "#{node['java']['rpm_url']}/#{pkg}"
- checksum node['java']['rpm_checksum']
- mode "0644"
- end
- else
- cookbook_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
- source pkg
- mode "0644"
- action :create_if_missing
- end
- end
- end
-else
- Chef::Log.error("Installation of Sun Java packages not supported on this platform.")
-end
-
include_recipe "java::#{node['java']['install_flavor']}"
View
75 ci_environment/java/recipes/openjdk.rb
@@ -1,4 +1,4 @@
-#
+# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: java
# Recipe:: openjdk
@@ -17,32 +17,67 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+version = node['java']['jdk_version']
+java_home = node['java']['java_home']
+java_home_parent = ::File.dirname java_home
+jdk_home = ""
+
pkgs = value_for_platform(
- ["centos","redhat","fedora"] => {
- "default" => ["java-1.6.0-openjdk","java-1.6.0-openjdk-devel"]
- },
- "default" => ["openjdk-6-jdk","default-jdk"]
- )
+ ["centos","redhat","fedora","scientific","amazon"] => {
+ "default" => ["java-1.#{version}.0-openjdk","java-1.#{version}.0-openjdk-devel"]
+ },
+ ["arch","freebsd"] => {
+ "default" => ["openjdk#{version}"]
+ },
+ "default" => ["openjdk-#{version}-jdk"]
+ )
+
+# done by special request for rberger
+ruby_block "set-env-java-home" do
+ block do
+ ENV["JAVA_HOME"] = java_home
+ end
+end
-execute "update-java-alternatives" do
- alternative = case [node[:platform], node[:platform_version]]
- when ["ubuntu", "11.04"] then
- "java-6-openjdk"
- when ["ubuntu", "11.10"] then
- "java-1.6.0-openjdk"
- else
- "java-1.6.0-openjdk"
- end
+if platform?("ubuntu","debian","redhat","centos","fedora","scientific","amazon")
+ ruby_block "update-java-alternatives" do
+ block do
+ if platform?("ubuntu", "debian") and version == 6
+ run_context = Chef::RunContext.new(node, {})
+ r = Chef::Resource::Execute.new("update-java-alternatives", run_context)
+ r.command "update-java-alternatives -s java-6-openjdk"
+ r.returns [0,2]
+ r.run_action(:create)
+ else
+ # have to do this on ubuntu for version 7 because Ubuntu does
+ # not currently set jdk 7 as the default jvm on installation
+ require "fileutils"
+ arch = node['kernel']['machine'] =~ /x86_64/ ? "x86_64" : "i386"
+ Chef::Log.debug("glob is #{java_home_parent}/java*#{version}*openjdk*")
+ jdk_home = Dir.glob("#{java_home_parent}/java*#{version}*openjdk{,[-\.]#{arch}}")[0]
+ Chef::Log.debug("jdk_home is #{jdk_home}")
+ # delete the symlink if it already exists
+ if ::File.exists? java_home
+ FileUtils.rm_f java_home
+ end
+ FileUtils.ln_sf jdk_home, java_home
- command "update-java-alternatives -s #{alternative}"
- returns [0,2]
- action :nothing
- only_if { platform?("ubuntu", "debian") }
+ cmd = Chef::ShellOut.new(
+ %Q[ update-alternatives --install /usr/bin/java java #{java_home}/bin/java 1;
+ update-alternatives --set java #{java_home}/bin/java ]
+ ).run_command
+ unless cmd.exitstatus == 0 or cmd.exitstatus == 2
+ Chef::Application.fatal!("Failed to update-alternatives for openjdk!")
+ end
+ end
+ end
+ action :nothing
+ end
end
pkgs.each do |pkg|
package pkg do
action :install
- notifies :run, "execute[update-java-alternatives]"
+ notifies :create, "ruby_block[update-java-alternatives]" if platform?("ubuntu","debian","redhat","centos","fedora","scientific","amazon")
end
end
View
64 ci_environment/java/recipes/oracle.rb
@@ -0,0 +1,64 @@
+#
+# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
+# Cookbook Name:: java
+# Recipe:: oracle
+#
+# Copyright 2011, Bryan w. Berry
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+java_home = node['java']["java_home"]
+arch = node['java']['arch']
+jdk_version = node['java']['jdk_version']
+
+#convert version number to a string if it isn't already
+if jdk_version.instance_of? Fixnum
+ jdk_version = jdk_version.to_s
+end
+
+case jdk_version
+when "6"
+ tarball_url = node['java']['jdk']['6'][arch]['url']
+ tarball_checksum = node['java']['jdk']['6'][arch]['checksum']
+when "7"
+ tarball_url = node['java']['jdk']['7'][arch]['url']
+ tarball_checksum = node['java']['jdk']['7'][arch]['checksum']
+end
+
+if tarball_url =~ /example.com/
+ Chef::Application.fatal!("You must change the download link to your private repository. You can no longer download java directly from http://download.oracle.com without a web broswer")
+end
+
+ruby_block "set-env-java-home" do
+ block do
+ ENV["JAVA_HOME"] = java_home
+ end
+end
+
+file "/etc/profile.d/jdk.sh" do
+ content <<-EOS
+ export JAVA_HOME=#{node['java']["java_home"]}
+ EOS
+ mode 0755
+end
+
+
+java_ark "jdk" do
+ url tarball_url
+ checksum tarball_checksum
+ app_home java_home
+ bin_cmds ["java"]
+ action :install
+end
+
View
48 ci_environment/java/recipes/oracle_i386.rb
@@ -0,0 +1,48 @@
+#
+# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
+# Cookbook Name:: java
+# Recipe:: oracle_i386
+#
+# Copyright 2010-2011, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+java_home = node['java']["java_home"]
+
+case node['java']['jdk_version']
+when "6"
+ tarball_url = node['java']['jdk']['6']['i586']['url']
+ tarball_checksum = node['java']['jdk']['6']['i586']['checksum']
+when "7"
+ tarball_url = node['java']['jdk']['7']['i586']['url']
+ tarball_checksum = node['java']['jdk']['7']['i586']['checksum']
+end
+
+ruby_block "set-env-java-home" do
+ block do
+ ENV["JAVA_HOME"] = java_home
+ end
+end
+
+yum_package "glibc" do
+ arch "i686"
+# provider Chef::Provider::Package::Yum
+end
+
+java_ark "jdk-alt" do
+ url tarball_url
+ checksum tarball_checksum
+ app_home java_home
+ default false
+ action :install
+end
View
49 ci_environment/java/recipes/sun.rb
@@ -1,49 +0,0 @@
-#
-# Author:: Seth Chisamore (<schisamo@opscode.com>)
-# Cookbook Name:: java
-# Recipe:: sun
-#
-# Copyright 2010-2011, Opscode, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-pkgs = value_for_platform(
- ["centos","redhat","fedora"] => {
- "default" => ["jdk-#{node['java']['version']}-ea-linux-#{node['java']['arch']}.rpm"]
- },
- ["debian","ubuntu"] => {
- "default" => ["sun-java6-jdk"]
- }
-)
-
-
-execute "update-java-alternatives" do
- command "update-java-alternatives -s java-6-sun"
- returns [0,2]
- action :nothing
- only_if { platform?("ubuntu", "debian") }
-end
-
-pkgs.each do |pkg|
- package pkg do
- case node['platform']
- when "ubuntu", "debian"
- response_file "java.seed"
- when "centos", "redhat", "fedora"
- source "#{Chef::Config[:file_cache_path]}/#{pkg}"
- options "--nogpgcheck" # sun/oracle doesn't sign their RPMs o_O
- end
- action :install
- notifies :run, "execute[update-java-alternatives]"
- end
-end
View
37 ci_environment/java/resources/ark.rb
@@ -0,0 +1,37 @@
+#
+# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
+# Cookbook Name:: java
+# Resource:: ark
+#
+# Copyright 2011, Bryan w. Berry
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+actions :install, :remove
+
+attribute :url, :regex => /^http:\/\/.*(tar.gz|bin|zip)$/, :default => nil
+attribute :mirrorlist, :kind_of => Array, :default => nil
+attribute :checksum, :regex => /^[a-zA-Z0-9]{64}$/, :default => nil
+attribute :app_home, :kind_of => String, :default => nil
+attribute :app_home_mode, :kind_of => Integer, :default => 0755
+attribute :bin_cmds, :kind_of => Array, :default => nil
+attribute :owner, :default => "root"
+attribute :default, :equal_to => [true, false], :default => true
+
+# we have to set default for the supports attribute
+# in initializer since it is a 'reserved' attribute name
+def initialize(*args)
+ super
+ @action = :install
+ @supports = {:report => true, :exception => true}
+end
View
18 ci_environment/libncurses/recipes/default.rb
@@ -21,11 +21,15 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-package "libncursesw5-dev"
+pkgs = value_for_platform(
+ ["centos","redhat","fedora"] => {
+ "default" => ["ncurses-devel"]
+ },
+ "default" => ["libncursesw5-dev","libncurses5-dev"]
+)
-case node['platform']
-when "ubuntu","debian"
- %w{libncurses5-dev}.each do |pkg|
- package(pkg) { action :install }
- end # each
-end # case
+pkgs.each do |pkg|
+ package pkg do
+ action :install
+ end
+end
View
2  ci_environment/libqt4/recipes/default.rb
@@ -2,4 +2,6 @@
when "debian", "ubuntu"
package "libqt4-dev"
package "qt4-qmake"
+when "centos", "redhat", "fedora"
+ package "qt-webkit-devel"
end
View
2  ci_environment/travis_build_environment/templates/default/root/dot_bashrc.sh
@@ -80,7 +80,7 @@ if [ -x /usr/bin/dircolors ]; then
alias egrep='egrep --color=auto'
fi
-export JAVA_HOME="/usr/lib/jvm/java-6-<%= node['java']['install_flavor'] %>"
+export JAVA_HOME="<%= node['java']['java_home'] %>"
export DEBIAN_FRONTEND=noninteractive
export CI=true
View
2  ci_environment/travis_build_environment/templates/default/vagrant/dot_bashrc.sh
@@ -109,4 +109,4 @@ if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
-export JAVA_HOME="/usr/lib/jvm/java-6-<%= node['java']['install_flavor'] %>"
+export JAVA_HOME="<%= node['java']['java_home'] %>"
View
153 ci_environment/yum/README.md
@@ -0,0 +1,153 @@
+Description
+===========
+
+Configures various YUM components on Red Hat-like systems. Includes LWRP for managing repositories and their GPG keys.
+
+Based on the work done by Eric Wolfe and Charles Duffy on the yumrepo cookbook. http://github.com/atomic-penguin/cookbooks/tree/yumrepo/yumrepo
+
+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
+
+## v.0.1.2:
+
+* Remove yum update in default recipe, that doesn't update caches, it updates packages installed.
+
+Requirements
+============
+RHEL, 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).
+
+Attributes
+==========
+
+* `node['yum']['epel_release']` - Set the epel release version based on `node['platform_version']`.
+* `node['yum']['ius_release']` - Set the IUS release to install.
+
+Recipes
+=======
+
+default
+-------
+The 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.
+
+yum
+---
+Manages the configuration of the `/etc/yum.conf` via attributes.
+
+epel
+----
+
+Installs 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.
+
+ius
+----
+
+Installs 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.
+
+The IUS repository requires EPEL, and the recipe includes `yum::epel` to install this.
+
+Resources/Providers
+===================
+
+key
+---
+This 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.
+
+# Actions
+- :add: installs the GPG key into `/etc/pki/rpm-gpg/`
+- :remove: removes the GPG key from `/etc/pki/rpm-gpg/`
+
+# Attribute Parameters
+
+- key: name attribute. The name of the GPG key to install.
+- url: if the key needs to be downloaded, the URL providing the download.
+
+# Example
+
+``` ruby
+# add the Zenoss GPG key
+yum_key "RPM-GPG-KEY-zenoss" do
+ url "http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss"
+ action :add
+end
+
+# remove Zenoss GPG key
+yum_key "RPM-GPG-KEY-zenoss" do
+ action :remove
+end
+```
+
+repository
+----------
+This LWRP provides an easy way to manage additional YUM repositories. GPG keys can be managed with the `key` LWRP.
+
+# Actions
+
+- :add: creates a repository file and builds the repository listing
+- :remove: removes the repository file
+
+# Attribute Parameters
+
+- repo_name: name attribute. The name of the channel to discover
+- description. The description of the repository
+- url: The URL providing the packages
+- mirrorlist: Default is `false`, if `true` the `url` is considered a list of mirrors
+- key: Optional, the name of the GPG key file installed by the `key` LWRP.
+
+- enabled: Default is `1`, set to `0` if the repository is disabled.
+- type: Optional, alternate type of repository
+- failovermethod: Optional, failovermethod
+- bootstrapurl: Optional, bootstrapurl
+
+# Example
+
+``` ruby
+# add the Zenoss repository
+yum_repository "zenoss" do
+ name "Zenoss Stable repo"
+ url "http://dev.zenoss.com/yum/stable/"
+ key "RPM-GPG-KEY-zenoss"
+ action :add
+end
+
+# remove Zenoss repo
+yum_repository "zenoss" do
+ action :remove
+end
+```
+
+Usage
+=====
+
+Put `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.
+
+License and Author
+==================
+
+Author:: Eric G. Wolfe
+Author:: Matt Ray (<matt@opscode.com>)
+Author:: Joshua Timberman (<joshua@opscode.com>)
+
+Copyright:: 2010 Tippr Inc.
+Copyright:: 2011 Eric G. Wolfe
+Copyright:: 2011 Opscode, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
View
33 ci_environment/yum/attributes/default.rb
@@ -0,0 +1,33 @@
+#
+# Cookbook Name:: yum
+# Attributes:: default
+#
+# Copyright 2011, Eric G. Wolfe
+# Copyright 2011, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Example: override.yum.exclude = "kernel* compat-glibc*"
+default[:yum][:exclude]
+default[:yum][:installonlypkgs]
+
+default['yum']['epel_release'] = case node['platform_version'].to_i
+ when 6
+ "6-5"
+ when 5
+ "5-4"
+ when 4
+ "4-10"
+ end
+default['yum']['ius_release'] = '1.0-8'
View
60 ci_environment/yum/metadata.json
@@ -0,0 +1,60 @@
+{
+ "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.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 (<matt@opscode.com>)\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\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",
+ "platforms": {
+ "redhat": ">= 5.0",
+ "centos": ">= 5.0",
+ "scientific": ">= 5.0"
+ },
+ "dependencies": {
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ "yum/exclude": {
+ "display_name": "yum.conf exclude",
+ "description": "List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed.",
+ "required": "optional",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "recipes": [
+
+ ]
+ },
+ "yum/installonlypkgs": {
+ "display_name": "yum.conf installonlypkgs",
+ "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.",
+ "required": "optional",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "recipes": [
+
+ ]
+ }
+ },
+ "groupings": {
+ },
+ "recipes": {
+ "yum": "Runs 'yum update' during compile phase",
+ "yum::yum": "manages yum configuration"
+ },
+ "version": "0.5.2"
+}
View
21 ci_environment/yum/metadata.rb
@@ -0,0 +1,21 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.5.2"
+recipe "yum", "Runs 'yum update' during compile phase"
+recipe "yum::yum", "manages yum configuration"
+
+%w{ redhat centos scientific }.each do |os|
+ supports os, ">= 5.0"
+end
+
+attribute "yum/exclude",
+ :display_name => "yum.conf exclude",
+ :description => "List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed.",
+ :required => "optional"
+
+attribute "yum/installonlypkgs",
+ :display_name => "yum.conf installonlypkgs",
+ :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.",
+ :required => "optional"
View
74 ci_environment/yum/providers/key.rb
@@ -0,0 +1,74 @@
+#
+# Cookbook Name:: yum
+# Provider:: key
+#
+# Copyright 2010, Tippr Inc.
+# Copyright 2011, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+action :add do
+ unless ::File.exists?("/etc/pki/rpm-gpg/#{new_resource.key}")
+ Chef::Log.info "Adding #{new_resource.key} GPG key to /etc/pki/rpm-gpg/"
+
+ if node[:platform_version].to_i <= 5
+ package "gnupg"
+ elsif node[:platform_version].to_i >= 6
+ package "gnupg2"
+ end
+
+ execute "rpm --import /etc/pki/rpm-gpg/#{new_resource.key}" do
+ action :nothing
+ not_if <<-EOH
+ function packagenames_for_keyfile() {
+ local filename="$1"
+ gpg \
+ --with-fingerprint \
+ --with-colons \
+ --fixed-list-mode \
+ "$filename" \
+ | gawk -F: '/^pub/ { print tolower(sprintf("gpg-pubkey-%s-%x\\n", substr($5, length($5)-8+1), $6)) }'
+ }
+
+ for pkgname in $(packagenames_for_keyfile "/etc/pki/rpm-gpg/#{new_resource.key}"); do
+ if [[ $pkgname ]] && ! rpm -q $pkgname ; then
+ exit 1;
+ fi;
+ done
+
+ exit 0
+ EOH
+ end
+
+ #download the file if necessary
+ if new_resource.url
+ remote_file "/etc/pki/rpm-gpg/#{new_resource.key}" do
+ source new_resource.url
+ mode "0644"
+ notifies :run, resources(:execute => "rpm --import /etc/pki/rpm-gpg/#{new_resource.key}"), :immediately
+ end
+ end
+
+ end
+end
+
+action :remove do
+ if ::File.exists?("/etc/pki/rpm-gpg/#{new_resource.key}")
+ Chef::Log.info "Removing #{new_resource.key} key from /etc/pki/rpm-gpg/"
+ file "/etc/pki/rpm-gpg/#{new_resource.key}" do
+ action :delete
+ end
+ new_resource.updated_by_last_action(true)
+ end
+end
View
65 ci_environment/yum/providers/repository.rb
@@ -0,0 +1,65 @@
+#
+# Cookbook Name:: yum
+# Provider:: repository
+#
+# Copyright 2010, Tippr Inc.
+# Copyright 2011, Opscode, Inc..
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# note that deletion does not remove GPG keys, either from the repo or
+# /etc/pki/rpm-gpg; this is a design decision.
+
+action :add do
+ unless ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
+ Chef::Log.info "Adding #{new_resource.repo_name} repository to /etc/yum.repos.d/#{new_resource.repo_name}.repo"
+ #import the gpg key. If it needs to be downloaded or imported from a cookbook
+ #that can be done in the calling recipe
+ if new_resource.key then
+ yum_key new_resource.key
+ end
+ #get the metadata
+ execute "yum -q makecache" do
+ action :nothing
+ end
+ #write out the file
+ template "/etc/yum.repos.d/#{new_resource.repo_name}.repo" do
+ cookbook "yum"
+ source "repo.erb"
+ mode "0644"
+ variables({
+ :repo_name => new_resource.repo_name,
+ :description => new_resource.description,
+ :url => new_resource.url,
+ :mirrorlist => new_resource.mirrorlist,
+ :key => new_resource.key,
+ :enabled => new_resource.enabled,
+ :type => new_resource.type,
+ :failovermethod => new_resource.failovermethod,
+ :bootstrapurl => new_resource.bootstrapurl
+ })
+ notifies :run, resources(:execute => "yum -q makecache"), :immediately
+ end
+ end
+end
+
+action :remove do