New Vagrant VM and updated instructions.
This commit is contained in:
parent
9bce812c8f
commit
17dc8b8e4f
|
@ -3,8 +3,8 @@
|
|||
# See https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md
|
||||
#
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box= "discourse/discourse-0.9.9.15.box"
|
||||
config.vm.box_url = "https://vagrantcloud.com/discourse/discourse-0.9.9.15.box"
|
||||
config.vm.box = 'discourse/discourse-1.3.0'
|
||||
config.vm.box_url = "http://discourse-vms.s3.amazonaws.com/discourse-1.3.0.box"
|
||||
|
||||
# Make this VM reachable on the host network as well, so that other
|
||||
# VM's running other browsers can access our dev server.
|
||||
|
@ -45,21 +45,4 @@ Vagrant.configure("2") do |config|
|
|||
nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
|
||||
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => nfs_setting
|
||||
|
||||
config.vm.provision :shell, :inline => "apt-get -qq update && apt-get -qq -y install ruby1.9.3 build-essential && gem install chef --no-rdoc --no-ri --conservative"
|
||||
|
||||
chef_cookbooks_path = ["chef/cookbooks"]
|
||||
|
||||
# This run uses the updated chef-solo and does normal configuration
|
||||
config.vm.provision :chef_solo do |chef|
|
||||
chef.binary_env = "GEM_HOME=/opt/chef/embedded/lib/ruby/gems/1.9.1/ GEM_PATH= "
|
||||
chef.binary_path = "/opt/chef/bin/"
|
||||
chef.cookbooks_path = chef_cookbooks_path
|
||||
|
||||
chef.add_recipe "recipe[apt]"
|
||||
chef.add_recipe "recipe[build-essential]"
|
||||
chef.add_recipe "recipe[vim]"
|
||||
chef.add_recipe "recipe[java]"
|
||||
chef.add_recipe "recipe[imagemagick]"
|
||||
chef.add_recipe "discourse"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
LIBRARIAN_CHEF_INSTALL__STRIP_DOT_GIT: '1'
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
#^syntax detection
|
||||
|
||||
site 'http://community.opscode.com/api/v1'
|
||||
|
||||
cookbook 'apt'
|
||||
cookbook 'vim'
|
||||
cookbook 'build-essential'
|
||||
cookbook 'omnibus_updater'
|
|
@ -1,14 +0,0 @@
|
|||
SITE
|
||||
remote: http://community.opscode.com/api/v1
|
||||
specs:
|
||||
apt (1.8.4)
|
||||
build-essential (1.3.4)
|
||||
omnibus_updater (0.1.2)
|
||||
vim (1.0.2)
|
||||
|
||||
DEPENDENCIES
|
||||
apt (>= 0)
|
||||
build-essential (>= 0)
|
||||
omnibus_updater (>= 0)
|
||||
vim (>= 0)
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
.bundle
|
||||
.cache
|
||||
.kitchen
|
||||
bin
|
|
@ -1,70 +0,0 @@
|
|||
## v1.8.4:
|
||||
|
||||
* [COOK-2171] - Update README to clarify required Chef version: 10.18.0
|
||||
or higher.
|
||||
|
||||
## v1.8.2:
|
||||
|
||||
* [COOK-2112] - need [] around "arch" in sources.list entries
|
||||
* [COOK-2171] - fixes a regression in the notification
|
||||
|
||||
## v1.8.0:
|
||||
|
||||
* [COOK-2143] - Allow for a custom cacher-ng port
|
||||
* [COOK-2171] - On `apt_repository.run_action(:add)` the source file
|
||||
is not created.
|
||||
* [COOK-2184] - apt::cacher-ng, use `cacher_port` attribute in
|
||||
acng.conf
|
||||
|
||||
## v1.7.0:
|
||||
|
||||
* [COOK-2082] - add "arch" parameter to apt_repository LWRP
|
||||
|
||||
## v1.6.0:
|
||||
|
||||
* [COOK-1893] - `apt_preference` use "`package_name`" resource instead of "name"
|
||||
* [COOK-1894] - change filename for sources.list.d files
|
||||
* [COOK-1914] - Wrong dir permissions for /etc/apt/preferences.d/
|
||||
* [COOK-1942] - README.md has wrong name for the keyserver attribute
|
||||
* [COOK-2019] - create 01proxy before any other apt-get updates get executed
|
||||
|
||||
## v1.5.2:
|
||||
|
||||
* [COOK-1682] - use template instead of file resource in apt::cacher-client
|
||||
* [COOK-1875] - cacher-client should be Environment-aware
|
||||
|
||||
## V1.5.0:
|
||||
|
||||
* [COOK-1500] - Avoid triggering apt-get update
|
||||
* [COOK-1548] - Add execute commands for autoclean and autoremove
|
||||
* [COOK-1591] - Setting up the apt proxy should leave https
|
||||
connections direct
|
||||
* [COOK-1596] - execute[apt-get-update-periodic] never runs
|
||||
* [COOK-1762] - create /etc/apt/preferences.d directory
|
||||
* [COOK-1776] - apt key check isn't idempotent
|
||||
|
||||
## v1.4.8:
|
||||
|
||||
* Adds test-kitchen support
|
||||
* [COOK-1435] - repository lwrp is not idempotent with http key
|
||||
|
||||
## v1.4.6:
|
||||
|
||||
* [COOK-1530] - apt_repository isn't aware of update-success-stamp
|
||||
file (also reverts COOK-1382 patch).
|
||||
|
||||
## v1.4.4:
|
||||
|
||||
* [COOK-1229] - Allow cacher IP to be set manually in non-Chef Solo
|
||||
environments
|
||||
* [COOK-1530] - Immediately update apt-cache when sources.list file is dropped off
|
||||
|
||||
## v1.4.2:
|
||||
|
||||
* [COOK-1155] - LWRP for apt pinning
|
||||
|
||||
## v1.4.0:
|
||||
|
||||
* [COOK-889] - overwrite existing repo source files
|
||||
* [COOK-921] - optionally use cookbook\_file or remote\_file for key
|
||||
* [COOK-1032] - fixes problem with apt repository key installation
|
|
@ -1,29 +0,0 @@
|
|||
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.
|
|
@ -1,3 +0,0 @@
|
|||
source :rubygems
|
||||
|
||||
gem 'test-kitchen', '>= 0.7.0'
|
|
@ -1,132 +0,0 @@
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
archive-tar-minitar (0.5.2)
|
||||
builder (3.1.4)
|
||||
bunny (0.7.9)
|
||||
chef (10.18.2)
|
||||
bunny (>= 0.6.0, < 0.8.0)
|
||||
erubis
|
||||
highline (>= 1.6.9)
|
||||
json (>= 1.4.4, <= 1.6.1)
|
||||
mixlib-authentication (>= 1.3.0)
|
||||
mixlib-cli (>= 1.1.0)
|
||||
mixlib-config (>= 1.1.2)
|
||||
mixlib-log (>= 1.3.0)
|
||||
mixlib-shellout
|
||||
moneta (< 0.7.0)
|
||||
net-ssh (~> 2.2.2)
|
||||
net-ssh-multi (~> 1.1.0)
|
||||
ohai (>= 0.6.0)
|
||||
rest-client (>= 1.0.4, < 1.7.0)
|
||||
treetop (~> 1.4.9)
|
||||
uuidtools
|
||||
yajl-ruby (~> 1.1)
|
||||
childprocess (0.3.7)
|
||||
ffi (~> 1.0, >= 1.0.6)
|
||||
coderay (1.0.8)
|
||||
erubis (2.7.0)
|
||||
excon (0.16.10)
|
||||
ffi (1.3.1)
|
||||
fog (1.9.0)
|
||||
builder
|
||||
excon (~> 0.14)
|
||||
formatador (~> 0.2.0)
|
||||
mime-types
|
||||
multi_json (~> 1.0)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (>= 2.1.3)
|
||||
nokogiri (~> 1.5.0)
|
||||
ruby-hmac
|
||||
foodcritic (1.7.0)
|
||||
erubis
|
||||
gherkin (~> 2.11.1)
|
||||
gist (~> 3.1.0)
|
||||
nokogiri (~> 1.5.4)
|
||||
pry (~> 0.9.8.4)
|
||||
rak (~> 1.4)
|
||||
treetop (~> 1.4.10)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
formatador (0.2.4)
|
||||
gherkin (2.11.5)
|
||||
json (>= 1.4.6)
|
||||
gist (3.1.1)
|
||||
hashr (0.0.22)
|
||||
highline (1.6.15)
|
||||
i18n (0.6.1)
|
||||
ipaddress (0.8.0)
|
||||
json (1.5.4)
|
||||
librarian (0.0.26)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
chef (>= 0.10)
|
||||
highline
|
||||
thor (~> 0.15)
|
||||
log4r (1.1.10)
|
||||
method_source (0.7.1)
|
||||
mime-types (1.19)
|
||||
mixlib-authentication (1.3.0)
|
||||
mixlib-log
|
||||
mixlib-cli (1.2.2)
|
||||
mixlib-config (1.1.2)
|
||||
mixlib-log (1.4.1)
|
||||
mixlib-shellout (1.1.0)
|
||||
moneta (0.6.0)
|
||||
multi_json (1.5.0)
|
||||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh (2.2.2)
|
||||
net-ssh-gateway (1.1.0)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh-multi (1.1)
|
||||
net-ssh (>= 2.1.4)
|
||||
net-ssh-gateway (>= 0.99.0)
|
||||
nokogiri (1.5.6)
|
||||
ohai (6.16.0)
|
||||
ipaddress
|
||||
mixlib-cli
|
||||
mixlib-config
|
||||
mixlib-log
|
||||
mixlib-shellout
|
||||
systemu
|
||||
yajl-ruby
|
||||
polyglot (0.3.3)
|
||||
pry (0.9.8.4)
|
||||
coderay (~> 1.0.5)
|
||||
method_source (~> 0.7.1)
|
||||
slop (>= 2.4.4, < 3)
|
||||
rak (1.4)
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
ruby-hmac (0.4.0)
|
||||
slop (2.4.4)
|
||||
systemu (2.5.2)
|
||||
test-kitchen (0.7.0)
|
||||
fog
|
||||
foodcritic (>= 1.4.0)
|
||||
hashr (~> 0.0.20)
|
||||
highline (>= 1.6.9)
|
||||
librarian (~> 0.0.20)
|
||||
mixlib-cli (~> 1.2.2)
|
||||
vagrant (~> 1.0.2)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
thor (0.16.0)
|
||||
treetop (1.4.12)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
uuidtools (2.1.3)
|
||||
vagrant (1.0.6)
|
||||
archive-tar-minitar (= 0.5.2)
|
||||
childprocess (~> 0.3.1)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6.0)
|
||||
json (~> 1.5.1)
|
||||
log4r (~> 1.1.9)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (~> 2.2.2)
|
||||
yajl-ruby (1.1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
test-kitchen (>= 0.7.0)
|
|
@ -1,201 +0,0 @@
|
|||
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.
|
|
@ -1,229 +0,0 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
This cookbook includes recipes to execute apt-get update to ensure the
|
||||
local APT package cache is up to date. There are recipes for managing
|
||||
the apt-cacher-ng caching proxy and proxy clients. It also includes a
|
||||
LWRP for managing APT repositories in /etc/apt/sources.list.d as well as
|
||||
an LWRP for pinning packages via /etc/apt/preferences.d.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
Version 1.8.2+ of this cookbook requires **Chef 10.16.4** or later.
|
||||
|
||||
If your Chef version is earlier than 10.16.4, use version 1.7.0 of
|
||||
this cookbook.
|
||||
|
||||
See [CHEF-3493](http://tickets.opscode.com/browse/CHEF-3493) and
|
||||
[this code comment](http://bit.ly/VgvCgf) for more information on this
|
||||
requirement.
|
||||
|
||||
Platform
|
||||
--------
|
||||
|
||||
* Debian
|
||||
* Ubuntu
|
||||
|
||||
May work with or without modification on other Debian derivatives.
|
||||
|
||||
Recipes
|
||||
=======
|
||||
|
||||
default
|
||||
-------
|
||||
|
||||
This recipe installs the `update-notifier-common` package to provide
|
||||
the timestamp file used to only run `apt-get update` if the cache is
|
||||
more than one day old.
|
||||
|
||||
This recipe should appear first in the run list of Debian or Ubuntu
|
||||
nodes to ensure that the package cache is up to date before managing
|
||||
any `package` resources with Chef.
|
||||
|
||||
This recipe also sets up a local cache directory for preseeding packages.
|
||||
|
||||
cacher-ng
|
||||
---------
|
||||
|
||||
Installs the `apt-cacher-ng` package and service so the system can
|
||||
provide APT caching. You can check the usage report at
|
||||
http://{hostname}:3142/acng-report.html. The `cacher-ng` recipe
|
||||
includes the `cacher-client` recipe, so it helps seed itself.
|
||||
|
||||
cacher-client
|
||||
-------------
|
||||
Configures the node to use the `apt-cacher-ng` server as a client. If you
|
||||
want to restrict your node to using the `apt-cacher-ng` server in your
|
||||
Environment, set `['apt']['cacher-client']['restrict_environment']` to `true`.
|
||||
To use a cacher server (or standard proxy server) not available via search
|
||||
set the atttribute `['apt']['cacher-ipaddress']` and for a custom port
|
||||
set `['apt']['cacher_port']`
|
||||
|
||||
Resources/Providers
|
||||
===================
|
||||
|
||||
Managing repositories
|
||||
---------------------
|
||||
|
||||
This LWRP provides an easy way to manage additional APT repositories.
|
||||
Adding a new repository will notify running the `execute[apt-get-update]`
|
||||
resource immediately.
|
||||
|
||||
# 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
|
||||
- uri: the base of the Debian distribution
|
||||
- distribution: this is usually your release's codename...ie something
|
||||
like `karmic`, `lucid` or `maverick`
|
||||
- components: package groupings..when it doubt use `main`
|
||||
- arch: constrain package to a particular arch like `i386`, `amd64` or
|
||||
even `armhf` or `powerpc`. Defaults to nil.
|
||||
- deb_src: whether or not to add the repository as a source repo as
|
||||
well - value can be `true` or `false`, default `false`.
|
||||
- keyserver: the GPG keyserver where the key for the repo should be retrieved
|
||||
- key: if a `keyserver` is provided, this is assumed to be the
|
||||
fingerprint, otherwise it can be either the URI to the GPG key for
|
||||
the repo, or a cookbook_file.
|
||||
- cookbook: if key should be a cookbook_file, specify a cookbook where
|
||||
the key is located for files/default. Defaults to nil, so it will
|
||||
use the cookbook where the resource is used.
|
||||
|
||||
# Examples
|
||||
|
||||
# add the Zenoss repo
|
||||
apt_repository "zenoss" do
|
||||
uri "http://dev.zenoss.org/deb"
|
||||
components ["main","stable"]
|
||||
end
|
||||
|
||||
# add the Nginx PPA; grab key from keyserver
|
||||
apt_repository "nginx-php" do
|
||||
uri "http://ppa.launchpad.net/nginx/php5/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
keyserver "keyserver.ubuntu.com"
|
||||
key "C300EE8C"
|
||||
end
|
||||
|
||||
# add the Nginx PPA; grab key from keyserver, also add source repo
|
||||
apt_repository "nginx-php" do
|
||||
uri "http://ppa.launchpad.net/nginx/php5/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
keyserver "keyserver.ubuntu.com"
|
||||
key "C300EE8C"
|
||||
deb_src true
|
||||
end
|
||||
|
||||
# add the Cloudkick Repo
|
||||
apt_repository "cloudkick" do
|
||||
uri "http://packages.cloudkick.com/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
key "http://packages.cloudkick.com/cloudkick.packages.key"
|
||||
end
|
||||
|
||||
# add the Cloudkick Repo with the key downloaded in the cookbook
|
||||
apt_repository "cloudkick" do
|
||||
uri "http://packages.cloudkick.com/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
key "cloudkick.packages.key"
|
||||
end
|
||||
|
||||
# add the Cloudera Repo of CDH4 packages for Ubuntu 12.04 on AMD64
|
||||
apt_repository "cloudera" do
|
||||
uri "http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh"
|
||||
arch "amd64"
|
||||
distribution "precise-cdh4"
|
||||
components ["contrib"]
|
||||
key "http://archive.cloudera.com/debian/archive.key"
|
||||
end
|
||||
|
||||
# remove Zenoss repo
|
||||
apt_repository "zenoss" do
|
||||
action :remove
|
||||
end
|
||||
|
||||
Pinning packages
|
||||
----------------
|
||||
|
||||
This LWRP provides an easy way to pin packages in /etc/apt/preferences.d.
|
||||
Although apt-pinning is quite helpful from time to time please note that Debian
|
||||
does not encourage its use without thorough consideration.
|
||||
|
||||
Further information regarding apt-pinning is available via
|
||||
http://wiki.debian.org/AptPreferences.
|
||||
|
||||
# Actions
|
||||
|
||||
- :add: creates a preferences file under /etc/apt/preferences.d
|
||||
- :remove: Removes the file, therefore unpin the package
|
||||
|
||||
# Attribute Parameters
|
||||
|
||||
- package_name: name attribute. The name of the package
|
||||
- pin: The package version/repository to pin
|
||||
- pin_priority: The pinning priority aka "the highest package version wins"
|
||||
|
||||
# Examples
|
||||
|
||||
# Pin libmysqlclient16 to version 5.1.49-3
|
||||
apt_preference "libmysqlclient16" do
|
||||
pin "version 5.1.49-3"
|
||||
pin_priority "700"
|
||||
end
|
||||
|
||||
# Unpin libmysqlclient16
|
||||
apt_preference "libmysqlclient16" do
|
||||
action :remove
|
||||
end
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Put `recipe[apt]` first in the run list. If you have other recipes
|
||||
that you want to use to configure how apt behaves, like new sources,
|
||||
notify the execute resource to run, e.g.:
|
||||
|
||||
template "/etc/apt/sources.list.d/my_apt_sources.list" do
|
||||
notifies :run, resources(:execute => "apt-get update"), :immediately
|
||||
end
|
||||
|
||||
The above will run during execution phase since it is a normal
|
||||
template resource, and should appear before other package resources
|
||||
that need the sources in the template.
|
||||
|
||||
Put `recipe[apt::cacher-ng]` in the run_list for a server to provide
|
||||
APT caching and add `recipe[apt::cacher-client]` on the rest of the
|
||||
Debian-based nodes to take advantage of the caching server.
|
||||
|
||||
If you want to cleanup unused packages, there is also the `apt-get autoclean`
|
||||
and `apt-get autoremove` resources provided for automated cleanup.
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
Author:: Matt Ray (<matt@opscode.com>)
|
||||
Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
|
||||
Copyright 2009-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.
|
||||
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.
|
|
@ -1,2 +0,0 @@
|
|||
default['apt']['cacher-client']['restrict_environment'] = false
|
||||
default['apt']['cacher_port'] = 3142
|
|
@ -1,50 +0,0 @@
|
|||
[DEFAULT]
|
||||
;; All times are in seconds, but you can add a suffix
|
||||
;; for minutes(m), hours(h) or days(d)
|
||||
|
||||
;; commented out address so apt-proxy will listen on all IPs
|
||||
;; address = 127.0.0.1
|
||||
port = 9999
|
||||
cache_dir = /var/cache/apt-proxy
|
||||
|
||||
;; Control files (Packages/Sources/Contents) refresh rate
|
||||
min_refresh_delay = 1s
|
||||
complete_clientless_downloads = 1
|
||||
|
||||
;; Debugging settings.
|
||||
debug = all:4 db:0
|
||||
|
||||
time = 30
|
||||
passive_ftp = on
|
||||
|
||||
;;--------------------------------------------------------------
|
||||
;; Cache housekeeping
|
||||
|
||||
cleanup_freq = 1d
|
||||
max_age = 120d
|
||||
max_versions = 3
|
||||
|
||||
;;---------------------------------------------------------------
|
||||
;; Backend servers
|
||||
;;
|
||||
;; Place each server in its own [section]
|
||||
|
||||
[ubuntu]
|
||||
; Ubuntu archive
|
||||
backends =
|
||||
http://us.archive.ubuntu.com/ubuntu
|
||||
|
||||
[ubuntu-security]
|
||||
; Ubuntu security updates
|
||||
backends = http://security.ubuntu.com/ubuntu
|
||||
|
||||
[debian]
|
||||
;; Backend servers, in order of preference
|
||||
backends =
|
||||
http://debian.osuosl.org/debian/
|
||||
|
||||
[security]
|
||||
;; Debian security archive
|
||||
backends =
|
||||
http://security.debian.org/debian-security
|
||||
http://ftp2.de.debian.org/debian-security
|
File diff suppressed because one or more lines are too long
|
@ -1,14 +0,0 @@
|
|||
name "apt"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Configures apt and apt services and LWRPs for managing apt repositories and preferences"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "1.8.4"
|
||||
recipe "apt", "Runs apt-get update during compile phase and sets up preseed directories"
|
||||
recipe "apt::cacher-ng", "Set up an apt-cacher-ng caching proxy"
|
||||
recipe "apt::cacher-client", "Client for the apt::cacher-ng caching proxy"
|
||||
|
||||
%w{ ubuntu debian }.each do |os|
|
||||
supports os
|
||||
end
|
|
@ -1,61 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Provider:: preference
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Build preferences.d file contents
|
||||
def build_pref(package_name, pin, pin_priority)
|
||||
preference_content = "Package: #{package_name}\nPin: #{pin}\nPin-Priority: #{pin_priority}\n"
|
||||
end
|
||||
|
||||
action :add do
|
||||
new_resource.updated_by_last_action(false)
|
||||
|
||||
preference = build_pref(new_resource.package_name,
|
||||
new_resource.pin,
|
||||
new_resource.pin_priority)
|
||||
|
||||
preference_dir = directory "/etc/apt/preferences.d" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00755
|
||||
recursive true
|
||||
action :nothing
|
||||
end
|
||||
|
||||
preference_file = file "/etc/apt/preferences.d/#{new_resource.name}" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00644
|
||||
content preference
|
||||
action :nothing
|
||||
end
|
||||
|
||||
preference_dir.run_action(:create)
|
||||
# write out the preference file, replace it if it already exists
|
||||
preference_file.run_action(:create)
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if ::File.exists?("/etc/apt/preferences.d/#{new_resource.name}")
|
||||
Chef::Log.info "Un-pinning #{new_resource.name} from /etc/apt/preferences.d/"
|
||||
file "/etc/apt/preferences.d/#{new_resource.name}" do
|
||||
action :delete
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
|
@ -1,134 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Provider:: repository
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
# install apt key from keyserver
|
||||
def install_key_from_keyserver(key, keyserver)
|
||||
execute "install-key #{key}" do
|
||||
command "apt-key adv --keyserver #{keyserver} --recv #{key}"
|
||||
action :run
|
||||
not_if "apt-key list | grep #{key}"
|
||||
end
|
||||
end
|
||||
|
||||
# run command and extract gpg ids
|
||||
def extract_gpg_ids_from_cmd(cmd)
|
||||
so = Mixlib::ShellOut.new(cmd)
|
||||
so.run_command
|
||||
so.stdout.split(/\n/).collect do |t|
|
||||
if z = t.match(/^pub\s+\d+\w\/([0-9A-F]{8})/)
|
||||
z[1]
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
# install apt key from URI
|
||||
def install_key_from_uri(uri)
|
||||
key_name = uri.split(/\//).last
|
||||
cached_keyfile = "#{Chef::Config[:file_cache_path]}/#{key_name}"
|
||||
if new_resource.key =~ /http/
|
||||
remote_file cached_keyfile do
|
||||
source new_resource.key
|
||||
mode 00644
|
||||
action :create
|
||||
end
|
||||
else
|
||||
cookbook_file cached_keyfile do
|
||||
source new_resource.key
|
||||
cookbook new_resource.cookbook
|
||||
mode 00644
|
||||
action :create
|
||||
end
|
||||
end
|
||||
|
||||
execute "install-key #{key_name}" do
|
||||
command "apt-key add #{cached_keyfile}"
|
||||
action :run
|
||||
not_if do
|
||||
installed_ids = extract_gpg_ids_from_cmd("apt-key finger")
|
||||
key_ids = extract_gpg_ids_from_cmd("gpg --with-fingerprint #{cached_keyfile}")
|
||||
(installed_ids & key_ids).sort == key_ids.sort
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# build repo file contents
|
||||
def build_repo(uri, distribution, components, arch, add_deb_src)
|
||||
components = components.join(' ') if components.respond_to?(:join)
|
||||
repo_info = "#{uri} #{distribution} #{components}\n"
|
||||
repo_info = "[arch=#{arch}] #{repo_info}" if arch
|
||||
repo = "deb #{repo_info}"
|
||||
repo << "deb-src #{repo_info}" if add_deb_src
|
||||
repo
|
||||
end
|
||||
|
||||
action :add do
|
||||
new_resource.updated_by_last_action(false)
|
||||
@repo_file = nil
|
||||
|
||||
recipe_eval do
|
||||
# add key
|
||||
if new_resource.keyserver && new_resource.key
|
||||
install_key_from_keyserver(new_resource.key, new_resource.keyserver)
|
||||
elsif new_resource.key
|
||||
install_key_from_uri(new_resource.key)
|
||||
end
|
||||
|
||||
file "/var/lib/apt/periodic/update-success-stamp" do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute "apt-get update" do
|
||||
ignore_failure true
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# build repo file
|
||||
repository = build_repo(new_resource.uri,
|
||||
new_resource.distribution,
|
||||
new_resource.components,
|
||||
new_resource.arch,
|
||||
new_resource.deb_src)
|
||||
|
||||
@repo_file = file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00644
|
||||
content repository
|
||||
action :create
|
||||
notifies :delete, "file[/var/lib/apt/periodic/update-success-stamp]", :immediately
|
||||
notifies :run, "execute[apt-get update]", :immediately if new_resource.cache_rebuild
|
||||
end
|
||||
end
|
||||
|
||||
raise RuntimeError, "The repository file to create is nil, cannot continue." if @repo_file.nil?
|
||||
new_resource.updated_by_last_action(@repo_file.updated?)
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if ::File.exists?("/etc/apt/sources.list.d/#{new_resource.name}.list")
|
||||
Chef::Log.info "Removing #{new_resource.name} repository from /etc/apt/sources.list.d/"
|
||||
file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,59 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Recipe:: cacher-client
|
||||
#
|
||||
# Copyright 2011, 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
#remove Acquire::http::Proxy lines from /etc/apt/apt.conf since we use 01proxy
|
||||
#these are leftover from preseed installs
|
||||
execute 'Remove proxy from /etc/apt/apt.conf' do
|
||||
command "sed --in-place '/^Acquire::http::Proxy/d' /etc/apt/apt.conf"
|
||||
only_if "grep Acquire::http::Proxy /etc/apt/apt.conf"
|
||||
end
|
||||
|
||||
servers = []
|
||||
if node['apt'] && node['apt']['cacher_ipaddress']
|
||||
cacher = Chef::Node.new
|
||||
cacher.name(node['apt']['cacher_ipaddress'])
|
||||
cacher.ipaddress(node['apt']['cacher_ipaddress'])
|
||||
servers << cacher
|
||||
end
|
||||
|
||||
unless Chef::Config[:solo]
|
||||
query = 'recipes:apt\:\:cacher-ng'
|
||||
query += " AND chef_environment:#{node.chef_environment}" if node['apt']['cacher-client']['restrict_environment']
|
||||
Chef::Log.debug("apt::cacher-client searching for '#{query}'")
|
||||
servers += search(:node, query)
|
||||
end
|
||||
|
||||
if servers.length > 0
|
||||
Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
|
||||
template '/etc/apt/apt.conf.d/01proxy' do
|
||||
source '01proxy.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00644
|
||||
variables(
|
||||
:proxy => servers[0]['ipaddress'],
|
||||
:port => node['apt']['cacher_port']
|
||||
)
|
||||
end.run_action(:create)
|
||||
else
|
||||
Chef::Log.info('No apt-cacher-ng server found.')
|
||||
file '/etc/apt/apt.conf.d/01proxy' do
|
||||
action :delete
|
||||
end
|
||||
end
|
|
@ -1,43 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Recipe:: cacher-ng
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
package "apt-cacher-ng" do
|
||||
action :install
|
||||
end
|
||||
|
||||
service "apt-cacher-ng" do
|
||||
supports :restart => true, :status => false
|
||||
action :enable
|
||||
end
|
||||
|
||||
template "/etc/apt-cacher-ng/acng.conf" do
|
||||
source "acng.conf.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00644
|
||||
notifies :restart, "service[apt-cacher-ng]"
|
||||
end
|
||||
|
||||
# Reopen resource w/ start in case config issue causes startup to fail
|
||||
service "apt-cacher-ng" do
|
||||
action :start
|
||||
end
|
||||
|
||||
#this will help seed the proxy
|
||||
include_recipe "apt::cacher-client"
|
|
@ -1,68 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2008-2011, Opscode, Inc.
|
||||
# Copyright 2009, Bryan McLellan <btm@loftninjas.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Run apt-get update to create the stamp file
|
||||
execute "apt-get-update" do
|
||||
command "apt-get update"
|
||||
ignore_failure true
|
||||
not_if do ::File.exists?('/var/lib/apt/periodic/update-success-stamp') end
|
||||
end
|
||||
|
||||
# For other recipes to call to force an update
|
||||
execute "apt-get update" do
|
||||
command "apt-get update"
|
||||
ignore_failure true
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# Automatically remove packages that are no longer needed for dependencies
|
||||
execute "apt-get autoremove" do
|
||||
command "apt-get -y autoremove"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# Automatically remove .deb files for packages no longer on your system
|
||||
execute "apt-get autoclean" do
|
||||
command "apt-get -y autoclean"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# provides /var/lib/apt/periodic/update-success-stamp on apt-get update
|
||||
package "update-notifier-common" do
|
||||
notifies :run, resources(:execute => "apt-get-update"), :immediately
|
||||
end
|
||||
|
||||
execute "apt-get-update-periodic" do
|
||||
command "apt-get update"
|
||||
ignore_failure true
|
||||
only_if do
|
||||
::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
|
||||
::File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now - 86400
|
||||
end
|
||||
end
|
||||
|
||||
%w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
|
||||
directory dirname do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00755
|
||||
action :create
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Resource:: preference
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
actions :add, :remove
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
@action = :add
|
||||
end
|
||||
|
||||
attribute :package_name, :kind_of => String, :name_attribute => true
|
||||
attribute :pin, :kind_of => String
|
||||
attribute :pin_priority, :kind_of => String
|
|
@ -1,40 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Resource:: repository
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
actions :add, :remove
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
@action = :add
|
||||
end
|
||||
|
||||
#name of the repo, used for source.list filename
|
||||
attribute :repo_name, :kind_of => String, :name_attribute => true
|
||||
attribute :uri, :kind_of => String
|
||||
attribute :distribution, :kind_of => String
|
||||
attribute :components, :kind_of => Array, :default => []
|
||||
attribute :arch, :kind_of => String, :default => nil
|
||||
#whether or not to add the repository as a source repo as well
|
||||
attribute :deb_src, :default => false
|
||||
attribute :keyserver, :kind_of => String, :default => nil
|
||||
attribute :key, :kind_of => String, :default => nil
|
||||
attribute :cookbook, :kind_of => String, :default => nil
|
||||
#trigger cache rebuild
|
||||
#If not you can trigger in the recipe itself after checking the status of resource.updated{_by_last_action}?
|
||||
attribute :cache_rebuild, :kind_of => [TrueClass, FalseClass], :default => true
|
|
@ -1,2 +0,0 @@
|
|||
Acquire::http::Proxy "http://<%= @proxy %>:<%= @port %>";
|
||||
Acquire::https::Proxy "DIRECT";
|
|
@ -1,276 +0,0 @@
|
|||
|
||||
# Letter case in directive names does not matter. Must be separated with colons.
|
||||
# Valid boolean values are a zero number for false, non-zero numbers for true.
|
||||
|
||||
CacheDir: /var/cache/apt-cacher-ng
|
||||
|
||||
# set empty to disable logging
|
||||
LogDir: /var/log/apt-cacher-ng
|
||||
|
||||
# place to look for additional configuration and resource files if they are not
|
||||
# found in the configuration directory
|
||||
# SupportDir: /usr/lib/apt-cacher-ng
|
||||
|
||||
# TCP (http) port
|
||||
# Set to 9999 to emulate apt-proxy
|
||||
Port:<%= node['apt']['cacher_port'] %>
|
||||
|
||||
# Addresses or hostnames to listen on. Multiple addresses must be separated by
|
||||
# spaces. Each entry must be an exact local address which is associated with a
|
||||
# local interface. DNS resolution is performed using getaddrinfo(3) for all
|
||||
# available protocols (IPv4, IPv6, ...). Using a protocol specific format will
|
||||
# create binding(s) only on protocol specific socket(s) (e.g. 0.0.0.0 will listen
|
||||
# only to IPv4).
|
||||
#
|
||||
# Default: not set, will listen on all interfaces and protocols
|
||||
#
|
||||
# BindAddress: localhost 192.168.7.254 publicNameOnMainInterface
|
||||
|
||||
# The specification of another proxy which shall be used for downloads.
|
||||
# Username and password are, and see manual for limitations.
|
||||
#
|
||||
#Proxy: http://www-proxy.example.net:80
|
||||
#proxy: username:proxypassword@proxy.example.net:3128
|
||||
|
||||
# Repository remapping. See manual for details.
|
||||
# In this example, some backends files might be generated during package
|
||||
# installation using information collected on the system.
|
||||
Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian # Debian Archives
|
||||
Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu # Ubuntu Archives
|
||||
Remap-debvol: file:debvol_mirror*.gz /debian-volatile ; file:backends_debvol # Debian Volatile Archives
|
||||
Remap-cygwin: file:cygwin_mirrors /cygwin # ; file:backends_cygwin # incomplete, please create this file or specify preferred mirrors here
|
||||
Remap-sfnet: file:sfnet_mirrors # ; file:backends_sfnet # incomplete, please create this file or specify preferred mirrors here
|
||||
Remap-alxrep: file:archlx_mirrors /archlinux # ; file:backend_archlx # Arch Linux
|
||||
Remap-fedora: file:fedora_mirrors # Fedora Linux
|
||||
Remap-epel: file:epel_mirrors # Fedora EPEL
|
||||
Remap-slrep: file:sl_mirrors # Scientific Linux
|
||||
|
||||
# This is usually not needed for security.debian.org because it's always the
|
||||
# same DNS hostname. However, it might be enabled in order to use hooks,
|
||||
# ForceManaged mode or special flags in this context.
|
||||
# Remap-secdeb: security.debian.org
|
||||
|
||||
# Virtual page accessible in a web browser to see statistics and status
|
||||
# information, i.e. under http://localhost:3142/acng-report.html
|
||||
ReportPage: acng-report.html
|
||||
|
||||
# Socket file for accessing through local UNIX socket instead of TCP/IP. Can be
|
||||
# used with inetd bridge or cron client.
|
||||
# SocketPath:/var/run/apt-cacher-ng/socket
|
||||
|
||||
# Forces log file to be written to disk after every line when set to 1. Default
|
||||
# is 0, buffers are flushed when the client disconnects.
|
||||
#
|
||||
# (technically, alias to the Debug option, see its documentation for details)
|
||||
#
|
||||
# UnbufferLogs: 0
|
||||
|
||||
# Set to 0 to store only type, time and transfer sizes.
|
||||
# 1 -> client IP and relative local path are logged too
|
||||
# VerboseLog: 1
|
||||
|
||||
# Don't detach from the console
|
||||
# ForeGround: 0
|
||||
|
||||
# Store the pid of the daemon process therein
|
||||
# PidFile: /var/run/apt-cacher-ng/pid
|
||||
|
||||
# Forbid outgoing connections, work around them or respond with 503 error
|
||||
# offlinemode:0
|
||||
|
||||
# Forbid all downloads that don't run through preconfigured backends (.where)
|
||||
#ForceManaged: 0
|
||||
|
||||
# Days before considering an unreferenced file expired (to be deleted).
|
||||
# Warning: if the value is set too low and particular index files are not
|
||||
# available for some days (mirror downtime) there is a risk of deletion of
|
||||
# still useful package files.
|
||||
ExTreshold: 4
|
||||
|
||||
# Stop expiration when a critical problem appeared. Currently only failed
|
||||
# refresh of an index file is considered as critical.
|
||||
#
|
||||
# WARNING: don't touch this option or set to zero.
|
||||
# Anything else is DANGEROUS and may cause data loss.
|
||||
#
|
||||
# ExAbortOnProblems: 1
|
||||
|
||||
# Replace some Windows/DOS-FS incompatible chars when storing
|
||||
# StupidFs: 0
|
||||
|
||||
# Experimental feature for apt-listbugs: pass-through SOAP requests and
|
||||
# responses to/from bugs.debian.org. If not set, default is true if
|
||||
# ForceManaged is enabled and false otherwise.
|
||||
# ForwardBtsSoap: 1
|
||||
|
||||
# The daemon has a small cache for DNS data, to speed up resolution. The
|
||||
# expiration time of the DNS entries can be configured in seconds.
|
||||
# DnsCacheSeconds: 3600
|
||||
|
||||
# Don't touch the following values without good consideration!
|
||||
#
|
||||
# Max. count of connection threads kept ready (for faster response in the
|
||||
# future). Should be a sane value between 0 and average number of connections,
|
||||
# and depend on the amount of spare RAM.
|
||||
# MaxStandbyConThreads: 8
|
||||
#
|
||||
# Hard limit of active thread count for incoming connections, i.e. operation
|
||||
# is refused when this value is reached (below zero = unlimited).
|
||||
# MaxConThreads: -1
|
||||
#
|
||||
# Pigeonholing files with regular expressions (static/volatile). Can be
|
||||
# overriden here but not should not be done permanently because future update
|
||||
# of default settings would not be applied later.
|
||||
# VfilePattern = (^|.*?/)(Index|Packages(\.gz|\.bz2|\.lzma|\.xz)?|InRelease|Release|Release\.gpg|Sources(\.gz|\.bz2|\.lzma|\.xz)?|release|index\.db-.*\.gz|Contents-[^/]*(\.gz|\.bz2|\.lzma|\.xz)?|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*(\.gz|\.bz2|\.lzma|\.xz)?|MD5SUMS|SHA1SUMS|((setup|setup-legacy)(\.ini|\.bz2|\.hint)(\.sig)?)|mirrors\.lst|repo(index|md)\.xml(\.asc|\.key)?|directory\.yast|products|content(\.asc|\.key)?|media|filelists\.xml\.gz|filelists\.sqlite\.bz2|repomd\.xml|packages\.[a-zA-Z][a-zA-Z]\.gz|info\.txt|license\.tar\.gz|license\.zip|.*\.db(\.tar\.gz)?|.*\.files\.tar\.gz|.*\.abs\.tar\.gz|metalink\?repo|.*prestodelta\.xml\.gz)$|/dists/.*/installer-[^/]+/[^0-9][^/]+/images/.*
|
||||
# PfilePattern = .*(\.d?deb|\.rpm|\.dsc|\.tar(\.gz|\.bz2|\.lzma|\.xz)(\.gpg)?|\.diff(\.gz|\.bz2|\.lzma|\.xz)|\.jigdo|\.template|changelog|copyright|\.udeb|\.debdelta|\.diff/.*\.gz|(Devel)?ReleaseAnnouncement(\?.*)?|[a-f0-9]+-(susedata|updateinfo|primary|deltainfo).xml.gz|fonts/(final/)?[a-z]+32.exe(\?download.*)?|/dists/.*/installer-[^/]+/[0-9][^/]+/images/.*)$
|
||||
# Whitelist for expiration, file types not to be removed even when being
|
||||
# unreferenced. Default: many parts from VfilePattern where no parent index
|
||||
# exists or might be unknown.
|
||||
# WfilePattern = (^|.*?/)(Release|InRelease|Release\.gpg|(Packages|Sources)(\.gz|\.bz2|\.lzma|\.xz)?|Translation[^/]*(\.gz|\.bz2|\.lzma|\.xz)?|MD5SUMS|SHA1SUMS|.*\.xml|.*\.db\.tar\.gz|.*\.files\.tar\.gz|.*\.abs\.tar\.gz|[a-z]+32.exe)$|/dists/.*/installer-.*/images/.*
|
||||
|
||||
# Higher modes only working with the debug version
|
||||
# Warning, writes a lot into apt-cacher.err logfile
|
||||
# Value overwrites UnbufferLogs setting (aliased)
|
||||
# Debug:3
|
||||
|
||||
# Usually, general purpose proxies like Squid expose the IP address of the
|
||||
# client user to the remote server using the X-Forwarded-For HTTP header. This
|
||||
# behaviour can be optionally turned on with the Expose-Origin option.
|
||||
# ExposeOrigin: 0
|
||||
|
||||
# When logging the originating IP address, trust the information supplied by
|
||||
# the client in the X-Forwarded-For header.
|
||||
# LogSubmittedOrigin: 0
|
||||
|
||||
# The version string reported to the peer, to be displayed as HTTP client (and
|
||||
# version) in the logs of the mirror.
|
||||
# WARNING: some archives use this header to detect/guess capabilities of the
|
||||
# client (i.e. redirection support) and change the behaviour accordingly, while
|
||||
# ACNG might not support the expected features. Expect side effects.
|
||||
#
|
||||
# UserAgent: Yet Another HTTP Client/1.2.3p4
|
||||
|
||||
# In some cases the Import and Expiration tasks might create fresh volatile
|
||||
# data for internal use by reconstructing them using patch files. This
|
||||
# by-product might be recompressed with bzip2 and with some luck the resulting
|
||||
# file becomes identical to the *.bz2 file on the server, usable for APT
|
||||
# clients trying to fetch the full .bz2 compressed version. Injection of the
|
||||
# generated files into the cache has however a disadvantage on underpowered
|
||||
# servers: bzip2 compression can create high load on the server system and the
|
||||
# visible download of the busy .bz2 files also becomes slower.
|
||||
#
|
||||
# RecompBz2: 0
|
||||
|
||||
# Network timeout for outgoing connections.
|
||||
# NetworkTimeout: 60
|
||||
|
||||
# Sometimes it makes sense to not store the data in cache and just return the
|
||||
# package data to client as it comes in. DontCache parameters can enable this
|
||||
# behaviour for certain URL types. The tokens are extended regular expressions
|
||||
# that URLs are matched against.
|
||||
#
|
||||
# DontCacheRequested is applied to the URL as it comes in from the client.
|
||||
# Example: exclude packages built with kernel-package for x86
|
||||
# DontCacheRequested: linux-.*_10\...\.Custo._i386
|
||||
# Example usecase: exclude popular private IP ranges from caching
|
||||
# DontCacheRequested: 192.168.0 ^10\..* 172.30
|
||||
#
|
||||
# DontCacheResolved is applied to URLs after mapping to the target server. If
|
||||
# multiple backend servers are specified then it's only matched against the
|
||||
# download link for the FIRST possible source (due to implementation limits).
|
||||
# Example usecase: all Ubuntu stuff comes from a local mirror (specified as
|
||||
# backend), don't cache it again:
|
||||
# DontCacheResolved: ubuntumirror.local.net
|
||||
#
|
||||
# DontCache directive sets (overrides) both, DontCacheResolved and
|
||||
# DontCacheRequested. Provided for convenience, see those directives for
|
||||
# details.
|
||||
#
|
||||
# Default permission set of freshly created files and directories, as octal
|
||||
# numbers (see chmod(1) for details).
|
||||
# Can by limited by the umask value (see umask(2) for details) if it's set in
|
||||
# the environment of the starting shell, e.g. in apt-cacher-ng init script or
|
||||
# in its configuration file.
|
||||
# DirPerms: 00755
|
||||
# FilePerms: 00664
|
||||
#
|
||||
#
|
||||
# It's possible to use use apt-cacher-ng as a regular web server with limited
|
||||
# feature set, i.e.
|
||||
# including directory browsing and download of any file;
|
||||
# excluding sorting, mime types/encodings, CGI execution, index page
|
||||
# redirection and other funny things.
|
||||
# To get this behavior, mappings between virtual directories and real
|
||||
# directories on the server must be defined with the LocalDirs directive.
|
||||
# Virtual and real dirs are separated by spaces, multiple pairs are separated
|
||||
# by semi-colons. Real directories must be absolute paths.
|
||||
# NOTE: Since the names of that key directories share the same namespace as
|
||||
# repository names (see Remap-...) it's administrators job to avoid such
|
||||
# collisions on them (unless created deliberately).
|
||||
#
|
||||
# LocalDirs: woo /data/debarchive/woody ; hamm /data/debarchive/hamm
|
||||
|
||||
# Precache a set of files referenced by specified index files. This can be used
|
||||
# to create a partial mirror usable for offline work. There are certain limits
|
||||
# and restrictions on the path specification, see manual for details. A list of
|
||||
# (maybe) relevant index files could be retrieved via
|
||||
# "apt-get --print-uris update" on a client machine.
|
||||
#
|
||||
# PrecacheFor: debrep/dists/unstable/*/source/Sources* debrep/dists/unstable/*/binary-amd64/Packages*
|
||||
|
||||
# Arbitrary set of data to append to request headers sent over the wire. Should
|
||||
# be a well formated HTTP headers part including newlines (DOS style) which
|
||||
# can be entered as escape sequences (\r\n).
|
||||
# RequestAppendix: X-Tracking-Choice: do-not-track\r\n
|
||||
|
||||
# Specifies the IP protocol families to use for remote connections. Order does
|
||||
# matter, first specified are considered first. Possible combinations:
|
||||
# v6 v4
|
||||
# v4 v6
|
||||
# v6
|
||||
# v4
|
||||
# (empty or not set: use system default)
|
||||
#
|
||||
# ConnectProto: v6 v4
|
||||
|
||||
# Regular expiration algorithm finds package files which are no longer listed
|
||||
# in any index file and removes them of them after a safety period.
|
||||
# This option allows to keep more versions of a package in the cache after
|
||||
# safety period is over.
|
||||
# KeepExtraVersions: 1
|
||||
|
||||
# Optionally uses TCP access control provided by libwrap, see hosts_access(5)
|
||||
# for details. Daemon name is apt-cacher-ng. Default if not set: decided on
|
||||
# startup by looking for explicit mentioning of apt-cacher-ng in
|
||||
# /etc/hosts.allow or /etc/hosts.deny files.
|
||||
# UseWrap: 0
|
||||
|
||||
# If many machines from the same local network attempt to update index files
|
||||
# (apt-get update) at nearly the same time, the known state of these index file
|
||||
# is temporarily frozen and multiple requests receive the cached response
|
||||
# without contacting the server. This parameter (in seconds) specifies the
|
||||
# length of this period before the files are considered outdated.
|
||||
# Setting it too low transfers more data and increases remote server load,
|
||||
# setting it too high (more than a couple of minutes) increases the risk of
|
||||
# delivering inconsistent responses to the clients.
|
||||
# FreshIndexMaxAge: 27
|
||||
|
||||
# Usually the users are not allowed to specify custom TCP ports of remote
|
||||
# mirrors in the requests, only the default HTTP port can be used (instead,
|
||||
# proxy administrator can create Remap- rules with custom ports). This
|
||||
# restriction can be disabled by specifying a list of allowed ports or 0 for
|
||||
# any port.
|
||||
#
|
||||
# AllowUserPorts: 80
|
||||
|
||||
# Normally the HTTP redirection responses are forwarded to the original caller
|
||||
# (i.e. APT) which starts a new download attempt from the new URL. This
|
||||
# solution is ok for client configurations with proxy mode but doesn't work
|
||||
# well with configurations using URL prefixes. To work around this the server
|
||||
# can restart its own download with another URL. However, this might be used to
|
||||
# circumvent download source policies by malicious users.
|
||||
# The RedirMax option specifies how many such redirects the server should
|
||||
# follow per request, 0 disables the internal redirection. If not set,
|
||||
# default value is 0 if ForceManaged is used and 5 otherwise.
|
||||
#
|
||||
# RedirMax: 5
|
|
@ -1,4 +0,0 @@
|
|||
.bundle
|
||||
.cache
|
||||
.kitchen
|
||||
bin
|
|
@ -1,35 +0,0 @@
|
|||
## v1.3.4:
|
||||
|
||||
* [COOK-2272] - Complete `platform_family` conversion in build-essential
|
||||
|
||||
## v1.3.2:
|
||||
|
||||
* [COOK-2069] - build-essential will install osx-gcc-installer when
|
||||
Xcode is present
|
||||
|
||||
## v1.3.0:
|
||||
|
||||
* [COOK-1895] - support smartos
|
||||
|
||||
## v1.2.0:
|
||||
|
||||
* Add test-kitchen support (source repo only)
|
||||
* [COOK-1677] - build-essential cookbook support for OpenSuse and SLES
|
||||
* [COOK-1718] - build-essential cookbook metadata should include scientific
|
||||
* [COOK-1768] - The apt-get update in build-essentials needs to be renamed
|
||||
|
||||
## v1.1.2:
|
||||
|
||||
* [COOK-1620] - support OS X 10.8
|
||||
|
||||
## v1.1.0:
|
||||
|
||||
* [COOK-1098] - support amazon linux
|
||||
* [COOK-1149] - support Mac OS X
|
||||
* [COOK-1296] - allow for compile-time installation of packages
|
||||
through an attribute (see README)
|
||||
|
||||
## v1.0.2:
|
||||
|
||||
* [COOK-1098] - Add Amazon Linux platform support
|
||||
* [COOK-1149] - Add OS X platform support
|
|
@ -1,29 +0,0 @@
|
|||
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.
|
|
@ -1,3 +0,0 @@
|
|||
source :rubygems
|
||||
|
||||
gem 'test-kitchen', '<= 1.0'
|
|
@ -1,201 +0,0 @@
|
|||
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.
|
|
@ -1,131 +0,0 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
Installs packages required for compiling C software from source. Use
|
||||
this cookbook if you wish to compile C programs, or install RubyGems
|
||||
with native extensions.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
Chef version 0.10.10+ and Ohai 0.6.12+ are required.
|
||||
|
||||
## Platform
|
||||
|
||||
Supported platforms by platform family:
|
||||
|
||||
* Linux (fedora redhat centos ubuntu debian amazon scientific)
|
||||
* Darwin (`mac_os_x` 10.6+)
|
||||
* SmartOs
|
||||
|
||||
## Cookbooks
|
||||
|
||||
Requires `pkgin` cookbook on SmartOS
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
* `node['build_essential']['compiletime']` - Whether the resources in
|
||||
the default recipe should be configured at the "Compile" phase of the
|
||||
Chef run. Defaults to false, see __Usage__ for more information.
|
||||
* `node['build_essential']['osx']['gcc_installer_url']` - The URL of
|
||||
the OS X GCC package installer (.pkg).
|
||||
* `node['build_essential']['osx']['gcc_installer_checksum']` - The
|
||||
SHA256 checksum of the OS X GCC installer.
|
||||
|
||||
Recipes
|
||||
=======
|
||||
|
||||
This cookbook has one recipe, default.
|
||||
|
||||
On Linux platforms (see __Platform__ above for a supported list of
|
||||
families), packages required to build C source projects are installed.
|
||||
This includes GCC, make, autconf and others. On Debian-family
|
||||
distributions, the apt-cache may need to be updated, especially during
|
||||
compile time installation. See __Usage__ for further information.
|
||||
|
||||
On Mac OS X, the GCC standalone installer by Kenneth Reitz is
|
||||
installed. Note that this is *not* the Xcode CLI package, as that does
|
||||
not include all programs and headers required to build some common
|
||||
GNU-style C projects, such as those that are available from projects
|
||||
such as MacPorts or Homebrew. Changing the attributes for the GCC
|
||||
installer URL and checksum to the Xcode values may work, but this is
|
||||
untested.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Simply include the `build-essential` and the required tools will be
|
||||
installed to the system, and later recipes will be able to compile
|
||||
software from C source code.
|
||||
|
||||
For RubyGems that include native C extensions you wish to use with
|
||||
Chef, you should do two things.
|
||||
|
||||
0. Ensure that the C libraries, include files and other assorted "dev"
|
||||
type packages are installed. You should do this in the compile phase
|
||||
after the build-essential recipe.
|
||||
1. Use the `chef_gem` resource in your recipes. This requires Chef version 0.10.10+.
|
||||
2. Set the `compiletime` attribute in roles where such recipes are
|
||||
required. This will ensure that the build tools are available to
|
||||
compile the RubyGems' extensions, as `chef_gem` happens during the
|
||||
compile phase, too.
|
||||
|
||||
Example installation of a devel package at compile-time in a recipe:
|
||||
|
||||
package "mypackage-dev" do
|
||||
action :nothing
|
||||
end.run_action(:install)
|
||||
|
||||
Example use of `chef_gem`:
|
||||
|
||||
chef_gem "mygem"
|
||||
|
||||
Example role:
|
||||
|
||||
name "myapp"
|
||||
run_list(
|
||||
"recipe[build-essential]",
|
||||
"recipe[myapp]"
|
||||
)
|
||||
default_attributes(
|
||||
"build_essential" => {
|
||||
"compiletime" => true
|
||||
}
|
||||
)
|
||||
|
||||
The compile time option (via the attribute) is to ensure that the
|
||||
proper packages are available at the right time in the Chef run. It is
|
||||
recommended that the build-essential recipe appear early in the run
|
||||
list.
|
||||
|
||||
The Chef wiki has documentation on
|
||||
[the anatomy of a chef run](http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run).
|
||||
|
||||
Limitations
|
||||
===========
|
||||
|
||||
It is not in the scope of this cookbook to handle installing the
|
||||
required headers for individual software projects in order to compile
|
||||
them, or to compile RubyGems with native C extensions. You should
|
||||
create a cookbook for handling that.
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
|
||||
Copyright 2009-2011, Opscode, Inc. (<legal@opscode.com>)
|
||||
|
||||
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.
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: build-essential
|
||||
# Attributes:: default
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
default['build_essential']['compiletime'] = false
|
||||
|
||||
case node['platform_family']
|
||||
when "mac_os_x"
|
||||
case
|
||||
when Chef::VersionConstraint.new("~> 10.7.0").include?(node['platform_version']),
|
||||
Chef::VersionConstraint.new("~> 10.8.0").include?(node['platform_version'])
|
||||
default['build_essential']['osx']['gcc_installer_url'] = "https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg"
|
||||
default['build_essential']['osx']['gcc_installer_checksum'] = "df36aa87606feb99d0db9ac9a492819e"
|
||||
when Chef::VersionConstraint.new("~> 10.6.0").include?(node['platform_version'])
|
||||
default['build_essential']['osx']['gcc_installer_url'] = "https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.6.pkg"
|
||||
default['build_essential']['osx']['gcc_installer_checksum'] = "d1db5bab6a3f6b9f3b5577a130baeefa"
|
||||
end
|
||||
end
|
|
@ -1,43 +0,0 @@
|
|||
{
|
||||
"name": "build-essential",
|
||||
"description": "Installs C compiler / build tools",
|
||||
"long_description": "",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"fedora": ">= 0.0.0",
|
||||
"redhat": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0",
|
||||
"debian": ">= 0.0.0",
|
||||
"amazon": ">= 0.0.0",
|
||||
"suse": ">= 0.0.0",
|
||||
"scientific": ">= 0.0.0",
|
||||
"oracle": ">= 0.0.0",
|
||||
"smartos": ">= 0.0.0",
|
||||
"mac_os_x": ">= 10.6.0",
|
||||
"mac_os_x_server": ">= 10.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
"pkgin": ">= 0.0.0"
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
"build-essential": "Installs packages required for compiling C software from source."
|
||||
},
|
||||
"version": "1.3.4"
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
name "build-essential"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs C compiler / build tools"
|
||||
version "1.3.4"
|
||||
recipe "build-essential", "Installs packages required for compiling C software from source."
|
||||
|
||||
%w{ fedora redhat centos ubuntu debian amazon suse scientific oracle smartos}.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
supports "mac_os_x", ">= 10.6.0"
|
||||
supports "mac_os_x_server", ">= 10.6.0"
|
||||
suggests "pkgin"
|
|
@ -1,92 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: build-essential
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2008-2009, 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.
|
||||
#
|
||||
|
||||
require 'chef/shell_out'
|
||||
|
||||
compiletime = node['build_essential']['compiletime']
|
||||
|
||||
case node['platform_family']
|
||||
when "rhel", "suse", "fedora", "debian"
|
||||
|
||||
# on apt-based platforms when first provisioning we need to force
|
||||
# apt-get update at compiletime if we are going to try to install at compiletime
|
||||
if node['platform_family'] == "debian"
|
||||
execute "apt-get-update-build-essentials" do
|
||||
command "apt-get update"
|
||||
action :nothing
|
||||
# tip: to suppress this running every time, just use the apt cookbook
|
||||
not_if do
|
||||
::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
|
||||
::File.mtime('/var/lib/apt/periodic/update-success-stamp') > Time.now - 86400*2
|
||||
end
|
||||
end.run_action(:run) if compiletime
|
||||
end
|
||||
|
||||
packages = case node['platform_family']
|
||||
when "debian"
|
||||
%w{build-essential binutils-doc}
|
||||
when "rhel", "fedora"
|
||||
%w{gcc gcc-c++ kernel-devel make}
|
||||
when "suse"
|
||||
%w{gcc gcc-c++ kernel-default-devel make m4} # in SLES there is no kernel-devel
|
||||
end
|
||||
|
||||
packages.each do |pkg|
|
||||
r = package pkg do
|
||||
action ( compiletime ? :nothing : :install )
|
||||
end
|
||||
r.run_action(:install) if compiletime
|
||||
end
|
||||
|
||||
%w{autoconf flex bison}.each do |pkg|
|
||||
r = package pkg do
|
||||
action ( compiletime ? :nothing : :install )
|
||||
end
|
||||
r.run_action(:install) if compiletime
|
||||
end
|
||||
|
||||
when "smartos"
|
||||
include_recipe 'pkgin'
|
||||
%w{gcc47 gcc47-runtime scmgit-base gmake pkg-config binutils}.each do |package|
|
||||
pkgin_package package do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
|
||||
when "mac_os_x"
|
||||
result = Chef::ShellOut.new("pkgutil --pkgs").run_command
|
||||
osx_gcc_installer_installed = result.stdout.split("\n").include?("com.apple.pkg.gcc4.2Leo")
|
||||
developer_tools_cli_installed = result.stdout.split("\n").include?("com.apple.pkg.DeveloperToolsCLI")
|
||||
pkg_filename = File.basename(node['build_essential']['osx']['gcc_installer_url'])
|
||||
pkg_path = "#{Chef::Config[:file_cache_path]}/#{pkg_filename}"
|
||||
|
||||
r = remote_file pkg_path do
|
||||
source node['build_essential']['osx']['gcc_installer_url']
|
||||
checksum node['build_essential']['osx']['gcc_installer_checksum']
|
||||
action ( compiletime ? :nothing : :create )
|
||||
not_if { osx_gcc_installer_installed or developer_tools_cli_installed }
|
||||
end
|
||||
r.run_action(:create) if compiletime
|
||||
|
||||
r = execute "sudo installer -pkg \"#{pkg_path}\" -target /" do
|
||||
action ( compiletime ? :nothing : :run )
|
||||
not_if { osx_gcc_installer_installed or developer_tools_cli_installed }
|
||||
end
|
||||
r.run_action(:run) if compiletime
|
||||
end
|
|
@ -1,28 +0,0 @@
|
|||
## v1.1.4:
|
||||
|
||||
* [COOK-2146] - style updates
|
||||
|
||||
## v1.1.2:
|
||||
|
||||
* [COOK-1989] - fix scope for handler local variable to the enable block
|
||||
|
||||
## v1.1.0:
|
||||
|
||||
* [COOK-1645] - properly delete old handlers
|
||||
* [COOK-1322] - support platforms that use 'wheel' as root group'
|
||||
|
||||
## v1.0.8:
|
||||
|
||||
* [COOK-1177] - doesn't work on windows due to use of unix specific attributes
|
||||
## v1.0.6:
|
||||
|
||||
* [COOK-1069] - typo in chef_handler readme
|
||||
|
||||
## v1.0.4:
|
||||
|
||||
* [COOK-654] dont try and access a class before it has been loaded
|
||||
* fix bad boolean check (if vs unless)
|
||||
|
||||
## v1.0.2:
|
||||
|
||||
* [COOK-620] ensure handler code is reloaded during daemonized chef runs
|
|
@ -1,29 +0,0 @@
|
|||
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.
|
|
@ -1,201 +0,0 @@
|
|||
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.
|
|
@ -1,103 +0,0 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
Creates a configured handler path for distributing [Chef report and exception handlers](http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers). Also exposes an LWRP for enabling Chef handlers from within recipe code (as opposed to hard coding in the client.rb file). This is useful for cookbook authors who may want to ship a product specific handler (see the `cloudkick` cookbook for an example) with their cookbook.
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
`node["chef_handler"]["handler_path"]` - location to drop off handlers directory, default is `/var/chef/handlers`.
|
||||
|
||||
Resource/Provider
|
||||
=================
|
||||
|
||||
`chef_handler`
|
||||
--------------
|
||||
|
||||
Requires, configures and enables handlers on the node for the current Chef run. Also has the ability to pass arguments to the handlers initializer. This allows initialization data to be pulled from a node's attribute data.
|
||||
|
||||
It is best to declare `chef_handler` resources early on in the compile phase so they are available to fire for any exceptions during the Chef run. If you have a base role you would want any recipes that register Chef handlers to come first in the run_list.
|
||||
|
||||
### Actions
|
||||
|
||||
- :enable: Enables the Chef handler for the current Chef run on the current node
|
||||
- :disable: Disables the Chef handler for the current Chef run on the current node
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- class_name: name attribute. The name of the handler class (can be module name-spaced).
|
||||
- source: full path to the handler file. can also be a gem path if the handler ships as part of a Ruby gem.
|
||||
- arguments: an array of arguments to pass the handler's class initializer
|
||||
- supports: type of Chef Handler to register as, ie :report, :exception or both. default is `:report => true, :exception => true`
|
||||
|
||||
### Example
|
||||
|
||||
# register the Chef::Handler::JsonFile handler
|
||||
# that ships with the Chef gem
|
||||
chef_handler "Chef::Handler::JsonFile" do
|
||||
source "chef/handler/json_file"
|
||||
arguments :path => '/var/chef/reports'
|
||||
action :enable
|
||||
end
|
||||
|
||||
# do the same but during the compile phase
|
||||
chef_handler "Chef::Handler::JsonFile" do
|
||||
source "chef/handler/json_file"
|
||||
arguments :path => '/var/chef/reports'
|
||||
action :nothing
|
||||
end.run_action(:enable)
|
||||
|
||||
# handle exceptions only
|
||||
chef_handler "Chef::Handler::JsonFile" do
|
||||
source "chef/handler/json_file"
|
||||
arguments :path => '/var/chef/reports'
|
||||
supports :exception => true
|
||||
action :enable
|
||||
end
|
||||
|
||||
|
||||
# enable the CloudkickHandler which was
|
||||
# dropped off in the default handler path.
|
||||
# passes the oauth key/secret to the handler's
|
||||
# intializer.
|
||||
chef_handler "CloudkickHandler" do
|
||||
source "#{node['chef_handler']['handler_path']}/cloudkick_handler.rb"
|
||||
arguments [node['cloudkick']['oauth_key'], node['cloudkick']['oauth_secret']]
|
||||
action :enable
|
||||
end
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
default
|
||||
-------
|
||||
|
||||
Put the recipe `chef_handler` at the start of the node's run list to make sure that custom handlers are dropped off early on in the Chef run and available for later recipes.
|
||||
|
||||
For information on how to write report and exception handlers for Chef, please see the Chef wiki pages:
|
||||
http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers
|
||||
|
||||
json_file
|
||||
---------
|
||||
|
||||
Leverages the `chef_handler` LWRP to automatically register the `Chef::Handler::JsonFile` handler that ships as part of Chef. This handler serializes the run status data to a JSON file located at `/var/chef/reports`.
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
|
||||
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.
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Cookbook Name:: chef_handlers
|
||||
# Attribute:: default
|
||||
#
|
||||
# Copyright 2011-2013, 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.
|
||||
#
|
||||
|
||||
default["chef_handler"]["root_user"] = "root"
|
||||
|
||||
case platform
|
||||
when "openbsd", "freebsd", "mac_os_x", "mac_os_x_server"
|
||||
default["chef_handler"]["root_group"] = "wheel"
|
||||
else
|
||||
default["chef_handler"]["root_group"] = "root"
|
||||
end
|
||||
|
||||
default["chef_handler"]["handler_path"] = "#{File.expand_path(File.join(Chef::Config[:file_cache_path], '..'))}/handlers"
|
|
@ -1 +0,0 @@
|
|||
This directory contains Chef handlers to distribute to your nodes.
|
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
"name": "chef_handler",
|
||||
"description": "Distribute and enable Chef Exception and Report handlers",
|
||||
"long_description": "Description\n===========\n\nCreates a configured handler path for distributing [Chef report and exception handlers](http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers). Also exposes an LWRP for enabling Chef handlers from within recipe code (as opposed to hard coding in the client.rb file). This is useful for cookbook authors who may want to ship a product specific handler (see the `cloudkick` cookbook for an example) with their cookbook.\n\nAttributes\n==========\n\n`node[\"chef_handler\"][\"handler_path\"]` - location to drop off handlers directory, default is `/var/chef/handlers`.\n\nResource/Provider\n=================\n\n`chef_handler`\n--------------\n\nRequires, configures and enables handlers on the node for the current Chef run. Also has the ability to pass arguments to the handlers initializer. This allows initialization data to be pulled from a node's attribute data.\n\nIt is best to declare `chef_handler` resources early on in the compile phase so they are available to fire for any exceptions during the Chef run. If you have a base role you would want any recipes that register Chef handlers to come first in the run_list.\n\n### Actions\n\n- :enable: Enables the Chef handler for the current Chef run on the current node\n- :disable: Disables the Chef handler for the current Chef run on the current node\n\n### Attribute Parameters\n\n- class_name: name attribute. The name of the handler class (can be module name-spaced).\n- source: full path to the handler file. can also be a gem path if the handler ships as part of a Ruby gem.\n- arguments: an array of arguments to pass the handler's class initializer\n- supports: type of Chef Handler to register as, ie :report, :exception or both. default is `:report => true, :exception => true`\n\n### Example\n\n # register the Chef::Handler::JsonFile handler\n # that ships with the Chef gem\n chef_handler \"Chef::Handler::JsonFile\" do\n source \"chef/handler/json_file\"\n arguments :path => '/var/chef/reports'\n action :enable\n end\n\n # do the same but during the compile phase\n chef_handler \"Chef::Handler::JsonFile\" do\n source \"chef/handler/json_file\"\n arguments :path => '/var/chef/reports'\n action :nothing\n end.run_action(:enable)\n\n # handle exceptions only\n chef_handler \"Chef::Handler::JsonFile\" do\n source \"chef/handler/json_file\"\n arguments :path => '/var/chef/reports'\n supports :exception => true\n action :enable\n end\n\n\n # enable the CloudkickHandler which was\n # dropped off in the default handler path.\n # passes the oauth key/secret to the handler's\n # intializer.\n chef_handler \"CloudkickHandler\" do\n source \"#{node['chef_handler']['handler_path']}/cloudkick_handler.rb\"\n arguments [node['cloudkick']['oauth_key'], node['cloudkick']['oauth_secret']]\n action :enable\n end\n\n\nUsage\n=====\n\ndefault\n-------\n\nPut the recipe `chef_handler` at the start of the node's run list to make sure that custom handlers are dropped off early on in the Chef run and available for later recipes.\n\nFor information on how to write report and exception handlers for Chef, please see the Chef wiki pages:\nhttp://wiki.opscode.com/display/chef/Exception+and+Report+Handlers\n\njson_file\n---------\n\nLeverages the `chef_handler` LWRP to automatically register the `Chef::Handler::JsonFile` handler that ships as part of Chef. This handler serializes the run status data to a JSON file located at `/var/chef/reports`.\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore (<schisamo@opscode.com>)\n\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": {
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
},
|
||||
"version": "1.1.4"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
name "chef_handler"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Distribute and enable Chef Exception and Report handlers"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "1.1.4"
|
|
@ -1,93 +0,0 @@
|
|||
#
|
||||
# Author:: Seth Chisamore <schisamo@opscode.com>
|
||||
# Cookbook Name:: chef_handler
|
||||
# Provider:: default
|
||||
#
|
||||
# Copyright:: 2011-2013, Opscode, Inc <legal@opscode.com>
|
||||
#
|
||||
# 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 whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :enable do
|
||||
# use load instead of require to ensure the handler file
|
||||
# is reloaded into memory each chef run. fixes COOK-620
|
||||
handler = nil
|
||||
converge_by("load #{@new_resource.source}") do
|
||||
begin
|
||||
Object.send(:remove_const, klass)
|
||||
GC.start
|
||||
rescue
|
||||
Chef::Log.debug("#{@new_resource.class_name} has not been loaded.")
|
||||
end
|
||||
file_name = @new_resource.source
|
||||
file_name << ".rb" unless file_name =~ /.*\.rb$/
|
||||
load file_name
|
||||
handler = klass.send(:new, *collect_args(@new_resource.arguments))
|
||||
end
|
||||
@new_resource.supports.each do |type, enable|
|
||||
if enable
|
||||
# we have to re-enable the handler every chef run
|
||||
# to ensure daemonized Chef always has the latest
|
||||
# handler code. TODO: add a :reload action
|
||||
converge_by("enable #{@new_resource} as a #{type} handler") do
|
||||
Chef::Log.info("Enabling #{@new_resource} as a #{type} handler")
|
||||
Chef::Config.send("#{type}_handlers").delete_if { |v| v.class.to_s.include? @new_resource.class_name.split('::', 3).last }
|
||||
Chef::Config.send("#{type}_handlers") << handler
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :disable do
|
||||
@new_resource.supports.each_key do |type|
|
||||
if enabled?(type)
|
||||
converge_by("disable #{@new_resource} as a #{type} handler") do
|
||||
Chef::Log.info("Disabling #{@new_resource} as a #{type} handler")
|
||||
Chef::Config.send("#{type}_handlers").delete_if { |v| v.class.to_s.include? @new_resource.class_name.split('::', 3).last }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::ChefHandler.new(@new_resource.name)
|
||||
@current_resource.class_name(@new_resource.class_name)
|
||||
@current_resource.source(@new_resource.source)
|
||||
@current_resource
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def enabled?(type)
|
||||
Chef::Config.send("#{type}_handlers").select do |handler|
|
||||
handler.class.to_s.include? @new_resource.class_name
|
||||
end.size >= 1
|
||||
end
|
||||
|
||||
def collect_args(resource_args = [])
|
||||
if resource_args.is_a? Array
|
||||
resource_args
|
||||
else
|
||||
[resource_args]
|
||||
end
|
||||
end
|
||||
|
||||
def klass
|
||||
@klass ||= begin
|
||||
@new_resource.class_name.split('::').inject(Kernel) { |scope, const_name| scope.const_get(const_name) }
|
||||
end
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Cookbook Name:: chef_handlers
|
||||
# Recipe:: default
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
Chef::Log.info("Chef Handlers will be at: #{node['chef_handler']['handler_path']}")
|
||||
|
||||
remote_directory node['chef_handler']['handler_path'] do
|
||||
source 'handlers'
|
||||
# Just inherit permissions on Windows, don't try to set POSIX perms
|
||||
if node["platform"] != "windows"
|
||||
owner node['chef_handler']['root_user']
|
||||
group node['chef_handler']['root_group']
|
||||
mode "0755"
|
||||
recursive true
|
||||
end
|
||||
action :nothing
|
||||
end.run_action(:create)
|
|
@ -1,28 +0,0 @@
|
|||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Cookbook Name:: chef_handlers
|
||||
# Recipe:: json_file
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# force resource actions in compile phase so exception handler
|
||||
# fires for compile phase exceptions
|
||||
|
||||
chef_handler "Chef::Handler::JsonFile" do
|
||||
source "chef/handler/json_file"
|
||||
arguments :path => '/var/chef/reports'
|
||||
action :nothing
|
||||
end.run_action(:enable)
|
|
@ -1,34 +0,0 @@
|
|||
#
|
||||
# Author:: Seth Chisamore <schisamo@opscode.com>
|
||||
# Cookbook Name:: chef_handler
|
||||
# Resource:: default
|
||||
#
|
||||
# Copyright:: 2011-2013, Opscode, Inc <legal@opscode.com>
|
||||
#
|
||||
# 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 :enable, :disable
|
||||
|
||||
attribute :class_name, :kind_of => String, :name_attribute => true
|
||||
attribute :source, :default => nil, :kind_of => String
|
||||
attribute :arguments, :default => []
|
||||
attribute :supports, :kind_of => Hash, :default => { :report => true, :exception => true }
|
||||
|
||||
# we have to set default for the supports attribute
|
||||
# in initializer since it is a 'reserved' attribute name
|
||||
def initialize(*args)
|
||||
super
|
||||
@action = :enable
|
||||
@supports = { :report => true, :exception => true }
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
# execute "upgrade-rvm" do
|
||||
# command "gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3"
|
||||
# command "rvm get stable && rvm reload"
|
||||
# action :nothing
|
||||
# end
|
||||
#
|
||||
# execute "upgrade-ruby" do
|
||||
# command "yes | rvm install ruby-2.1.5 --verify-downloads 1"
|
||||
# action :nothing
|
||||
# end
|
||||
#
|
||||
# execute "set-ruby" do
|
||||
# command "rvm use ruby-2.1.5"
|
||||
# user "vagrant"
|
||||
# action :nothing
|
||||
# end
|
||||
#
|
||||
# ruby_block "ruby-upgrade-message" do
|
||||
# block do
|
||||
# Chef::Log.info "Upgrading ruby. This will take a while."
|
||||
# end
|
||||
# notifies :run, "execute[upgrade-rvm]", :immediately
|
||||
# notifies :run, "execute[upgrade-ruby]", :immediately
|
||||
# notifies :run, "execute[set-ruby]", :immediately
|
||||
# action :create
|
||||
# end
|
|
@ -1,11 +0,0 @@
|
|||
Imagemagick CHANGELOG
|
||||
=====================
|
||||
|
||||
v0.2.3 (2014-02-25)
|
||||
-------------------
|
||||
[COOK-3748] - Add support for Amazon Linux & Mac OS X
|
||||
|
||||
|
||||
v0.2.2
|
||||
----------
|
||||
- Fixes COOK-662
|
|
@ -1,50 +0,0 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
Installs ImageMagick and optionally Rmagick (RubyGem).
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
## Platform:
|
||||
|
||||
Tested on:
|
||||
|
||||
* Ubuntu (10.04)
|
||||
* RHEL (6.1, 5.7)
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To install just ImageMagick,
|
||||
|
||||
include_recipe "imagemagick"
|
||||
|
||||
In your own recipe/cookbook. To install the development libraries,
|
||||
|
||||
include_recipe "imagemagick::devel"
|
||||
|
||||
To install the RubyGem rmagick,
|
||||
|
||||
include_recipe "imagemagick::rmagick"
|
||||
|
||||
Which will install imagemagick, as well as the development libraries for imagemagick (so rmagick can be built).
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
|
||||
Copyright:: 2009, 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.
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"name": "imagemagick",
|
||||
"version": "0.2.3",
|
||||
"description": "Installs/Configures imagemagick",
|
||||
"long_description": "Description\n===========\n\nInstalls ImageMagick and optionally Rmagick (RubyGem).\n\nRequirements\n============\n\n## Platform:\n\nTested on:\n\n* Ubuntu (10.04)\n* RHEL (6.1, 5.7)\n\nUsage\n=====\n\nTo install just ImageMagick,\n\n include_recipe \"imagemagick\"\n\nIn your own recipe/cookbook. To install the development libraries,\n\n include_recipe \"imagemagick::devel\"\n\nTo install the RubyGem rmagick,\n\n include_recipe \"imagemagick::rmagick\"\n\nWhich will install imagemagick, as well as the development libraries for imagemagick (so rmagick can be built).\n\nLicense and Author\n==================\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, 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": {
|
||||
"fedora": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"rhel": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0",
|
||||
"debian": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
"imagemagick": "Installs imagemagick package",
|
||||
"imagemagick::devel": "Installs imagemagick development libraries",
|
||||
"imagemagick::rmagick": "Installs rmagick gem"
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
name "imagemagick"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs/Configures imagemagick"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "0.2.3"
|
||||
|
||||
recipe "imagemagick", "Installs imagemagick package"
|
||||
recipe "imagemagick::devel", "Installs imagemagick development libraries"
|
||||
recipe "imagemagick::rmagick", "Installs rmagick gem"
|
||||
|
||||
%w{fedora centos rhel ubuntu debian}.each do |os|
|
||||
supports os
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: imagemagick
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2009, 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.
|
||||
#
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel'
|
||||
package 'ImageMagick'
|
||||
when 'debian', 'mac_os_x'
|
||||
package 'imagemagick'
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: imagemagick
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2009, 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.
|
||||
#
|
||||
|
||||
include_recipe "imagemagick"
|
||||
|
||||
dev_pkg = value_for_platform(
|
||||
["redhat", "centos", "fedora", "amazon"] => { "default" => "ImageMagick-devel" },
|
||||
"debian" => { "default" => "libmagickwand-dev" },
|
||||
"ubuntu" => {
|
||||
"8.04" => "libmagick9-dev",
|
||||
"8.10" => "libmagick9-dev",
|
||||
"default" => "libmagickwand-dev"
|
||||
}
|
||||
)
|
||||
|
||||
package dev_pkg
|
|
@ -1,22 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: imagemagick
|
||||
# Recipe:: rmagick
|
||||
#
|
||||
# Copyright 2009, 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.
|
||||
#
|
||||
include_recipe "imagemagick"
|
||||
include_recipe "imagemagick::devel"
|
||||
|
||||
gem_package "rmagick"
|
|
@ -1,7 +0,0 @@
|
|||
.bundle
|
||||
.cache
|
||||
.kitchen
|
||||
bin
|
||||
#*#
|
||||
*~
|
||||
.#*#
|
|
@ -1,92 +0,0 @@
|
|||
## v1.10.0:
|
||||
|
||||
* [COOK-2400] - Allow java ark :url to be https
|
||||
* [COOK-2436] - Upgrade needed for oracle jdk in java cookbook
|
||||
|
||||
## v1.9.6:
|
||||
|
||||
* [COOK-2412] - add support for Oracle Linux
|
||||
|
||||
## v1.9.4:
|
||||
|
||||
* [COOK-2083] - Run set-env-java-home in Java cookbook only if necessary
|
||||
* [COOK-2332] - ark provider does not allow for *.tgz tarballs to be used
|
||||
* [COOK-2345] - Java cookbook fails on CentOS6 (update-java-alternatives)
|
||||
|
||||
## v1.9.2:
|
||||
|
||||
* [COOK-2306] - FoodCritic fixes for java cookbook
|
||||
|
||||
## v1.9.0:
|
||||
|
||||
* [COOK-2236] - Update the Oracle Java version in the Java cookbook to
|
||||
release 1.7u11
|
||||
|
||||
## v1.8.2:
|
||||
|
||||
* [COOK-2205] - Fix for missing /usr/lib/jvm/default-java on Debian
|
||||
|
||||
## v1.8.0:
|
||||
|
||||
* [COOK-2095] - Add windows support
|
||||
|
||||
## v1.7.0:
|
||||
|
||||
* [COOK-2001] - improvements for Oracle update-alternatives
|
||||
- When installing an Oracle JDK it is now registered with a higher
|
||||
priority than OpenJDK. (Related to COOK-1131.)
|
||||
- When running both the oracle and oracle_i386 recipes, alternatives
|
||||
are now created for both JDKs.
|
||||
- Alternatives are now created for all binaries listed in version
|
||||
specific attributes. (Related to COOK-1563 and COOK-1635.)
|
||||
- When installing Oracke JDKs on Ubuntu, create .jinfo files for use
|
||||
with update-java-alternatives. Commands to set/install
|
||||
alternatives now only run if needed.
|
||||
|
||||
## v1.6.4:
|
||||
|
||||
* [COOK-1930] - fixed typo in attribute for java 5 on i586
|
||||
|
||||
## v1.6.2:
|
||||
|
||||
* whyrun support in `java_ark` LWRP
|
||||
* CHEF-1804 compatibility
|
||||
* [COOK-1786]- install Java 6u37 and Java 7u9
|
||||
* [COOK-1819] -incorrect warning text about
|
||||
`node['java']['oracle']['accept_oracle_download_terms']`
|
||||
|
||||
## v1.6.0:
|
||||
|
||||
* [COOK-1218] - Install Oracle JDK from Oracle download directly
|
||||
* [COOK-1631] - set JAVA_HOME in openjdk recipe
|
||||
* [COOK-1655] - Install correct architecture on Amazon Linux
|
||||
|
||||
## v1.5.4:
|
||||
|
||||
* [COOK-885] - update alternatives called on wrong file
|
||||
* [COOK-1607] - use shellout instead of execute resource to update
|
||||
alternatives
|
||||
|
||||
## v1.5.2:
|
||||
|
||||
* [COOK-1200] - remove sun-java6-jre on Ubuntu before installing
|
||||
Oracle's Java
|
||||
* [COOK-1260] - fails on Ubuntu 12.04 64bit with openjdk7
|
||||
* [COOK-1265] - Oracle Java should symlink the jar command
|
||||
|
||||
## 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
|
|
@ -1,257 +0,0 @@
|
|||
# Contributing to Opscode Cookbooks
|
||||
|
||||
We are glad you want to contribute to Opscode Cookbooks! The first
|
||||
step is the desire to improve the project.
|
||||
|
||||
You can find the answers to additional frequently asked questions
|
||||
[on the wiki](http://wiki.opscode.com/display/chef/How+to+Contribute).
|
||||
|
||||
You can find additional information about
|
||||
[contributing to cookbooks](http://wiki.opscode.com/display/chef/How+to+Contribute+to+Opscode+Cookbooks)
|
||||
on the wiki as well.
|
||||
|
||||
## Quick-contribute
|
||||
|
||||
* Create an account on our [bug tracker](http://tickets.opscode.com)
|
||||
* Sign our contributor agreement (CLA)
|
||||
[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L)
|
||||
(keep reading if you're contributing on behalf of your employer)
|
||||
* Create a ticket for your change on the
|
||||
[bug tracker](http://tickets.opscode.com)
|
||||
* Link to your patch as a rebased git branch or pull request from the
|
||||
ticket
|
||||
* Resolve the ticket as fixed
|
||||
|
||||
We regularly review contributions and will get back to you if we have
|
||||
any suggestions or concerns.
|
||||
|
||||
## The Apache License and the CLA/CCLA
|
||||
|
||||
Licensing is very important to open source projects, it helps ensure
|
||||
the software continues to be available under the terms that the author
|
||||
desired. Chef uses the Apache 2.0 license to strike a balance between
|
||||
open contribution and allowing you to use the software however you
|
||||
would like to.
|
||||
|
||||
The license tells you what rights you have that are provided by the
|
||||
copyright holder. It is important that the contributor fully
|
||||
understands what rights they are licensing and agrees to them.
|
||||
Sometimes the copyright holder isn't the contributor, most often when
|
||||
the contributor is doing work for a company.
|
||||
|
||||
To make a good faith effort to ensure these criteria are met, Opscode
|
||||
requires a Contributor License Agreement (CLA) or a Corporate
|
||||
Contributor License Agreement (CCLA) for all contributions. This is
|
||||
without exception due to some matters not being related to copyright
|
||||
and to avoid having to continually check with our lawyers about small
|
||||
patches.
|
||||
|
||||
It only takes a few minutes to complete a CLA, and you retain the
|
||||
copyright to your contribution.
|
||||
|
||||
You can complete our contributor agreement (CLA)
|
||||
[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L).
|
||||
If you're contributing on behalf of your employer, have your employer
|
||||
fill out our
|
||||
[Corporate CLA](https://secure.echosign.com/public/hostedForm?formid=PIE6C7AX856)
|
||||
instead.
|
||||
|
||||
## Ticket Tracker (JIRA)
|
||||
|
||||
The [ticket tracker](http://tickets.opscode.com) is the most important
|
||||
documentation for the code base. It provides significant historical
|
||||
information, such as:
|
||||
|
||||
* Which release a bug fix is included in
|
||||
* Discussion regarding the design and merits of features
|
||||
* Error output to aid in finding similar bugs
|
||||
|
||||
Each ticket should aim to fix one bug or add one feature.
|
||||
|
||||
## Using git
|
||||
|
||||
You can get a quick copy of the repository for this cookbook by
|
||||
running `git clone
|
||||
git://github.com/opscode-coobkooks/COOKBOOKNAME.git`.
|
||||
|
||||
For collaboration purposes, it is best if you create a Github account
|
||||
and fork the repository to your own account. Once you do this you will
|
||||
be able to push your changes to your Github repository for others to
|
||||
see and use.
|
||||
|
||||
If you have another repository in your GitHub account named the same
|
||||
as the cookbook, we suggest you suffix the repository with -cookbook.
|
||||
|
||||
### Branches and Commits
|
||||
|
||||
You should submit your patch as a git branch named after the ticket,
|
||||
such as COOK-1337. This is called a _topic branch_ and allows users to
|
||||
associate a branch of code with the ticket.
|
||||
|
||||
It is a best practice to have your commit message have a _summary
|
||||
line_ that includes the ticket number, followed by an empty line and
|
||||
then a brief description of the commit. This also helps other
|
||||
contributors understand the purpose of changes to the code.
|
||||
|
||||
[COOK-1757] - platform_family and style
|
||||
|
||||
* use platform_family for platform checking
|
||||
* update notifies syntax to "resource_type[resource_name]" instead of
|
||||
resources() lookup
|
||||
* COOK-692 - delete config files dropped off by packages in conf.d
|
||||
* dropped debian 4 support because all other platforms have the same
|
||||
values, and it is older than "old stable" debian release
|
||||
|
||||
Remember that not all users use Chef in the same way or on the same
|
||||
operating systems as you, so it is helpful to be clear about your use
|
||||
case and change so they can understand it even when it doesn't apply
|
||||
to them.
|
||||
|
||||
### Github and Pull Requests
|
||||
|
||||
All of Opscode's open source cookbook projects are available on
|
||||
[Github](http://www.github.com/opscode-cookbooks).
|
||||
|
||||
We don't require you to use Github, and we will even take patch diffs
|
||||
attached to tickets on the tracker. However Github has a lot of
|
||||
convenient features, such as being able to see a diff of changes
|
||||
between a pull request and the main repository quickly without
|
||||
downloading the branch.
|
||||
|
||||
If you do choose to use a pull request, please provide a link to the
|
||||
pull request from the ticket __and__ a link to the ticket from the
|
||||
pull request. Because pull requests only have two states, open and
|
||||
closed, we can't easily filter pull requests that are waiting for a
|
||||
reply from the author for various reasons.
|
||||
|
||||
### More information
|
||||
|
||||
Additional help with git is available on the
|
||||
[Working with Git](http://wiki.opscode.com/display/chef/Working+with+Git)
|
||||
wiki page.
|
||||
|
||||
## Functional and Unit Tests
|
||||
|
||||
This cookbook is set up to run tests under
|
||||
[Opscode's test-kitchen](https://github.com/opscode/test-kitchen). It
|
||||
uses minitest-chef to run integration tests after the node has been
|
||||
converged to verify that the state of the node.
|
||||
|
||||
Test kitchen should run completely without exception using the default
|
||||
[baseboxes provided by Opscode](https://github.com/opscode/bento).
|
||||
Because Test Kitchen creates VirtualBox machines and runs through
|
||||
every configuration in the Kitchenfile, it may take some time for
|
||||
these tests to complete.
|
||||
|
||||
If your changes are only for a specific recipe, run only its
|
||||
configuration with Test Kitchen. If you are adding a new recipe, or
|
||||
other functionality such as a LWRP or definition, please add
|
||||
appropriate tests and ensure they run with Test Kitchen.
|
||||
|
||||
If any don't pass, investigate them before submitting your patch.
|
||||
|
||||
Any new feature should have unit tests included with the patch with
|
||||
good code coverage to help protect it from future changes. Similarly,
|
||||
patches that fix a bug or regression should have a _regression test_.
|
||||
Simply put, this is a test that would fail without your patch but
|
||||
passes with it. The goal is to ensure this bug doesn't regress in the
|
||||
future. Consider a regular expression that doesn't match a certain
|
||||
pattern that it should, so you provide a patch and a test to ensure
|
||||
that the part of the code that uses this regular expression works as
|
||||
expected. Later another contributor may modify this regular expression
|
||||
in a way that breaks your use cases. The test you wrote will fail,
|
||||
signalling to them to research your ticket and use case and accounting
|
||||
for it.
|
||||
|
||||
If you need help writing tests, please ask on the Chef Developer's
|
||||
mailing list, or the #chef-hacking IRC channel.
|
||||
|
||||
## Code Review
|
||||
|
||||
Opscode regularly reviews code contributions and provides suggestions
|
||||
for improvement in the code itself or the implementation.
|
||||
|
||||
We find contributions by searching the ticket tracker for _resolved_
|
||||
tickets with a status of _fixed_. If we have feedback we will reopen
|
||||
the ticket and you should resolve it again when you've made the
|
||||
changes or have a response to our feedback. When we believe the patch
|
||||
is ready to be merged, we will tag the _Code Reviewed_ field with
|
||||
_Reviewed_.
|
||||
|
||||
Depending on the project, these tickets are then merged within a week
|
||||
or two, depending on the current release cycle.
|
||||
|
||||
## Release Cycle
|
||||
|
||||
The versioning for Opscode Cookbook projects is X.Y.Z.
|
||||
|
||||
* X is a major release, which may not be fully compatible with prior
|
||||
major releases
|
||||
* Y is a minor release, which adds both new features and bug fixes
|
||||
* Z is a patch release, which adds just bug fixes
|
||||
|
||||
A released version of a cookbook will end in an even number, e.g.
|
||||
"1.2.4" or "0.8.0". When development for the next version of the
|
||||
cookbook begins, the "Z" patch number is incremented to the next odd
|
||||
number, however the next release of the cookbook may be a major or
|
||||
minor incrementing version.
|
||||
|
||||
Releases of Opscode's cookbooks are usually announced on the Chef user
|
||||
mailing list. Releases of several cookbooks may be batched together
|
||||
and announced on the [Opscode Blog](http://www.opscode.com/blog).
|
||||
|
||||
## Working with the community
|
||||
|
||||
These resources will help you learn more about Chef and connect to
|
||||
other members of the Chef community:
|
||||
|
||||
* [chef](http://lists.opscode.com/sympa/info/chef) and
|
||||
[chef-dev](http://lists.opscode.com/sympa/info/chef-dev) mailing
|
||||
lists
|
||||
* #chef and #chef-hacking IRC channels on irc.freenode.net
|
||||
* [Community Cookbook site](http://community.opscode.com)
|
||||
* [Chef wiki](http://wiki.opscode.com/display/chef)
|
||||
* Opscode Chef [product page](http://www.opscode.com/chef)
|
||||
|
||||
|
||||
## Cookbook Contribution Do's and Don't's
|
||||
|
||||
Please do include tests for your contribution. If you need help, ask
|
||||
on the
|
||||
[chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev)
|
||||
or the
|
||||
[#chef-hacking IRC channel](http://community.opscode.com/chat/chef-hacking).
|
||||
Not all platforms that a cookbook supports may be supported by Test
|
||||
Kitchen. Please provide evidence of testing your contribution if it
|
||||
isn't trivial so we don't have to duplicate effort in testing. Chef
|
||||
10.14+ "doc" formatted output is sufficient.
|
||||
|
||||
Please do indicate new platform (families) or platform versions in the
|
||||
commit message, and update the relevant ticket.
|
||||
|
||||
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.'
|
||||
|
||||
Please do use [foodcritic](http://acrmp.github.com/foodcritic) to
|
||||
lint-check the cookbook. Except FC007, it should pass all correctness
|
||||
rules. FC007 is okay as long as the dependent cookbooks are *required*
|
||||
for the default behavior of the cookbook, such as to support an
|
||||
uncommon platform, secondary recipe, etc.
|
||||
|
||||
Please do ensure that your changes do not break or modify behavior for
|
||||
other platforms supported by the cookbook. For example if your changes
|
||||
are for Debian, make sure that they do not break on CentOS.
|
||||
|
||||
Please do not modify the version number in the metadata.rb, Opscode
|
||||
will select the appropriate version based on the release cycle
|
||||
information above.
|
||||
|
||||
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 update the CHANGELOG.md when releasing a new version of
|
||||
the cookbook.
|
|
@ -1,3 +0,0 @@
|
|||
source :rubygems
|
||||
|
||||
gem 'test-kitchen', '< 1.0'
|
|
@ -1,201 +0,0 @@
|
|||
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.
|
|
@ -1,213 +0,0 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
Installs a Java. Uses OpenJDK by default but supports installation of Oracle's JDK.
|
||||
|
||||
This cookbook contains the `java_ark` LWPR which has been deprecated
|
||||
in favor of [ark](https://github.com/opscode-cookbooks/ark).
|
||||
|
||||
**IMPORTANT NOTE**
|
||||
|
||||
As of 26 March 2012 you can no longer directly download
|
||||
the JDK from Oracle's website without using a special cookie. This cookbook uses
|
||||
that cookie to download the oracle recipe on your behalf, but . . .
|
||||
|
||||
the java::oracle recipe forces you to set either override
|
||||
the `node['java']['oracle']['accept_oracle_download_terms']` to true or set up a
|
||||
private repository accessible by HTTP.
|
||||
|
||||
Example
|
||||
|
||||
### override the `accept_oracle_download_terms`
|
||||
|
||||
roles/base.rb
|
||||
This cookbook also provides the `java_ark` LWRP which other java
|
||||
cookbooks can use to install java-related applications from binary
|
||||
packages.
|
||||
|
||||
default_attributes(
|
||||
:java => {
|
||||
:oracle => {
|
||||
"accept_oracle_download_terms" => true
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
You are most encouraged to voice your complaints to Oracle and/or
|
||||
switch to OpenJDK.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
Platform
|
||||
--------
|
||||
|
||||
* Debian, Ubuntu
|
||||
* CentOS, Red Hat, Fedora, Scientific, Amazon
|
||||
* ArchLinux
|
||||
* FreeBSD
|
||||
* Windows
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
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.
|
||||
* `node['java']['remove_deprecated_packages']` - Removes the now deprecated Ubuntu JDK
|
||||
packages from the system, default `false`
|
||||
* `node['java']['oracle']['accept_oracle_download_terms']` - Indicates that you accept
|
||||
Oracle's EULA
|
||||
* `node['java']['windows']['url']` - The internal location of your java install for windows
|
||||
* `node['java']['windows']['package_name']` - The package name used by windows_package to
|
||||
check in the registry to determine if the install has already been run
|
||||
|
||||
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. If the platform is windows it
|
||||
will include the windows recipe instead.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
windows
|
||||
-------
|
||||
|
||||
Because there is no easy way to pull the java msi off oracle's site,
|
||||
this recipe requires you to host it internally on your own http repo.
|
||||
|
||||
Resources/Providers
|
||||
===================
|
||||
|
||||
This cookbook contains the `java_ark` LWPR which has been deprecated
|
||||
in favor of [ark](https://github.com/opscode-cookbooks/ark).
|
||||
|
||||
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
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Simply include the `java` recipe where ever you would like Java installed.
|
||||
|
||||
To install Oracle flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role:
|
||||
|
||||
name "java"
|
||||
description "Install Oracle Java on Ubuntu"
|
||||
override_attributes(
|
||||
"java" => {
|
||||
"install_flavor" => "oracle"
|
||||
}
|
||||
)
|
||||
run_list(
|
||||
"recipe[java]"
|
||||
)
|
||||
|
||||
Development
|
||||
===========
|
||||
|
||||
This cookbook uses
|
||||
[test-kitchen](https://github.com/opscode/test-kitchen) for
|
||||
integration tests. Pull requests should pass existing tests in
|
||||
files/default/tests/minitest-handler. Additional tests are always welcome.
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
|
||||
|
||||
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.
|
||||
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.
|
|
@ -1,77 +0,0 @@
|
|||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Cookbook Name:: java
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2010, 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.
|
||||
|
||||
# remove the deprecated Ubuntu jdk packages
|
||||
default['java']['remove_deprecated_packages'] = false
|
||||
|
||||
# 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","scientific","amazon","oracle"
|
||||
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"
|
||||
when "windows"
|
||||
default['java']['install_flavor'] = "windows"
|
||||
default['java']['windows']['url'] = nil
|
||||
default['java']['windows']['package_name'] = "Java(TM) SE Development Kit 7 (64-bit)"
|
||||
else
|
||||
default['java']['java_home'] = "/usr/lib/jvm/default-java"
|
||||
end
|
||||
|
||||
# if you change this to true, you can download directly from Oracle
|
||||
default['java']['oracle']['accept_oracle_download_terms'] = false
|
||||
|
||||
# direct download paths for oracle, you have been warned!
|
||||
|
||||
# jdk6 attributes
|
||||
default['java']['jdk']['6']['bin_cmds'] = [ "appletviewer", "apt", "ControlPanel", "extcheck", "HtmlConverter", "idlj", "jar", "jarsigner",
|
||||
"java", "javac", "javadoc", "javah", "javap", "javaws", "jconsole", "jcontrol", "jdb", "jhat",
|
||||
"jinfo", "jmap", "jps", "jrunscript", "jsadebugd", "jstack", "jstat", "jstatd", "jvisualvm",
|
||||
"keytool", "native2ascii", "orbd", "pack200", "policytool", "rmic", "rmid", "rmiregistry",
|
||||
"schemagen", "serialver", "servertool", "tnameserv", "unpack200", "wsgen", "wsimport", "xjc" ]
|
||||
|
||||
# x86_64
|
||||
default['java']['jdk']['6']['x86_64']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/6u43-b01/jdk-6u43-linux-x64.bin'
|
||||
default['java']['jdk']['6']['x86_64']['checksum'] = '653c35ec6c64c3b127dea0afed1f16ba2b32efcaeae86fc02777b70e3e166aee'
|
||||
|
||||
# i586
|
||||
default['java']['jdk']['6']['i586']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/6u43-b01/jdk-6u43-linux-i586.bin'
|
||||
default['java']['jdk']['6']['i586']['checksum'] = '616df04eddac146b1c67de00ae07bb2d1179f470f35f9e661e1f5075423cf4e1'
|
||||
|
||||
# jdk7 attributes
|
||||
|
||||
default['java']['jdk']['7']['bin_cmds'] = [ "appletviewer", "apt", "ControlPanel", "extcheck", "idlj", "jar", "jarsigner", "java", "javac",
|
||||
"javadoc", "javafxpackager", "javah", "javap", "javaws", "jcmd", "jconsole", "jcontrol", "jdb",
|
||||
"jhat", "jinfo", "jmap", "jps", "jrunscript", "jsadebugd", "jstack", "jstat", "jstatd", "jvisualvm",
|
||||
"keytool", "native2ascii", "orbd", "pack200", "policytool", "rmic", "rmid", "rmiregistry",
|
||||
"schemagen", "serialver", "servertool", "tnameserv", "unpack200", "wsgen", "wsimport", "xjc" ]
|
||||
|
||||
# x86_64
|
||||
default['java']['jdk']['7']['x86_64']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-linux-x64.tar.gz'
|
||||
default['java']['jdk']['7']['x86_64']['checksum'] = '8611ce31e0b7ecb99d34703ad89b29a545a3fb30356553be3674366cbe722782'
|
||||
|
||||
# i586
|
||||
default['java']['jdk']['7']['i586']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-linux-i586.tar.gz'
|
||||
default['java']['jdk']['7']['i586']['checksum'] = '4046e941e05717538dd4deb1b1f55cb8bb6bd38793c7317034d1f5019086d956'
|
|
@ -1,25 +0,0 @@
|
|||
require 'minitest/spec'
|
||||
require 'open3'
|
||||
|
||||
describe_recipe 'java::openjdk' do
|
||||
|
||||
|
||||
include MiniTest::Chef::Assertions
|
||||
include MiniTest::Chef::Context
|
||||
include MiniTest::Chef::Resources
|
||||
|
||||
it "installs the correct version of the jdk" do
|
||||
stdin,stdout,stderr = Open3.popen3( "java -version" )
|
||||
version_line = stderr.readline
|
||||
jdk_version = version_line.scan(/\.([678])\./)[0][0]
|
||||
assert_equal node['java']['jdk_version'], jdk_version
|
||||
end
|
||||
|
||||
it "properly sets JAVA_HOME environment variable" do
|
||||
stdin,stdout,stderr = Open3.popen3( "echo $JAVA_HOME" )
|
||||
java_home = stdout.readline.rstrip
|
||||
assert_equal node['java']['java_home'], java_home
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
require 'minitest/spec'
|
||||
require 'open3'
|
||||
|
||||
describe_recipe 'java::oracle' do
|
||||
|
||||
|
||||
include MiniTest::Chef::Assertions
|
||||
include MiniTest::Chef::Context
|
||||
include MiniTest::Chef::Resources
|
||||
|
||||
it "installs the correct version of the jdk" do
|
||||
stdin,stdout,stderr = Open3.popen3( "java -version" )
|
||||
version_line = stderr.readline
|
||||
jdk_version = version_line.scan(/\.([678])\./)[0][0]
|
||||
assert_equal node['java']['jdk_version'], jdk_version
|
||||
end
|
||||
|
||||
it "properly sets JAVA_HOME environment variable" do
|
||||
stdin,stdout,stderr = Open3.popen3( "echo $JAVA_HOME" )
|
||||
java_home = stdout.readline.rstrip
|
||||
assert_equal node['java']['java_home'], java_home
|
||||
end
|
||||
|
||||
end
|
File diff suppressed because one or more lines are too long
|
@ -1,19 +0,0 @@
|
|||
name "java"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs Java runtime."
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "1.10.0"
|
||||
|
||||
recipe "java", "Installs Java runtime"
|
||||
recipe "java::openjdk", "Installs the OpenJDK 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 scientific fedora amazon arch oracle freebsd windows }.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
depends "windows"
|
|
@ -1,264 +0,0 @@
|
|||
#
|
||||
# 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 whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
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(/(.tgz|.tar.gz|.zip)/)[0]
|
||||
app_dir_name = app_dir_name.split("-bin")[0]
|
||||
end
|
||||
[app_dir_name, file_name]
|
||||
end
|
||||
|
||||
def oracle_downloaded?(download_path, new_resource)
|
||||
if ::File.exists? download_path
|
||||
require 'digest'
|
||||
downloaded_sha = Digest::SHA256.file(download_path).hexdigest
|
||||
downloaded_sha == new_resource.checksum
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def download_direct_from_oracle(tarball_name, new_resource)
|
||||
download_path = "#{Chef::Config[:file_cache_path]}/#{tarball_name}"
|
||||
jdk_id = new_resource.url.scan(/\/([6789]u[0-9][0-9]?-b[0-9][0-9])\//)[0][0]
|
||||
cookie = "oraclelicensejdk-#{jdk_id}-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"
|
||||
if node['java']['oracle']['accept_oracle_download_terms']
|
||||
# install the curl package
|
||||
p = package "curl" do
|
||||
action :nothing
|
||||
end
|
||||
# no converge_by block since the package provider will take care of this run_action
|
||||
p.run_action(:install)
|
||||
description = "download oracle tarball straight from the server"
|
||||
converge_by(description) do
|
||||
Chef::Log.debug "downloading oracle tarball straight from the source"
|
||||
cmd = Chef::ShellOut.new(
|
||||
%Q[ curl -L --cookie "#{cookie}" #{new_resource.url} -o #{download_path} ]
|
||||
)
|
||||
cmd.run_command
|
||||
cmd.error!
|
||||
end
|
||||
else
|
||||
Chef::Application.fatal!("You must set the attribute node['java']['oracle']['accept_oracle_download_terms'] to true if you want to download directly from the oracle site!")
|
||||
end
|
||||
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 = new_resource.app_home + "_alt"
|
||||
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)
|
||||
description = "create dir #{app_root} and change owner to #{new_resource.owner}"
|
||||
converge_by(description) do
|
||||
FileUtils.mkdir app_root, :mode => new_resource.app_home_mode
|
||||
FileUtils.chown new_resource.owner, new_resource.owner, app_root
|
||||
end
|
||||
end
|
||||
|
||||
if new_resource.url =~ /^http:\/\/download.oracle.com.*$/
|
||||
download_path = "#{Chef::Config[:file_cache_path]}/#{tarball_name}"
|
||||
if oracle_downloaded?(download_path, new_resource)
|
||||
Chef::Log.debug("oracle tarball already downloaded, not downloading again")
|
||||
else
|
||||
download_direct_from_oracle tarball_name, new_resource
|
||||
end
|
||||
else
|
||||
Chef::Log.debug("downloading tarball from an unofficial repository")
|
||||
r = remote_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do
|
||||
source new_resource.url
|
||||
checksum new_resource.checksum
|
||||
mode 0755
|
||||
action :nothing
|
||||
end
|
||||
#no converge by on run_action remote_file takes care of it.
|
||||
r.run_action(:create_if_missing)
|
||||
end
|
||||
|
||||
require 'tmpdir'
|
||||
|
||||
description = "create tmpdir, extract compressed data into tmpdir,
|
||||
move extracted data to #{app_dir} and delete tmpdir"
|
||||
converge_by(description) do
|
||||
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|tgz)/
|
||||
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
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
#set up .jinfo file for update-java-alternatives
|
||||
java_name = app_home.split('/')[-1]
|
||||
jinfo_file = "#{app_root}/.#{java_name}.jinfo"
|
||||
if platform_family?("debian") && !::File.exists?(jinfo_file)
|
||||
description = "Add #{jinfo_file} for debian"
|
||||
converge_by(description) do
|
||||
Chef::Log.debug "Adding #{jinfo_file} for debian"
|
||||
template jinfo_file do
|
||||
source "oracle.jinfo.erb"
|
||||
variables(
|
||||
:priority => new_resource.alternatives_priority,
|
||||
:bin_cmds => new_resource.bin_cmds,
|
||||
:name => java_name,
|
||||
:app_dir => app_home
|
||||
)
|
||||
action :create
|
||||
end
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
#link app_home to app_dir
|
||||
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
|
||||
description = "Symlink #{app_dir} to #{app_home}"
|
||||
converge_by(description) do
|
||||
Chef::Log.debug "Symlinking #{app_dir} to #{app_home}"
|
||||
FileUtils.rm_f app_home
|
||||
FileUtils.ln_sf app_dir, app_home
|
||||
end
|
||||
end
|
||||
|
||||
#update-alternatives
|
||||
if new_resource.bin_cmds
|
||||
new_resource.bin_cmds.each do |cmd|
|
||||
|
||||
bin_path = "/usr/bin/#{cmd}"
|
||||
alt_path = "#{app_home}/bin/#{cmd}"
|
||||
priority = new_resource.alternatives_priority
|
||||
|
||||
# install the alternative if needed
|
||||
alternative_exists = Chef::ShellOut.new("update-alternatives --display #{cmd} | grep #{alt_path}").run_command.exitstatus == 0
|
||||
unless alternative_exists
|
||||
description = "Add alternative for #{cmd}"
|
||||
converge_by(description) do
|
||||
Chef::Log.debug "Adding alternative for #{cmd}"
|
||||
install_cmd = Chef::ShellOut.new("update-alternatives --install #{bin_path} #{cmd} #{alt_path} #{priority}").run_command
|
||||
unless install_cmd.exitstatus == 0
|
||||
Chef::Application.fatal!(%Q[ set alternative failed ])
|
||||
end
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
# set the alternative if default
|
||||
if new_resource.default
|
||||
alternative_is_set = Chef::ShellOut.new("update-alternatives --display #{cmd} | grep \"link currently points to #{alt_path}\"").run_command.exitstatus == 0
|
||||
unless alternative_is_set
|
||||
description = "Set alternative for #{cmd}"
|
||||
converge_by(description) do
|
||||
Chef::Log.debug "Setting alternative for #{cmd}"
|
||||
set_cmd = Chef::ShellOut.new("update-alternatives --set #{cmd} #{alt_path}").run_command
|
||||
unless set_cmd.exitstatus == 0
|
||||
Chef::Application.fatal!(%Q[ set alternative failed ])
|
||||
end
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
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
|
||||
# the execute resource will take care of of the run_action(:run)
|
||||
cmd.run_action(:run)
|
||||
end
|
||||
description = "remove #{new_resource.name} at #{app_dir}"
|
||||
converge_by(description) do
|
||||
Chef::Log.info "Removing #{new_resource.name} at #{app_dir}"
|
||||
FileUtils.rm_rf app_dir
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Cookbook Name:: java
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2008-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.
|
||||
#
|
||||
|
||||
if node['platform_family'] == "windows"
|
||||
include_recipe "java::windows"
|
||||
else
|
||||
include_recipe "java::#{node['java']['install_flavor']}"
|
||||
end
|
||||
|
||||
# Purge the deprecated Sun Java packages if remove_deprecated_packages is true
|
||||
%w[sun-java6-jdk sun-java6-bin sun-java6-jre].each do |pkg|
|
||||
package pkg do
|
||||
action :purge
|
||||
only_if { node['java']['remove_deprecated_packages'] }
|
||||
end
|
||||
end
|
|
@ -1,97 +0,0 @@
|
|||
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Cookbook Name:: java
|
||||
# Recipe:: openjdk
|
||||
#
|
||||
# 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.
|
||||
|
||||
jdk_version = node['java']['jdk_version'].to_i
|
||||
java_home = node['java']['java_home']
|
||||
java_home_parent = ::File.dirname java_home
|
||||
jdk_home = ""
|
||||
|
||||
pkgs = value_for_platform(
|
||||
["centos","redhat","fedora","scientific","amazon","oracle"] => {
|
||||
"default" => ["java-1.#{jdk_version}.0-openjdk","java-1.#{jdk_version}.0-openjdk-devel"]
|
||||
},
|
||||
["debian","ubuntu"] => {
|
||||
"default" => ["openjdk-#{jdk_version}-jdk","default-jre-headless"]
|
||||
},
|
||||
["arch","freebsd"] => {
|
||||
"default" => ["openjdk#{jdk_version}"]
|
||||
},
|
||||
"default" => ["openjdk-#{jdk_version}-jdk"]
|
||||
)
|
||||
|
||||
# done by special request for rberger
|
||||
ruby_block "set-env-java-home" do
|
||||
block do
|
||||
ENV["JAVA_HOME"] = java_home
|
||||
end
|
||||
not_if { ENV["JAVA_HOME"] == java_home }
|
||||
end
|
||||
|
||||
file "/etc/profile.d/jdk.sh" do
|
||||
content <<-EOS
|
||||
export JAVA_HOME=#{node['java']['java_home']}
|
||||
EOS
|
||||
mode 0755
|
||||
end
|
||||
|
||||
|
||||
if platform?("ubuntu","debian","redhat","centos","fedora","scientific","amazon","oracle")
|
||||
ruby_block "update-java-alternatives" do
|
||||
block do
|
||||
arch = node['kernel']['machine'] =~ /x86_64/ ? "x86_64" : "i386"
|
||||
arch = 'amd64' if arch == 'x86_64' && platform?("ubuntu") && node["platform_version"].to_f >= 12.04
|
||||
if platform?("ubuntu", "debian") and jdk_version == 6
|
||||
java_name = if node["platform_version"].to_f >= 11.10
|
||||
"java-1.6.0-openjdk"
|
||||
else
|
||||
"java-6-openjdk"
|
||||
end
|
||||
java_name += "-i386" if arch == "i386" && node['platform_version'].to_f >= 12.04
|
||||
Chef::ShellOut.new("update-java-alternatives","-s", java_name, :returns => [0,2]).run_command
|
||||
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"
|
||||
Chef::Log.debug("glob is #{java_home_parent}/java*#{jdk_version}*openjdk*#{arch}")
|
||||
jdk_home = Dir.glob("#{java_home_parent}/java*#{jdk_version}*openjdk*#{arch}").first
|
||||
Chef::Log.debug("jdk_home is #{jdk_home}")
|
||||
if jdk_home
|
||||
FileUtils.rm_f java_home if ::File.exists? java_home
|
||||
FileUtils.ln_sf jdk_home, java_home
|
||||
end
|
||||
|
||||
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 :create, "ruby_block[update-java-alternatives]", :immediately if platform?("ubuntu","debian","redhat","centos","fedora","scientific","amazon","oracle")
|
||||
end
|
||||
end
|
|
@ -1,68 +0,0 @@
|
|||
#
|
||||
# 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']
|
||||
bin_cmds = node['java']['jdk']['6']['bin_cmds']
|
||||
when "7"
|
||||
tarball_url = node['java']['jdk']['7'][arch]['url']
|
||||
tarball_checksum = node['java']['jdk']['7'][arch]['checksum']
|
||||
bin_cmds = node['java']['jdk']['7']['bin_cmds']
|
||||
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
|
||||
not_if { ENV["JAVA_HOME"] == java_home }
|
||||
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 bin_cmds
|
||||
alternatives_priority 1062
|
||||
action :install
|
||||
end
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
#
|
||||
# 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']
|
||||
bin_cmds = node['java']['jdk']['6']['bin_cmds']
|
||||
when "7"
|
||||
tarball_url = node['java']['jdk']['7']['i586']['url']
|
||||
tarball_checksum = node['java']['jdk']['7']['i586']['checksum']
|
||||
bin_cmds = node['java']['jdk']['7']['bin_cmds']
|
||||
end
|
||||
|
||||
ruby_block "set-env-java-home" do
|
||||
block do
|
||||
ENV["JAVA_HOME"] = java_home
|
||||
end
|
||||
not_if { ENV["JAVA_HOME"] == java_home }
|
||||
end
|
||||
|
||||
yum_package "glibc" do
|
||||
arch "i686"
|
||||
only_if { platform_family?( "rhel", "fedora" ) }
|
||||
end
|
||||
|
||||
java_ark "jdk-alt" do
|
||||
url tarball_url
|
||||
checksum tarball_checksum
|
||||
app_home java_home
|
||||
bin_cmds bin_cmds
|
||||
action :install
|
||||
default false
|
||||
end
|
|
@ -1,28 +0,0 @@
|
|||
#
|
||||
# Author:: Kendrick Martin (<kendrick.martin@webtrends.com>)
|
||||
# Cookbook Name:: java
|
||||
# Recipe:: windows
|
||||
#
|
||||
# Copyright 2008-2012 Webtrends, 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.
|
||||
#
|
||||
|
||||
Chef::Log.warn("No download url set for java installer.") unless node['java']['windows']['url']
|
||||
|
||||
windows_package node['java']['windows']['package_name'] do
|
||||
source node['java']['windows']['url']
|
||||
action :install
|
||||
installer_type :custom
|
||||
options "/s"
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
#
|
||||
# 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 => /^https?:\/\/.*(tar.gz|tgz|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
|
||||
attribute :alternatives_priority, :kind_of => Integer, :default => 1
|
||||
|
||||
# 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
|
|
@ -1,6 +0,0 @@
|
|||
name=<%= @name %>
|
||||
priority=<%= @priority %>
|
||||
section=main
|
||||
|
||||
<% @bin_cmds.each do |cmd| -%>jdk <%= cmd %> <%= @app_dir %>/bin/<%= cmd %>
|
||||
<% end -%>
|
|
@ -1,7 +0,0 @@
|
|||
.*
|
||||
!.gitignore
|
||||
!.kitchen.yml
|
||||
bin
|
||||
Gemfile.lock
|
||||
Cheffile.lock
|
||||
tmp*
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
driver_plugin: vagrant
|
||||
platforms:
|
||||
- name: ubuntu-12.04
|
||||
driver_config:
|
||||
box: opscode-ubuntu-12.04
|
||||
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04.box
|
||||
- name: ubuntu-10.04
|
||||
driver_config:
|
||||
box: opscode-ubuntu-10.04
|
||||
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-10.04.box
|
||||
- name: centos-6.4
|
||||
driver_config:
|
||||
box: opscode-centos-6.4
|
||||
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-6.3.box
|
||||
- name: centos-5.8
|
||||
driver_config:
|
||||
box: opscode-centos-5.8
|
||||
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-5.8.box
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[omnibus_updater_test::default]
|
||||
- recipe[minitest-handler]
|
||||
- name: upgrade
|
||||
run_list:
|
||||
- recipe[omnibus_updater_test::version_upgrade]
|
||||
- recipe[minitest-handler]
|
|
@ -1,52 +0,0 @@
|
|||
v0.2.4
|
||||
======
|
||||
* Only download omnibus package if version difference detected (#20 #22 #23)
|
||||
* Provide attribute for always downloading package even if version matches
|
||||
|
||||
v0.2.3
|
||||
======
|
||||
* Use chef internals for interactions with omnitruck to provide proper proxy support (#19)
|
||||
|
||||
v0.2.0
|
||||
======
|
||||
* Use omnitruck client for url generation for package fetching
|
||||
* Use `prerelease` in favor of `allow_release_clients`
|
||||
|
||||
v0.1.2
|
||||
======
|
||||
* Fix regression on debian package path construction (thanks [ashmere](https://github.com/ashmere))
|
||||
|
||||
v0.1.1
|
||||
======
|
||||
* Search for proper version suffix if not provided (removes default '-1')
|
||||
* Do not allow release clients by default when version search is enabled
|
||||
* Push omnibus package installation to the end of run (reduces issue described in #10)
|
||||
* Allow updater to be disabled via attribute (thanks [Teemu Matilainen](https://github.com/tmatilai))
|
||||
|
||||
v0.1.0
|
||||
======
|
||||
* Fix redhat related versioning issues
|
||||
* Remove requirement for '-1' suffix on versions
|
||||
* Initial support for automatic latest version install
|
||||
|
||||
v0.0.5
|
||||
======
|
||||
* Add support for Ubuntu 12.10
|
||||
* Path fixes for non-64 bit packages (thanks [ashmere](https://github.com/ashmere))
|
||||
|
||||
v0.0.4
|
||||
======
|
||||
* Use new aws bucket by default
|
||||
* Update file key building
|
||||
|
||||
v0.0.3
|
||||
======
|
||||
* Path fix for debian omnibus packages (thanks [ashmere](https://github.com/ashmere))
|
||||
|
||||
v0.0.2
|
||||
======
|
||||
* Add robust check when uninstalling chef gem to prevent removal from omnibus
|
||||
|
||||
v0.0.1
|
||||
======
|
||||
* Initial release
|
|
@ -1,4 +0,0 @@
|
|||
site 'http://community.opscode.com/api/v1'
|
||||
|
||||
cookbook 'omnibus_updater', path: './'
|
||||
cookbook 'omnibus_updater_test', path: './test/kitchen/cookbooks/omnibus_updater_test'
|
|
@ -1,3 +0,0 @@
|
|||
source :rubygems
|
||||
|
||||
gem 'vagabond'
|
|
@ -1,75 +0,0 @@
|
|||
OmnibusUpdater
|
||||
==============
|
||||
|
||||
Update your omnibus! This cookbook can install the omnibus
|
||||
Chef package into your system if you are currently running
|
||||
via gem install, and it can keep your omnibus install up
|
||||
to date.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Add the recipe to your run list and specify what version should
|
||||
be installed on the node:
|
||||
|
||||
`knife node run_list add recipe[omnibus_updater]`
|
||||
|
||||
In your role you'll likely want to set the version. It defaults
|
||||
to nothing, and will install the latest..
|
||||
|
||||
```
|
||||
override_attributes(
|
||||
:omnibus_updater => {
|
||||
:version => '11.4.0'
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
It can also uninstall Chef from the system Ruby installation
|
||||
if you tell it to:
|
||||
|
||||
```
|
||||
override_attributes(
|
||||
:omnibus_updater => {
|
||||
:remove_chef_system_gem => true
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
Latest Version
|
||||
--------------
|
||||
|
||||
Force installation of the latest version regardless of value stored in version
|
||||
attribute by setting the `force_latest` attribute.
|
||||
|
||||
Chef Killing
|
||||
------------
|
||||
|
||||
By default the omnibus updater will kill the chef instance by raising and exception.
|
||||
You can turn this off using the `kill_chef_on_upgrade` attribute. It is not
|
||||
recommended to turn this off. Internal chef libraries may change, move, or no
|
||||
longer exist. The currently running instance can encounter unexpected states because
|
||||
of this. To prevent this, the updater will attempt to kill the Chef instance so
|
||||
that it can be restarted in a normal state.
|
||||
|
||||
Prerelease
|
||||
--------
|
||||
|
||||
Prereleases can be installed via the auto-installation using `prerelease` attribute.
|
||||
|
||||
Disable
|
||||
-------
|
||||
|
||||
If you want to disable the updater you can set the `disabled`
|
||||
attribute to true. This might be useful if the cookbook is added
|
||||
to a role but should then be skipped for example on a Chef server.
|
||||
|
||||
Infos
|
||||
=====
|
||||
|
||||
* Repo: https://github.com/hw-cookbooks/omnibus_updater
|
||||
* IRC: Freenode @ #heavywater
|
||||
* Cookbook: http://ckbk.it/omnibus_updater
|
|
@ -1,9 +0,0 @@
|
|||
default[:omnibus_updater][:version] = nil
|
||||
default[:omnibus_updater][:force_latest] = false
|
||||
default[:omnibus_updater][:cache_dir] = '/opt'
|
||||
default[:omnibus_updater][:cache_omnibus_installer] = false
|
||||
default[:omnibus_updater][:remove_chef_system_gem] = false
|
||||
default[:omnibus_updater][:prerelease] = false
|
||||
default[:omnibus_updater][:disabled] = false
|
||||
default[:omnibus_updater][:kill_chef_on_upgrade] = true
|
||||
default[:omnibus_updater][:always_download] = false
|
|
@ -1,11 +0,0 @@
|
|||
module OmnibusChecker
|
||||
def is_omnibus?
|
||||
Gem.bindir =~ %r{/opt/(opscode|chef)/}
|
||||
end
|
||||
end
|
||||
|
||||
OmnibusChecker.send(:extend, OmnibusChecker)
|
||||
|
||||
unless(Chef::Recipe.instance_methods.include?(:is_omnibus?))
|
||||
Chef::Recipe.send(:include, OmnibusChecker)
|
||||
end
|
|
@ -1,64 +0,0 @@
|
|||
module OmnibusTrucker
|
||||
class << self
|
||||
URL_MAP = {
|
||||
:p => :platform, :pv => :platform_version, :m => :machine,
|
||||
:v => :version, :prerelease => :prerelease,
|
||||
:nightlies => :nightlies
|
||||
}
|
||||
|
||||
def build_url(*opts)
|
||||
args = node = nil
|
||||
opts.each do |o|
|
||||
if(o.kind_of?(Hash))
|
||||
args = o
|
||||
elsif(o.kind_of?(Chef::Node))
|
||||
node = o
|
||||
else
|
||||
raise ArgumentError.new "Provided argument is not allowed: #{o.class}"
|
||||
end
|
||||
end
|
||||
args ||= {}
|
||||
if(node)
|
||||
args = collect_attributes(node).merge(args)
|
||||
end
|
||||
url = args[:url] || "http://www.opscode.com/chef/download#{'-server' if args[:server]}"
|
||||
u_args = URL_MAP.map do |u_k, a_k|
|
||||
"#{u_k}=#{args[a_k]}" unless args[a_k].nil?
|
||||
end.compact
|
||||
"#{url}?#{u_args.join('&')}"
|
||||
end
|
||||
|
||||
def collect_attributes(node, args={})
|
||||
set = Hash[*(
|
||||
[:platform_family, :platform, :platform_version].map do |k|
|
||||
[k, args[k] || node[k]]
|
||||
end.flatten.compact
|
||||
)]
|
||||
unless(@attrs)
|
||||
if(set[:platform_family] == 'rhel')
|
||||
@attrs = {:platform => 'el', :platform_version => set[:platform_version].to_i}
|
||||
else
|
||||
@attrs = {:platform => set[:platform], :platform_version => set[:platform_version]}
|
||||
end
|
||||
@attrs[:machine] = args[:machine] || node[:kernel][:machine]
|
||||
end
|
||||
@attrs
|
||||
end
|
||||
|
||||
def url(url_or_node, node = nil)
|
||||
if(url_or_node.is_a?(Chef::Node))
|
||||
url = build_url(url_or_node)
|
||||
node = url_or_node
|
||||
else
|
||||
url = url_or_node
|
||||
raise "Node instance is required for Omnitruck.url!" unless node
|
||||
end
|
||||
request = Chef::REST::RESTRequest.new(:head, URI.parse(url), nil)
|
||||
result = request.call
|
||||
if(result.kind_of?(Net::HTTPRedirection))
|
||||
result['location']
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
name "omnibus_updater"
|
||||
maintainer "Chris Roberts"
|
||||
maintainer_email "chrisroberts.code@gmail.com"
|
||||
license "Apache 2.0"
|
||||
description "Chef omnibus package updater and installer"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "0.2.4"
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
if(node[:omnibus_updater][:disabled])
|
||||
Chef::Log.warn 'Omnibus updater disabled via `disabled` attribute'
|
||||
else
|
||||
include_recipe 'omnibus_updater::downloader'
|
||||
include_recipe 'omnibus_updater::installer'
|
||||
end
|
||||
|
||||
if(node[:omnibus_updater][:remove_chef_system_gem])
|
||||
include_recipe 'omnibus_updater::remove_chef_system_gem'
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
# NOTE: This recipe is here for others that just want the
|
||||
# package, not the actual installation (lxc for example)
|
||||
|
||||
if(node[:omnibus_updater][:direct_url])
|
||||
remote_path = node[:omnibus_updater][:direct_url]
|
||||
else
|
||||
version = node[:omnibus_updater][:version] || ''
|
||||
remote_path = OmnibusTrucker.url(
|
||||
OmnibusTrucker.build_url(node,
|
||||
:version => node[:omnibus_updater][:force_latest] ? nil : version.sub(/\-.+$/, ''),
|
||||
:prerelease => node[:omnibus_updater][:preview]
|
||||
), node
|
||||
)
|
||||
end
|
||||
|
||||
if(remote_path)
|
||||
node.set[:omnibus_updater][:full_url] = remote_path
|
||||
Chef::Log.info "Omnibus Updater remote path: #{remote_path}"
|
||||
|
||||
remote_file "omnibus_remote[#{File.basename(remote_path)}]" do
|
||||
path File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))
|
||||
source remote_path
|
||||
backup false
|
||||
action :create_if_missing
|
||||
only_if do
|
||||
unless(version = node[:omnibus_updater][:version])
|
||||
version = node[:omnibus_updater][:full_url].scan(%r{chef_(\d+\.\d+.\d+)}).flatten.first
|
||||
end
|
||||
node[:omnibus_updater][:always_download] || Chef::VERSION != version.to_s.sub(/\-.+$/, '')
|
||||
end
|
||||
end
|
||||
else
|
||||
Chef::Log.warn 'Failed to retrieve omnibus download URL'
|
||||
end
|
||||
|
||||
include_recipe 'omnibus_updater::old_package_cleaner'
|
|
@ -1,36 +0,0 @@
|
|||
include_recipe 'omnibus_updater'
|
||||
remote_path = node[:omnibus_updater][:full_url].to_s
|
||||
|
||||
ruby_block 'Omnibus Chef install notifier' do
|
||||
block{ true }
|
||||
action :nothing
|
||||
subscribes :create, "remote_file[omnibus_remote[#{File.basename(remote_path)}]]", :immediately
|
||||
notifies :run, "execute[omnibus_install[#{File.basename(remote_path)}]]", :delayed
|
||||
end
|
||||
|
||||
execute "omnibus_install[#{File.basename(remote_path)}]" do
|
||||
case File.extname(remote_path)
|
||||
when '.deb'
|
||||
command "dpkg -i #{File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))}"
|
||||
when '.rpm'
|
||||
command "rpm -Uvh #{File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))}"
|
||||
when '.sh'
|
||||
command "/bin/sh #{File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))}"
|
||||
else
|
||||
raise "Unknown package type encountered for install: #{File.extname(remote_path)}"
|
||||
end
|
||||
action :nothing
|
||||
notifies :create, 'ruby_block[omnibus chef killer]', :immediately
|
||||
end
|
||||
|
||||
ruby_block 'omnibus chef killer' do
|
||||
block do
|
||||
raise 'New omnibus chef version installed. Killing Chef run!'
|
||||
end
|
||||
action :nothing
|
||||
only_if do
|
||||
node[:omnibus_updater][:kill_chef_on_upgrade]
|
||||
end
|
||||
end
|
||||
|
||||
include_recipe 'omnibus_updater::old_package_cleaner'
|
|
@ -1,14 +0,0 @@
|
|||
old_pkgs =
|
||||
if(::File.exist?(node[:omnibus_updater][:cache_dir]))
|
||||
Dir.glob(File.join(node[:omnibus_updater][:cache_dir], 'chef*')).find_all do |file|
|
||||
!file.include?(node[:omnibus_updater][:version].to_s) && !file.scan(/\.(rpm|deb)$/).empty?
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
old_pkgs.each do |filename|
|
||||
file filename do
|
||||
action :delete
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
gem_package 'chef' do
|
||||
action :purge
|
||||
only_if do
|
||||
Chef::Provider::Package::Rubygems.new(
|
||||
Chef::Resource::GemPackage.new('dummy_package')
|
||||
).gem_env.gem_paths.detect{|path|
|
||||
path.start_with?('/opt/omnibus') || path.start_with?('/opt/chef')
|
||||
}.nil? && node[:omnibus_updater][:remove_chef_system_gem]
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
cookbook "omnibus_updater" do
|
||||
configuration "default"
|
||||
configuration "version_upgrade"
|
||||
configuration "search"
|
||||
lint false
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
require 'minitest/spec'
|
||||
require 'open-uri'
|
||||
|
||||
describe_recipe 'omnibus_updater_test::default' do
|
||||
include MiniTest::Chef::Assertions
|
||||
|
||||
it "sets remote package location" do
|
||||
assert(node[:omnibus_updater][:full_url], "Failed to set URI for omnibus package")
|
||||
end
|
||||
|
||||
it "does not download the package to the node" do
|
||||
file("/opt/#{File.basename(node[:omnibus_updater][:full_url])}").wont_exist
|
||||
end
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
require 'minitest/spec'
|
||||
require 'rexml/document'
|
||||
require 'open-uri'
|
||||
|
||||
describe_recipe 'omnibus_updater_test::version_upgrade' do
|
||||
include MiniTest::Chef::Assertions
|
||||
|
||||
it "sets remote package location" do
|
||||
assert(node[:omnibus_updater][:full_url], "Failed to set URI for omnibus package")
|
||||
end
|
||||
|
||||
it "downloads the package to the node" do
|
||||
file("/opt/#{File.basename(node[:omnibus_updater][:full_url])}").must_exist
|
||||
end
|
||||
|
||||
it "installs the proper version into the node" do
|
||||
assert_equal(
|
||||
node[:omnibus_updater][:version].scan(/^\d+\.\d+\.\d+/).first,
|
||||
`chef-client --version`.strip.scan(/\d+\.\d+\.\d+/).first,
|
||||
"Installed chef version does not match version requested"
|
||||
)
|
||||
end
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
name 'omnibus_updater_test'
|
||||
version '0.0.1'
|
||||
depends "omnibus_updater"
|
||||
depends "minitest-handler"
|
|
@ -1,3 +0,0 @@
|
|||
node.set[:omnibus_updater][:kill_chef_on_upgrade] = false
|
||||
node.set[:omnibus_updater][:version] = false
|
||||
include_recipe "omnibus_updater"
|
|
@ -1,3 +0,0 @@
|
|||
node.set[:omnibus_updater][:version] = '11.2.0'
|
||||
node.set[:omnibus_updater][:kill_chef_on_upgrade] = false
|
||||
include_recipe "omnibus_updater"
|
|
@ -1,50 +0,0 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
Installs vim.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
## Platform:
|
||||
|
||||
* Ubuntu/Debian
|
||||
* Red Hat/CentOS/Fedora/Scientific
|
||||
* ArchLinux
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
* `node[:vim][:extra_packages]` - An array of extra packages related to vim to install (like plugins). Empty array by default.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Put `recipe[vim]` in a run list, or `include_recipe 'vim'` to ensure that vim is installed on your systems.
|
||||
|
||||
If you would like to install additional vim plugin packages, include their package names in the `node[:vim][:extra_packages]` attribute. Verify that your operating sytem has the package available.
|
||||
|
||||
Changes
|
||||
=======
|
||||
|
||||
## v1.0.2:
|
||||
|
||||
* Fixes COOK-598 (RHEL platforms support).
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Joshua Timberman <joshua@opscode.com>
|
||||
|
||||
Copyright 2010, 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
|
|
@ -1,20 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: vim
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2010, 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.
|
||||
#
|
||||
|
||||
default[:vim][:extra_packages] = []
|
|
@ -1,36 +0,0 @@
|
|||
{
|
||||
"name": "vim",
|
||||
"description": "Installs vim and optional extra packages.",
|
||||
"long_description": "Description\n===========\n\nInstalls vim.\n\nRequirements\n============\n\n## Platform:\n\n* Ubuntu/Debian\n* Red Hat/CentOS/Fedora/Scientific\n* ArchLinux\n\nAttributes\n==========\n\n* `node[:vim][:extra_packages]` - An array of extra packages related to vim to install (like plugins). Empty array by default.\n\nUsage\n=====\n\nPut `recipe[vim]` in a run list, or `include_recipe 'vim'` to ensure that vim is installed on your systems.\n\nIf you would like to install additional vim plugin packages, include their package names in the `node[:vim][:extra_packages]` attribute. Verify that your operating sytem has the package available.\n\nChanges\n=======\n\n## v1.0.2:\n\n* Fixes COOK-598 (RHEL platforms support).\n\nLicense and Author\n==================\n\nAuthor:: Joshua Timberman <joshua@opscode.com>\n\nCopyright 2010, 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\n",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"debian": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0",
|
||||
"arch": ">= 0.0.0",
|
||||
"redhat": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"fedora": ">= 0.0.0",
|
||||
"scientific": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs vim and optional extra packages."
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "1.0.2"
|
||||
|
||||
%w{debian ubuntu arch redhat centos fedora scientific}.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: vim
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2010, 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.
|
||||
#
|
||||
|
||||
# There is no vim package on RHEL/CentOS derivatives
|
||||
# * vim-minimal gives you /bin/vi
|
||||
# * vim-enhanced gives you /usr/bin/vim
|
||||
vim_base_pkgs = value_for_platform(
|
||||
["ubuntu", "debian", "arch"] => { "default" => ["vim"] },
|
||||
["redhat", "centos", "fedora", "scientific"] => { "default" => ["vim-minimal","vim-enhanced"] },
|
||||
"default" => ["vim"]
|
||||
)
|
||||
|
||||
vim_base_pkgs.each do |vim_base_pkg|
|
||||
package vim_base_pkg
|
||||
end
|
||||
|
||||
node[:vim][:extra_packages].each do |vimpkg|
|
||||
package vimpkg
|
||||
end
|
|
@ -1,161 +0,0 @@
|
|||
## Future
|
||||
|
||||
* package preseeding/response_file support
|
||||
* package installation location via a `target_dir` attribute.
|
||||
* [COOK-666] `windows_package` should support CoApp packages
|
||||
* windows_registry :force_modify action should use RegNotifyChangeKeyValue from WinAPI
|
||||
* WindowsRebootHandler/`windows_reboot` LWRP should support kicking off subsequent chef run on reboot.
|
||||
|
||||
## v1.8.4:
|
||||
|
||||
* [COOK-2336] - MSI That requires reboot returns with RC 3010 and
|
||||
causes chef run failure
|
||||
* [COOK-2368] - `version` attribute of the `windows_package` provider
|
||||
should be documented
|
||||
|
||||
## v1.8.2:
|
||||
|
||||
**Important**: Use powershell in nodes expanded run lists to ensure
|
||||
powershell is downloaded, as powershell has a dependency on this
|
||||
cookbook; v1.8.0 created a circular dependency.
|
||||
|
||||
* [COOK-2301] - windows 1.8.0 has circular dependency on powershell
|
||||
|
||||
## v1.8.0:
|
||||
|
||||
* [COOK-2126] - Add checksum attribute to windows_zipfile
|
||||
* [COOK-2142] - Add printer and printer_port LWRPs
|
||||
* [COOK-2149] - Chef::Log.debug Windows Package command line
|
||||
* [COOK-2155] -`windows_package` does not send checksum to
|
||||
`cached_file` in `installer_type`
|
||||
|
||||
## v1.7.0:
|
||||
|
||||
* [COOK-1745] - allow for newer versions of rubyzip
|
||||
|
||||
## v1.6.0:
|
||||
|
||||
* [COOK-2048] - undefined method for Falseclass on task :change when
|
||||
action is :nothing (and task doesn't exist)
|
||||
* [COOK-2049] - Add `windows_pagefile` resource
|
||||
|
||||
## v1.5.0:
|
||||
|
||||
* [COOK-1251] - Fix LWRP "NotImplementedError"
|
||||
* [COOK-1921] - Task LWRP will return true for resource exists when no
|
||||
other scheduled tasks exist
|
||||
* [COOK-1932] - Include :change functionality to windows task lwrp
|
||||
|
||||
## v1.4.0:
|
||||
|
||||
* [COOK-1571] - windows_package resource (with msi provider) does not
|
||||
accept spaces in filename
|
||||
* [COOK-1581] - Windows cookbook needs a scheduled tasks LWRP
|
||||
* [COOK-1584] - `windows_registry` should support all registry types
|
||||
|
||||
## v1.3.4:
|
||||
|
||||
* [COOK-1173] - windows_registry throws Win32::Registry::Error for
|
||||
action :remove on a nonexistent key
|
||||
* [COOK-1182] - windows package sets start window title instead of
|
||||
quoting a path
|
||||
* [COOK-1476] - zipfile lwrp should support :zip action
|
||||
* [COOK-1485] - package resource fails to perform install correctly
|
||||
when "source" contains quote
|
||||
* [COOK-1519] - add action :remove for path lwrp
|
||||
|
||||
## v1.3.2:
|
||||
|
||||
* [COOK-1033] - remove the `libraries/ruby_19_patches.rb` file which
|
||||
causes havoc on non-Windows systems.
|
||||
* [COOK-811] - add a timeout parameter attribute for `windows_package`
|
||||
|
||||
## v1.3.0:
|
||||
|
||||
* [COOK-1323] - Update for changes in Chef 0.10.10.
|
||||
- Setting file mode doesn't make sense on Windows (package provider
|
||||
- and reboot_handler recipe)
|
||||
- Prefix ::Win32 to avoid namespace collision with Chef::Win32
|
||||
- (registry_helper library)
|
||||
- Use chef_gem instead of gem_package so gems get installed correctly
|
||||
under the Ruby environment Chef runs in (reboot_handler recipe,
|
||||
zipfile provider)
|
||||
|
||||
## v1.2.12:
|
||||
|
||||
* [COOK-1037] - specify version for rubyzip gem
|
||||
* [COOK-1007] - windows_feature does not work to remove features with
|
||||
dism
|
||||
* [COOK-667] - shortcut resource + provider for Windows platforms
|
||||
|
||||
## v1.2.10
|
||||
|
||||
* [COOK-939] - add `type` parameter to `windows_registry` to allow binary registry keys.
|
||||
* [COOK-940] - refactor logic so multiple values get created.
|
||||
|
||||
## v1.2.8
|
||||
|
||||
* FIX: Older Windows (Windows Server 2003) sometimes return 127 on successful forked commands
|
||||
* FIX: `windows_package`, ensure we pass the WOW* registry redirection flags into reg.open
|
||||
|
||||
## v1.2.6
|
||||
|
||||
* patch to fix [CHEF-2684], Open4 is named Open3 in Ruby 1.9
|
||||
* Ruby 1.9's Open3 returns 0 and 42 for successful commands
|
||||
* retry keyword can only be used in a rescue block in Ruby 1.9
|
||||
|
||||
## v1.2.4
|
||||
|
||||
* windows_package - catch Win32::Registry::Error that pops up when searching certain keys
|
||||
|
||||
## v1.2.2
|
||||
|
||||
* combined numerous helper libarires for easier sharing across libaries/LWRPs
|
||||
* renamed Chef::Provider::WindowsFeature::Base file to the more descriptive `feature_base.rb`
|
||||
* refactored windows_path LWRP
|
||||
* :add action should MODIFY the the underlying ENV variable (vs CREATE)
|
||||
* deleted greedy :remove action until it could be made more idempotent
|
||||
* added a windows_batch resource/provider for running batch scripts remotely
|
||||
|
||||
## v1.2.0
|
||||
|
||||
* [COOK-745] gracefully handle required server restarts on Windows platform
|
||||
* WindowsRebootHandler for requested and pending reboots
|
||||
* windows_reboot LWRP for requesting (receiving notifies) reboots
|
||||
* reboot_handler recipe for enabling WindowsRebootHandler as a report handler
|
||||
* [COOK-714] Correct initialize misspelling
|
||||
* RegistryHelper - new `get_values` method which returns all values for a particular key.
|
||||
|
||||
## v1.0.8
|
||||
|
||||
* [COOK-719] resource/provider for managing windows features
|
||||
* [COOK-717] remove `windows_env_vars` resource as env resource exists in core chef
|
||||
* new `Windows::Version` helper class
|
||||
* refactored `Windows::Helper` mixin
|
||||
|
||||
## v1.0.6
|
||||
|
||||
* added `force_modify` action to `windows_registry` resource
|
||||
* add `win_friendly_path` helper
|
||||
* re-purpose default recipe to install useful supporting windows related gems
|
||||
|
||||
## v1.0.4
|
||||
|
||||
* [COOK-700] new resources and improvements to the `windows_registry` provider (thanks Paul Morton!)
|
||||
* Open the registry in the bitednes of the OS
|
||||
* Provide convenience methods to check if keys and values exit
|
||||
* Provide convenience method for reading registry values
|
||||
* NEW - `windows_auto_run` resource/provider
|
||||
* NEW - `windows_env_vars` resource/provider
|
||||
* NEW - `windows_path` resource/provider
|
||||
* re-write of the windows_package logic for determining current installed packages
|
||||
* new checksum attribute for windows_package resource...useful for remote packages
|
||||
|
||||
## v1.0.2:
|
||||
|
||||
* [COOK-647] account for Wow6432Node registry redirecter
|
||||
* [COOK-656] begin/rescue on win32/registry
|
||||
|
||||
## 1.0.0:
|
||||
|
||||
* [COOK-612] initial release
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue