diff --git a/Vagrantfile b/Vagrantfile index 54955eaa0..b59891803 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/chef/.librarian/chef/config b/chef/.librarian/chef/config deleted file mode 100644 index 691ee08e4..000000000 --- a/chef/.librarian/chef/config +++ /dev/null @@ -1,3 +0,0 @@ ---- -LIBRARIAN_CHEF_INSTALL__STRIP_DOT_GIT: '1' - diff --git a/chef/Cheffile b/chef/Cheffile deleted file mode 100644 index d4c1e89bc..000000000 --- a/chef/Cheffile +++ /dev/null @@ -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' diff --git a/chef/Cheffile.lock b/chef/Cheffile.lock deleted file mode 100644 index fcdf684cb..000000000 --- a/chef/Cheffile.lock +++ /dev/null @@ -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) - diff --git a/chef/cookbooks/apt/.gitignore b/chef/cookbooks/apt/.gitignore deleted file mode 100644 index fc5b76d48..000000000 --- a/chef/cookbooks/apt/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.bundle -.cache -.kitchen -bin diff --git a/chef/cookbooks/apt/CHANGELOG.md b/chef/cookbooks/apt/CHANGELOG.md deleted file mode 100644 index 2f2c53caa..000000000 --- a/chef/cookbooks/apt/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/CONTRIBUTING b/chef/cookbooks/apt/CONTRIBUTING deleted file mode 100644 index 89ac873b4..000000000 --- a/chef/cookbooks/apt/CONTRIBUTING +++ /dev/null @@ -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. diff --git a/chef/cookbooks/apt/Gemfile b/chef/cookbooks/apt/Gemfile deleted file mode 100644 index 01e60b95c..000000000 --- a/chef/cookbooks/apt/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source :rubygems - -gem 'test-kitchen', '>= 0.7.0' diff --git a/chef/cookbooks/apt/Gemfile.lock b/chef/cookbooks/apt/Gemfile.lock deleted file mode 100644 index 07e4652e0..000000000 --- a/chef/cookbooks/apt/Gemfile.lock +++ /dev/null @@ -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) diff --git a/chef/cookbooks/apt/LICENSE b/chef/cookbooks/apt/LICENSE deleted file mode 100644 index 11069edd7..000000000 --- a/chef/cookbooks/apt/LICENSE +++ /dev/null @@ -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. diff --git a/chef/cookbooks/apt/README.md b/chef/cookbooks/apt/README.md deleted file mode 100644 index a4c6508d4..000000000 --- a/chef/cookbooks/apt/README.md +++ /dev/null @@ -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 () -Author:: Matt Ray () -Author:: Seth Chisamore () - -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. diff --git a/chef/cookbooks/apt/attributes/default.rb b/chef/cookbooks/apt/attributes/default.rb deleted file mode 100644 index 1f4ab34a0..000000000 --- a/chef/cookbooks/apt/attributes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -default['apt']['cacher-client']['restrict_environment'] = false -default['apt']['cacher_port'] = 3142 diff --git a/chef/cookbooks/apt/files/default/apt-proxy-v2.conf b/chef/cookbooks/apt/files/default/apt-proxy-v2.conf deleted file mode 100644 index 6541f25ed..000000000 --- a/chef/cookbooks/apt/files/default/apt-proxy-v2.conf +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/metadata.json b/chef/cookbooks/apt/metadata.json deleted file mode 100644 index 6c7b005bf..000000000 --- a/chef/cookbooks/apt/metadata.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "apt", - "description": "Configures apt and apt services and LWRPs for managing apt repositories and preferences", - "long_description": "Description\n===========\n\nThis cookbook includes recipes to execute apt-get update to ensure the\nlocal APT package cache is up to date. There are recipes for managing\nthe apt-cacher-ng caching proxy and proxy clients. It also includes a\nLWRP for managing APT repositories in /etc/apt/sources.list.d as well as\nan LWRP for pinning packages via /etc/apt/preferences.d.\n\nRequirements\n============\n\nVersion 1.8.2+ of this cookbook requires **Chef 10.16.4** or later.\n\nIf your Chef version is earlier than 10.16.4, use version 1.7.0 of\nthis cookbook.\n\nSee [CHEF-3493](http://tickets.opscode.com/browse/CHEF-3493) and\n[this code comment](http://bit.ly/VgvCgf) for more information on this\nrequirement.\n\nPlatform\n--------\n\n* Debian\n* Ubuntu\n\nMay work with or without modification on other Debian derivatives.\n\nRecipes\n=======\n\ndefault\n-------\n\nThis recipe installs the `update-notifier-common` package to provide\nthe timestamp file used to only run `apt-get update` if the cache is\nmore than one day old.\n\nThis recipe should appear first in the run list of Debian or Ubuntu\nnodes to ensure that the package cache is up to date before managing\nany `package` resources with Chef.\n\nThis recipe also sets up a local cache directory for preseeding packages.\n\ncacher-ng\n---------\n\nInstalls the `apt-cacher-ng` package and service so the system can\nprovide APT caching. You can check the usage report at\nhttp://{hostname}:3142/acng-report.html. The `cacher-ng` recipe\nincludes the `cacher-client` recipe, so it helps seed itself.\n\ncacher-client\n-------------\nConfigures the node to use the `apt-cacher-ng` server as a client. If you\nwant to restrict your node to using the `apt-cacher-ng` server in your\nEnvironment, set `['apt']['cacher-client']['restrict_environment']` to `true`.\nTo use a cacher server (or standard proxy server) not available via search\nset the atttribute `['apt']['cacher-ipaddress']` and for a custom port\nset `['apt']['cacher_port']`\n\nResources/Providers\n===================\n\nManaging repositories\n---------------------\n\nThis LWRP provides an easy way to manage additional APT repositories.\nAdding a new repository will notify running the `execute[apt-get-update]`\nresource immediately.\n\n# Actions\n\n- :add: creates a repository file and builds the repository listing\n- :remove: removes the repository file\n\n# Attribute Parameters\n\n- repo_name: name attribute. The name of the channel to discover\n- uri: the base of the Debian distribution\n- distribution: this is usually your release's codename...ie something\n like `karmic`, `lucid` or `maverick`\n- components: package groupings..when it doubt use `main`\n- arch: constrain package to a particular arch like `i386`, `amd64` or\n even `armhf` or `powerpc`. Defaults to nil.\n- deb_src: whether or not to add the repository as a source repo as\n well - value can be `true` or `false`, default `false`.\n- keyserver: the GPG keyserver where the key for the repo should be retrieved\n- key: if a `keyserver` is provided, this is assumed to be the\n fingerprint, otherwise it can be either the URI to the GPG key for\n the repo, or a cookbook_file.\n- cookbook: if key should be a cookbook_file, specify a cookbook where\n the key is located for files/default. Defaults to nil, so it will\n use the cookbook where the resource is used.\n\n# Examples\n\n # add the Zenoss repo\n apt_repository \"zenoss\" do\n uri \"http://dev.zenoss.org/deb\"\n components [\"main\",\"stable\"]\n end\n\n # add the Nginx PPA; grab key from keyserver\n apt_repository \"nginx-php\" do\n uri \"http://ppa.launchpad.net/nginx/php5/ubuntu\"\n distribution node['lsb']['codename']\n components [\"main\"]\n keyserver \"keyserver.ubuntu.com\"\n key \"C300EE8C\"\n end\n\n # add the Nginx PPA; grab key from keyserver, also add source repo\n apt_repository \"nginx-php\" do\n uri \"http://ppa.launchpad.net/nginx/php5/ubuntu\"\n distribution node['lsb']['codename']\n components [\"main\"]\n keyserver \"keyserver.ubuntu.com\"\n key \"C300EE8C\"\n deb_src true\n end\n\n # add the Cloudkick Repo\n apt_repository \"cloudkick\" do\n uri \"http://packages.cloudkick.com/ubuntu\"\n distribution node['lsb']['codename']\n components [\"main\"]\n key \"http://packages.cloudkick.com/cloudkick.packages.key\"\n end\n\n # add the Cloudkick Repo with the key downloaded in the cookbook\n apt_repository \"cloudkick\" do\n uri \"http://packages.cloudkick.com/ubuntu\"\n distribution node['lsb']['codename']\n components [\"main\"]\n key \"cloudkick.packages.key\"\n end\n\n # add the Cloudera Repo of CDH4 packages for Ubuntu 12.04 on AMD64\n apt_repository \"cloudera\" do\n uri \"http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh\"\n arch \"amd64\"\n distribution \"precise-cdh4\"\n components [\"contrib\"]\n key \"http://archive.cloudera.com/debian/archive.key\"\n end\n\n # remove Zenoss repo\n apt_repository \"zenoss\" do\n action :remove\n end\n\nPinning packages\n----------------\n\nThis LWRP provides an easy way to pin packages in /etc/apt/preferences.d.\nAlthough apt-pinning is quite helpful from time to time please note that Debian\ndoes not encourage its use without thorough consideration.\n\nFurther information regarding apt-pinning is available via\nhttp://wiki.debian.org/AptPreferences.\n\n# Actions\n\n- :add: creates a preferences file under /etc/apt/preferences.d\n- :remove: Removes the file, therefore unpin the package\n\n# Attribute Parameters\n\n- package_name: name attribute. The name of the package\n- pin: The package version/repository to pin\n- pin_priority: The pinning priority aka \"the highest package version wins\"\n\n# Examples\n\n # Pin libmysqlclient16 to version 5.1.49-3\n apt_preference \"libmysqlclient16\" do\n pin \"version 5.1.49-3\"\n pin_priority \"700\"\n end\n\n # Unpin libmysqlclient16\n apt_preference \"libmysqlclient16\" do\n action :remove\n end\n\nUsage\n=====\n\nPut `recipe[apt]` first in the run list. If you have other recipes\nthat you want to use to configure how apt behaves, like new sources,\nnotify the execute resource to run, e.g.:\n\n template \"/etc/apt/sources.list.d/my_apt_sources.list\" do\n notifies :run, resources(:execute => \"apt-get update\"), :immediately\n end\n\nThe above will run during execution phase since it is a normal\ntemplate resource, and should appear before other package resources\nthat need the sources in the template.\n\nPut `recipe[apt::cacher-ng]` in the run_list for a server to provide\nAPT caching and add `recipe[apt::cacher-client]` on the rest of the\nDebian-based nodes to take advantage of the caching server.\n\nIf you want to cleanup unused packages, there is also the `apt-get autoclean`\nand `apt-get autoremove` resources provided for automated cleanup.\n\nLicense and Author\n==================\n\nAuthor:: Joshua Timberman ()\nAuthor:: Matt Ray ()\nAuthor:: Seth Chisamore ()\n\nCopyright 2009-2012 Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", - "maintainer": "Opscode, Inc.", - "maintainer_email": "cookbooks@opscode.com", - "license": "Apache 2.0", - "platforms": { - "ubuntu": ">= 0.0.0", - "debian": ">= 0.0.0" - }, - "dependencies": { - }, - "recommendations": { - }, - "suggestions": { - }, - "conflicting": { - }, - "providing": { - }, - "replacing": { - }, - "attributes": { - }, - "groupings": { - }, - "recipes": { - "apt": "Runs apt-get update during compile phase and sets up preseed directories", - "apt::cacher-ng": "Set up an apt-cacher-ng caching proxy", - "apt::cacher-client": "Client for the apt::cacher-ng caching proxy" - }, - "version": "1.8.4" -} \ No newline at end of file diff --git a/chef/cookbooks/apt/metadata.rb b/chef/cookbooks/apt/metadata.rb deleted file mode 100644 index 27f7d9302..000000000 --- a/chef/cookbooks/apt/metadata.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/providers/preference.rb b/chef/cookbooks/apt/providers/preference.rb deleted file mode 100644 index abfb440e8..000000000 --- a/chef/cookbooks/apt/providers/preference.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/providers/repository.rb b/chef/cookbooks/apt/providers/repository.rb deleted file mode 100644 index da7e4f258..000000000 --- a/chef/cookbooks/apt/providers/repository.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/recipes/cacher-client.rb b/chef/cookbooks/apt/recipes/cacher-client.rb deleted file mode 100644 index 35f1bdfe3..000000000 --- a/chef/cookbooks/apt/recipes/cacher-client.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/recipes/cacher-ng.rb b/chef/cookbooks/apt/recipes/cacher-ng.rb deleted file mode 100644 index 9b986971c..000000000 --- a/chef/cookbooks/apt/recipes/cacher-ng.rb +++ /dev/null @@ -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" diff --git a/chef/cookbooks/apt/recipes/default.rb b/chef/cookbooks/apt/recipes/default.rb deleted file mode 100644 index 00dd40a94..000000000 --- a/chef/cookbooks/apt/recipes/default.rb +++ /dev/null @@ -1,68 +0,0 @@ -# -# Cookbook Name:: apt -# Recipe:: default -# -# Copyright 2008-2011, Opscode, Inc. -# Copyright 2009, Bryan McLellan -# -# 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 diff --git a/chef/cookbooks/apt/resources/preference.rb b/chef/cookbooks/apt/resources/preference.rb deleted file mode 100644 index 89558e850..000000000 --- a/chef/cookbooks/apt/resources/preference.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/resources/repository.rb b/chef/cookbooks/apt/resources/repository.rb deleted file mode 100644 index 7515da412..000000000 --- a/chef/cookbooks/apt/resources/repository.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/apt/templates/default/01proxy.erb b/chef/cookbooks/apt/templates/default/01proxy.erb deleted file mode 100644 index eea71c230..000000000 --- a/chef/cookbooks/apt/templates/default/01proxy.erb +++ /dev/null @@ -1,2 +0,0 @@ -Acquire::http::Proxy "http://<%= @proxy %>:<%= @port %>"; -Acquire::https::Proxy "DIRECT"; diff --git a/chef/cookbooks/apt/templates/default/acng.conf.erb b/chef/cookbooks/apt/templates/default/acng.conf.erb deleted file mode 100644 index a98de8542..000000000 --- a/chef/cookbooks/apt/templates/default/acng.conf.erb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/build-essential/.gitignore b/chef/cookbooks/build-essential/.gitignore deleted file mode 100644 index fc5b76d48..000000000 --- a/chef/cookbooks/build-essential/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.bundle -.cache -.kitchen -bin diff --git a/chef/cookbooks/build-essential/CHANGELOG.md b/chef/cookbooks/build-essential/CHANGELOG.md deleted file mode 100644 index 4149decfd..000000000 --- a/chef/cookbooks/build-essential/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/chef/cookbooks/build-essential/CONTRIBUTING b/chef/cookbooks/build-essential/CONTRIBUTING deleted file mode 100644 index 89ac873b4..000000000 --- a/chef/cookbooks/build-essential/CONTRIBUTING +++ /dev/null @@ -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. diff --git a/chef/cookbooks/build-essential/Gemfile b/chef/cookbooks/build-essential/Gemfile deleted file mode 100644 index 5586844c5..000000000 --- a/chef/cookbooks/build-essential/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source :rubygems - -gem 'test-kitchen', '<= 1.0' diff --git a/chef/cookbooks/build-essential/LICENSE b/chef/cookbooks/build-essential/LICENSE deleted file mode 100644 index 11069edd7..000000000 --- a/chef/cookbooks/build-essential/LICENSE +++ /dev/null @@ -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. diff --git a/chef/cookbooks/build-essential/README.md b/chef/cookbooks/build-essential/README.md deleted file mode 100644 index b3b8fb05f..000000000 --- a/chef/cookbooks/build-essential/README.md +++ /dev/null @@ -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 () -Author:: Seth Chisamore () - -Copyright 2009-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. diff --git a/chef/cookbooks/build-essential/attributes/default.rb b/chef/cookbooks/build-essential/attributes/default.rb deleted file mode 100644 index f45750f02..000000000 --- a/chef/cookbooks/build-essential/attributes/default.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/build-essential/metadata.json b/chef/cookbooks/build-essential/metadata.json deleted file mode 100644 index e9301a787..000000000 --- a/chef/cookbooks/build-essential/metadata.json +++ /dev/null @@ -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" -} \ No newline at end of file diff --git a/chef/cookbooks/build-essential/metadata.rb b/chef/cookbooks/build-essential/metadata.rb deleted file mode 100644 index 70b6add3d..000000000 --- a/chef/cookbooks/build-essential/metadata.rb +++ /dev/null @@ -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" diff --git a/chef/cookbooks/build-essential/recipes/default.rb b/chef/cookbooks/build-essential/recipes/default.rb deleted file mode 100644 index 4eff37384..000000000 --- a/chef/cookbooks/build-essential/recipes/default.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/chef_handler/CHANGELOG.md b/chef/cookbooks/chef_handler/CHANGELOG.md deleted file mode 100644 index a249ec322..000000000 --- a/chef/cookbooks/chef_handler/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/chef/cookbooks/chef_handler/CONTRIBUTING b/chef/cookbooks/chef_handler/CONTRIBUTING deleted file mode 100644 index 89ac873b4..000000000 --- a/chef/cookbooks/chef_handler/CONTRIBUTING +++ /dev/null @@ -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. diff --git a/chef/cookbooks/chef_handler/LICENSE b/chef/cookbooks/chef_handler/LICENSE deleted file mode 100644 index 11069edd7..000000000 --- a/chef/cookbooks/chef_handler/LICENSE +++ /dev/null @@ -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. diff --git a/chef/cookbooks/chef_handler/README.md b/chef/cookbooks/chef_handler/README.md deleted file mode 100644 index ab99822a1..000000000 --- a/chef/cookbooks/chef_handler/README.md +++ /dev/null @@ -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 () - -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. diff --git a/chef/cookbooks/chef_handler/attributes/default.rb b/chef/cookbooks/chef_handler/attributes/default.rb deleted file mode 100644 index 19d2fec9f..000000000 --- a/chef/cookbooks/chef_handler/attributes/default.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Author:: Seth Chisamore () -# 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" diff --git a/chef/cookbooks/chef_handler/files/default/handlers/README b/chef/cookbooks/chef_handler/files/default/handlers/README deleted file mode 100644 index b5750660a..000000000 --- a/chef/cookbooks/chef_handler/files/default/handlers/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains Chef handlers to distribute to your nodes. diff --git a/chef/cookbooks/chef_handler/metadata.json b/chef/cookbooks/chef_handler/metadata.json deleted file mode 100644 index fbdc1f681..000000000 --- a/chef/cookbooks/chef_handler/metadata.json +++ /dev/null @@ -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 ()\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" -} \ No newline at end of file diff --git a/chef/cookbooks/chef_handler/metadata.rb b/chef/cookbooks/chef_handler/metadata.rb deleted file mode 100644 index 703ae11e7..000000000 --- a/chef/cookbooks/chef_handler/metadata.rb +++ /dev/null @@ -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" diff --git a/chef/cookbooks/chef_handler/providers/default.rb b/chef/cookbooks/chef_handler/providers/default.rb deleted file mode 100644 index 49d60595e..000000000 --- a/chef/cookbooks/chef_handler/providers/default.rb +++ /dev/null @@ -1,93 +0,0 @@ -# -# Author:: Seth Chisamore -# Cookbook Name:: chef_handler -# Provider:: 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. -# - -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 diff --git a/chef/cookbooks/chef_handler/recipes/default.rb b/chef/cookbooks/chef_handler/recipes/default.rb deleted file mode 100644 index 540a5ffa7..000000000 --- a/chef/cookbooks/chef_handler/recipes/default.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Author:: Seth Chisamore () -# 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) diff --git a/chef/cookbooks/chef_handler/recipes/json_file.rb b/chef/cookbooks/chef_handler/recipes/json_file.rb deleted file mode 100644 index d2fab1054..000000000 --- a/chef/cookbooks/chef_handler/recipes/json_file.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# Author:: Seth Chisamore () -# 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) diff --git a/chef/cookbooks/chef_handler/resources/default.rb b/chef/cookbooks/chef_handler/resources/default.rb deleted file mode 100644 index f74aafa6c..000000000 --- a/chef/cookbooks/chef_handler/resources/default.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# Author:: Seth Chisamore -# Cookbook Name:: chef_handler -# Resource:: 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. -# - -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 diff --git a/chef/cookbooks/discourse/recipes/default.rb b/chef/cookbooks/discourse/recipes/default.rb deleted file mode 100644 index 7313bce44..000000000 --- a/chef/cookbooks/discourse/recipes/default.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/imagemagick/CHANGELOG.md b/chef/cookbooks/imagemagick/CHANGELOG.md deleted file mode 100644 index b9cf734bf..000000000 --- a/chef/cookbooks/imagemagick/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/chef/cookbooks/imagemagick/README.md b/chef/cookbooks/imagemagick/README.md deleted file mode 100644 index 0da714e06..000000000 --- a/chef/cookbooks/imagemagick/README.md +++ /dev/null @@ -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 () - -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. diff --git a/chef/cookbooks/imagemagick/metadata.json b/chef/cookbooks/imagemagick/metadata.json deleted file mode 100644 index 30852e063..000000000 --- a/chef/cookbooks/imagemagick/metadata.json +++ /dev/null @@ -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 ()\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" - } -} \ No newline at end of file diff --git a/chef/cookbooks/imagemagick/metadata.rb b/chef/cookbooks/imagemagick/metadata.rb deleted file mode 100644 index fe3015f12..000000000 --- a/chef/cookbooks/imagemagick/metadata.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/imagemagick/recipes/default.rb b/chef/cookbooks/imagemagick/recipes/default.rb deleted file mode 100644 index 5bef370ce..000000000 --- a/chef/cookbooks/imagemagick/recipes/default.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/imagemagick/recipes/devel.rb b/chef/cookbooks/imagemagick/recipes/devel.rb deleted file mode 100644 index 35f53962c..000000000 --- a/chef/cookbooks/imagemagick/recipes/devel.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/imagemagick/recipes/rmagick.rb b/chef/cookbooks/imagemagick/recipes/rmagick.rb deleted file mode 100644 index d4c085ffb..000000000 --- a/chef/cookbooks/imagemagick/recipes/rmagick.rb +++ /dev/null @@ -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" diff --git a/chef/cookbooks/java/.gitignore b/chef/cookbooks/java/.gitignore deleted file mode 100644 index 09a8860ce..000000000 --- a/chef/cookbooks/java/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.bundle -.cache -.kitchen -bin -#*# -*~ -.#*# diff --git a/chef/cookbooks/java/CHANGELOG.md b/chef/cookbooks/java/CHANGELOG.md deleted file mode 100644 index b2bab5dd3..000000000 --- a/chef/cookbooks/java/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/chef/cookbooks/java/CONTRIBUTING.md b/chef/cookbooks/java/CONTRIBUTING.md deleted file mode 100644 index 3a9989787..000000000 --- a/chef/cookbooks/java/CONTRIBUTING.md +++ /dev/null @@ -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. diff --git a/chef/cookbooks/java/Gemfile b/chef/cookbooks/java/Gemfile deleted file mode 100644 index 46e07661a..000000000 --- a/chef/cookbooks/java/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source :rubygems - -gem 'test-kitchen', '< 1.0' diff --git a/chef/cookbooks/java/LICENSE b/chef/cookbooks/java/LICENSE deleted file mode 100644 index 11069edd7..000000000 --- a/chef/cookbooks/java/LICENSE +++ /dev/null @@ -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. diff --git a/chef/cookbooks/java/README.md b/chef/cookbooks/java/README.md deleted file mode 100644 index a1468136a..000000000 --- a/chef/cookbooks/java/README.md +++ /dev/null @@ -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 () -Author:: Bryan W. Berry () - -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. diff --git a/chef/cookbooks/java/attributes/default.rb b/chef/cookbooks/java/attributes/default.rb deleted file mode 100644 index 3613d17a0..000000000 --- a/chef/cookbooks/java/attributes/default.rb +++ /dev/null @@ -1,77 +0,0 @@ -# -# Author:: Seth Chisamore () -# 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' diff --git a/chef/cookbooks/java/files/default/tests/minitest/openjdk_test.rb b/chef/cookbooks/java/files/default/tests/minitest/openjdk_test.rb deleted file mode 100644 index d17a7415a..000000000 --- a/chef/cookbooks/java/files/default/tests/minitest/openjdk_test.rb +++ /dev/null @@ -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 - diff --git a/chef/cookbooks/java/files/default/tests/minitest/oracle_test.rb b/chef/cookbooks/java/files/default/tests/minitest/oracle_test.rb deleted file mode 100644 index 1759b0ad8..000000000 --- a/chef/cookbooks/java/files/default/tests/minitest/oracle_test.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/java/metadata.json b/chef/cookbooks/java/metadata.json deleted file mode 100644 index facc84dc5..000000000 --- a/chef/cookbooks/java/metadata.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "java", - "description": "Installs Java runtime.", - "long_description": "Description\n===========\n\nInstalls a Java. Uses OpenJDK by default but supports installation of Oracle's JDK.\n\nThis cookbook contains the `java_ark` LWPR which has been deprecated\nin favor of [ark](https://github.com/opscode-cookbooks/ark).\n\n**IMPORTANT NOTE**\n\nAs of 26 March 2012 you can no longer directly download\nthe JDK from Oracle's website without using a special cookie. This cookbook uses\nthat cookie to download the oracle recipe on your behalf, but . . .\n\nthe java::oracle recipe forces you to set either override\nthe `node['java']['oracle']['accept_oracle_download_terms']` to true or set up a\nprivate repository accessible by HTTP.\n\nExample\n\n### override the `accept_oracle_download_terms`\n\nroles/base.rb\nThis cookbook also provides the `java_ark` LWRP which other java\ncookbooks can use to install java-related applications from binary\npackages.\n\n default_attributes(\n :java => {\n :oracle => {\n \"accept_oracle_download_terms\" => true\n }\n }\n )\n\nYou are most encouraged to voice your complaints to Oracle and/or\nswitch to OpenJDK.\n\nRequirements\n============\n\nPlatform\n--------\n\n* Debian, Ubuntu\n* CentOS, Red Hat, Fedora, Scientific, Amazon\n* ArchLinux\n* FreeBSD\n* Windows\n\nAttributes\n==========\n\nSee `attributes/default.rb` for default values.\n\n* `node[\"java\"][\"install_flavor\"]` - Flavor of JVM you would like installed (`oracle` or\n`openjdk`), default `openjdk`.\n* `node['java']['java_home']` - Default location of the \"`$JAVA_HOME`\".\n* `node['java']['tarball']` - Name of the tarball to retrieve from your corporate\nrepository default `jdk1.6.0_29_i386.tar.gz`\n* `node['java']['tarball_checksum']` - Checksum for the tarball, if you use a different\ntarball, you also need to create a new sha256 checksum\n* `node['java']['jdk']` - Version and architecture specific attributes for setting the\nURL on Oracle's site for the JDK, and the checksum of the .tar.gz.\n* `node['java']['remove_deprecated_packages']` - Removes the now deprecated Ubuntu JDK\npackages from the system, default `false`\n* `node['java']['oracle']['accept_oracle_download_terms']` - Indicates that you accept\n Oracle's EULA\n* `node['java']['windows']['url']` - The internal location of your java install for windows\n* `node['java']['windows']['package_name']` - The package name used by windows_package to\n check in the registry to determine if the install has already been run\n\nRecipes\n=======\n\ndefault\n-------\n\nInclude the default recipe in a run list, to get `java`. By default\nthe `openjdk` flavor of Java is installed, but this can be changed by\nusing the `install_flavor` attribute. If the platform is windows it \nwill include the windows recipe instead.\n\nOpenJDK is the default because of licensing changes made upstream by\nOracle. See notes on the `oracle` recipe below.\n\nopenjdk\n-------\n\nThis recipe installs the `openjdk` flavor of Java.\n\noracle\n------\n\nThis recipe installs the `oracle` flavor of Java. This recipe does not\nuse distribution packages as Oracle changed the licensing terms with\nJDK 1.6u27 and prohibited the practice for both the debian and EL worlds.\n\nFor both debian and centos/rhel, this recipe pulls the binary\ndistribution from the Oracle website, and installs it in the default\nJAVA_HOME for each distribution. For debian/ubuntu, this is\n/usr/lib/jvm/default-java. For Centos/RHEL, this is /usr/lib/jvm/java\n\nAfter putting the binaries in place, the oracle recipe updates\n/usr/bin/java to point to the installed JDK using the\n`update-alternatives` script\n\noracle_i386\n-----------\n\nThis recipe installs the 32-bit Java virtual machine without setting\nit as the default. This can be useful if you have applications on the\nsame machine that require different versions of the JVM.\n\nwindows\n-------\n\nBecause there is no easy way to pull the java msi off oracle's site, \nthis recipe requires you to host it internally on your own http repo.\n\nResources/Providers\n===================\n\nThis cookbook contains the `java_ark` LWPR which has been deprecated\nin favor of [ark](https://github.com/opscode-cookbooks/ark).\n\nBy default, the extracted directory is extracted to\n`app_root/extracted_dir_name` and symlinked to `app_root/default`\n\n# Actions\n\n- `:install`: extracts the tarball and makes necessary symlinks\n- `:remove`: removes the tarball and run update-alternatives for all\n symlinked `bin_cmds`\n\n# Attribute Parameters\n\n- `url`: path to tarball, .tar.gz, .bin (oracle-specific), and .zip\n currently supported\n- `checksum`: sha256 checksum, not used for security but avoid\n redownloading the archive on each chef-client run\n- `app_home`: the default for installations of this type of\n application, for example, `/usr/lib/tomcat/default`. If your\n application is not set to the default, it will be placed at the same\n level in the directory hierarchy but the directory name will be\n `app_root/extracted_directory_name + \"_alt\"`\n- `app_home_mode`: file mode for app_home, is an integer\n- `bin_cmds`: array of binary commands that should be symlinked to\n /usr/bin, examples are mvn, java, javac, etc. These cmds must be in\n the bin/ subdirectory of the extracted folder. Will be ignored if this\n java_ark is not the default\n- `owner`: owner of extracted directory, set to \"root\" by default\n- `default`: whether this the default installation of this package,\n boolean true or false\n\n\n# Examples\n\n # install jdk6 from Oracle\n java_ark \"jdk\" do\n url 'http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64.bin'\n checksum 'a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365'\n app_home '/usr/local/java/default'\n bin_cmds [\"java\", \"javac\"]\n action :install\n end\n\n\nUsage\n=====\n\nSimply include the `java` recipe where ever you would like Java installed.\n\nTo install Oracle flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role:\n\n name \"java\"\n description \"Install Oracle Java on Ubuntu\"\n override_attributes(\n \"java\" => {\n \"install_flavor\" => \"oracle\"\n }\n )\n run_list(\n \"recipe[java]\"\n )\n\nDevelopment\n===========\n\nThis cookbook uses\n[test-kitchen](https://github.com/opscode/test-kitchen) for\nintegration tests. Pull requests should pass existing tests in\nfiles/default/tests/minitest-handler. Additional tests are always welcome.\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore ()\nAuthor:: Bryan W. Berry ()\n\nCopyright:: 2008-2012, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", - "maintainer": "Opscode, Inc.", - "maintainer_email": "cookbooks@opscode.com", - "license": "Apache 2.0", - "platforms": { - "debian": ">= 0.0.0", - "ubuntu": ">= 0.0.0", - "centos": ">= 0.0.0", - "redhat": ">= 0.0.0", - "scientific": ">= 0.0.0", - "fedora": ">= 0.0.0", - "amazon": ">= 0.0.0", - "arch": ">= 0.0.0", - "oracle": ">= 0.0.0", - "freebsd": ">= 0.0.0", - "windows": ">= 0.0.0" - }, - "dependencies": { - "windows": ">= 0.0.0" - }, - "recommendations": { - }, - "suggestions": { - }, - "conflicting": { - }, - "providing": { - }, - "replacing": { - }, - "attributes": { - }, - "groupings": { - }, - "recipes": { - "java": "Installs Java runtime", - "java::openjdk": "Installs the OpenJDK flavor of Java", - "java::oracle": "Installs the Oracle flavor of Java", - "java::oracle_i386": "Installs the 32-bit jvm without setting it as the default" - }, - "version": "1.10.0" -} \ No newline at end of file diff --git a/chef/cookbooks/java/metadata.rb b/chef/cookbooks/java/metadata.rb deleted file mode 100644 index 0cf992a4b..000000000 --- a/chef/cookbooks/java/metadata.rb +++ /dev/null @@ -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" diff --git a/chef/cookbooks/java/providers/ark.rb b/chef/cookbooks/java/providers/ark.rb deleted file mode 100644 index 7d0072307..000000000 --- a/chef/cookbooks/java/providers/ark.rb +++ /dev/null @@ -1,264 +0,0 @@ -# -# Author:: Bryan W. Berry () -# 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 diff --git a/chef/cookbooks/java/recipes/default.rb b/chef/cookbooks/java/recipes/default.rb deleted file mode 100644 index 7b21843c5..000000000 --- a/chef/cookbooks/java/recipes/default.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Author:: Seth Chisamore () -# 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 diff --git a/chef/cookbooks/java/recipes/openjdk.rb b/chef/cookbooks/java/recipes/openjdk.rb deleted file mode 100644 index c623348d2..000000000 --- a/chef/cookbooks/java/recipes/openjdk.rb +++ /dev/null @@ -1,97 +0,0 @@ -# Author:: Bryan W. Berry () -# Author:: Seth Chisamore () -# 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 diff --git a/chef/cookbooks/java/recipes/oracle.rb b/chef/cookbooks/java/recipes/oracle.rb deleted file mode 100644 index 578d3dd4f..000000000 --- a/chef/cookbooks/java/recipes/oracle.rb +++ /dev/null @@ -1,68 +0,0 @@ -# -# Author:: Bryan W. Berry () -# 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 - diff --git a/chef/cookbooks/java/recipes/oracle_i386.rb b/chef/cookbooks/java/recipes/oracle_i386.rb deleted file mode 100644 index 3f89f2994..000000000 --- a/chef/cookbooks/java/recipes/oracle_i386.rb +++ /dev/null @@ -1,52 +0,0 @@ -# -# Author:: Bryan W. Berry () -# 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 diff --git a/chef/cookbooks/java/recipes/windows.rb b/chef/cookbooks/java/recipes/windows.rb deleted file mode 100644 index 8480edc45..000000000 --- a/chef/cookbooks/java/recipes/windows.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# Author:: Kendrick Martin () -# 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 \ No newline at end of file diff --git a/chef/cookbooks/java/resources/ark.rb b/chef/cookbooks/java/resources/ark.rb deleted file mode 100644 index d96042c31..000000000 --- a/chef/cookbooks/java/resources/ark.rb +++ /dev/null @@ -1,38 +0,0 @@ -# -# Author:: Bryan W. Berry () -# 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 diff --git a/chef/cookbooks/java/templates/default/oracle.jinfo.erb b/chef/cookbooks/java/templates/default/oracle.jinfo.erb deleted file mode 100644 index 0d10b515e..000000000 --- a/chef/cookbooks/java/templates/default/oracle.jinfo.erb +++ /dev/null @@ -1,6 +0,0 @@ -name=<%= @name %> -priority=<%= @priority %> -section=main - -<% @bin_cmds.each do |cmd| -%>jdk <%= cmd %> <%= @app_dir %>/bin/<%= cmd %> -<% end -%> diff --git a/chef/cookbooks/omnibus_updater/.gitignore b/chef/cookbooks/omnibus_updater/.gitignore deleted file mode 100644 index d14fc3c00..000000000 --- a/chef/cookbooks/omnibus_updater/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.* -!.gitignore -!.kitchen.yml -bin -Gemfile.lock -Cheffile.lock -tmp* \ No newline at end of file diff --git a/chef/cookbooks/omnibus_updater/.kitchen.yml b/chef/cookbooks/omnibus_updater/.kitchen.yml deleted file mode 100644 index fbc6fb993..000000000 --- a/chef/cookbooks/omnibus_updater/.kitchen.yml +++ /dev/null @@ -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] diff --git a/chef/cookbooks/omnibus_updater/CHANGELOG.md b/chef/cookbooks/omnibus_updater/CHANGELOG.md deleted file mode 100644 index 0f1a522be..000000000 --- a/chef/cookbooks/omnibus_updater/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/Cheffile b/chef/cookbooks/omnibus_updater/Cheffile deleted file mode 100644 index c9538720d..000000000 --- a/chef/cookbooks/omnibus_updater/Cheffile +++ /dev/null @@ -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' \ No newline at end of file diff --git a/chef/cookbooks/omnibus_updater/Gemfile b/chef/cookbooks/omnibus_updater/Gemfile deleted file mode 100644 index f948d094e..000000000 --- a/chef/cookbooks/omnibus_updater/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source :rubygems - -gem 'vagabond' diff --git a/chef/cookbooks/omnibus_updater/README.md b/chef/cookbooks/omnibus_updater/README.md deleted file mode 100644 index 6c5636423..000000000 --- a/chef/cookbooks/omnibus_updater/README.md +++ /dev/null @@ -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 \ No newline at end of file diff --git a/chef/cookbooks/omnibus_updater/attributes/default.rb b/chef/cookbooks/omnibus_updater/attributes/default.rb deleted file mode 100644 index c51027e36..000000000 --- a/chef/cookbooks/omnibus_updater/attributes/default.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/libraries/omnibus_checker.rb b/chef/cookbooks/omnibus_updater/libraries/omnibus_checker.rb deleted file mode 100644 index 445ae2ab4..000000000 --- a/chef/cookbooks/omnibus_updater/libraries/omnibus_checker.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/libraries/omnitrucker.rb b/chef/cookbooks/omnibus_updater/libraries/omnitrucker.rb deleted file mode 100644 index da15a99d1..000000000 --- a/chef/cookbooks/omnibus_updater/libraries/omnitrucker.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/metadata.rb b/chef/cookbooks/omnibus_updater/metadata.rb deleted file mode 100644 index 8333fb9c5..000000000 --- a/chef/cookbooks/omnibus_updater/metadata.rb +++ /dev/null @@ -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" - diff --git a/chef/cookbooks/omnibus_updater/recipes/default.rb b/chef/cookbooks/omnibus_updater/recipes/default.rb deleted file mode 100644 index ab71128ef..000000000 --- a/chef/cookbooks/omnibus_updater/recipes/default.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/recipes/downloader.rb b/chef/cookbooks/omnibus_updater/recipes/downloader.rb deleted file mode 100644 index 17948a504..000000000 --- a/chef/cookbooks/omnibus_updater/recipes/downloader.rb +++ /dev/null @@ -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' diff --git a/chef/cookbooks/omnibus_updater/recipes/installer.rb b/chef/cookbooks/omnibus_updater/recipes/installer.rb deleted file mode 100644 index ee99670b6..000000000 --- a/chef/cookbooks/omnibus_updater/recipes/installer.rb +++ /dev/null @@ -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' diff --git a/chef/cookbooks/omnibus_updater/recipes/old_package_cleaner.rb b/chef/cookbooks/omnibus_updater/recipes/old_package_cleaner.rb deleted file mode 100644 index 51edb2eb8..000000000 --- a/chef/cookbooks/omnibus_updater/recipes/old_package_cleaner.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/recipes/remove_chef_system_gem.rb b/chef/cookbooks/omnibus_updater/recipes/remove_chef_system_gem.rb deleted file mode 100644 index 9db164486..000000000 --- a/chef/cookbooks/omnibus_updater/recipes/remove_chef_system_gem.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/test/kitchen/Kitchenfile b/chef/cookbooks/omnibus_updater/test/kitchen/Kitchenfile deleted file mode 100644 index 86a12c63e..000000000 --- a/chef/cookbooks/omnibus_updater/test/kitchen/Kitchenfile +++ /dev/null @@ -1,6 +0,0 @@ -cookbook "omnibus_updater" do - configuration "default" - configuration "version_upgrade" - configuration "search" - lint false -end diff --git a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/default_test.rb b/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/default_test.rb deleted file mode 100644 index f93cfa43a..000000000 --- a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/default_test.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/version_upgrade_test.rb b/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/version_upgrade_test.rb deleted file mode 100644 index b9a53de18..000000000 --- a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/version_upgrade_test.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/metadata.rb b/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/metadata.rb deleted file mode 100644 index 6be474e15..000000000 --- a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/metadata.rb +++ /dev/null @@ -1,4 +0,0 @@ -name 'omnibus_updater_test' -version '0.0.1' -depends "omnibus_updater" -depends "minitest-handler" diff --git a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/recipes/default.rb b/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/recipes/default.rb deleted file mode 100644 index 9717f06c9..000000000 --- a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/recipes/default.rb +++ /dev/null @@ -1,3 +0,0 @@ -node.set[:omnibus_updater][:kill_chef_on_upgrade] = false -node.set[:omnibus_updater][:version] = false -include_recipe "omnibus_updater" diff --git a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/recipes/version_upgrade.rb b/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/recipes/version_upgrade.rb deleted file mode 100644 index bfb2a6e78..000000000 --- a/chef/cookbooks/omnibus_updater/test/kitchen/cookbooks/omnibus_updater_test/recipes/version_upgrade.rb +++ /dev/null @@ -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" diff --git a/chef/cookbooks/vim/README.md b/chef/cookbooks/vim/README.md deleted file mode 100644 index 7186b128a..000000000 --- a/chef/cookbooks/vim/README.md +++ /dev/null @@ -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 - -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 diff --git a/chef/cookbooks/vim/attributes/default.rb b/chef/cookbooks/vim/attributes/default.rb deleted file mode 100644 index 08e9e47d4..000000000 --- a/chef/cookbooks/vim/attributes/default.rb +++ /dev/null @@ -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] = [] diff --git a/chef/cookbooks/vim/metadata.json b/chef/cookbooks/vim/metadata.json deleted file mode 100644 index f743602c6..000000000 --- a/chef/cookbooks/vim/metadata.json +++ /dev/null @@ -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 \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" -} \ No newline at end of file diff --git a/chef/cookbooks/vim/metadata.rb b/chef/cookbooks/vim/metadata.rb deleted file mode 100644 index 25f185d0f..000000000 --- a/chef/cookbooks/vim/metadata.rb +++ /dev/null @@ -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 - diff --git a/chef/cookbooks/vim/recipes/default.rb b/chef/cookbooks/vim/recipes/default.rb deleted file mode 100644 index cb5f1a2c6..000000000 --- a/chef/cookbooks/vim/recipes/default.rb +++ /dev/null @@ -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 diff --git a/chef/cookbooks/windows/CHANGELOG.md b/chef/cookbooks/windows/CHANGELOG.md deleted file mode 100644 index 6b493f264..000000000 --- a/chef/cookbooks/windows/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/chef/cookbooks/windows/CONTRIBUTING b/chef/cookbooks/windows/CONTRIBUTING deleted file mode 100644 index 89ac873b4..000000000 --- a/chef/cookbooks/windows/CONTRIBUTING +++ /dev/null @@ -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. diff --git a/chef/cookbooks/windows/LICENSE b/chef/cookbooks/windows/LICENSE deleted file mode 100644 index 11069edd7..000000000 --- a/chef/cookbooks/windows/LICENSE +++ /dev/null @@ -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. diff --git a/chef/cookbooks/windows/README.md b/chef/cookbooks/windows/README.md deleted file mode 100644 index 2829cbd0e..000000000 --- a/chef/cookbooks/windows/README.md +++ /dev/null @@ -1,609 +0,0 @@ -Description -=========== - -Provides a set of Windows-specific primitives (Chef resources) meant to aid in the creation of cookbooks/recipes targeting the Windows platform. - -Requirements -============ - -Version 1.3.0+ of this cookbook requires Chef 0.10.10+. - -Platform --------- - -* Windows XP -* Windows Vista -* Windows Server 2003 R2 -* Windows 7 -* Windows Server 2008 (R1, R2) - -The `windows_task` LWRP requires Windows Server 2008 due to its API usage. - -Cookbooks ---------- - -The following cookbooks provided by Opscode are required as noted: - -* chef_handler (`windows::reboot_handler` leverages the chef_handler LWRP) -* powershell - The Printer and Printer Port LWRP require Powershell. - -**NOTE** We cannot specifically depend on Opscode's powershell, - because powershell depends on this cookbook. Ensure that - `recipe[powershell]` exists in the node's expanded run list so it - gets downloaded where the printer LWRPs are used. - -Attributes -========== - -* `node['windows']['allow_pending_reboots']` - used to configure the `WindowsRebootHandler` (via the `windows::reboot_handler` recipe) to act on pending reboots. default is true (ie act on pending reboots). The value of this attribute only has an effect if the `windows::reboot_handler` is in a node's run list. - -Resource/Provider -================= - -windows\_auto\_run ------------------- - -### Actions - -- :create: Create an item to be run at login -- :remove: Remove an item that was previously setup to run at login - -### Attribute Parameters - -- :name: Name attribute. The name of the value to be stored in the registry -- :program: The program to be run at login -- :args: The arguments for the program - -### Examples - - # Run BGInfo at login - windows_auto_run 'BGINFO' do - program "C:/Sysinternals/bginfo.exe" - args "\"C:/Sysinternals/Config.bgi\" /NOLICPROMPT /TIMER:0" - not_if { Registry.value_exists?(AUTO_RUN_KEY, 'BGINFO') } - action :create - end - - -windows\_batch --------------- - -Execute a batch script using the cmd.exe interpreter (much like the script resources for bash, csh, powershell, perl, python and ruby). A temporary file is created and executed like other script resources, rather than run inline. By their nature, Script resources are not idempotent, as they are completely up to the user's imagination. Use the `not_if` or `only_if` meta parameters to guard the resource for idempotence. - -### Actions - -- :run: run the batch file - -### Attribute Parameters - -- command: name attribute. Name of the command to execute. -- code: quoted string of code to execute. -- creates: a file this command creates - if the file exists, the command will not be run. -- cwd: current working directory to run the command from. -- flags: command line flags to pass to the interpreter when invoking. -- user: A user name or user ID that we should change to before running this command. -- group: A group name or group ID that we should change to before running this command. - -### Examples - - windows_batch "unzip_and_move_ruby" do - code <<-EOH - 7z.exe x #{Chef::Config[:file_cache_path]}/ruby-1.8.7-p352-i386-mingw32.7z -oC:\\source -r -y - xcopy C:\\source\\ruby-1.8.7-p352-i386-mingw32 C:\\ruby /e /y - EOH - end - - windows_batch "echo some env vars" do - code <<-EOH - echo %TEMP% - echo %SYSTEMDRIVE% - echo %PATH% - echo %WINDIR% - EOH - end - -windows\_feature ----------------- - -Windows Roles and Features can be thought of as built-in operating system packages that ship with the OS. A server role is a set of software programs that, when they are installed and properly configured, lets a computer perform a specific function for multiple users or other computers within a network. A Role can have multiple Role Services that provide functionality to the Role. Role services are software programs that provide the functionality of a role. Features are software programs that, although they are not directly parts of roles, can support or augment the functionality of one or more roles, or improve the functionality of the server, regardless of which roles are installed. Collectively we refer to all of these attributes as 'features'. - -This resource allows you to manage these 'features' in an unattended, idempotent way. - -There are two providers for the `windows_features` which map into Microsoft's two major tools for managing roles/features: [Deployment Image Servicing and Management (DISM)](http://msdn.microsoft.com/en-us/library/dd371719(v=vs.85).aspx) and [Servermanagercmd](http://technet.microsoft.com/en-us/library/ee344834(WS.10).aspx) (The CLI for Server Manager). As Servermanagercmd is deprecated, Chef will set the default provider to `Chef::Provider::WindowsFeature::DISM` if DISM is present on the system being configured. The default provider will fall back to `Chef::Provider::WindowsFeature::ServerManagerCmd`. - -For more information on Roles, Role Services and Features see the [Microsoft TechNet article on the topic](http://technet.microsoft.com/en-us/library/cc754923.aspx). For a complete list of all features that are available on a node type either of the following commands at a command prompt: - - dism /online /Get-Features - servermanagercmd -query - -### Actions - -- :install: install a Windows role/feature -- :remove: remove a Windows role/feature - -### Attribute Parameters - -- feature_name: name of the feature/role to install. The same feature may have different names depending on the provider used (ie DHCPServer vs DHCP; DNS-Server-Full-Role vs DNS). - -### Providers - -- **Chef::Provider::WindowsFeature::DISM**: Uses Deployment Image Servicing and Management (DISM) to manage roles/features. -- **Chef::Provider::WindowsFeature::ServerManagerCmd**: Uses Server Manager to manage roles/features. - -### Examples - - # enable the node as a DHCP Server - windows_feature "DHCPServer" do - action :install - end - - # enable TFTP - windows_feature "TFTP" do - action :install - end - - # disable Telnet client/server - %w{ TelnetServer TelnetClient }.each do |feature| - windows_feature feature do - action :remove - end - end - -windows\_package ----------------- - -Manage Windows application packages in an unattended, idempotent way. - -The following application installers are currently supported: - -* MSI packages -* InstallShield -* Wise InstallMaster -* Inno Setup -* Nullsoft Scriptable Install System - -If the proper installer type is not passed into the resource's installer_type attribute, the provider will do it's best to identify the type by introspecting the installation package. If the installation type cannot be properly identified the `:custom` value can be passed into the installer_type attribute along with the proper flags for silent/quiet installation (using the `options` attribute..see example below). - -__PLEASE NOTE__ - For proper idempotence the resource's `package_name` should be the same as the 'DisplayName' registry value in the uninstallation data that is created during package installation. The easiest way to definitively find the proper 'DisplayName' value is to install the package on a machine and search for the uninstall information under the following registry keys: - -* `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall` -* `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall` -* `HKEY_LOCAL_MACHINE\Software\Wow6464Node\Microsoft\Windows\CurrentVersion\Uninstall` - -For maximum flexibility the `source` attribute supports both remote and local installation packages. - -### Actions - -- :install: install a package -- :remove: remove a package. The remove action is completely hit or miss as many application uninstallers do not support a full silent/quiet mode. - -### Attribute Parameters - -- package_name: name attribute. The 'DisplayName' of the application installation package. -- source: The source of the windows installer. This can either be a URI or a local path. -- installer_type: They type of windows installation package. valid values are: :msi, :inno, :nsis, :wise, :installshield, :custom. If this value is not provided, the provider will do it's best to identify the installer type through introspection of the file. -- checksum: useful if source is remote, the SHA-256 checksum of the file--if the local file matches the checksum, Chef will not download it -- options: Additional options to pass the underlying installation command -- timeout: set a timeout for the package download (default 600 seconds) -- version: The version number of this package, as indicated by the 'DisplayVersion' value in one of the 'Uninstall' registry keys. If the given version number does equal the 'DisplayVersion' in the registry, the package will be installed. -- success_codes: set an array of possible successful installation - return codes. Previously this was hardcoded, but certain MSIs may - have a different return code, e.g. 3010 for reboot required. Must be - an array, and defaults to `[0, 42, 127]`. - -### Examples - - # install PuTTY (InnoSetup installer) - windows_package "PuTTY version 0.60" do - source "http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-installer.exe" - installer_type :inno - action :install - end - - # install 7-Zip (MSI installer) - windows_package "7-Zip 9.20 (x64 edition)" do - source "http://downloads.sourceforge.net/sevenzip/7z920-x64.msi" - action :install - end - - # install Notepad++ (Y U No Emacs?) using a local installer - windows_package "Notepad++" do - source "c:/installation_files/npp.5.9.2.Installer.exe" - action :install - end - - # install VLC for that Xvid (NSIS installer) - windows_package "VLC media player 1.1.10" do - source "http://superb-sea2.dl.sourceforge.net/project/vlc/1.1.10/win32/vlc-1.1.10-win32.exe" - action :install - end - - # install Firefox as custom installer and manually set the silent install flags - windows_package "Mozilla Firefox 5.0 (x86 en-US)" do - source "http://archive.mozilla.org/pub/mozilla.org/mozilla.org/firefox/releases/5.0/win32/en-US/Firefox%20Setup%205.0.exe" - options "-ms" - installer_type :custom - action :install - end - - # Google Chrome FTW (MSI installer) - windows_package "Google Chrome" do - source "https://dl-ssl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B806F36C0-CB54-4A84-A3F3-0CF8A86575E0%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dfalse/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi" - action :install - end - - # remove Google Chrome (but why??) - windows_package "Google Chrome" do - action :remove - end - - # remove 7-Zip - windows_package "7-Zip 9.20 (x64 edition)" do - action :remove - end - - -windows\_printer\_port ----------------------- - -**Note** Include `recipe[powershell]` on the node's expanded run list - to ensure the powershell cookbook is downloaded to avoid circular - dependency. - -Create and delete TCP/IPv4 printer ports. - -### Actions - -- :create: Create a TCIP/IPv4 printer port. This is the default action. -- :delete: Delete a TCIP/IPv4 printer port - -### Attribute Parameters - -- :ipv4_address: Name attribute. Required. IPv4 address, e.g. "10.0.24.34" -- :port_name: Port name. Optional. Defaults to "IP_" + :ipv4_address -- :port_number: Port number. Optional. Defaults to 9100. -- :port_description: Port description. Optional. -- :snmp_enabled: Boolean. Optional. Defaults to false. -- :port_protocol: Port protocol, 1 (RAW), or 2 (LPR). Optional. Defaults to 1. - -### Examples - - # simplest example. Creates a TCP/IP printer port named "IP_10.4.64.37" - # with all defaults - windows_printer_port '10.4.64.37' do - end - - # delete a printer port - windows_printer_port '10.4.64.37' do - action :delete - end - - # delete a port with a custom port_name - windows_printer_port '10.4.64.38' do - port_name "My awesome port" - action :delete - end - - # Create a port with more options - windows_printer_port '10.4.64.39' do - port_name "My awesome port" - snmp_enabled true - port_protocol 2 - end - - -windows\_printer ----------------- - -**Note** Include `recipe[powershell]` on the node's expanded run list - to ensure the powershell cookbook is downloaded to avoid circular - dependency. - -Create Windows printer. Note that this doesn't currently install a printer -driver. You must already have the driver installed on the system. - -The Windows Printer LWRP will automatically create a TCP/IP printer port for you using the `ipv4_address` property. If you want more granular control over the printer port, just create it using the `windows_printer_port` LWRP before creating the printer. - -### Actions - -- :create: Create a new printer -- :delete: Delete a new printer - -### Attribute Parameters - -- :device_id: Name attribute. Required. Printer queue name, e.g. "HP LJ 5200 in fifth floor copy room" -- :comment: Optional string describing the printer queue. -- :default: Boolean. Optional. Defaults to false. Note that Windows sets the first printer defined to the default printer regardless of this setting. -- :driver_name: String. Required. Exact name of printer driver. Note that the printer driver must already be installed on the node. -- :location: Printer location, e.g. "Fifth floor copy room", or "US/NYC/Floor42/Room4207" -- :shared: Boolean. Defaults to false. -- :share_name: Printer share name. -- :ipv4_address: Printer IPv4 address, e.g. "10.4.64.23". You don't have to be able to ping the IP addresss to set it. Required. - - -### Examples - - # create a printer - windows_printer 'HP LaserJet 5th Floor' do - driver_name 'HP LaserJet 4100 Series PCL6' - ipv4_address '10.4.64.38' - end - - # delete a printer - # Note: this doesn't delete the associated printer port. - # See `windows_printer_port` above for how to delete the port. - windows_printer 'HP LaserJet 5th Floor' do - action :delete - end - - -windows\_reboot ---------------- - -Sets required data in the node's run_state to notify `WindowsRebootHandler` a reboot is requested. If Chef run completes successfully a reboot will occur if the `WindowsRebootHandler` is properly registered as a report handler. As an action of `:request` will cause a node to reboot every Chef run, this resource is usually notified by other resources...ie restart node after a package is installed (see example below). - -### Actions - -- :request: requests a reboot at completion of successful Cher run. requires `WindowsRebootHandler` to be registered as a report handler. -- :cancel: remove reboot request from node.run_state. this will cancel *ALL* previously requested reboots as this is a binary state. - -### Attribute Parameters - -- :timeout: Name attribute. timeout delay in seconds to wait before proceeding with the requested reboot. default is 60 seconds -- :reason: comment on the reason for the reboot. default is 'Opscode Chef initiated reboot' - -### Examples - - # if the package installs, schedule a reboot at end of chef run - windows_reboot 60 do - reason 'cause chef said so' - action :nothing - end - windows_package 'some_package' do - action :install - notifies :request, 'windows_reboot[60]' - end - - # cancel the previously requested reboot - windows_reboot 60 do - action :cancel - end - -windows\_registry ------------------ - -Creates and modifies Windows registry keys. - -*Change in v1.3.0: The Win32 classes use `::Win32` to avoid namespace conflict with `Chef::Win32` (introduced in Chef 0.10.10).* - -### Actions - -- :create: create a new registry key with the provided values. -- :modify: modify an existing registry key with the provided values. -- :force_modify: modify an existing registry key with the provided values. ensures the value is actually set by checking multiple times. useful for fighting race conditions where two processes are trying to set the same registry key. This will be updated in the near future to use 'RegNotifyChangeKeyValue' which is exposed by the WinAPI and allows a process to register for notification on a registry key change. -- :remove: removes a value from an existing registry key - -### Attribute Parameters - -- key_name: name attribute. The registry key to create/modify. -- values: hash of the values to set under the registry key. The individual hash items will become respective 'Value name' => 'Value data' items in the registry key. -- type: Type of key to create, defaults to REG_SZ. Must be a symbol, see the overview below for valid values. - -### Registry key types - -- :binary: REG_BINARY -- :string: REG_SZ -- :multi_string: REG_MULTI_SZ -- :expand_string: REG_EXPAND_SZ -- :dword: REG_DWORD -- :dword_big_endian: REG_DWORD_BIG_ENDIAN -- :qword: REG_QWORD - -### Examples - - # make the local windows proxy match the one set for Chef - proxy = URI.parse(Chef::Config[:http_proxy]) - windows_registry 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' do - values 'ProxyEnable' => 1, 'ProxyServer' => "#{proxy.host}:#{proxy.port}", 'ProxyOverride' => '' - end - - # enable Remote Desktop and poke the firewall hole - windows_registry 'HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server' do - values 'FdenyTSConnections' => 0 - end - - # Delete an item from the registry - windows_registry 'HKCU\Software\Test' do - #Key is the name of the value that you want to delete the value is always empty - values 'ValueToDelete' => '' - action :remove - end - - # Add a REG_MULTI_SZ value to the registry - windows_registry 'HKCU\Software\Test' do - values 'MultiString' => ['line 1', 'line 2', 'line 3'] - type :multi_string - end - -### Library Methods - - Registry.value_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run','BGINFO') - Registry.key_exists?('HKLM\SOFTWARE\Microsoft') - BgInfo = Registry.get_value('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run','BGINFO') - -windows\_path -------------- - -### Actions - -- :add: Add an item to the system path -- :remove: Remove an item from the system path - -### Attribute Parameters - -- :path: Name attribute. The name of the value to add to the system path - -### Examples - - #Add Sysinternals to the system path - windows_path 'C:\Sysinternals' do - action :add - end - - #Remove 7-Zip from the system path - windows_path 'C:\7-Zip' do - action :remove - end - -windows\_task -------------- - -Creates, deletes or runs a Windows scheduled task. Requires Windows -Server 2008 due to API usage. - -### Actions - -- :create: creates a task -- :delete: deletes a task -- :run: runs a task -- :change: changes the un/pw or command of a task - -### Attribute Parameters - -- name: name attribute, The task name. -- command: The command the task will run. -- cwd: The directory the task will be run from. -- user: The user to run the task as. (requires password) -- password: The user's password. (requires user) -- run_level: Run with limited or highest privileges. -- frequency: Frequency with which to run the task. (hourly, daily, ect.) -- frequency_modifier: Multiple for frequency. (15 minutes, 2 days) - -### Examples - - # Run Chef every 15 minutes - windows_task "Chef client" do - user "Administrator" - password "$ecR3t" - cwd "C:\chef\bin" - command "chef-client -L C:\tmp\" - run_level :highest - frequency :minute - frequency_modifier 15 - end - - # Update Chef Client task with new password and log location - windows_task "Chef client" do - user "Administrator" - password "N3wPassW0Rd" - cwd "C:\chef\bin" - command "chef-client -L C:\chef\logs\" - action :change - end - - # Delete a taks named "old task" - windows_task "old task" do - action :delete - end - -windows\_zipfile ----------------- - -Most version of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken on the zip file every Chef run. - -### Actions - -- :unzip: unzip a compressed file - -### Attribute Parameters - -- path: name attribute. The path where files will be unzipped to. -- source: The source of the zip file. This can either be a URI or a local path. -- overwrite: force an overwrite of the files if the already exists. -- checksum: useful if source is remote, the SHA-256 checksum of the file--if the local file matches the checksum, Chef will not download it - -### Examples - - # unzip a remote zip file locally - windows_zipfile "c:/bin" do - source "http://download.sysinternals.com/Files/SysinternalsSuite.zip" - action :unzip - not_if {::File.exists?("c:/bin/PsExec.exe")} - end - - # unzip a local zipfile - windows_zipfile "c:/the_codez" do - source "c:/foo/baz/the_codez.zip" - action :unzip - end - - -Exception/Report Handlers -========================= - -WindowsRebootHandler --------------------- - -Required reboots are a necessary evil of configuring and managing Windows nodes. This report handler (ie fires at the end of successful Chef runs) acts on requested (Chef initiated) or pending (as determined by the OS per configuration action we performed) reboots. The `allow_pending_reboots` initialization argument should be set to false if you do not want the handler to automatically reboot a node if it has been determined a reboot is pending. Reboots can still be requested explicitly via the `windows_reboot` LWRP. - -## Initialization Arguments - -- `allow_pending_reboots`: indicator on whether the handler should act on a the Window's 'pending reboot' state. default is true -- `timeout`: timeout delay in seconds to wait before proceeding with the reboot. default is 60 seconds -- `reason`: comment on the reason for the reboot. default is 'Opscode Chef initiated reboot' - -Usage -===== - -Place an explicit dependency on this cookbook (using depends in the cookbook's metadata.rb) from any cookbook where you would like to use the Windows-specific resources/providers that ship with this cookbook. - - depends "windows" - -default -------- - -Convenience recipe that installs supporting gems for many of the resources/providers that ship with this cookbook. - -*Change in v1.3.0: Uses chef_gem instead of gem_package to ensure gem installation in Chef 0.10.10.* - -reboot\_handler --------------- - -Leverages the `chef_handler` LWRP to register the `WindowsRebootHandler` report handler that ships as part of this cookbook. By default this handler is set to automatically act on pending reboots. If you would like to change this behavior override `node['windows']['allow_pending_reboots']` and set the value to false. For example: - - % cat roles/base.rb - name "base" - description "base role" - override_attributes( - "windows" => { - "allow_pending_reboots" => false - } - ) - -This will still allow a reboot to be explicitly requested via the `windows_reboot` LWRP. - -License and Author -================== - -Author:: Seth Chisamore () -Author:: Doug MacEachern () -Author:: Paul Morton () -Author:: Doug Ireton () - -Copyright:: 2011, Opscode, Inc. -Copyright:: 2010, VMware, Inc. -Copyright:: 2011, Business Intelligence Associates, Inc -Copyright:: 2012, Nordstrom, 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. diff --git a/chef/cookbooks/windows/attributes/default.rb b/chef/cookbooks/windows/attributes/default.rb deleted file mode 100644 index b6788b12e..000000000 --- a/chef/cookbooks/windows/attributes/default.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Attribute:: 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. -# - -default['windows']['allow_pending_reboots'] = true -default['windows']['rubyzipversion'] = nil \ No newline at end of file diff --git a/chef/cookbooks/windows/files/default/handlers/windows_reboot_handler.rb b/chef/cookbooks/windows/files/default/handlers/windows_reboot_handler.rb deleted file mode 100644 index e94dbb4ff..000000000 --- a/chef/cookbooks/windows/files/default/handlers/windows_reboot_handler.rb +++ /dev/null @@ -1,76 +0,0 @@ -# -# Author:: Seth Chisamore () -# Copyright:: Copyright (c) 2011 Opscode, Inc -# License:: Apache License, Version 2.0 -# -# 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. -# - -class WindowsRebootHandler < Chef::Handler - include Chef::Mixin::ShellOut - - def initialize(allow_pending_reboots = true, timeout = 60, reason = "Opscode Chef initiated reboot") - @allow_pending_reboots = allow_pending_reboots - @timeout = timeout - @reason = reason - end - - def report - log_message, reboot = begin - if reboot_requested? - ["chef_handler[#{self.class}] requested reboot will occur in #{timeout} seconds", true] - elsif reboot_pending? - if @allow_pending_reboots - ["chef_handler[#{self.class}] reboot pending - automatic reboot will occur in #{timeout} seconds", true] - else - ["chef_handler[#{self.class}] reboot pending but handler not configured to act on pending reboots - please reboot node manually", false] - end - else - ["chef_handler[#{self.class}] no reboot requested or pending", false] - end - end - - Chef::Log.warn(log_message) - shell_out!("shutdown /r /t #{timeout} /c \"#{reason}\"") if reboot - end - - private - # reboot cause CHEF says so: - # reboot explicitly requested in our cookbook code - def reboot_requested? - node.run_state[:reboot_requested] == true - end - - # reboot cause WIN says so: - # reboot pending because of some configuration action we performed - def reboot_pending? - # Any files listed here means reboot needed - (Registry.key_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations') && - Registry.get_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager','PendingFileRenameOperations').any?) || - # 1 for any value means reboot pending - # "9306cdfc-c4a1-4a22-9996-848cb67eddc3"=1 - (Registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') && - Registry.get_values('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired').select{|v| v[2] == 1 }.any?) || - # 1 or 2 for 'Flags' value means reboot pending - (Registry.key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile') && - [1,2].include?(Registry::get_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile','Flags'))) - end - - def timeout - node.run_state[:reboot_timeout] || @timeout - end - - def reason - node.run_state[:reboot_reason] || @reason - end -end \ No newline at end of file diff --git a/chef/cookbooks/windows/libraries/feature_base.rb b/chef/cookbooks/windows/libraries/feature_base.rb deleted file mode 100644 index aa92b93d1..000000000 --- a/chef/cookbooks/windows/libraries/feature_base.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Chef - class Provider - class WindowsFeature - module Base - - def action_install - unless installed? - install_feature(@new_resource.feature_name) - @new_resource.updated_by_last_action(true) - Chef::Log.info("#{@new_resource} installed feature") - else - Chef::Log.debug("#{@new_resource} is already installed - nothing to do") - end - end - - def action_remove - if installed? - remove_feature(@new_resource.feature_name) - @new_resource.updated_by_last_action(true) - Chef::Log.info("#{@new_resource} removed") - else - Chef::Log.debug("#{@new_resource} feature does not exist - nothing to do") - end - end - - def install_feature(name) - raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :install" - end - - def remove_feature(name) - raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :remove" - end - - def installed? - raise Chef::Exceptions::Override, "You must override installed? in #{self}" - end - end - end - end -end - \ No newline at end of file diff --git a/chef/cookbooks/windows/libraries/helper.rb b/chef/cookbooks/windows/libraries/helper.rb deleted file mode 100644 index 8194115b1..000000000 --- a/chef/cookbooks/windows/libraries/helper.rb +++ /dev/null @@ -1,86 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Library:: helper -# -# 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. -# - -module Windows - module Helper - - AUTO_RUN_KEY = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' - ENV_KEY = 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' - - # returns windows friendly version of the provided path, - # ensures backslashes are used everywhere - def win_friendly_path(path) - path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR) if path - end - - # account for Window's wacky File System Redirector - # http://msdn.microsoft.com/en-us/library/aa384187(v=vs.85).aspx - # especially important for 32-bit processes (like Ruby) on a - # 64-bit instance of Windows. - def locate_sysnative_cmd(cmd) - if ::File.exists?("#{ENV['WINDIR']}\\sysnative\\#{cmd}") - "#{ENV['WINDIR']}\\sysnative\\#{cmd}" - elsif ::File.exists?("#{ENV['WINDIR']}\\system32\\#{cmd}") - "#{ENV['WINDIR']}\\system32\\#{cmd}" - else - cmd - end - end - - # Create a feature provider dependent value object. - # mainly created becasue Windows Feature names are - # different based on whether dism.exe or servicemanagercmd.exe - # is used for installation - def value_for_feature_provider(provider_hash) - p = Chef::Platform.find_provider_for_node(node, :windows_feature) - key = p.to_s.downcase.split('::').last - provider_hash[key] || provider_hash[key.to_sym] - end - - # singleton instance of the Windows Version checker - def win_version - @win_version ||= Windows::Version.new - end - - # if a file is local it returns a windows friendly path version - # if a file is remote it caches it locally - def cached_file(source, checksum=nil, windows_path=true) - @installer_file_path ||= begin - - if(source =~ /^(https?:\/\/)(.*\/)(.*)$/) - cache_file_path = "#{Chef::Config[:file_cache_path]}/#{::File.basename(source)}" - Chef::Log.debug("Caching a copy of file #{source} at #{cache_file_path}") - r = Chef::Resource::RemoteFile.new(cache_file_path, run_context) - r.source(source) - r.backup(false) - r.checksum(checksum) if checksum - r.run_action(:create) - else - cache_file_path = source - end - - windows_path ? win_friendly_path(cache_file_path) : cache_file_path - end - end - - end -end - -Chef::Recipe.send(:include, Windows::Helper) diff --git a/chef/cookbooks/windows/libraries/registry_helper.rb b/chef/cookbooks/windows/libraries/registry_helper.rb deleted file mode 100644 index 1b3a69c10..000000000 --- a/chef/cookbooks/windows/libraries/registry_helper.rb +++ /dev/null @@ -1,357 +0,0 @@ -# -# Author:: Doug MacEachern () -# Author:: Seth Chisamore () -# Author:: Paul Morton () -# Cookbook Name:: windows -# Provider:: registry -# -# Copyright:: 2010, VMware, Inc. -# Copyright:: 2011, Opscode, Inc. -# Copyright:: 2011, Business Intelligence Associates, 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 RUBY_PLATFORM =~ /mswin|mingw32|windows/ - require 'win32/registry' - require 'ruby-wmi' -end - -module Windows - module RegistryHelper - - @@native_registry_constant = ENV['PROCESSOR_ARCHITEW6432'] == 'AMD64' ? 0x0100 : 0x0200 - - def get_hive_name(path) - Chef::Log.debug("Resolving registry shortcuts to full names") - - reg_path = path.split("\\") - hive_name = reg_path.shift - - hkey = { - "HKLM" => "HKEY_LOCAL_MACHINE", - "HKCU" => "HKEY_CURRENT_USER", - "HKU" => "HKEY_USERS" - }[hive_name] || hive_name - - Chef::Log.debug("Hive resolved to #{hkey}") - return hkey - end - - def get_hive(path) - - Chef::Log.debug("Getting hive for #{path}") - reg_path = path.split("\\") - hive_name = reg_path.shift - - hkey = get_hive_name(path) - - hive = { - "HKEY_LOCAL_MACHINE" => ::Win32::Registry::HKEY_LOCAL_MACHINE, - "HKEY_USERS" => ::Win32::Registry::HKEY_USERS, - "HKEY_CURRENT_USER" => ::Win32::Registry::HKEY_CURRENT_USER - }[hkey] - - unless hive - Chef::Application.fatal!("Unsupported registry hive '#{hive_name}'") - end - - - Chef::Log.debug("Registry hive resolved to #{hkey}") - return hive - end - - def unload_hive(path) - hive = get_hive(path) - if hive == ::Win32::Registry::HKEY_USERS - reg_path = path.split("\\") - priv = Chef::WindowsPrivileged.new - begin - priv.reg_unload_key(reg_path[1]) - rescue - end - end - end - - def set_value(mode,path,values,type=nil) - hive, reg_path, hive_name, root_key, hive_loaded = get_reg_path_info(path) - key_name = reg_path.join("\\") - - Chef::Log.debug("Creating #{path}") - - if !key_exists?(path,true) - create_key(path) - end - - hive.send(mode, key_name, ::Win32::Registry::KEY_ALL_ACCESS | @@native_registry_constant) do |reg| - changed_something = false - values.each do |k,val| - key = "#{k}" #wtf. avoid "can't modify frozen string" in win32/registry.rb - cur_val = nil - begin - cur_val = reg[key] - rescue - #subkey does not exist (ok) - end - if cur_val != val - Chef::Log.debug("setting #{key}=#{val}") - - if type.nil? - type = :string - end - - reg_type = { - :binary => ::Win32::Registry::REG_BINARY, - :string => ::Win32::Registry::REG_SZ, - :multi_string => ::Win32::Registry::REG_MULTI_SZ, - :expand_string => ::Win32::Registry::REG_EXPAND_SZ, - :dword => ::Win32::Registry::REG_DWORD, - :dword_big_endian => ::Win32::Registry::REG_DWORD_BIG_ENDIAN, - :qword => ::Win32::Registry::REG_QWORD - }[type] - - reg.write(key, reg_type, val) - - ensure_hive_unloaded(hive_loaded) - - changed_something = true - end - end - return changed_something - end - return false - end - - def get_value(path,value) - hive, reg_path, hive_name, root_key, hive_loaded = get_reg_path_info(path) - key = reg_path.join("\\") - - hive.open(key, ::Win32::Registry::KEY_ALL_ACCESS | @@native_registry_constant) do | reg | - begin - return reg[value] - rescue - return nil - ensure - ensure_hive_unloaded(hive_loaded) - end - end - end - - def get_values(path) - hive, reg_path, hive_name, root_key, hive_loaded = get_reg_path_info(path) - key = reg_path.join("\\") - hive.open(key, ::Win32::Registry::KEY_ALL_ACCESS | @@native_registry_constant) do | reg | - values = [] - begin - reg.each_value do |name, type, data| - values << [name, type, data] - end - rescue - ensure - ensure_hive_unloaded(hive_loaded) - end - values - end - end - - def delete_value(path,values) - hive, reg_path, hive_name, root_key, hive_loaded = get_reg_path_info(path) - key = reg_path.join("\\") - Chef::Log.debug("Deleting values in #{path}") - hive.open(key, ::Win32::Registry::KEY_ALL_ACCESS | @@native_registry_constant) do | reg | - values.each_key { |key| - name = "#{key}" - # Ensure delete operation is idempotent. - if value_exists?(path, key) - Chef::Log.debug("Deleting value #{name} in #{path}") - reg.delete_value(name) - else - Chef::Log.debug("Value #{name} in #{path} does not exist, skipping.") - end - } - end - - end - - def create_key(path) - hive, reg_path, hive_name, root_key, hive_loaded = get_reg_path_info(path) - key = reg_path.join("\\") - Chef::Log.debug("Creating registry key #{path}") - hive.create(key) - end - - def value_exists?(path,value) - if key_exists?(path,true) - - hive, reg_path, hive_name, root_key , hive_loaded = get_reg_path_info(path) - key = reg_path.join("\\") - - Chef::Log.debug("Attempting to open #{key}"); - Chef::Log.debug("Native Constant #{@@native_registry_constant}") - Chef::Log.debug("Hive #{hive}") - - hive.open(key, ::Win32::Registry::KEY_READ | @@native_registry_constant) do | reg | - begin - rtn_value = reg[value] - return true - rescue - return false - ensure - ensure_hive_unloaded(hive_loaded) - end - end - - end - return false - end - - # TODO: Does not load user registry... - def key_exists?(path, load_hive = false) - if load_hive - hive, reg_path, hive_name, root_key , hive_loaded = get_reg_path_info(path) - key = reg_path.join("\\") - else - hive = get_hive(path) - reg_path = path.split("\\") - hive_name = reg_path.shift - root_key = reg_path[0] - key = reg_path.join("\\") - hive_loaded = false - end - - begin - hive.open(key, ::Win32::Registry::Constants::KEY_READ | @@native_registry_constant ) - return true - rescue - return false - ensure - ensure_hive_unloaded(hive_loaded) - end - end - - def get_user_hive_location(sid) - reg_key = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\#{sid}" - Chef::Log.debug("Looking for profile at #{reg_key}") - if key_exists?(reg_key) - return get_value(reg_key,'ProfileImagePath') - else - return nil - end - - end - - def resolve_user_to_sid(username) - begin - sid = WMI::Win32_UserAccount.find(:first, :conditions => {:name => username}).sid - Chef::Log.debug("Resolved user SID to #{sid}") - return sid - rescue - return nil - end - end - - def hive_loaded?(path) - hive = get_hive(path) - reg_path = path.split("\\") - hive_name = reg_path.shift - user_hive = path[0] - - if is_user_hive?(hive) - return key_exists?("#{hive_name}\\#{user_hive}") - else - return true - end - end - - def is_user_hive?(hive) - if hive == ::Win32::Registry::HKEY_USERS - return true - else - return true - end - end - - def get_reg_path_info(path) - hive = get_hive(path) - reg_path = path.split("\\") - hive_name = reg_path.shift - root_key = reg_path[0] - hive_loaded = false - - if is_user_hive?(hive) && !key_exists?("#{hive_name}\\#{root_key}") - reg_path, hive_loaded = load_user_hive(hive,reg_path,root_key) - root_key = reg_path[0] - Chef::Log.debug("Resolved user (#{path}) to (#{reg_path.join('/')})") - end - - return hive, reg_path, hive_name, root_key, hive_loaded - end - - def load_user_hive(hive,reg_path,user_hive) - Chef::Log.debug("Reg Path #{reg_path}") - # See if the hive is loaded. Logged in users will have a key that is named their SID - # if the user has specified the a path by SID and the user is logged in, this function - # should not be executed. - if is_user_hive?(hive) && !key_exists?("HKU\\#{user_hive}") - Chef::Log.debug("The user is not logged in and has not been specified by SID") - sid = resolve_user_to_sid(user_hive) - Chef::Log.debug("User SID resolved to (#{sid})") - # Now that the user has been resolved to a SID, check and see if the hive exists. - # If this exists by SID, the user is logged in and we should use that key. - # TODO: Replace the username with the sid and send it back because the username - # does not exist as the key location. - load_reg = false - if key_exists?("HKU\\#{sid}") - reg_path[0] = sid #use the active profile (user is logged on) - Chef::Log.debug("HKEY_USERS Mapped: #{user_hive} -> #{sid}") - else - Chef::Log.debug("User is not logged in") - load_reg = true - end - - # The user is not logged in, so we should load the registry from disk - if load_reg - profile_path = get_user_hive_location(sid) - if profile_path != nil - ntuser_dat = "#{profile_path}\\NTUSER.DAT" - if ::File.exists?(ntuser_dat) - priv = Chef::WindowsPrivileged.new - if priv.reg_load_key(sid,ntuser_dat) - Chef::Log.debug("RegLoadKey(#{sid}, #{user_hive}, #{ntuser_dat})") - reg_path[0] = sid - else - Chef::Log.debug("Failed RegLoadKey(#{sid}, #{user_hive}, #{ntuser_dat})") - end - end - end - end - end - - return reg_path, load_reg - - end - - private - def ensure_hive_unloaded(hive_loaded=false) - if(hive_loaded) - Chef::Log.debug("Hive was loaded, we really should unload it") - unload_hive(path) - end - end - end -end - -module Registry - module_function - extend Windows::RegistryHelper -end diff --git a/chef/cookbooks/windows/libraries/version.rb b/chef/cookbooks/windows/libraries/version.rb deleted file mode 100644 index 693c33b9d..000000000 --- a/chef/cookbooks/windows/libraries/version.rb +++ /dev/null @@ -1,204 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Library:: version -# -# 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. -# - -if RUBY_PLATFORM =~ /mswin|mingw32|windows/ - require 'ruby-wmi' - require 'Win32API' -end - -module Windows - class Version - - # http://msdn.microsoft.com/en-us/library/ms724833(v=vs.85).aspx - - # Suite Masks - # Microsoft BackOffice components are installed. - VER_SUITE_BACKOFFICE = 0x00000004 - # Windows Server 2003, Web Edition is installed. - VER_SUITE_BLADE = 0x00000400 - # Windows Server 2003, Compute Cluster Edition is installed. - VER_SUITE_COMPUTE_SERVER = 0x00004000 - # Windows Server 2008 Datacenter, Windows Server 2003, Datacenter Edition, or Windows 2000 Datacenter Server is installed. - VER_SUITE_DATACENTER = 0x00000080 - # Windows Server 2008 Enterprise, Windows Server 2003, Enterprise Edition, or Windows 2000 Advanced Server is installed. Refer to the Remarks section for more information about this bit flag. - VER_SUITE_ENTERPRISE = 0x00000002 - # Windows XP Embedded is installed. - VER_SUITE_EMBEDDEDNT = 0x00000040 - # Windows Vista Home Premium, Windows Vista Home Basic, or Windows XP Home Edition is installed. - VER_SUITE_PERSONAL = 0x00000200 - # Remote Desktop is supported, but only one interactive session is supported. This value is set unless the system is running in application server mode. - VER_SUITE_SINGLEUSERTS = 0x00000100 - # Microsoft Small Business Server was once installed on the system, but may have been upgraded to another version of Windows. Refer to the Remarks section for more information about this bit flag. - VER_SUITE_SMALLBUSINESS = 0x00000001 - # Microsoft Small Business Server is installed with the restrictive client license in force. Refer to the Remarks section for more information about this bit flag. - VER_SUITE_SMALLBUSINESS_RESTRICTED = 0x00000020 - # Windows Storage Server 2003 R2 or Windows Storage Server 2003is installed. - VER_SUITE_STORAGE_SERVER = 0x00002000 - # Terminal Services is installed. This value is always set. - # If VER_SUITE_TERMINAL is set but VER_SUITE_SINGLEUSERTS is not set, the system is running in application server mode. - VER_SUITE_TERMINAL = 0x00000010 - # Windows Home Server is installed. - VER_SUITE_WH_SERVER = 0x00008000 - - # Product Type - # The system is a domain controller and the operating system is Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, or Windows 2000 Server. - VER_NT_DOMAIN_CONTROLLER = 0x0000002 - # The operating system is Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, or Windows 2000 Server. - # Note that a server that is also a domain controller is reported as VER_NT_DOMAIN_CONTROLLER, not VER_NT_SERVER. - VER_NT_SERVER = 0x0000003 - # The operating system is Windows 7, Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional. - VER_NT_WORKSTATION = 0x0000001 - - # GetSystemMetrics - # The build number if the system is Windows Server 2003 R2; otherwise, 0. - SM_SERVERR2 = 89 - - # http://msdn.microsoft.com/en-us/library/ms724358(v=vs.85).aspx - # this is what it sounds like...when kittens die - SKU = { - 0x00000006 => {:ms_const => 'PRODUCT_BUSINESS', :name => 'Business'}, - 0x00000010 => {:ms_const => 'PRODUCT_BUSINESS_N', :name => 'Business N'}, - 0x00000012 => {:ms_const => 'PRODUCT_CLUSTER_SERVER', :name => 'HPC Edition'}, - 0x00000008 => {:ms_const => 'PRODUCT_DATACENTER_SERVER', :name => 'Server Datacenter (full installation)'}, - 0x0000000C => {:ms_const => 'PRODUCT_DATACENTER_SERVER_CORE', :name => 'Server Datacenter (core installation)'}, - 0x00000027 => {:ms_const => 'PRODUCT_DATACENTER_SERVER_CORE_V', :name => 'Server Datacenter without Hyper-V (core installation)'}, - 0x00000025 => {:ms_const => 'PRODUCT_DATACENTER_SERVER_V', :name => 'Server Datacenter without Hyper-V (full installation)'}, - 0x00000004 => {:ms_const => 'PRODUCT_ENTERPRISE', :name => 'Enterprise'}, - 0x00000046 => {:ms_const => 'PRODUCT_ENTERPRISE_E', :name => 'Not supported'}, - 0x0000001B => {:ms_const => 'PRODUCT_ENTERPRISE_N', :name => 'Enterprise N'}, - 0x0000000A => {:ms_const => 'PRODUCT_ENTERPRISE_SERVER', :name => 'Server Enterprise (full installation)'}, - 0x0000000E => {:ms_const => 'PRODUCT_ENTERPRISE_SERVER_CORE', :name => 'Server Enterprise (core installation)'}, - 0x00000029 => {:ms_const => 'PRODUCT_ENTERPRISE_SERVER_CORE_V', :name => 'Server Enterprise without Hyper-V (core installation)'}, - 0x0000000F => {:ms_const => 'PRODUCT_ENTERPRISE_SERVER_IA64', :name => 'Server Enterprise for Itanium-based Systems'}, - 0x00000026 => {:ms_const => 'PRODUCT_ENTERPRISE_SERVER_V', :name => 'Server Enterprise without Hyper-V (full installation)'}, - 0x00000002 => {:ms_const => 'PRODUCT_HOME_BASIC', :name => 'Home Basic'}, - 0x00000043 => {:ms_const => 'PRODUCT_HOME_BASIC_E', :name => 'Not supported'}, - 0x00000005 => {:ms_const => 'PRODUCT_HOME_BASIC_N', :name => 'Home Basic N'}, - 0x00000003 => {:ms_const => 'PRODUCT_HOME_PREMIUM', :name => 'Home Premium'}, - 0x00000044 => {:ms_const => 'PRODUCT_HOME_PREMIUM_E', :name => 'Not supported'}, - 0x0000001A => {:ms_const => 'PRODUCT_HOME_PREMIUM_N', :name => 'Home Premium N'}, - 0x0000002A => {:ms_const => 'PRODUCT_HYPERV', :name => 'Microsoft Hyper-V Server'}, - 0x0000001E => {:ms_const => 'PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT', :name => 'Windows Essential Business Server Management Server'}, - 0x00000020 => {:ms_const => 'PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING', :name => 'Windows Essential Business Server Messaging Server'}, - 0x0000001F => {:ms_const => 'PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY', :name => 'Windows Essential Business Server Security Server'}, - 0x00000030 => {:ms_const => 'PRODUCT_PROFESSIONAL', :name => 'Professional'}, - 0x00000045 => {:ms_const => 'PRODUCT_PROFESSIONAL_E', :name => 'Not supported'}, - 0x00000031 => {:ms_const => 'PRODUCT_PROFESSIONAL_N', :name => 'Professional N'}, - 0x00000018 => {:ms_const => 'PRODUCT_SERVER_FOR_SMALLBUSINESS', :name => 'Windows Server 2008 for Windows Essential Server Solutions'}, - 0x00000023 => {:ms_const => 'PRODUCT_SERVER_FOR_SMALLBUSINESS_V', :name => 'Windows Server 2008 without Hyper-V for Windows Essential Server Solutions'}, - 0x00000021 => {:ms_const => 'PRODUCT_SERVER_FOUNDATION', :name => 'Server Foundation'}, - 0x00000022 => {:ms_const => 'PRODUCT_HOME_PREMIUM_SERVER', :name => 'Windows Home Server 2011'}, - 0x00000032 => {:ms_const => 'PRODUCT_SB_SOLUTION_SERVER', :name => 'Windows Small Business Server 2011 Essentials'}, - 0x00000013 => {:ms_const => 'PRODUCT_HOME_SERVER', :name => 'Windows Storage Server 2008 R2 Essentials'}, - 0x00000009 => {:ms_const => 'PRODUCT_SMALLBUSINESS_SERVER', :name => 'Windows Small Business Server'}, - 0x00000038 => {:ms_const => 'PRODUCT_SOLUTION_EMBEDDEDSERVER', :name => 'Windows MultiPoint Server'}, - 0x00000007 => {:ms_const => 'PRODUCT_STANDARD_SERVER', :name => 'Server Standard (full installation)'}, - 0x0000000D => {:ms_const => 'PRODUCT_STANDARD_SERVER_CORE', :name => 'Server Standard (core installation)'}, - 0x00000028 => {:ms_const => 'PRODUCT_STANDARD_SERVER_CORE_V', :name => 'Server Standard without Hyper-V (core installation)'}, - 0x00000024 => {:ms_const => 'PRODUCT_STANDARD_SERVER_V', :name => 'Server Standard without Hyper-V (full installation)'}, - 0x0000000B => {:ms_const => 'PRODUCT_STARTER', :name => 'Starter'}, - 0x00000042 => {:ms_const => 'PRODUCT_STARTER_E', :name => 'Not supported'}, - 0x0000002F => {:ms_const => 'PRODUCT_STARTER_N', :name => 'Starter N'}, - 0x00000017 => {:ms_const => 'PRODUCT_STORAGE_ENTERPRISE_SERVER', :name => 'Storage Server Enterprise'}, - 0x00000014 => {:ms_const => 'PRODUCT_STORAGE_EXPRESS_SERVER', :name => 'Storage Server Express'}, - 0x00000015 => {:ms_const => 'PRODUCT_STORAGE_STANDARD_SERVER', :name => 'Storage Server Standard'}, - 0x00000016 => {:ms_const => 'PRODUCT_STORAGE_WORKGROUP_SERVER', :name => 'Storage Server Workgroup'}, - 0x00000000 => {:ms_const => 'PRODUCT_UNDEFINED', :name => 'An unknown product'}, - 0x00000001 => {:ms_const => 'PRODUCT_ULTIMATE', :name => 'Ultimate'}, - 0x00000047 => {:ms_const => 'PRODUCT_ULTIMATE_E', :name => 'Not supported'}, - 0x0000001C => {:ms_const => 'PRODUCT_ULTIMATE_N', :name => 'Ultimate N'}, - 0x00000011 => {:ms_const => 'PRODUCT_WEB_SERVER', :name => 'Web Server (full installation)'}, - 0x0000001D => {:ms_const => 'PRODUCT_WEB_SERVER_CORE', :name => 'Web Server (core installation)'} - } - - attr_reader :major_version, :minor_version, :build_number, :service_pack_major_version, :service_pack_minor_version - attr_reader :version, :product_type, :product_suite, :sku - - def initialize - unless RUBY_PLATFORM =~ /mswin|mingw32|windows/ - raise NotImplementedError, 'only valid on Windows platform' - end - @version, @product_type, @product_suite, @sku, @service_pack_major_version, @service_pack_minor_version = get_os_info - @major_version, @minor_version, @build_number = version.split('.').map{|v| v.to_i } - end - - WIN_VERSIONS = { - "Windows 7" => {:major => 6, :minor => 1, :callable => lambda{ @product_type == VER_NT_WORKSTATION }}, - "Windows Server 2008 R2" => {:major => 6, :minor => 1, :callable => lambda{ @product_type != VER_NT_WORKSTATION }}, - "Windows Server 2008" => {:major => 6, :minor => 0, :callable => lambda{ @product_type != VER_NT_WORKSTATION }}, - "Windows Vista" => {:major => 6, :minor => 0, :callable => lambda{ @product_type == VER_NT_WORKSTATION }}, - "Windows Server 2003 R2" => {:major => 5, :minor => 2, :callable => lambda{ Win32API.new('user32', 'GetSystemMetrics', 'I', 'I').call(SM_SERVERR2) != 0 }}, - "Windows Home Server" => {:major => 5, :minor => 2, :callable => lambda{ (@product_suite & VER_SUITE_WH_SERVER) == VER_SUITE_WH_SERVER }}, - "Windows Server 2003" => {:major => 5, :minor => 2, :callable => lambda{ Win32API.new('user32', 'GetSystemMetrics', 'I', 'I').call(SM_SERVERR2) == 0 }}, - "Windows XP" => {:major => 5, :minor => 1}, - "Windows 2000" => {:major => 5, :minor => 0} - } - - marketing_names = Array.new - - # General Windows checks - WIN_VERSIONS.each do |k,v| - method_name = "#{k.gsub(/\s/, '_').downcase}?" - define_method(method_name) do - (@major_version == v[:major]) && - (@minor_version == v[:minor]) && - (v[:callable] ? v[:callable].call : true) - end - marketing_names << [k, method_name] - end - - define_method(:marketing_name) do - marketing_names.each do |mn| - break mn[0] if self.send(mn[1]) - end - end - - # Server Type checks - %w{ core full datacenter }.each do |m| - define_method("server_#{m}?") do - if @sku - !(SKU[@sku][:name] =~ /#{m}/i).nil? - else - false - end - end - end - - private - # Win32API call to GetSystemMetrics(SM_SERVERR2) - # returns: The build number if the system is Windows Server 2003 R2; otherwise, 0. - def sm_serverr2 - @sm_serverr2 ||= Win32API.new('user32', 'GetSystemMetrics', 'I', 'I').call(SM_SERVERR2) - end - - # query WMI Win32_OperatingSystem for required OS info - def get_os_info - cols = %w{ Version ProductType OSProductSuite OperatingSystemSKU ServicePackMajorVersion ServicePackMinorVersion } - os_info = WMI::Win32_OperatingSystem.find(:first) - cols.map do |c| - begin - os_info.send(c) - rescue # OperatingSystemSKU doesn't exist in all versions of Windows - nil - end - end - end - end -end diff --git a/chef/cookbooks/windows/libraries/windows_privileged.rb b/chef/cookbooks/windows/libraries/windows_privileged.rb deleted file mode 100644 index 2b3753de1..000000000 --- a/chef/cookbooks/windows/libraries/windows_privileged.rb +++ /dev/null @@ -1,94 +0,0 @@ -# -# Author:: Doug MacEachern -# Author:: Paul Morton () -# Cookbook Name:: windows -# Library:: windows_privileged -# -# Copyright:: 2010, VMware, Inc. -# Copyright:: 2011, Business Intelligence Associates, 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 RUBY_PLATFORM =~ /mswin|mingw32|windows/ - require 'windows/error' - require 'windows/registry' - require 'windows/process' - require 'windows/security' -end - -#helpers for Windows API calls that require privilege adjustments -class Chef - class WindowsPrivileged - if RUBY_PLATFORM =~ /mswin|mingw32|windows/ - include Windows::Error - include Windows::Registry - include Windows::Process - include Windows::Security - end - #File -> Load Hive... in regedit.exe - def reg_load_key(name, file) - run(SE_BACKUP_NAME, SE_RESTORE_NAME) do - rc = RegLoadKey(HKEY_USERS, "#{name}", file) - if rc == ERROR_SUCCESS - return true - elsif rc == ERROR_SHARING_VIOLATION - return false - else - raise get_last_error(rc) - end - end - end - - #File -> Unload Hive... in regedit.exe - def reg_unload_key(name) - run(SE_BACKUP_NAME, SE_RESTORE_NAME) do - rc = RegUnLoadKey(HKEY_USERS, "#{name}") - if rc != ERROR_SUCCESS - raise get_last_error(rc) - end - end - end - - def run(*privileges) - token = [0].pack('L') - - unless OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, token) - raise get_last_error - end - token = token.unpack('L')[0] - - privileges.each do |name| - unless adjust_privilege(token, name, SE_PRIVILEGE_ENABLED) - raise get_last_error - end - end - - begin - yield - ensure #disable privs - privileges.each do |name| - adjust_privilege(token, name, 0) - end - end - end - - def adjust_privilege(token, priv, attr=0) - luid = [0,0].pack('Ll') - if LookupPrivilegeValue(nil, priv, luid) - new_state = [1, luid.unpack('Ll'), attr].flatten.pack('LLlL') - AdjustTokenPrivileges(token, 0, new_state, new_state.size, 0, 0) - end - end - end -end \ No newline at end of file diff --git a/chef/cookbooks/windows/metadata.json b/chef/cookbooks/windows/metadata.json deleted file mode 100644 index 8e06676cb..000000000 --- a/chef/cookbooks/windows/metadata.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "windows", - "description": "Provides a set of useful Windows-specific primitives.", - "long_description": "Description\n===========\n\nProvides a set of Windows-specific primitives (Chef resources) meant to aid in the creation of cookbooks/recipes targeting the Windows platform.\n\nRequirements\n============\n\nVersion 1.3.0+ of this cookbook requires Chef 0.10.10+.\n\nPlatform\n--------\n\n* Windows XP\n* Windows Vista\n* Windows Server 2003 R2\n* Windows 7\n* Windows Server 2008 (R1, R2)\n\nThe `windows_task` LWRP requires Windows Server 2008 due to its API usage.\n\nCookbooks\n---------\n\nThe following cookbooks provided by Opscode are required as noted:\n\n* chef_handler (`windows::reboot_handler` leverages the chef_handler LWRP)\n* powershell - The Printer and Printer Port LWRP require Powershell.\n\n**NOTE** We cannot specifically depend on Opscode's powershell,\n because powershell depends on this cookbook. Ensure that\n `recipe[powershell]` exists in the node's expanded run list so it\n gets downloaded where the printer LWRPs are used.\n\nAttributes\n==========\n\n* `node['windows']['allow_pending_reboots']` - used to configure the `WindowsRebootHandler` (via the `windows::reboot_handler` recipe) to act on pending reboots. default is true (ie act on pending reboots). The value of this attribute only has an effect if the `windows::reboot_handler` is in a node's run list.\n\nResource/Provider\n=================\n\nwindows\\_auto\\_run\n------------------\n\n### Actions\n\n- :create: Create an item to be run at login\n- :remove: Remove an item that was previously setup to run at login\n\n### Attribute Parameters\n\n- :name: Name attribute. The name of the value to be stored in the registry\n- :program: The program to be run at login\n- :args: The arguments for the program\n\n### Examples\n\n # Run BGInfo at login\n windows_auto_run 'BGINFO' do\n program \"C:/Sysinternals/bginfo.exe\"\n args \"\\\"C:/Sysinternals/Config.bgi\\\" /NOLICPROMPT /TIMER:0\"\n not_if { Registry.value_exists?(AUTO_RUN_KEY, 'BGINFO') }\n action :create\n end\n\n\nwindows\\_batch\n--------------\n\nExecute a batch script using the cmd.exe interpreter (much like the script resources for bash, csh, powershell, perl, python and ruby). A temporary file is created and executed like other script resources, rather than run inline. By their nature, Script resources are not idempotent, as they are completely up to the user's imagination. Use the `not_if` or `only_if` meta parameters to guard the resource for idempotence.\n\n### Actions\n\n- :run: run the batch file\n\n### Attribute Parameters\n\n- command: name attribute. Name of the command to execute.\n- code: quoted string of code to execute.\n- creates: a file this command creates - if the file exists, the command will not be run.\n- cwd: current working directory to run the command from.\n- flags: command line flags to pass to the interpreter when invoking.\n- user: A user name or user ID that we should change to before running this command.\n- group: A group name or group ID that we should change to before running this command.\n\n### Examples\n\n windows_batch \"unzip_and_move_ruby\" do\n code <<-EOH\n 7z.exe x #{Chef::Config[:file_cache_path]}/ruby-1.8.7-p352-i386-mingw32.7z -oC:\\\\source -r -y\n xcopy C:\\\\source\\\\ruby-1.8.7-p352-i386-mingw32 C:\\\\ruby /e /y\n EOH\n end\n\n windows_batch \"echo some env vars\" do\n code <<-EOH\n echo %TEMP%\n echo %SYSTEMDRIVE%\n echo %PATH%\n echo %WINDIR%\n EOH\n end\n\nwindows\\_feature\n----------------\n\nWindows Roles and Features can be thought of as built-in operating system packages that ship with the OS. A server role is a set of software programs that, when they are installed and properly configured, lets a computer perform a specific function for multiple users or other computers within a network. A Role can have multiple Role Services that provide functionality to the Role. Role services are software programs that provide the functionality of a role. Features are software programs that, although they are not directly parts of roles, can support or augment the functionality of one or more roles, or improve the functionality of the server, regardless of which roles are installed. Collectively we refer to all of these attributes as 'features'.\n\nThis resource allows you to manage these 'features' in an unattended, idempotent way.\n\nThere are two providers for the `windows_features` which map into Microsoft's two major tools for managing roles/features: [Deployment Image Servicing and Management (DISM)](http://msdn.microsoft.com/en-us/library/dd371719(v=vs.85).aspx) and [Servermanagercmd](http://technet.microsoft.com/en-us/library/ee344834(WS.10).aspx) (The CLI for Server Manager). As Servermanagercmd is deprecated, Chef will set the default provider to `Chef::Provider::WindowsFeature::DISM` if DISM is present on the system being configured. The default provider will fall back to `Chef::Provider::WindowsFeature::ServerManagerCmd`.\n\nFor more information on Roles, Role Services and Features see the [Microsoft TechNet article on the topic](http://technet.microsoft.com/en-us/library/cc754923.aspx). For a complete list of all features that are available on a node type either of the following commands at a command prompt:\n\n dism /online /Get-Features\n servermanagercmd -query\n\n### Actions\n\n- :install: install a Windows role/feature\n- :remove: remove a Windows role/feature\n\n### Attribute Parameters\n\n- feature_name: name of the feature/role to install. The same feature may have different names depending on the provider used (ie DHCPServer vs DHCP; DNS-Server-Full-Role vs DNS).\n\n### Providers\n\n- **Chef::Provider::WindowsFeature::DISM**: Uses Deployment Image Servicing and Management (DISM) to manage roles/features.\n- **Chef::Provider::WindowsFeature::ServerManagerCmd**: Uses Server Manager to manage roles/features.\n\n### Examples\n\n # enable the node as a DHCP Server\n windows_feature \"DHCPServer\" do\n action :install\n end\n\n # enable TFTP\n windows_feature \"TFTP\" do\n action :install\n end\n\n # disable Telnet client/server\n %w{ TelnetServer TelnetClient }.each do |feature|\n windows_feature feature do\n action :remove\n end\n end\n\nwindows\\_package\n----------------\n\nManage Windows application packages in an unattended, idempotent way.\n\nThe following application installers are currently supported:\n\n* MSI packages\n* InstallShield\n* Wise InstallMaster\n* Inno Setup\n* Nullsoft Scriptable Install System\n\nIf the proper installer type is not passed into the resource's installer_type attribute, the provider will do it's best to identify the type by introspecting the installation package. If the installation type cannot be properly identified the `:custom` value can be passed into the installer_type attribute along with the proper flags for silent/quiet installation (using the `options` attribute..see example below).\n\n__PLEASE NOTE__ - For proper idempotence the resource's `package_name` should be the same as the 'DisplayName' registry value in the uninstallation data that is created during package installation. The easiest way to definitively find the proper 'DisplayName' value is to install the package on a machine and search for the uninstall information under the following registry keys:\n\n* `HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall`\n* `HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall`\n* `HKEY_LOCAL_MACHINE\\Software\\Wow6464Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall`\n\nFor maximum flexibility the `source` attribute supports both remote and local installation packages.\n\n### Actions\n\n- :install: install a package\n- :remove: remove a package. The remove action is completely hit or miss as many application uninstallers do not support a full silent/quiet mode.\n\n### Attribute Parameters\n\n- package_name: name attribute. The 'DisplayName' of the application installation package.\n- source: The source of the windows installer. This can either be a URI or a local path.\n- installer_type: They type of windows installation package. valid values are: :msi, :inno, :nsis, :wise, :installshield, :custom. If this value is not provided, the provider will do it's best to identify the installer type through introspection of the file.\n- checksum: useful if source is remote, the SHA-256 checksum of the file--if the local file matches the checksum, Chef will not download it\n- options: Additional options to pass the underlying installation command\n- timeout: set a timeout for the package download (default 600 seconds)\n- version: The version number of this package, as indicated by the 'DisplayVersion' value in one of the 'Uninstall' registry keys. If the given version number does equal the 'DisplayVersion' in the registry, the package will be installed.\n- success_codes: set an array of possible successful installation\n return codes. Previously this was hardcoded, but certain MSIs may\n have a different return code, e.g. 3010 for reboot required. Must be\n an array, and defaults to `[0, 42, 127]`.\n\n### Examples\n\n # install PuTTY (InnoSetup installer)\n windows_package \"PuTTY version 0.60\" do\n source \"http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-installer.exe\"\n installer_type :inno\n action :install\n end\n\n # install 7-Zip (MSI installer)\n windows_package \"7-Zip 9.20 (x64 edition)\" do\n source \"http://downloads.sourceforge.net/sevenzip/7z920-x64.msi\"\n action :install\n end\n\n # install Notepad++ (Y U No Emacs?) using a local installer\n windows_package \"Notepad++\" do\n source \"c:/installation_files/npp.5.9.2.Installer.exe\"\n action :install\n end\n\n # install VLC for that Xvid (NSIS installer)\n windows_package \"VLC media player 1.1.10\" do\n source \"http://superb-sea2.dl.sourceforge.net/project/vlc/1.1.10/win32/vlc-1.1.10-win32.exe\"\n action :install\n end\n\n # install Firefox as custom installer and manually set the silent install flags\n windows_package \"Mozilla Firefox 5.0 (x86 en-US)\" do\n source \"http://archive.mozilla.org/pub/mozilla.org/mozilla.org/firefox/releases/5.0/win32/en-US/Firefox%20Setup%205.0.exe\"\n options \"-ms\"\n installer_type :custom\n action :install\n end\n\n # Google Chrome FTW (MSI installer)\n windows_package \"Google Chrome\" do\n source \"https://dl-ssl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B806F36C0-CB54-4A84-A3F3-0CF8A86575E0%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dfalse/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi\"\n action :install\n end\n\n # remove Google Chrome (but why??)\n windows_package \"Google Chrome\" do\n action :remove\n end\n\n # remove 7-Zip\n windows_package \"7-Zip 9.20 (x64 edition)\" do\n action :remove\n end\n\n\nwindows\\_printer\\_port\n----------------------\n\n**Note** Include `recipe[powershell]` on the node's expanded run list\n to ensure the powershell cookbook is downloaded to avoid circular\n dependency.\n\nCreate and delete TCP/IPv4 printer ports.\n\n### Actions\n\n- :create: Create a TCIP/IPv4 printer port. This is the default action.\n- :delete: Delete a TCIP/IPv4 printer port\n\n### Attribute Parameters\n\n- :ipv4_address: Name attribute. Required. IPv4 address, e.g. \"10.0.24.34\"\n- :port_name: Port name. Optional. Defaults to \"IP_\" + :ipv4_address\n- :port_number: Port number. Optional. Defaults to 9100.\n- :port_description: Port description. Optional.\n- :snmp_enabled: Boolean. Optional. Defaults to false.\n- :port_protocol: Port protocol, 1 (RAW), or 2 (LPR). Optional. Defaults to 1.\n\n### Examples\n\n # simplest example. Creates a TCP/IP printer port named \"IP_10.4.64.37\"\n # with all defaults\n windows_printer_port '10.4.64.37' do\n end\n\n # delete a printer port\n windows_printer_port '10.4.64.37' do\n action :delete\n end\n\n # delete a port with a custom port_name\n windows_printer_port '10.4.64.38' do\n port_name \"My awesome port\"\n action :delete\n end\n\n # Create a port with more options\n windows_printer_port '10.4.64.39' do\n port_name \"My awesome port\"\n snmp_enabled true\n port_protocol 2\n end\n\n\nwindows\\_printer\n----------------\n\n**Note** Include `recipe[powershell]` on the node's expanded run list\n to ensure the powershell cookbook is downloaded to avoid circular\n dependency.\n\nCreate Windows printer. Note that this doesn't currently install a printer\ndriver. You must already have the driver installed on the system.\n\nThe Windows Printer LWRP will automatically create a TCP/IP printer port for you using the `ipv4_address` property. If you want more granular control over the printer port, just create it using the `windows_printer_port` LWRP before creating the printer.\n\n### Actions\n\n- :create: Create a new printer\n- :delete: Delete a new printer\n\n### Attribute Parameters\n\n- :device_id: Name attribute. Required. Printer queue name, e.g. \"HP LJ 5200 in fifth floor copy room\"\n- :comment: Optional string describing the printer queue.\n- :default: Boolean. Optional. Defaults to false. Note that Windows sets the first printer defined to the default printer regardless of this setting.\n- :driver_name: String. Required. Exact name of printer driver. Note that the printer driver must already be installed on the node.\n- :location: Printer location, e.g. \"Fifth floor copy room\", or \"US/NYC/Floor42/Room4207\"\n- :shared: Boolean. Defaults to false.\n- :share_name: Printer share name.\n- :ipv4_address: Printer IPv4 address, e.g. \"10.4.64.23\". You don't have to be able to ping the IP addresss to set it. Required.\n\n\n### Examples\n\n # create a printer\n windows_printer 'HP LaserJet 5th Floor' do\n driver_name 'HP LaserJet 4100 Series PCL6'\n ipv4_address '10.4.64.38'\n end\n\n # delete a printer\n # Note: this doesn't delete the associated printer port.\n # See `windows_printer_port` above for how to delete the port.\n windows_printer 'HP LaserJet 5th Floor' do\n action :delete\n end\n\n\nwindows\\_reboot\n---------------\n\nSets required data in the node's run_state to notify `WindowsRebootHandler` a reboot is requested. If Chef run completes successfully a reboot will occur if the `WindowsRebootHandler` is properly registered as a report handler. As an action of `:request` will cause a node to reboot every Chef run, this resource is usually notified by other resources...ie restart node after a package is installed (see example below).\n\n### Actions\n\n- :request: requests a reboot at completion of successful Cher run. requires `WindowsRebootHandler` to be registered as a report handler.\n- :cancel: remove reboot request from node.run_state. this will cancel *ALL* previously requested reboots as this is a binary state.\n\n### Attribute Parameters\n\n- :timeout: Name attribute. timeout delay in seconds to wait before proceeding with the requested reboot. default is 60 seconds\n- :reason: comment on the reason for the reboot. default is 'Opscode Chef initiated reboot'\n\n### Examples\n\n # if the package installs, schedule a reboot at end of chef run\n windows_reboot 60 do\n reason 'cause chef said so'\n action :nothing\n end\n windows_package 'some_package' do\n action :install\n notifies :request, 'windows_reboot[60]'\n end\n\n # cancel the previously requested reboot\n windows_reboot 60 do\n action :cancel\n end\n\nwindows\\_registry\n-----------------\n\nCreates and modifies Windows registry keys.\n\n*Change in v1.3.0: The Win32 classes use `::Win32` to avoid namespace conflict with `Chef::Win32` (introduced in Chef 0.10.10).*\n\n### Actions\n\n- :create: create a new registry key with the provided values.\n- :modify: modify an existing registry key with the provided values.\n- :force_modify: modify an existing registry key with the provided values. ensures the value is actually set by checking multiple times. useful for fighting race conditions where two processes are trying to set the same registry key. This will be updated in the near future to use 'RegNotifyChangeKeyValue' which is exposed by the WinAPI and allows a process to register for notification on a registry key change.\n- :remove: removes a value from an existing registry key\n\n### Attribute Parameters\n\n- key_name: name attribute. The registry key to create/modify.\n- values: hash of the values to set under the registry key. The individual hash items will become respective 'Value name' => 'Value data' items in the registry key.\n- type: Type of key to create, defaults to REG_SZ. Must be a symbol, see the overview below for valid values.\n\n### Registry key types\n\n- :binary: REG_BINARY\n- :string: REG_SZ\n- :multi_string: REG_MULTI_SZ\n- :expand_string: REG_EXPAND_SZ\n- :dword: REG_DWORD\n- :dword_big_endian: REG_DWORD_BIG_ENDIAN\n- :qword: REG_QWORD\n\n### Examples\n\n # make the local windows proxy match the one set for Chef\n proxy = URI.parse(Chef::Config[:http_proxy])\n windows_registry 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings' do\n values 'ProxyEnable' => 1, 'ProxyServer' => \"#{proxy.host}:#{proxy.port}\", 'ProxyOverride' => ''\n end\n\n # enable Remote Desktop and poke the firewall hole\n windows_registry 'HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server' do\n values 'FdenyTSConnections' => 0\n end\n\n # Delete an item from the registry\n windows_registry 'HKCU\\Software\\Test' do\n #Key is the name of the value that you want to delete the value is always empty\n values 'ValueToDelete' => ''\n action :remove\n end\n\n # Add a REG_MULTI_SZ value to the registry\n windows_registry 'HKCU\\Software\\Test' do\n values 'MultiString' => ['line 1', 'line 2', 'line 3']\n type :multi_string\n end\n\n### Library Methods\n\n Registry.value_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run','BGINFO')\n Registry.key_exists?('HKLM\\SOFTWARE\\Microsoft')\n BgInfo = Registry.get_value('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run','BGINFO')\n\nwindows\\_path\n-------------\n\n### Actions\n\n- :add: Add an item to the system path\n- :remove: Remove an item from the system path\n\n### Attribute Parameters\n\n- :path: Name attribute. The name of the value to add to the system path\n\n### Examples\n\n #Add Sysinternals to the system path\n windows_path 'C:\\Sysinternals' do\n action :add\n end\n\n #Remove 7-Zip from the system path\n windows_path 'C:\\7-Zip' do\n action :remove\n end\n\nwindows\\_task\n-------------\n\nCreates, deletes or runs a Windows scheduled task. Requires Windows\nServer 2008 due to API usage.\n\n### Actions\n\n- :create: creates a task\n- :delete: deletes a task\n- :run: runs a task\n- :change: changes the un/pw or command of a task\n\n### Attribute Parameters\n\n- name: name attribute, The task name.\n- command: The command the task will run.\n- cwd: The directory the task will be run from.\n- user: The user to run the task as. (requires password)\n- password: The user's password. (requires user)\n- run_level: Run with limited or highest privileges.\n- frequency: Frequency with which to run the task. (hourly, daily, ect.)\n- frequency_modifier: Multiple for frequency. (15 minutes, 2 days)\n\n### Examples\n\n # Run Chef every 15 minutes\n windows_task \"Chef client\" do\n user \"Administrator\"\n password \"$ecR3t\"\n cwd \"C:\\chef\\bin\"\n command \"chef-client -L C:\\tmp\\\"\n run_level :highest\n frequency :minute\n frequency_modifier 15\n end\n\n # Update Chef Client task with new password and log location\n windows_task \"Chef client\" do\n user \"Administrator\"\n password \"N3wPassW0Rd\"\n cwd \"C:\\chef\\bin\"\n command \"chef-client -L C:\\chef\\logs\\\"\n action :change\n end\n\n # Delete a taks named \"old task\"\n windows_task \"old task\" do\n action :delete\n end\n\nwindows\\_zipfile\n----------------\n\nMost version of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken on the zip file every Chef run.\n\n### Actions\n\n- :unzip: unzip a compressed file\n\n### Attribute Parameters\n\n- path: name attribute. The path where files will be unzipped to.\n- source: The source of the zip file. This can either be a URI or a local path.\n- overwrite: force an overwrite of the files if the already exists.\n- checksum: useful if source is remote, the SHA-256 checksum of the file--if the local file matches the checksum, Chef will not download it\n\n### Examples\n\n # unzip a remote zip file locally\n windows_zipfile \"c:/bin\" do\n source \"http://download.sysinternals.com/Files/SysinternalsSuite.zip\"\n action :unzip\n not_if {::File.exists?(\"c:/bin/PsExec.exe\")}\n end\n\n # unzip a local zipfile\n windows_zipfile \"c:/the_codez\" do\n source \"c:/foo/baz/the_codez.zip\"\n action :unzip\n end\n\n\nException/Report Handlers\n=========================\n\nWindowsRebootHandler\n--------------------\n\nRequired reboots are a necessary evil of configuring and managing Windows nodes. This report handler (ie fires at the end of successful Chef runs) acts on requested (Chef initiated) or pending (as determined by the OS per configuration action we performed) reboots. The `allow_pending_reboots` initialization argument should be set to false if you do not want the handler to automatically reboot a node if it has been determined a reboot is pending. Reboots can still be requested explicitly via the `windows_reboot` LWRP.\n\n## Initialization Arguments\n\n- `allow_pending_reboots`: indicator on whether the handler should act on a the Window's 'pending reboot' state. default is true\n- `timeout`: timeout delay in seconds to wait before proceeding with the reboot. default is 60 seconds\n- `reason`: comment on the reason for the reboot. default is 'Opscode Chef initiated reboot'\n\nUsage\n=====\n\nPlace an explicit dependency on this cookbook (using depends in the cookbook's metadata.rb) from any cookbook where you would like to use the Windows-specific resources/providers that ship with this cookbook.\n\n depends \"windows\"\n\ndefault\n-------\n\nConvenience recipe that installs supporting gems for many of the resources/providers that ship with this cookbook.\n\n*Change in v1.3.0: Uses chef_gem instead of gem_package to ensure gem installation in Chef 0.10.10.*\n\nreboot\\_handler\n--------------\n\nLeverages the `chef_handler` LWRP to register the `WindowsRebootHandler` report handler that ships as part of this cookbook. By default this handler is set to automatically act on pending reboots. If you would like to change this behavior override `node['windows']['allow_pending_reboots']` and set the value to false. For example:\n\n % cat roles/base.rb\n name \"base\"\n description \"base role\"\n override_attributes(\n \"windows\" => {\n \"allow_pending_reboots\" => false\n }\n )\n\nThis will still allow a reboot to be explicitly requested via the `windows_reboot` LWRP.\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore ()\nAuthor:: Doug MacEachern ()\nAuthor:: Paul Morton ()\nAuthor:: Doug Ireton ()\n\nCopyright:: 2011, Opscode, Inc.\nCopyright:: 2010, VMware, Inc.\nCopyright:: 2011, Business Intelligence Associates, Inc\nCopyright:: 2012, Nordstrom, Inc.\n\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": { - "windows": ">= 0.0.0" - }, - "dependencies": { - "chef_handler": ">= 0.0.0" - }, - "recommendations": { - }, - "suggestions": { - }, - "conflicting": { - }, - "providing": { - }, - "replacing": { - }, - "attributes": { - }, - "groupings": { - }, - "recipes": { - }, - "version": "1.8.4" -} \ No newline at end of file diff --git a/chef/cookbooks/windows/metadata.rb b/chef/cookbooks/windows/metadata.rb deleted file mode 100644 index 277885463..000000000 --- a/chef/cookbooks/windows/metadata.rb +++ /dev/null @@ -1,9 +0,0 @@ -name "windows" -maintainer "Opscode, Inc." -maintainer_email "cookbooks@opscode.com" -license "Apache 2.0" -description "Provides a set of useful Windows-specific primitives." -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "1.8.4" -supports "windows" -depends "chef_handler" diff --git a/chef/cookbooks/windows/providers/auto_run.rb b/chef/cookbooks/windows/providers/auto_run.rb deleted file mode 100644 index 36d84d6d5..000000000 --- a/chef/cookbooks/windows/providers/auto_run.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# Author:: Paul Morotn () -# Cookbook Name:: windows -# Provider:: auto_run -# -# Copyright:: 2011, Business Intelligence Associates, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -action :create do - windows_registry 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' do - values new_resource.name => "\"#{new_resource.program}\" #{new_resource.args}" - end -end - -action :remove do - windows_registry 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' do - values new_resource.name => '' - action :remove - end -end \ No newline at end of file diff --git a/chef/cookbooks/windows/providers/batch.rb b/chef/cookbooks/windows/providers/batch.rb deleted file mode 100644 index 9aa347cfe..000000000 --- a/chef/cookbooks/windows/providers/batch.rb +++ /dev/null @@ -1,62 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windws -# Provider:: batch -# -# 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. -# - -require 'tempfile' -require 'chef/resource/execute' - -action :run do - begin - script_file.puts(@new_resource.code) - script_file.close - set_owner_and_group - - # cwd hax...shell_out on windows needs to support proper 'cwd' - # follow CHEF-2357 for more - cwd = @new_resource.cwd ? "cd \"#{@new_resource.cwd}\" & " : "" - - r = Chef::Resource::Execute.new(@new_resource.name, run_context) - r.user(@new_resource.user) - r.group(@new_resource.group) - r.command("#{cwd}call \"#{script_file.path}\" #{@new_resource.flags}") - r.creates(@new_resource.creates) - r.returns(@new_resource.returns) - r.run_action(:run) - - @new_resource.updated_by_last_action(r.updated_by_last_action?) - ensure - unlink_script_file - end -end - -private -def set_owner_and_group - # FileUtils itself implements a no-op if +user+ or +group+ are nil - # You can prove this by running FileUtils.chown(nil,nil,'/tmp/file') - # as an unprivileged user. - FileUtils.chown(@new_resource.user, @new_resource.group, script_file.path) -end - -def script_file - @script_file ||= Tempfile.open(['chef-script', '.bat']) -end - -def unlink_script_file - @script_file && @script_file.close! -end diff --git a/chef/cookbooks/windows/providers/feature_dism.rb b/chef/cookbooks/windows/providers/feature_dism.rb deleted file mode 100644 index 4f2448020..000000000 --- a/chef/cookbooks/windows/providers/feature_dism.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Provider:: feature_dism -# -# 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. -# - -include Chef::Provider::WindowsFeature::Base -include Chef::Mixin::ShellOut -include Windows::Helper - -def install_feature(name) - shell_out!("#{dism} /online /enable-feature /featurename:#{@new_resource.feature_name} /norestart", {:returns => [0,42,127]}) -end - -def remove_feature(name) - shell_out!("#{dism} /online /disable-feature /featurename:#{@new_resource.feature_name} /norestart", {:returns => [0,42,127]}) -end - -def installed? - @installed ||= begin - cmd = shell_out("#{dism} /online /Get-Features", {:returns => [0,42,127]}) - cmd.stderr.empty? && (cmd.stdout =~ /^Feature Name : #{@new_resource.feature_name}.?$\n^State : Enabled.?$/i) - end -end - -private -# account for File System Redirector -# http://msdn.microsoft.com/en-us/library/aa384187(v=vs.85).aspx -def dism - @dism ||= begin - locate_sysnative_cmd("dism.exe") - end -end diff --git a/chef/cookbooks/windows/providers/feature_servermanagercmd.rb b/chef/cookbooks/windows/providers/feature_servermanagercmd.rb deleted file mode 100644 index b43749b3d..000000000 --- a/chef/cookbooks/windows/providers/feature_servermanagercmd.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Provider:: feature_servermanagercmd -# -# 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. -# - -include Chef::Provider::WindowsFeature::Base -include Chef::Mixin::ShellOut -include Windows::Helper - -def install_feature(name) - shell_out!("#{servermanagercmd} -install #{@new_resource.feature_name}", {:returns => [0,42,127]}) -end - -def remove_feature(name) - shell_out!("#{servermanagercmd} -remove #{@new_resource.feature_name}", {:returns => [0,42,127]}) -end - -def installed? - @installed ||= begin - cmd = shell_out("#{servermanagercmd} -query", {:returns => [0,42,127]}) - cmd.stderr.empty? && (cmd.stdout =~ /^\s*?\[X\]\s.+?\s\[#{@new_resource.feature_name}\]$/i) - end -end - -private -# account for File System Redirector -# http://msdn.microsoft.com/en-us/library/aa384187(v=vs.85).aspx -def servermanagercmd - @servermanagercmd ||= begin - locate_sysnative_cmd("servermanagercmd.exe") - end -end diff --git a/chef/cookbooks/windows/providers/package.rb b/chef/cookbooks/windows/providers/package.rb deleted file mode 100644 index c7c11efd5..000000000 --- a/chef/cookbooks/windows/providers/package.rb +++ /dev/null @@ -1,251 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Provider:: package -# -# 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. -# - -if RUBY_PLATFORM =~ /mswin|mingw32|windows/ - require 'win32/registry' -end - -require 'chef/mixin/shell_out' -require 'chef/mixin/language' - -include Chef::Mixin::ShellOut -include Windows::Helper - -# the logic in all action methods mirror that of -# the Chef::Provider::Package which will make -# refactoring into core chef easy - -action :install do - # If we specified a version, and it's not the current version, move to the specified version - if @new_resource.version != nil && @new_resource.version != @current_resource.version - install_version = @new_resource.version - # If it's not installed at all, install it - elsif @current_resource.version == nil - install_version = candidate_version - end - - if install_version - Chef::Log.info("Installing #{@new_resource} version #{install_version}") - status = install_package(@new_resource.package_name, install_version) - if status - @new_resource.updated_by_last_action(true) - end - end -end - -action :upgrade do - if @current_resource.version != candidate_version - orig_version = @current_resource.version || "uninstalled" - Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{candidate_version}") - status = upgrade_package(@new_resource.package_name, candidate_version) - if status - @new_resource.updated_by_last_action(true) - end - end -end - -action :remove do - if removing_package? - Chef::Log.info("Removing #{@new_resource}") - remove_package(@current_resource.package_name, @new_resource.version) - @new_resource.updated_by_last_action(true) - else - end -end - -def removing_package? - if @current_resource.version.nil? - false # nothing to remove - elsif @new_resource.version.nil? - true # remove any version of a package - elsif @new_resource.version == @current_resource.version - true # remove the version we have - else - false # we don't have the version we want to remove - end -end - -def expand_options(options) - options ? " #{options}" : "" -end - -# these methods are the required overrides of -# a provider that extends from Chef::Provider::Package -# so refactoring into core Chef should be easy - -def load_current_resource - @current_resource = Chef::Resource::WindowsPackage.new(@new_resource.name) - @current_resource.package_name(@new_resource.package_name) - @current_resource.version(nil) - - unless current_installed_version.nil? - @current_resource.version(current_installed_version) - end - - @current_resource -end - -def current_installed_version - @current_installed_version ||= begin - if installed_packages.include?(@new_resource.package_name) - installed_packages[@new_resource.package_name][:version] - end - end -end - -def candidate_version - @candidate_version ||= begin - @new_resource.version || 'latest' - end -end - -def install_package(name,version) - Chef::Log.debug("Processing #{@new_resource} as a #{installer_type} installer.") - install_args = [cached_file(@new_resource.source, @new_resource.checksum), expand_options(unattended_installation_flags), expand_options(@new_resource.options)] - Chef::Log.info("Starting installation...this could take awhile.") - Chef::Log.debug "Install command: #{ sprintf(install_command_template, *install_args) }" - shell_out!(sprintf(install_command_template, *install_args), {:timeout => @new_resource.timeout, :returns => @new_resource.success_codes}) -end - -def remove_package(name, version) - uninstall_string = installed_packages[@new_resource.package_name][:uninstall_string] - Chef::Log.info("Registry provided uninstall string for #{@new_resource} is '#{uninstall_string}'") - uninstall_command = begin - if uninstall_string =~ /msiexec/i - "#{uninstall_string} /qn" - else - uninstall_string.gsub!('"','') - "start \"\" /wait /d\"#{::File.dirname(uninstall_string)}\" #{::File.basename(uninstall_string)}#{expand_options(@new_resource.options)} /S" - end - end - Chef::Log.info("Removing #{@new_resource} with uninstall command '#{uninstall_command}'") - shell_out!(uninstall_command, {:returns => @new_resource.success_codes}) -end - -private - -def install_command_template - case installer_type - when :msi - "msiexec%2$s \"%1$s\"%3$s" - else - "start \"\" /wait %1$s%2$s%3$s" - end -end - -def uninstall_command_template - case installer_type - when :msi - "msiexec %2$s %1$s" - else - "start \"\" /wait /d%1$s %2$s %3$s" - end -end - -# http://unattended.sourceforge.net/installers.php -def unattended_installation_flags - case installer_type - when :msi - "/qb /i" - when :installshield - "/s /sms" - when :nsis - "/S /NCRC" - when :inno - #"/sp- /silent /norestart" - "/verysilent /norestart" - when :wise - "/s" - else - end -end - -def installed_packages - @installed_packages || begin - installed_packages = {} - # Computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall - installed_packages.merge!(extract_installed_packages_from_key(::Win32::Registry::HKEY_LOCAL_MACHINE)) #rescue nil - # 64-bit registry view - # Computer\HKEY_LOCAL_MACHINE\Software\Wow6464Node\Microsoft\Windows\CurrentVersion\Uninstall - installed_packages.merge!(extract_installed_packages_from_key(::Win32::Registry::HKEY_LOCAL_MACHINE, (::Win32::Registry::Constants::KEY_READ | 0x0100))) #rescue nil - # 32-bit registry view - # Computer\HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall - installed_packages.merge!(extract_installed_packages_from_key(::Win32::Registry::HKEY_LOCAL_MACHINE, (::Win32::Registry::Constants::KEY_READ | 0x0200))) #rescue nil - # Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall - installed_packages.merge!(extract_installed_packages_from_key(::Win32::Registry::HKEY_CURRENT_USER)) #rescue nil - installed_packages - end -end - -def extract_installed_packages_from_key(hkey = ::Win32::Registry::HKEY_LOCAL_MACHINE, desired = ::Win32::Registry::Constants::KEY_READ) - uninstall_subkey = 'Software\Microsoft\Windows\CurrentVersion\Uninstall' - packages = {} - begin - ::Win32::Registry.open(hkey, uninstall_subkey, desired) do |reg| - reg.each_key do |key, wtime| - begin - k = reg.open(key, desired) - display_name = k["DisplayName"] rescue nil - version = k["DisplayVersion"] rescue "NO VERSION" - uninstall_string = k["UninstallString"] rescue nil - if display_name - packages[display_name] = {:name => display_name, - :version => version, - :uninstall_string => uninstall_string} - end - rescue ::Win32::Registry::Error - end - end - end - rescue ::Win32::Registry::Error - end - packages -end - -def installer_type - @installer_type || begin - if @new_resource.installer_type - @new_resource.installer_type - else - basename = ::File.basename(cached_file(@new_resource.source, @new_resource.checksum)) - if basename.split(".").last == "msi" # Microsoft MSI - :msi - else - # search the binary file for installer type - contents = ::Kernel.open(::File.expand_path(cached_file(@new_resource.source)), "rb") {|io| io.read } # TODO limit data read in - case contents - when /inno/i # Inno Setup - :inno - when /wise/i # Wise InstallMaster - :wise - when /nsis/i # Nullsoft Scriptable Install System - :nsis - else - # if file is named 'setup.exe' assume installshield - if basename == "setup.exe" - :installshield - else - raise Chef::Exceptions::AttributeNotFound, "installer_type could not be determined, please set manually" - end - end - end - end - end -end diff --git a/chef/cookbooks/windows/providers/pagefile.rb b/chef/cookbooks/windows/providers/pagefile.rb deleted file mode 100644 index e80247e84..000000000 --- a/chef/cookbooks/windows/providers/pagefile.rb +++ /dev/null @@ -1,153 +0,0 @@ -# -# Author:: Kevin Moser () -# Cookbook Name:: windows -# Provider:: pagefile -# -# Copyright:: 2012, Nordstrom, 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 Chef::Mixin::ShellOut -include Windows::Helper - -action :set do - pagefile = @new_resource.name - initial_size = @new_resource.initial_size - maximum_size = @new_resource.maximum_size - system_managed = @new_resource.system_managed - automatic_managed = @new_resource.automatic_managed - updated = false - - if automatic_managed - unless automatic_managed? - set_automatic_managed - updated = true - end - else - if automatic_managed? - unset_automatic_managed - updated = true - end - - # Check that the resource is not just trying to unset automatic managed, if it is do nothing more - if (initial_size && maximum_size) || system_managed - unless exists?(pagefile) - create(pagefile) - end - - if system_managed - unless max_and_min_set?(pagefile, 0, 0) - set_system_managed(pagefile) - updated = true - end - else - unless max_and_min_set?(pagefile, initial_size, maximum_size) - set_custom_size(pagefile, initial_size, maximum_size) - updated = true - end - end - end - end - - @new_resource.updated_by_last_action(updated) -end - -action :delete do - pagefile = @new_resource.name - updated = false - - if exists?(pagefile) - delete(pagefile) - updated = true - end - - @new_resource.updated_by_last_action(updated) -end - - -private -def exists?(pagefile) - @exists ||= begin - cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" list /format:list", {:returns => [0]}) - cmd.stderr.empty? && (cmd.stdout =~ /SettingID=#{get_setting_id(pagefile)}/i) - end -end - -def max_and_min_set?(pagefile, min, max) - @max_and_min_set ||= begin - cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" list /format:list", {:returns => [0]}) - cmd.stderr.empty? && (cmd.stdout =~ /InitialSize=#{min}/i) && (cmd.stdout =~ /MaximumSize=#{max}/i) - end -end - -def create(pagefile) - Chef::Log.debug("Creating pagefile #{pagefile}") - cmd = shell_out("#{wmic} pagefileset create name=\"#{win_friendly_path(pagefile)}\"") - check_for_errors(cmd.stderr) -end - -def delete(pagefile) - Chef::Log.debug("Removing pagefile #{pagefile}") - cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" delete") - check_for_errors(cmd.stderr) -end - -def automatic_managed? - @automatic_managed ||= begin - cmd = shell_out("#{wmic} computersystem where name=\"%computername%\" get AutomaticManagedPagefile /format:list") - cmd.stderr.empty? && (cmd.stdout =~ /AutomaticManagedPagefile=TRUE/i) - end -end - -def set_automatic_managed - Chef::Log.debug("Setting pagefile to Automatic Managed") - cmd = shell_out("#{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=True") - check_for_errors(cmd.stderr) -end - -def unset_automatic_managed - Chef::Log.debug("Setting pagefile to User Managed") - cmd = shell_out("#{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=False") - check_for_errors(cmd.stderr) -end - -def set_custom_size(pagefile, min, max) - Chef::Log.debug("Setting #{pagefile} to InitialSize=#{min} & MaximumSize=#{max}") - cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=#{min},MaximumSize=#{max}", {:returns => [0]}) - check_for_errors(cmd.stderr) -end - -def set_system_managed(pagefile) - Chef::Log.debug("Setting #{pagefile} to System Managed") - cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=0,MaximumSize=0", {:returns => [0]}) - check_for_errors(cmd.stderr) -end - -def get_setting_id(pagefile) - pagefile = win_friendly_path(pagefile) - pagefile = pagefile.split("\\") - "#{pagefile[1]} @ #{pagefile[0]}" -end - -def check_for_errors(stderr) - unless stderr.empty? - Chef::Log.fatal(stderr) - end -end - -def wmic - @wmic ||= begin - locate_sysnative_cmd("wmic.exe") - end -end \ No newline at end of file diff --git a/chef/cookbooks/windows/providers/path.rb b/chef/cookbooks/windows/providers/path.rb deleted file mode 100644 index 6ec9191c3..000000000 --- a/chef/cookbooks/windows/providers/path.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# Author:: Paul Morotn () -# Cookbook Name:: windows -# Provider:: path -# -# Copyright:: 2011, Business Intelligence Associates, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -action :add do - env "PATH" do - action :modify - delim ::File::PATH_SEPARATOR - value new_resource.path - end -end - -action :remove do - env "PATH" do - action :delete - delim ::File::PATH_SEPARATOR - value new_resource.path - end -end \ No newline at end of file diff --git a/chef/cookbooks/windows/providers/printer.rb b/chef/cookbooks/windows/providers/printer.rb deleted file mode 100644 index 95a2c856d..000000000 --- a/chef/cookbooks/windows/providers/printer.rb +++ /dev/null @@ -1,100 +0,0 @@ -# -# Author:: Doug Ireton () -# Cookbook Name:: windows -# Provider:: printer -# -# Copyright:: 2012, Nordstrom, 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. -# - -# Support whyrun -def whyrun_supported? - true -end - -action :create do - if @current_resource.exists - Chef::Log.info "#{ @new_resource } already exists - nothing to do." - else - converge_by("Create #{ @new_resource }") do - create_printer - end - end -end - -action :delete do - if @current_resource.exists - converge_by("Delete #{ @new_resource }") do - delete_printer - end - else - Chef::Log.info "#{ @current_resource } doesn't exist - can't delete." - end -end - -def load_current_resource - @current_resource = Chef::Resource::WindowsPrinter.new(@new_resource.name) - @current_resource.name(@new_resource.name) - - if printer_exists?(@current_resource.name) - # TODO: Set @current_resource printer properties from registry - @current_resource.exists = true - end -end - - -private - -PRINTERS_REG_KEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\\' - -def printer_exists?(name) - printer_reg_key = PRINTERS_REG_KEY + name - Chef::Log.debug "Checking to see if this reg key exists: '#{ printer_reg_key }'" - Registry.key_exists?(printer_reg_key) -end - -def create_printer - - # Create the printer port first - windows_printer_port new_resource.ipv4_address do - end - - port_name = "IP_#{ new_resource.ipv4_address }" - - powershell "Creating printer: #{ new_resource.name }" do - code <<-EOH - - Set-WmiInstance -class Win32_Printer ` - -EnableAllPrivileges ` - -Argument @{ DeviceID = "#{ new_resource.device_id }"; - Comment = "#{ new_resource.comment }"; - Default = "$#{ new_resource.default }"; - DriverName = "#{ new_resource.driver_name }"; - Location = "#{ new_resource.location }"; - PortName = "#{ port_name }"; - Shared = "$#{ new_resource.shared }"; - ShareName = "#{ new_resource.share_name }"; - } - EOH - end -end - -def delete_printer - powershell "Deleting printer: #{ new_resource.name }" do - code <<-EOH - $printer = Get-WMIObject -class Win32_Printer -EnableAllPrivileges -Filter "name = '#{ new_resource.name }'" - $printer.Delete() - EOH - end -end diff --git a/chef/cookbooks/windows/providers/printer_port.rb b/chef/cookbooks/windows/providers/printer_port.rb deleted file mode 100644 index d6147f807..000000000 --- a/chef/cookbooks/windows/providers/printer_port.rb +++ /dev/null @@ -1,102 +0,0 @@ -# -# Author:: Doug Ireton () -# Cookbook Name:: windows -# Provider:: printer_port -# -# Copyright:: 2012, Nordstrom, 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. -# - -# Support whyrun -def whyrun_supported? - true -end - -action :create do - if @current_resource.exists - Chef::Log.info "#{ @new_resource } already exists - nothing to do." - else - converge_by("Create #{ @new_resource }") do - create_printer_port - end - end -end - -action :delete do - if @current_resource.exists - converge_by("Delete #{ @new_resource }") do - delete_printer_port - end - else - Chef::Log.info "#{ @current_resource } doesn't exist - can't delete." - end -end - -def load_current_resource - @current_resource = Chef::Resource::WindowsPrinterPort.new(@new_resource.name) - @current_resource.name(@new_resource.name) - @current_resource.ipv4_address(@new_resource.ipv4_address) - @current_resource.port_name(@new_resource.port_name || "IP_#{ @new_resource.ipv4_address }") - - if port_exists?(@current_resource.port_name) - # TODO: Set @current_resource port properties from registry - @current_resource.exists = true - end -end - - -private - -PORTS_REG_KEY = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\\' - -def port_exists?(name) - port_reg_key = PORTS_REG_KEY + name - - Chef::Log.debug "Checking to see if this reg key exists: '#{ port_reg_key }'" - Registry.key_exists?(port_reg_key) -end - - -def create_printer_port - - port_name = new_resource.port_name || "IP_#{ new_resource.ipv4_address }" - - # create the printer port using PowerShell - powershell "Creating printer port #{ new_resource.port_name }" do - code <<-EOH - - Set-WmiInstance -class Win32_TCPIPPrinterPort ` - -EnableAllPrivileges ` - -Argument @{ HostAddress = "#{ new_resource.ipv4_address }"; - Name = "#{ port_name }"; - Description = "#{ new_resource.port_description }"; - PortNumber = "#{ new_resource.port_number }"; - Protocol = "#{ new_resource.port_protocol }"; - SNMPEnabled = "$#{ new_resource.snmp_enabled }"; - } - EOH - end -end - -def delete_printer_port - - port_name = new_resource.port_name || "IP_#{ new_resource.ipv4_address }" - - powershell "Deleting printer port: #{ new_resource.port_name }" do - code <<-EOH - $port = Get-WMIObject -class Win32_TCPIPPrinterPort -EnableAllPrivileges -Filter "name = '#{ port_name }'" - $port.Delete() - EOH - end -end diff --git a/chef/cookbooks/windows/providers/reboot.rb b/chef/cookbooks/windows/providers/reboot.rb deleted file mode 100644 index 4fc5032d3..000000000 --- a/chef/cookbooks/windows/providers/reboot.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Provider:: reboot -# -# Copyright:: 2011, Opscode, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -action :request do - node.run_state[:reboot_requested] = true - node.run_state[:reboot_timeout] = @new_resource.timeout - node.run_state[:reboot_reason] = @new_resource.reason -end - -action :cancel do - node.run_state.delete(:reboot_requested) - node.run_state.delete(:reboot_timeout) - node.run_state.delete(:reboot_reason) -end diff --git a/chef/cookbooks/windows/providers/registry.rb b/chef/cookbooks/windows/providers/registry.rb deleted file mode 100644 index afd03ff93..000000000 --- a/chef/cookbooks/windows/providers/registry.rb +++ /dev/null @@ -1,72 +0,0 @@ -# -# Author:: Doug MacEachern () -# Author:: Seth Chisamore () -# Author:: Paul Morton () -# Cookbook Name:: windows -# Provider:: registry -# -# Copyright:: 2010, VMware, Inc. -# Copyright:: 2011, Opscode, Inc. -# Copyright:: 2011, Business Intelligence Associates, 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 Windows::RegistryHelper - -action :create do - registry_update(:create) -end - -action :modify do - registry_update(:open) -end - -action :force_modify do - require 'timeout' - Timeout.timeout(120) do - @new_resource.values.each do |value_name, value_data| - i = 1 - until i > 5 do - desired_value_data = value_data - current_value_data = get_value(@new_resource.key_name.dup, value_name.dup) - if current_value_data.to_s == desired_value_data.to_s - Chef::Log.debug("#{@new_resource} value [#{value_name}] desired [#{desired_value_data}] data already set. Check #{i}/5.") - i+=1 - else - Chef::Log.debug("#{@new_resource} value [#{value_name}] current [#{current_value_data}] data not equal to desired [#{desired_value_data}] data. Setting value and restarting check loop.") - begin - registry_update(:open) - rescue Exception - registry_update(:create) - end - i=0 # start count loop over - end - end - end - break - end -end - -action :remove do - delete_value(@new_resource.key_name,@new_resource.values) -end - -private -def registry_update(mode) - - Chef::Log.debug("Registry Mode (#{mode})") - updated = set_value(mode,@new_resource.key_name,@new_resource.values,@new_resource.type) - @new_resource.updated_by_last_action(updated) - -end diff --git a/chef/cookbooks/windows/providers/shortcut.rb b/chef/cookbooks/windows/providers/shortcut.rb deleted file mode 100644 index 69139142d..000000000 --- a/chef/cookbooks/windows/providers/shortcut.rb +++ /dev/null @@ -1,56 +0,0 @@ -# -# Author:: Doug MacEachern -# Cookbook Name:: windows -# Provider:: shortcut -# -# Copyright:: 2010, VMware, 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 load_current_resource - require 'win32ole' - - @link = WIN32OLE.new("WScript.Shell").CreateShortcut(@new_resource.name) - - @current_resource = Chef::Resource::WindowsShortcut.new(@new_resource.name) - @current_resource.name(@new_resource.name) - @current_resource.target(@link.TargetPath) - @current_resource.arguments(@link.Arguments) - @current_resource.description(@link.Description) - @current_resource.cwd(@link.WorkingDirectory) -end - -# Check to see if the shorcut needs any changes -# -# === Returns -# :: If a change is required -# :: If the shorcuts are identical -def compare_shortcut - [:target, :arguments, :description, :cwd].any? do |attr| - !@new_resource.send(attr).nil? && @current_resource.send(attr) != @new_resource.send(attr) - end -end - -def action_create - if compare_shortcut - @link.TargetPath = @new_resource.target if @new_resource.target != nil - @link.Arguments = @new_resource.arguments if @new_resource.arguments != nil - @link.Description = @new_resource.description if @new_resource.description != nil - @link.WorkingDirectory = @new_resource.cwd if @new_resource.cwd != nil - #ignoring: WindowStyle, Hotkey, IconLocation - @link.Save - Chef::Log.info("Added #{@new_resource} shortcut") - @updated = true - end -end diff --git a/chef/cookbooks/windows/providers/task.rb b/chef/cookbooks/windows/providers/task.rb deleted file mode 100644 index f9c5e9619..000000000 --- a/chef/cookbooks/windows/providers/task.rb +++ /dev/null @@ -1,124 +0,0 @@ -# -# Author:: Paul Mooring () -# Cookbook Name:: windows -# Provider:: task -# -# Copyright:: 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. -# - -require 'chef/mixin/shell_out' -include Chef::Mixin::ShellOut - -action :create do - if @current_resource.exists - Chef::Log.info "#{@new_resource} task already exists - nothing to do" - else - cmd = "schtasks /Create /TN \"#{@new_resource.name}\" " - cmd += "/SC #{@new_resource.frequency} /MO #{@new_resource.frequency_modifier} " - cmd += "/TR \"#{@new_resource.command}\" " - if @new_resource.user && @new_resource.password - cmd += "/RU \"#{@new_resource.user}\" /RP \"#{@new_resource.password}\" " - elsif (@new_resource.user and !@new_resource.password) || (@new_resource.password and !@new_resource.user) - Chef::Log.fatal "#{@new_resource.name}: Can't specify user or password without both!" - end - cmd += "/RL HIGHEST " if @new_resource.run_level == :highest - shell_out!(cmd, {:returns => [0]}) - @new_resource.updated_by_last_action true - Chef::Log.info "#{@new_resource} task created" - end -end - -action :run do - if @current_resource.exists - if @current_resource.status == :running - Chef::Log.info "#{@new_resource} task is currently running, skipping run" - else - cmd = "schtasks /Run /TN \"#{@current_resource.name}\"" - shell_out!(cmd, {:returns => [0]}) - @new_resource.updated_by_last_action true - Chef::Log.info "#{@new_resource} task ran" - end - else - Chef::Log.debug "#{@new_resource} task doesn't exists - nothing to do" - end -end - -action :change do - if @current_resource.exists - cmd = "schtasks /Change /TN \"#{@current_resource.name}\" " - cmd += "/TR \"#{@new_resource.command}\" " if @new_resource.command - if @new_resource.user && @new_resource.password - cmd += "/RU \"#{@new_resource.user}\" /RP \"#{@new_resource.password}\" " - elsif (@new_resource.user and !@new_resource.password) || (@new_resource.password and !@new_resource.user) - Chef::Log.fatal "#{@new_resource.name}: Can't specify user or password without both!" - end - shell_out!(cmd, {:returns => [0]}) - @new_resource.updated_by_last_action true - Chef::Log.info "Change #{@new_resource} task ran" - else - Chef::Log.debug "#{@new_resource} task doesn't exists - nothing to do" - end -end - -action :delete do - if @current_resource.exists - cmd = "schtasks /Delete /TN \"#{@current_resource.name}\"" - shell_out!(cmd, {:returns => [0]}) - @new_resource.updated_by_last_action true - Chef::Log.info "#{@new_resource} task deleted" - else - Chef::Log.debug "#{@new_resource} task doesn't exists - nothing to do" - end -end - -def load_current_resource - @current_resource = Chef::Resource::WindowsTask.new(@new_resource.name) - @current_resource.name(@new_resource.name) - - task_hash = load_task_hash(@current_resource.name) - if task_hash[:TaskName] == '\\' + @new_resource.name - @current_resource.exists = true - if task_hash[:Status] == "Running" - @current_resource.status = :running - end - @current_resource.cwd(task_hash[:Folder]) - @current_resource.command(task_hash[:TaskToRun]) - @current_resource.user(task_hash[:RunAsUser]) - end if task_hash.respond_to? :[] -end - -private - -def load_task_hash(task_name) - Chef::Log.debug "looking for existing tasks" - output = `schtasks /Query /FO LIST /V /TN \"#{task_name}\" 2> NUL` - if output.empty? - task = false - else - task = Hash.new - - output.split("\n").map! do |line| - line.split(":", 2).map! do |field| - field.strip - end - end.each do |field| - if field.kind_of? Array and field[0].respond_to? :to_sym - task[field[0].gsub(/\s+/,"").to_sym] = field[1] - end - end - end - - task -end diff --git a/chef/cookbooks/windows/providers/zipfile.rb b/chef/cookbooks/windows/providers/zipfile.rb deleted file mode 100644 index 44b373168..000000000 --- a/chef/cookbooks/windows/providers/zipfile.rb +++ /dev/null @@ -1,91 +0,0 @@ -# -# Author:: Doug MacEachern () -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Provider:: unzip -# -# Copyright:: 2010, VMware, Inc. -# Copyright:: 2011, Opscode, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include Windows::Helper - -require 'find' - -action :unzip do - ensure_rubyzip_gem_installed - Chef::Log.debug("unzip #{@new_resource.source} => #{@new_resource.path} (overwrite=#{@new_resource.overwrite})") - - Zip::ZipFile.open(cached_file(@new_resource.source, @new_resource.checksum)) do |zip| - zip.each do |entry| - path = ::File.join(@new_resource.path, entry.name) - FileUtils.mkdir_p(::File.dirname(path)) - if @new_resource.overwrite && ::File.exists?(path) && !::File.directory?(path) - FileUtils.rm(path) - end - zip.extract(entry, path) - end - end - @new_resource.updated_by_last_action(true) -end - -action :zip do - ensure_rubyzip_gem_installed - # sanitize paths for windows. - @new_resource.source.downcase.gsub!(::File::SEPARATOR, ::File::ALT_SEPARATOR) - @new_resource.path.downcase.gsub!(::File::SEPARATOR, ::File::ALT_SEPARATOR) - Chef::Log.debug("zip #{@new_resource.source} => #{@new_resource.path} (overwrite=#{@new_resource.overwrite})") - - if @new_resource.overwrite == false && ::File.exists?(@new_resource.path) - Chef::Log.info("file #{@new_resource.path} already exists and overwrite is set to false, exiting") - else - # delete the archive if it already exists, because we are recreating it. - if ::File.exists?(@new_resource.path) - ::File.unlink(@new_resource.path) - end - # only supporting compression of a single directory (recursively). - if ::File.directory?(@new_resource.source) - z = Zip::ZipFile.new(@new_resource.path, true) - unless @new_resource.source =~ /::File::ALT_SEPARATOR$/ - @new_resource.source << ::File::ALT_SEPARATOR - end - Find.find(@new_resource.source) do |f| - f.downcase.gsub!(::File::SEPARATOR, ::File::ALT_SEPARATOR) - # don't add root directory to the zipfile. - next if f == @new_resource.source - # strip the root directory from the filename before adding it to the zipfile. - zip_fname = f.sub(@new_resource.source, '') - Chef::Log.debug("adding #{zip_fname} to archive, sourcefile is: #{f}") - z.add(zip_fname, f) - end - z.close - else - Chef::Log.info("Single directory must be specified for compression, and #{@new_resource.source} does not meet that criteria.") - end - end -end - -private -def ensure_rubyzip_gem_installed - begin - require 'zip/zip' - rescue LoadError - Chef::Log.info("Missing gem 'rubyzip'...installing now.") - chef_gem "rubyzip" do - version node['windows']['rubyzipversion'] - end - require 'zip/zip' - end -end diff --git a/chef/cookbooks/windows/recipes/default.rb b/chef/cookbooks/windows/recipes/default.rb deleted file mode 100644 index f0dbffb6a..000000000 --- a/chef/cookbooks/windows/recipes/default.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# 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. -# - -# gems with precompiled binaries -%w{ win32-api win32-service }.each do |win_gem| - chef_gem win_gem do - options '--platform=mswin32' - action :install - end -end - -# the rest -%w{ windows-api windows-pr win32-dir win32-event win32-mutex }.each do |win_gem| - chef_gem win_gem do - action :install - end -end diff --git a/chef/cookbooks/windows/recipes/reboot_handler.rb b/chef/cookbooks/windows/recipes/reboot_handler.rb deleted file mode 100644 index 2e55b91fd..000000000 --- a/chef/cookbooks/windows/recipes/reboot_handler.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Recipe:: restart_handler -# -# 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. -# - -remote_directory node['chef_handler']['handler_path'] do - source 'handlers' - recursive true - action :create -end - -chef_handler 'WindowsRebootHandler' do - source "#{node['chef_handler']['handler_path']}/windows_reboot_handler.rb" - arguments node['windows']['allow_pending_reboots'] - supports :report => true, :exception => false - action :enable -end diff --git a/chef/cookbooks/windows/resources/auto_run.rb b/chef/cookbooks/windows/resources/auto_run.rb deleted file mode 100644 index 7beecc56b..000000000 --- a/chef/cookbooks/windows/resources/auto_run.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Author:: Paul Morotn () -# Cookbook Name:: windows -# Resource:: auto_run -# -# Copyright:: 2011, Business Intelligence Associates, 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 initialize(name,run_context=nil) - super - @action = :create -end - -actions :create, :remove - -attribute :program, :kind_of => String -attribute :name, :kind_of => String, :name_attribute => true -attribute :args, :kind_of => String, :default => '' diff --git a/chef/cookbooks/windows/resources/batch.rb b/chef/cookbooks/windows/resources/batch.rb deleted file mode 100644 index 7d4e9175c..000000000 --- a/chef/cookbooks/windows/resources/batch.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Resource:: batch -# -# 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. -# - -actions :run - -attribute :command, :kind_of => String, :name_attribute => true -attribute :cwd, :kind_of => String, :default => nil -attribute :code, :kind_of => String, :default => nil -attribute :user, :kind_of => [ String, Integer ], :default => nil -attribute :group, :kind_of => [ String, Integer ], :default => nil -attribute :creates, :kind_of => [ String ], :default => nil -attribute :flags, :kind_of => [ String ], :default => nil -attribute :returns, :kind_of => [Integer, Array], :default => 0 - -def initialize(name, run_context=nil) - super - @action = :run - @command = name -end diff --git a/chef/cookbooks/windows/resources/feature.rb b/chef/cookbooks/windows/resources/feature.rb deleted file mode 100644 index b67c0fb5d..000000000 --- a/chef/cookbooks/windows/resources/feature.rb +++ /dev/null @@ -1,40 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Resource:: feature -# -# 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. -# - -include Windows::Helper - -actions :install, :remove - -attribute :feature_name, :kind_of => String, :name_attribute => true - -def initialize(name, run_context=nil) - super - @action = :install - @provider = lookup_provider_constant(locate_default_provider) -end - -private -def locate_default_provider - if ::File.exists?(locate_sysnative_cmd('dism.exe')) - :windows_feature_dism - elsif ::File.exists?(locate_sysnative_cmd('servermanagercmd.exe')) - :windows_feature_servermanagercmd - end -end \ No newline at end of file diff --git a/chef/cookbooks/windows/resources/package.rb b/chef/cookbooks/windows/resources/package.rb deleted file mode 100644 index a9e822e85..000000000 --- a/chef/cookbooks/windows/resources/package.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Resource:: package -# -# 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. -# - -actions :install, :remove - -default_action :install - -attribute :package_name, :kind_of => String, :name_attribute => true -attribute :source, :kind_of => String, :required => true -attribute :version, :kind_of => String -attribute :options, :kind_of => String -attribute :installer_type, :kind_of => Symbol, :default => nil, :equal_to => [:msi, :inno, :nsis, :wise, :installshield, :custom] -attribute :checksum, :kind_of => String -attribute :timeout, :kind_of => Integer, :default => 600 -attribute :success_codes, :kind_of => Array, :default => [0, 42, 127] - -# TODO - -# add preseeding support -#attribute :response_file - -# allow target dirtory of installation to be set -#attribute :target_dir - -# Covers 0.10.8 and earlier -def initialize(*args) - super - @action = :install -end diff --git a/chef/cookbooks/windows/resources/pagefile.rb b/chef/cookbooks/windows/resources/pagefile.rb deleted file mode 100644 index 3d95f13f3..000000000 --- a/chef/cookbooks/windows/resources/pagefile.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Author:: Kevin Moser () -# Cookbook Name:: windows -# Resource:: pagefile -# -# Copyright:: 2012, Nordstrom, 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 :set, :delete - -attribute :name, :kind_of => String, :name_attribute => true -attribute :system_managed, :kind_of => [TrueClass, FalseClass] -attribute :automatic_managed, :kind_of => [TrueClass, FalseClass], :default => false -attribute :initial_size, :kind_of => Integer -attribute :maximum_size, :kind_of => Integer - -default_action :set \ No newline at end of file diff --git a/chef/cookbooks/windows/resources/path.rb b/chef/cookbooks/windows/resources/path.rb deleted file mode 100644 index f39aa8eb1..000000000 --- a/chef/cookbooks/windows/resources/path.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# Author:: Paul Morotn () -# Cookbook Name:: windows -# Resource:: path -# -# Copyright:: 2011, Business Intelligence Associates, 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 initialize(name,run_context=nil) - super - @action = :add -end - -actions :add, :remove - -attribute :path, :kind_of => String, :name_attribute => true diff --git a/chef/cookbooks/windows/resources/printer.rb b/chef/cookbooks/windows/resources/printer.rb deleted file mode 100644 index 5effa3370..000000000 --- a/chef/cookbooks/windows/resources/printer.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# Author:: Doug Ireton () -# Cookbook Name:: windows -# Resource:: printer -# -# Copyright:: 2012, Nordstrom, 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. -# -# See here for more info: -# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394492(v=vs.85).aspx - -require 'resolv' - -actions :create, :delete - -default_action :create - -attribute :device_id, :kind_of => String, :name_attribute => true, - :required => true -attribute :comment, :kind_of => String - -attribute :default, :kind_of => [ TrueClass, FalseClass ], :default => false -attribute :driver_name, :kind_of => String, :required => true -attribute :location, :kind_of => String -attribute :shared, :kind_of => [ TrueClass, FalseClass ], :default => false -attribute :share_name, :kind_of => String - -attribute :ipv4_address, :kind_of => String, :regex => Resolv::IPv4::Regex - -attr_accessor :exists diff --git a/chef/cookbooks/windows/resources/printer_port.rb b/chef/cookbooks/windows/resources/printer_port.rb deleted file mode 100644 index b79a6fcf1..000000000 --- a/chef/cookbooks/windows/resources/printer_port.rb +++ /dev/null @@ -1,40 +0,0 @@ -# -# Author:: Doug Ireton () -# Cookbook Name:: windows -# Resource:: printer_port -# -# Copyright:: 2012, Nordstrom, 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. -# -# See here for more info: -# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394492(v=vs.85).aspx - -require 'resolv' - -actions :create, :delete - -default_action :create - -attribute :ipv4_address, :name_attribute => true, :kind_of => String, - :required => true, :regex => Resolv::IPv4::Regex - -attribute :port_name , :kind_of => String -attribute :port_number , :kind_of => Fixnum, :default => 9100 -attribute :port_description, :kind_of => String -attribute :snmp_enabled , :kind_of => [ TrueClass, FalseClass ], - :default => false - -attribute :port_protocol, :kind_of => Fixnum, :default => 1, :equal_to => [1, 2] - -attr_accessor :exists diff --git a/chef/cookbooks/windows/resources/reboot.rb b/chef/cookbooks/windows/resources/reboot.rb deleted file mode 100644 index c788927db..000000000 --- a/chef/cookbooks/windows/resources/reboot.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Resource:: reboot -# -# 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. -# - -actions :request, :cancel - -attribute :timeout, :kind_of => Integer, :default => 60, :name_attribute => true -attribute :reason, :kind_of => String, :default => '' - -def initialize(name,run_context=nil) - super - @action = :request -end diff --git a/chef/cookbooks/windows/resources/registry.rb b/chef/cookbooks/windows/resources/registry.rb deleted file mode 100644 index 1289dbf55..000000000 --- a/chef/cookbooks/windows/resources/registry.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Author:: Doug MacEachern () -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Resource:: registry -# -# Copyright:: 2010, VMware, Inc. -# Copyright:: 2011, Opscode, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -actions :create, :modify, :force_modify, :remove - -attribute :key_name, :kind_of => String, :name_attribute => true -attribute :values, :kind_of => Hash -attribute :type, :kind_of => Symbol, :default => nil, :equal_to => [:binary, :string, :multi_string, :expand_string, :dword, :dword_big_endian, :qword] - -def initialize(name, run_context=nil) - super - @action = :modify - @key_name = name -end diff --git a/chef/cookbooks/windows/resources/shortcut.rb b/chef/cookbooks/windows/resources/shortcut.rb deleted file mode 100644 index eb6268b42..000000000 --- a/chef/cookbooks/windows/resources/shortcut.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# Author:: Doug MacEachern -# Cookbook Name:: windows -# Resource:: shortcut -# -# Copyright:: 2010, VMware, 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 :create - -default_action :create - -attribute :name, :kind_of => String -attribute :target, :kind_of => String -attribute :arguments, :kind_of => String -attribute :description, :kind_of => String -attribute :cwd, :kind_of => String - -# Covers 0.10.8 and earlier -def initialize(*args) - super - @action = :create -end diff --git a/chef/cookbooks/windows/resources/task.rb b/chef/cookbooks/windows/resources/task.rb deleted file mode 100644 index e0c4a2d7a..000000000 --- a/chef/cookbooks/windows/resources/task.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# Author:: Paul Mooring () -# Cookbook Name:: windows -# Resource:: task -# -# Copyright:: 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. -# - -# Passwords can't be loaded for existing tasks, making :modify both confusing -# and not very useful -actions :create, :delete, :run - -attribute :name, :kind_of => String, :name_attribute => true -attribute :command, :kind_of => String -attribute :cwd, :kind_of => String -attribute :user, :kind_of => String, :default => nil -attribute :password, :kind_of => String, :default => nil -attribute :run_level, :equal_to => [:highest, :limited], :default => :limited -attribute :frequency_modifier, :kind_of => Integer, :default => 1 -attribute :frequency, :equal_to => [:minute, - :hourly, - :daily, - :weekly, - :monthly, - :once, - :on_logon, - :on_idle], :default => :hourly - -attr_accessor :exists, :status - -def initialize(name, run_context=nil) - super - @action = :create -end diff --git a/chef/cookbooks/windows/resources/zipfile.rb b/chef/cookbooks/windows/resources/zipfile.rb deleted file mode 100644 index 02658164c..000000000 --- a/chef/cookbooks/windows/resources/zipfile.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Author:: Doug MacEachern () -# Author:: Seth Chisamore () -# Cookbook Name:: windows -# Resource:: unzip -# -# Copyright:: 2010, VMware, Inc. -# Copyright:: 2011, Opscode, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -actions :unzip, :zip - -attribute :path, :kind_of => String, :name_attribute => true -attribute :source, :kind_of => String -attribute :overwrite, :kind_of => [ TrueClass, FalseClass ], :default => false -attribute :checksum, :kind_of => String - -def initialize(name, run_context=nil) - super - @action = :unzip -end diff --git a/docs/VAGRANT.md b/docs/VAGRANT.md index d0004a273..ca580bf0d 100644 --- a/docs/VAGRANT.md +++ b/docs/VAGRANT.md @@ -11,7 +11,7 @@ on Discourse with: 1. Install Git: http://git-scm.com/downloads (or [GitHub for Windows](http://windows.github.com/) if you want a GUI) 2. Install VirtualBox: https://www.virtualbox.org/wiki/Downloads -3. Install Vagrant: http://www.vagrantup.com/ (We require Vagrant 1.1.2+ or later) +3. Install Vagrant: http://www.vagrantup.com/ (We require Vagrant 1.7.2 or later) 4. Open a terminal 5. Clone the project: `git clone https://github.com/discourse/discourse.git` 6. Enter the project directory: `cd discourse` @@ -92,6 +92,10 @@ bundle exec rails s In a few seconds, rails will start serving pages. To access them, open a web browser to [http://localhost:4000](http://localhost:4000) - if it all worked you should see discourse! Congratulations, you are ready to start working! +If you want to log in as a user, a shortcut you can use in development mode is to follow this link to log in as `eviltrout`: + +http://localhost:4000/session/eviltrout/become + You can now edit files on your local file system, using your favorite text editor or IDE. When you reload your web browser, it should have the latest changes. ### Tests @@ -103,7 +107,7 @@ To use it, follow all the above steps. Once rails is running, open a new termina ``` vagrant ssh cd /vagrant -RAILS_ENV=test bundle exec rake db:drop db:create db:migrate +RAILS_ENV=test bundle exec rake db:migrate bundle exec rake autospec p l=5 ``` @@ -127,13 +131,6 @@ mc Then in a browser, go to [http://localhost:4080](http://localhost:4080). Sent emails will be received by mailcatcher and shown in its web ui. -If for some reason mailcatcher is not installed, install and launch it with these commands: - -``` -sudo gem install mailcatcher -mailcatcher --http-ip 0.0.0.0 -``` - ### Shutting down the VM When you're done working on Discourse, you can shut down Vagrant with: @@ -141,4 +138,4 @@ When you're done working on Discourse, you can shut down Vagrant with: ``` vagrant halt ``` - +k