diff options
555 files changed, 60 insertions, 24896 deletions
diff --git a/Rakefile b/Rakefile deleted file mode 100644 index f2faba8a58..0000000000 --- a/Rakefile +++ /dev/null @@ -1,533 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2008, 2010 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. -# - -gems = %w[chef chef-server-api chef-server-webui chef-solr chef-expander chef-server] -require 'rubygems' - -desc "Build the chef gems" -task :gem do - gems.each do |dir| - Dir.chdir(dir) { sh "rake gem" } - end -end - -desc "Install the chef gems" -task :install do - gems.each do |dir| - Dir.chdir(dir) { sh "rake install" } - end -end - -desc "Uninstall the chef gems" -task :uninstall do - gems.reverse.each do |dir| - Dir.chdir(dir) { sh "rake uninstall" } - end -end - -desc "Run the rspec tests" -task :spec do - Dir.chdir("chef") { sh "rake spec" } - Dir.chdir("chef-server-api") { sh "rake spec" } - Dir.chdir("chef-expander") { sh "rake spec" } -end - -task :default => :spec - -def start_couchdb(type="normal") - @couchdb_server_pid = nil - cid = fork - if cid - @couchdb_server_pid = cid - else - exec("couchdb") - end -end - -def start_rabbitmq(type="normal") - @rabbitmq_server_pid = nil - cid = fork - if cid - @rabbitmq_server_pid = cid - else - exec("rabbitmq-server") - end -end - -def configure_rabbitmq(type="normal") - # hack. wait for rabbit to come up. - sleep 2 - - puts `rabbitmqctl add_vhost /chef` - - # create 'chef' user, give it the password 'testing' - puts `rabbitmqctl add_user chef testing` - - # the three regexes map to config, write, read permissions respectively - puts `rabbitmqctl set_permissions -p /chef chef ".*" ".*" ".*"` - - puts `rabbitmqctl list_users` - puts `rabbitmqctl list_vhosts` - puts `rabbitmqctl list_permissions -p /chef` - -end - -def start_chef_solr(type="normal") - @chef_solr_pid = nil - cid = fork - if cid - @chef_solr_pid = cid - else - case type - when "normal" - exec("./chef-solr/bin/chef-solr -l debug") - when "features" - p = fork { exec("./chef-solr/bin/chef-solr-installer -p /tmp/chef_solr_for_features --force") } - Process.wait(p) - exec("./chef-solr/bin/chef-solr -c #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug") - end - end -end - -def start_chef_expander(type="normal") - @chef_solr_indexer = nil - @chef_solr_indexer_pid = fork do - case type - when "normal" - exec("./chef-expander/bin/chef-expander -n 1 -i 1 -l debug") - when "features" - exec("./chef-expander/bin/chef-expander -c #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -n 1 -i 1") - end - end -end - -def start_chef_server(type="normal") - puts "Starting #{type} chef development server" - @chef_server_pid = nil - mcid = fork - if mcid # parent - @chef_server_pid = mcid - else # child - case type - when "normal" - puts "Starting chef server for development with './chef-server-api/bin/chef-server -a thin -l debug -N'" - exec("./chef-server-api/bin/chef-server -a thin -l debug -N") - when "features" - puts "Starting chef server for features with #{["./chef-server/bin/chef-server -a thin -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -N"].join(' ')}" - exec("./chef-server-api/bin/chef-server -a thin -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -N") - end - end -end - -def start_chef_webui(type="normal") - puts "Starting #{type} chef development server webui" - @chef_webui_pid = nil - mcid = fork - if mcid # parent - @chef_webui_pid = mcid - else # child - case type - when "normal" - puts "Starting chef webui for development with './chef-server/bin/chef-server-webui'" - exec("./chef-server-webui/bin/chef-server-webui") - when "features" - puts "Starting chef server webui for features with #{["./chef-server/bin/chef-server-webui -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")}"].join(' ')}" - exec("./chef-server-webui/bin/chef-server-webui -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")}") - end - end -end - -def start_dev_environment(type="normal") - start_couchdb(type) - start_rabbitmq(type) - sleep 2 - configure_rabbitmq(type) - start_chef_solr(type) - start_chef_expander(type) - start_chef_server(type) - start_chef_webui(type) - puts "Running CouchDB at #{@couchdb_server_pid}" - puts "Running RabbitMQ at #{@rabbitmq_server_pid}" - puts "Running Chef Solr at #{@chef_solr_pid}" - puts "Running Chef Solr Indexer at #{@chef_solr_indexer_pid}" - puts "Running Chef at #{@chef_server_pid}" - puts "Running Chef Web UI at #{@chef_webui_pid}" -end - -def stop_dev_environment - if @chef_webui_pid - puts "Stopping Chef Web UI" - Process.kill("KILL", @chef_webui_pid) - end - if @chef_server_pid - puts "Stopping Chef" - Process.kill("KILL", @chef_server_pid) - end - if @chef_solr_pid - puts "Stopping Chef Solr" - Process.kill("INT", @chef_solr_pid) - end - if @chef_solr_indexer_pid - puts "Stopping Chef Solr Indexer" - Process.kill("INT", @chef_solr_indexer_pid) - end - if @couchdb_server_pid - puts "Stopping CouchDB" - Process.kill("KILL", @couchdb_server_pid) - end - if @rabbitmq_server_pid - puts "Stopping RabbitMQ" - Process.kill("KILL", @rabbitmq_server_pid) - end - puts "Have a nice day!" -end - -def wait_for_ctrlc - puts "Hit CTRL-C to destroy development environment" - trap("CHLD", "IGNORE") - trap("INT") do - stop_dev_environment - exit 1 - end - while true - sleep 10 - end -end - -desc "Run a development instance of Chef" -task :dev do - start_dev_environment - wait_for_ctrlc -end - -namespace :dev do - desc "Run a test instance of Chef suitable for cucumber tests" - task :features do - start_dev_environment("features") - wait_for_ctrlc - end - - namespace :features do - - namespace :start do - desc "Start CouchDB for testing" - task :couchdb do - start_couchdb("features") - wait_for_ctrlc - end - - desc "Start RabbitMQ for testing" - task :rabbitmq do - start_rabbitmq("features") - configure_rabbitmq("features") - wait_for_ctrlc - end - - desc "Start Chef Solr for testing" - task :chef_solr do - start_chef_solr("features") - wait_for_ctrlc - end - - desc "Start Chef Solr Indexer for testing" - task :chef_expander do - start_chef_expander("features") - wait_for_ctrlc - end - - desc "Start Chef Server for testing" - task :chef_server do - start_chef_server("features") - wait_for_ctrlc - end - - desc "Start Chef Web UI for testing" - task :chef_webui do - start_chef_webui("features") - wait_for_ctrlc - end - - end - end - - namespace :start do - desc "Start CouchDB" - task :couchdb do - start_couchdb - wait_for_ctrlc - end - - desc "Start RabbitMQ" - task :rabbitmq do - start_rabbitmq - configure_rabbitmq - wait_for_ctrlc - end - - desc "Start Chef Solr" - task :chef_solr do - start_chef_solr - wait_for_ctrlc - end - - desc "Start Chef Solr Indexer" - task :chef_solr_indexer do - start_chef_expander - wait_for_ctrlc - end - - desc "Start Chef Server" - task :chef_server do - start_chef_server - wait_for_ctrlc - end - - desc "Start Chef Web UI" - task :chef_webui do - start_chef_webui - wait_for_ctrlc - end - end -end - -begin - require 'cucumber/rake/task' - - Cucumber::Rake::Task.new(:features) do |t| - t.profile = "default" - end - - namespace :features do - desc "Run cucumber tests for the REST API" - Cucumber::Rake::Task.new(:api) do |t| - t.profile = "api" - end - - namespace :api do - [ :nodes, :roles, :clients, :environments ].each do |api| - Cucumber::Rake::Task.new(api) do |apitask| - apitask.profile = "api_#{api.to_s}" - end - namespace api do - %w{create delete list show update}.each do |action| - Cucumber::Rake::Task.new("#{action}") do |t| - t.profile = "api_#{api.to_s}_#{action}" - end - end - end - end - - namespace :environments do - Cucumber::Rake::Task.new("cookbooks") do |t| - t.profile = "api_environments_cookbook_list" - end - - Cucumber::Rake::Task.new("nodes") do |t| - t.profile = "api_environments_node_list" - end - end - - namespace :nodes do - Cucumber::Rake::Task.new("sync") do |t| - t.profile = "api_nodes_sync" - end - end - - desc "Run cucumber tests for the cookbooks portion of the REST API" - Cucumber::Rake::Task.new(:cookbooks) do |t| - t.profile = "api_cookbooks" - end - namespace :cookbooks do - %w{list show upload download delete}.each do |action| - Cucumber::Rake::Task.new(action) do |t| - t.profile = "api_cookbooks_#{action}" - end - end - - Cucumber::Rake::Task.new(:cookbook_tarballs) do |t| - t.profile = "api_cookbooks_tarballs" - end - end - - namespace :data do - desc "Run cucumber tests for the data portion of the REST API" - Cucumber::Rake::Task.new(:data) do |t| - t.profile = "api_data" - end - - desc "Run cucumber tests for deleting data via the REST API" - Cucumber::Rake::Task.new(:delete) do |t| - t.profile = "api_data_delete" - end - desc "Run cucumber tests for adding items via the REST API" - Cucumber::Rake::Task.new(:item) do |t| - t.profile = "api_data_item" - end - end - - namespace :search do - desc "Run cucumber tests for searching via the REST API" - Cucumber::Rake::Task.new(:search) do |t| - t.profile = "api_search" - end - - desc "Run cucumber tests for listing search endpoints via the REST API" - Cucumber::Rake::Task.new(:list) do |t| - t.profile = "api_search_list" - end - desc "Run cucumber tests for searching via the REST API" - Cucumber::Rake::Task.new(:show) do |t| - t.profile = "api_search_show" - end - desc "Run cucumber tests for searching via the REST API" - Cucumber::Rake::Task.new(:reindex) do |t| - t.profile = "api_search_reindex" - end - end - end - - desc "Run cucumber tests for the chef client" - Cucumber::Rake::Task.new(:client) do |t| - t.profile = "client" - end - - namespace :client do - Cucumber::Rake::Task.new(:roles) do |t| - t.profile = "client_roles" - end - - Cucumber::Rake::Task.new(:run_interval) do |t| - t.profile = "client_run_interval" - end - - Cucumber::Rake::Task.new(:cookbook_sync) do |t| - t.profile = "client_cookbook_sync" - end - end - - desc "Run cucumber tests for the cookbooks" - Cucumber::Rake::Task.new(:cookbooks) do |t| - t.profile = "cookbooks" - end - - namespace :cookbook do - - desc "Run cucumber tests for the cookbook metadata" - Cucumber::Rake::Task.new(:metadata) do |t| - t.profile = "cookbook_metadata" - end - end - - desc "Run cucumber tests for the recipe language" - Cucumber::Rake::Task.new(:language) do |t| - t.profile = "language" - end - - Cucumber::Rake::Task.new(:attribute_settings) do |t| - t.profile = "attribute_settings" - end - - desc "Run cucumber tests for searching in recipes" - Cucumber::Rake::Task.new(:search) do |t| - t.profile = "search" - end - - Cucumber::Rake::Task.new(:language) do |t| - t.profile = "language" - end - - namespace :language do - Cucumber::Rake::Task.new(:recipe_include) do |t| - t.profile = "recipe_inclusion" - end - Cucumber::Rake::Task.new(:attribute_include) do |t| - t.profile = "attribute_inclusion" - end - end - - Cucumber::Rake::Task.new(:lwrp) do |t| - t.profile = "lwrp" - end - - desc "Run cucumber tests for providers" - Cucumber::Rake::Task.new(:provider) do |t| - t.profile = "provider" - end - - - namespace :provider do - desc "Run cucumber tests for deploy resources" - Cucumber::Rake::Task.new(:deploy) do |t| - t.profile = "provider_deploy" - end - - desc "Run cucumber tests for directory resources" - Cucumber::Rake::Task.new(:directory) do |t| - t.profile = "provider_directory" - end - - desc "Run cucumber tests for execute resources" - Cucumber::Rake::Task.new(:execute) do |t| - t.profile = "provider_execute" - end - - desc "Run cucumber tests for file resources" - Cucumber::Rake::Task.new(:file) do |t| - t.profile = "provider_file" - end - - desc "Run cucumber tests for remote_file resources" - Cucumber::Rake::Task.new(:remote_file) do |t| - t.profile = "provider_remote_file" - end - - desc "Run cucumber tests for template resources" - Cucumber::Rake::Task.new(:template) do |t| - t.profile = "provider_template" - end - - Cucumber::Rake::Task.new(:remote_directory) do |t| - t.profile = "provider_remote_directory" - end - - Cucumber::Rake::Task.new(:git) do |t| - t.profile = "provider_git" - end - - namespace :package do - desc "Run cucumber tests for macports packages" - Cucumber::Rake::Task.new(:macports) do |t| - t.profile = "provider_package_macports" - end - - Cucumber::Rake::Task.new(:gems) do |g| - g.profile = "provider_package_rubygems" - end - end - - desc "Run cucumber tests for knife" - Cucumber::Rake::Task.new(:knife) do |t| - t.profile = "knife" - end - - end - end -rescue LoadError - STDERR.puts "\n*** Cucumber is missing. (sudo) gem install cucumber to run integration tests. ***\n\n" -end diff --git a/chef-server-api/.gitignore b/chef-server-api/.gitignore deleted file mode 100644 index 68feb7d26c..0000000000 --- a/chef-server-api/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Gemfile.lock
\ No newline at end of file diff --git a/chef-server-api/.rspec b/chef-server-api/.rspec deleted file mode 100644 index 7bfa3f20e6..0000000000 --- a/chef-server-api/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color --fs diff --git a/chef-server-api/Gemfile b/chef-server-api/Gemfile deleted file mode 100644 index 2778a08153..0000000000 --- a/chef-server-api/Gemfile +++ /dev/null @@ -1,35 +0,0 @@ -$:.push File.expand_path("../lib", __FILE__) -require "chef-server-api/version" - -source :rubygems - -gem 'bunny' -gem 'uuidtools' -gem 'ohai' -gem 'dep_selector' - -merb_gems_version = "1.1.3" -gem "merb-core", merb_gems_version -gem "merb-assets", merb_gems_version -gem "merb-haml", merb_gems_version -gem "merb-helpers", merb_gems_version -gem "merb-param-protection", merb_gems_version - -gem "chef", ChefServerApi::VERSION, :git => "git://github.com/opscode/chef.git", :require => false # load individual parts as needed -gem "chef-solr", ChefServerApi::VERSION, :git => "git://github.com/opscode/chef.git", :require => "chef/solr" - -group(:development) do - gem "thin" - gem "pry" -end - -group(:test) do - gem "rake" - gem "rspec", "~> 2.5" - gem "webrat" - gem "webrat-rspec-rails" -end - -group(:production) do - gem "unicorn", "~> 2.0.0" -end diff --git a/chef-server-api/LICENSE b/chef-server-api/LICENSE deleted file mode 100644 index 11069edd79..0000000000 --- a/chef-server-api/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-server-api/README.rdoc b/chef-server-api/README.rdoc deleted file mode 100644 index 809d5b9a99..0000000000 --- a/chef-server-api/README.rdoc +++ /dev/null @@ -1,91 +0,0 @@ -= chef - -* http://www.opscode.com/chef - -== DESCRIPTION: - -Chef is a systems management framework masquerading as a configuration management tool. - -I'm in ur netwerk, cookin up yer servers. :) - -== REQUIREMENTS: - -chef: - -* ruby-openid -* json -* erubis -* stomp -* ohai - -chef-server and the chef-server-api (merb slice), same requires as chef above, plus: - -* merb-core -* merb-haml -* thin -* haml -* ruby-openid -* syntax - -Interim Note: - -Once the {chef,chef-server,chefserverslice}.gem set is installed, do the following: - - > cd /Library/Ruby/Gems/1.8/gems/chef-server<xxx> # or wherever your gems land - > sudo rake slices:chefserverslice:install - -This installs the chefserverslice into the chef-server merb application - -External Servers: - -* stompserver (for easy stomp mq testing) -* CouchDB - -== INSTALL: - -Install all of the above. To fire up a develpment environment, do the following: - - * Start CouchDB with 'couchdb' - * Start stompserver with 'stompserver' - * Start chef-indexer with: - - chef-indexer -l debug - - * Start chef-server: - - chef-server -N -c 2 - - * Test run chef to begin node registration: - - sudo ./bin/chef-client - - * Validate the node registration: - - Visit http://localhost:4000 - Login, enter an openid URL (see http://openid.net/get/) - Registrations, click Validate - - * Test run chef with: - - chef-client - -== LICENSE: - -Chef - A configuration management system - -Author:: Adam Jacob (<adam@opscode.com>) -Copyright:: Copyright (c) 2008-2012 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. - diff --git a/chef-server-api/Rakefile b/chef-server-api/Rakefile deleted file mode 100644 index 73f846978d..0000000000 --- a/chef-server-api/Rakefile +++ /dev/null @@ -1,52 +0,0 @@ -require File.dirname(__FILE__) + '/lib/chef-server-api/version' - -require 'rubygems' -require 'rake/gempackagetask' - -begin - require 'merb-core' - require 'merb-core/tasks/merb' -rescue LoadError - STDERR.puts "merb is not installed, merb rake tasks will not be available." -end - -GEM_NAME = "chef-server-api" - -spec = eval(File.read("chef-server-api.gemspec")) - -Rake::GemPackageTask.new(spec) do |pkg| - pkg.gem_spec = spec -end - -begin - require 'rspec/core/rake_task' - - desc "Run all specs in spec directory" - RSpec::Core::RakeTask.new(:spec) do |t| - t.pattern = FileList['spec/unit/**/*_spec.rb'] - end -rescue LoadError - desc "Install rspec to run the specs" - task :spec do - abort "rspec is not available, (sudo) gem install rspec to run tests" - end -end - - -task :default => :spec -desc "Install the gem" -task :install => :package do - sh %{gem install pkg/#{GEM_NAME}-#{ChefServerApi::VERSION} --no-rdoc --no-ri} -end - -desc "Uninstall the gem" -task :uninstall do - sh %{gem uninstall #{GEM_NAME} -x -v #{ChefServerApi::VERSION} } -end - -desc "Create a gemspec file" -task :gemspec do - File.open("#{GEM_NAME}.gemspec", "w") do |file| - file.puts spec.to_ruby - end -end diff --git a/chef-server-api/app/controllers/application.rb b/chef-server-api/app/controllers/application.rb deleted file mode 100644 index 66e3d760a2..0000000000 --- a/chef-server-api/app/controllers/application.rb +++ /dev/null @@ -1,137 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Author:: Christopher Walters (<cw@opscode.com>) -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2008-2010 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. -# - -require "chef/mixin/checksum" -require "chef/cookbook_loader" -require "mixlib/authentication/signatureverification" -require 'chef/json_compat' - -class Application < Merb::Controller - - include Chef::Mixin::Checksum - - def authenticate_every - begin - # Raises an error if required auth headers are missing - authenticator = Mixlib::Authentication::SignatureVerification.new(request) - - username = authenticator.user_id - Chef::Log.info("Authenticating client #{username}") - - user = Chef::ApiClient.cdb_load(username) - user_key = OpenSSL::PKey::RSA.new(user.public_key) - Chef::Log.debug "Authenticating Client:\n #{user.inspect}\n" - - # Store this for later.. - @auth_user = user - authenticator.authenticate_request(user_key) - rescue Mixlib::Authentication::MissingAuthenticationHeader => e - Chef::Log.debug "Authentication failed: #{e.class.name}: #{e.message}\n#{e.backtrace.join("\n")}" - raise BadRequest, "#{e.class.name}: #{e.message}" - rescue StandardError => se - Chef::Log.debug "Authentication failed: #{se}, #{se.backtrace.join("\n")}" - raise Unauthorized, "Failed to authenticate. Ensure that your client key is valid." - end - - unless authenticator.valid_request? - if authenticator.valid_timestamp? - raise Unauthorized, "Failed to authenticate. Ensure that your client key is valid." - else - raise Unauthorized, "Failed to authenticate. Please synchronize the clock on your client" - end - end - true - end - - def is_admin - if @auth_user.admin - true - else - raise Forbidden, "You are not allowed to take this action." - end - end - - def is_admin_or_validator - if @auth_user.admin || @auth_user.name == Chef::Config[:validation_client_name] - true - else - raise Forbidden, "You are not allowed to take this action." - end - end - - def admin_or_requesting_node - if @auth_user.admin || @auth_user.name == params[:id] - true - else - raise Forbidden, "You are not the correct node (auth_user name: #{@auth_user.name}, params[:id]: #{params[:id]}), or are not an API administrator (admin: #{@auth_user.admin})." - end - end - - # Store the URI of the current request in the session. - # - # We can return to this location by calling #redirect_back_or_default. - def store_location - session[:return_to] = request.uri - end - - # Redirect to the URI stored by the most recent store_location call or - # to the passed default. - def redirect_back_or_default(default) - loc = session[:return_to] || default - session[:return_to] = nil - redirect loc - end - - def access_denied - raise Unauthorized, "You must authenticate first!" - end - - def get_available_recipes - all_cookbooks_list = Chef::CookbookVersion.cdb_list(true) - available_recipes = all_cookbooks_list.sort{ |a,b| a.name.to_s <=> b.name.to_s }.inject([]) do |result, element| - element.recipes.sort.each do |r| - if r =~ /^(.+)::default$/ - result << $1 - else - result << r - end - end - result - end - available_recipes - end - - # Fix CHEF-1292/PL-538; cause Merb to pass the max nesting constant into - # obj.to_json, which it calls by default based on the original request's - # accept headers and the type passed into Merb::Controller.display - #-- - # TODO: tim, 2010-11-24: would be nice to instead have Merb call - # Chef::JSONCompat.to_json, instead of obj.to_json, but changing that - # behavior is convoluted in Merb. This override is assuming that - # Merb is eventually calling obj.to_json, which takes the :max_nesting - # option. - override! :display - def display(obj) - super(obj, nil, {:max_nesting => Chef::JSONCompat::JSON_MAX_NESTING}) - end - -end - diff --git a/chef-server-api/app/controllers/clients.rb b/chef-server-api/app/controllers/clients.rb deleted file mode 100644 index eafeb15c36..0000000000 --- a/chef-server-api/app/controllers/clients.rb +++ /dev/null @@ -1,118 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Nuo Yan (<nuo@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'chef/api_client' - -class Clients < Application - provides :json - - before :authenticate_every - before :is_admin, :only => [ :index, :update ] - before :is_admin_or_validator, :only => [ :create ] - before :admin_or_requesting_node, :only => [ :show, :destroy ] - - # GET /clients - def index - @list = Chef::ApiClient.cdb_list(true) - display(@list.inject({}) { |result, element| result[element.name] = absolute_url(:client, :id => element.name); result }) - end - - # GET /clients/:id - def show - begin - @client = Chef::ApiClient.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load client #{params[:id]}" - end - #display({ :name => @client.name, :admin => @client.admin, :public_key => @client.public_key }) - display @client - end - - # POST /clients - def create - exists = true - if params.has_key?(:inflated_object) - params[:name] ||= params[:inflated_object].name - params[:admin] ||= params[:inflated_object].admin - end - - # We can only create clients if we're the admin or the validator. - # But only allow creating admin clients if we're already an admin. - if params[:admin] == true && @auth_user.admin != true - raise Forbidden, "You are not allowed to take this action." - end - - begin - Chef::ApiClient.cdb_load(params[:name]) - rescue Chef::Exceptions::CouchDBNotFound - exists = false - end - raise Conflict, "Client already exists" if exists - - @client = Chef::ApiClient.new - @client.name(params[:name]) - @client.admin(params[:admin]) if params[:admin] - @client.create_keys - @client.cdb_save - - self.status = 201 - headers['Location'] = absolute_url(:client, @client.name) - display({ :uri => absolute_url(:client, @client.name), :private_key => @client.private_key }) - end - - # PUT /clients/:id - def update - if params.has_key?(:inflated_object) - params[:private_key] ||= params[:inflated_object].private_key - params[:admin] ||= params[:inflated_object].admin - end - - begin - @client = Chef::ApiClient.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load client #{params[:id]}" - end - - @client.admin(params[:admin]) unless params[:admin].nil? - - results = { :name => @client.name, :admin => @client.admin } - - if params[:private_key] == true - @client.create_keys - results[:private_key] = @client.private_key - end - - @client.cdb_save - - display(results) - end - - # DELETE /clients/:id - def destroy - begin - @client = Chef::ApiClient.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load client #{params[:id]}" - end - @client.cdb_destroy - display({ :name => @client.name }) - end - -end - diff --git a/chef-server-api/app/controllers/cookbooks.rb b/chef-server-api/app/controllers/cookbooks.rb deleted file mode 100644 index 7d4993d60a..0000000000 --- a/chef-server-api/app/controllers/cookbooks.rb +++ /dev/null @@ -1,231 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Author:: Christopher Walters (<cw@opscode.com>) -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2008, 2009, 2010 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. -# - -require 'chef/cookbook_loader' -require 'chef/cookbook/metadata' - -class Cookbooks < Application - - include Merb::CookbookVersionHelper - - provides :json - - before :authenticate_every - before :params_helper - before :is_admin, :only => [ :update, :destroy ] - - attr_accessor :cookbook_name, :cookbook_version - - def params_helper - self.cookbook_name = params[:cookbook_name] - self.cookbook_version = params[:cookbook_version] - end - - include Chef::Mixin::Checksum - include Merb::TarballHelper - - def index - if request.env['HTTP_X_CHEF_VERSION'] =~ /0\.9/ - index_09 - else - index_010 - end - end - - # GET /cookbooks - # returns data in the format of: - # {"apache2" => { - # :url => "http://url", - # :versions => [{:url => "http://url/1.0.0", :version => "1.0.0"}, {:url => "http://url/0.0.1", :version=>"0.0.1"}] - # } - # } - def index_010 - cookbook_list = Chef::CookbookVersion.cdb_list - # cookbook_list is in the format of {"apache2" => [0.0.1, 0.0.0]} where the version numbers are DepSelector::Version objects - num_versions = num_versions! - display(cookbook_list.inject({}) {|res, (cookbook_name, versions)| - versions = versions.map{ |x| DepSelector::Version.new(x) }.sort.reverse.map{ |x| x.to_s } - res[cookbook_name] = expand_cookbook_urls(cookbook_name, versions, num_versions) - res - }) - end - - # GET /cookbooks - # - # returns data in the format of: - # { - # "apache2" => "http://url/apache2", - # "python" => "http://url/python" - # } - def index_09 - cookbook_list = Chef::CookbookVersion.cdb_list_latest(false).keys.sort - response = Hash.new - cookbook_list.map! do |cookbook_name| - response[cookbook_name] = absolute_url(:cookbook, :cookbook_name => cookbook_name) - end - display response - end - - def index_recipes - recipes_with_versions = Chef::CookbookVersion.cdb_list(true).inject({}) do|memo, f| - memo[f.name] ||= {} - memo[f.name][f.version] = f.recipe_filenames_by_name.keys - memo - end - display recipes_with_versions - end - - def show_versions - if request.env['HTTP_X_CHEF_VERSION'] =~ /0\.9/ - show_versions_09 - else - show_versions_010 - end - end - - # GET /cookbooks/:cookbook_name - # - # returns data in the format of: - # {"apache2" => { - # :url => "http://url", - # :versions => [{:url => "http://url/1.0.0", :version => "1.0.0"}, {:url => "http://url/0.0.1", :version=>"0.0.1"}] - # } - # } - def show_versions_010 - versions = Chef::CookbookVersion.cdb_by_name(cookbook_name) - raise NotFound, "Cannot find a cookbook named #{cookbook_name}" unless versions && versions.size > 0 - num_versions = num_versions!("all") - cb_versions = versions[cookbook_name].map{ |x| DepSelector::Version.new(x) }.sort.reverse.map{ |x| x.to_s } - display({ cookbook_name => expand_cookbook_urls(cookbook_name, cb_versions, num_versions) }) - end - - # GET /cookbooks/:cookbook_name - # - # returns data in the format of: - # {"apache2" => ["1.0.0", "0.0.1"]} - def show_versions_09 - versions = Chef::CookbookVersion.cdb_by_name(cookbook_name) - raise NotFound, "Cannot find a cookbook named #{requested_cookbook_name}" unless versions && versions.size > 0 - - display versions - end - - def show - cookbook = get_cookbook_version(cookbook_name, cookbook_version) - display cookbook.generate_manifest_with_urls { |opts| absolute_url(:cookbook_file, opts) } - end - - def show_file - cookbook = get_cookbook_version(cookbook_name, cookbook_version) - - checksum = params[:checksum] - raise NotFound, "Cookbook #{cookbook_name} version #{cookbook_version} does not contain a file with checksum #{checksum}" unless cookbook.checksums.keys.include?(checksum) - - begin - filename = Chef::Checksum.new(checksum).storage.file_location - - send_file(filename) - rescue Errno::ENOENT => e - raise InternalServerError, "File with checksum #{checksum} not found in the repository (this should not happen)" - end - end - - def update - raise(BadRequest, "You didn't pass me a valid object!") unless params.has_key?('inflated_object') - raise(BadRequest, "You didn't pass me a Chef::CookbookVersion object!") unless params['inflated_object'].kind_of?(Chef::CookbookVersion) - unless params["inflated_object"].name == cookbook_name - raise(BadRequest, "You said the cookbook was named #{params['inflated_object'].name}, but the URL says it should be #{cookbook_name}.") - end - - unless params["inflated_object"].version == cookbook_version - raise(BadRequest, "You said the cookbook was version #{params['inflated_object'].version}, but the URL says it should be #{cookbook_version}.") - end - - begin - cookbook = Chef::CookbookVersion.cdb_load(cookbook_name, cookbook_version) - cookbook.manifest = params['inflated_object'].manifest - new_cookbook = false - rescue Chef::Exceptions::CouchDBNotFound => e - Chef::Log.debug("Cookbook #{cookbook_name} version #{cookbook_version} does not exist") - cookbook = params['inflated_object'] - new_cookbook = true - end - - unless new_cookbook - if cookbook.frozen_version? && params[:force].nil? - raise Conflict, "The cookbook #{cookbook.name} at version #{cookbook.version} is frozen. Use the 'force' option to override." - end - end - - cookbook.freeze_version if params["inflated_object"].frozen_version? - - # ensure that all checksums referred to by the manifest have been uploaded. - Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment| - next unless cookbook.manifest[segment] - cookbook.manifest[segment].each do |manifest_record| - checksum = manifest_record[:checksum] - path = manifest_record[:path] - - begin - checksum_obj = Chef::Checksum.cdb_load(checksum) - rescue Chef::Exceptions::CouchDBNotFound => cdbx - checksum_obj = nil - end - - raise BadRequest, "Manifest has checksum #{checksum} (path #{path}) but it hasn't yet been uploaded" unless checksum_obj - end - end - - raise InternalServerError, "Error saving cookbook" unless cookbook.cdb_save - - display cookbook - end - - def destroy - begin - cookbook = get_cookbook_version(cookbook_name, cookbook_version) - rescue ArgumentError => e - raise NotFound, "Cannot find a cookbook named #{cookbook_name} with version #{cookbook_version}" - end - - if params["purge"] == "true" - display cookbook.purge - else - display cookbook.cdb_destroy - end - end - - private - - def get_cookbook_version(name, version) - Chef::CookbookVersion.cdb_load(name, version) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot find a cookbook named #{name} with version #{version}" - rescue Net::HTTPServerException => e - if e.to_s =~ /^404/ - raise NotFound, "Cannot find a cookbook named #{name} with version #{version}" - else - raise - end - end - -end - diff --git a/chef-server-api/app/controllers/data_bags.rb b/chef-server-api/app/controllers/data_bags.rb deleted file mode 100644 index 8a4a8e015a..0000000000 --- a/chef-server-api/app/controllers/data_bags.rb +++ /dev/null @@ -1,75 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'chef/data_bag' - -class DataBags < Application - - provides :json - - before :authenticate_every - before :is_admin, :only => [ :create, :destroy ] - - def index - @bag_list = Chef::DataBag.cdb_list(false) - display(@bag_list.inject({}) { |r,b| r[b] = absolute_url(:datum, :id => b); r }) - - end - - def show - begin - @data_bag = Chef::DataBag.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load data bag #{params[:id]}" - end - display(@data_bag.list.inject({}) { |res, i| res[i] = absolute_url(:data_bag_item, :data_bag_id => @data_bag.name, :id => i); res }) - end - - def create - @data_bag = nil - if params.has_key?("inflated_object") - @data_bag = params["inflated_object"] - else - @data_bag = Chef::DataBag.new - @data_bag.name(params["name"]) - end - exists = true - begin - Chef::DataBag.cdb_load(@data_bag.name) - rescue Chef::Exceptions::CouchDBNotFound - exists = false - end - raise Conflict, "Data bag already exists" if exists - self.status = 201 - @data_bag.cdb_save - display({ :uri => absolute_url(:datum, :id => @data_bag.name) }) - end - - def destroy - begin - @data_bag = Chef::DataBag.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load data bag #{params[:id]}" - end - @data_bag.cdb_destroy - @data_bag.couchdb_rev = nil - display @data_bag - end - -end diff --git a/chef-server-api/app/controllers/data_item.rb b/chef-server-api/app/controllers/data_item.rb deleted file mode 100644 index f88a2507e8..0000000000 --- a/chef-server-api/app/controllers/data_item.rb +++ /dev/null @@ -1,108 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Author:: Nuo Yan (<nuo@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'chef/data_bag' -require 'chef/data_bag_item' - -class DataItem < Application - - provides :json - - before :populate_data_bag - before :authenticate_every - before :is_admin, :only => [ :create, :update, :destroy ] - - def populate_data_bag - begin - @data_bag = Chef::DataBag.cdb_load(params[:data_bag_id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load data bag #{params[:data_bag_id]}" - end - end - - def show - begin - @data_bag_item = Chef::DataBagItem.cdb_load(params[:data_bag_id], params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load data bag #{params[:data_bag_id]} item #{params[:id]}" - end - display @data_bag_item.raw_data - end - - def create - raw_data = nil - if params.has_key?("inflated_object") - raw_data = params["inflated_object"].raw_data - else - raw_data = params - raw_data.delete(:action) - raw_data.delete(:controller) - raw_data.delete(:data_bag_id) - end - @data_bag_item = nil - begin - @data_bag_item = Chef::DataBagItem.cdb_load(@data_bag.name, params[:id]) - rescue Chef::Exceptions::CouchDBNotFound - @data_bag_item = Chef::DataBagItem.new - @data_bag_item.data_bag(@data_bag.name) - else - raise Conflict, "Databag Item #{params[:id]} already exists" if @data_bag_item - end - @data_bag_item.raw_data = raw_data - @data_bag_item.cdb_save - display @data_bag_item.raw_data - end - - def update - raw_data = nil - if params.has_key?("inflated_object") - raw_data = params["inflated_object"].raw_data - else - raw_data = params - raw_data.delete(:action) - raw_data.delete(:controller) - raw_data.delete(:data_bag_id) - end - - begin - @data_bag_item = Chef::DataBagItem.cdb_load(@data_bag.name, params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load Databag Item #{params[:id]}" - end - - @data_bag_item.raw_data = raw_data - @data_bag_item.cdb_save - display @data_bag_item.raw_data - - end - - - def destroy - begin - @data_bag_item = Chef::DataBagItem.cdb_load(params[:data_bag_id], params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load data bag #{params[:data_bag_id]} item #{params[:id]}" - end - @data_bag_item.cdb_destroy - @data_bag_item.couchdb_rev = nil - display @data_bag_item - end - -end diff --git a/chef-server-api/app/controllers/environments.rb b/chef-server-api/app/controllers/environments.rb deleted file mode 100644 index d5e20171fe..0000000000 --- a/chef-server-api/app/controllers/environments.rb +++ /dev/null @@ -1,207 +0,0 @@ -# -# Author:: Stephen Delano (<stephen@opscode.com>) -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2010, 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. -# - -require 'chef/environment' -require 'chef/cookbook_version_selector' - -class Environments < Application - - include Merb::CookbookVersionHelper - - provides :json - - before :authenticate_every - before :is_admin, :only => [ :create, :update, :destroy ] - - # GET /environments - def index - environment_list = Chef::Environment.cdb_list(true) - display(environment_list.inject({}) { |res, env| res[env.name] = absolute_url(:environment, env.name); res }) - end - - # GET /environments/:id - def show - begin - environment = Chef::Environment.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load environment #{params[:id]}" - end - environment.couchdb_rev = nil - display environment - end - - # POST /environments - def create - env = params["inflated_object"] - exists = true - begin - Chef::Environment.cdb_load(env.name) - rescue Chef::Exceptions::CouchDBNotFound - exists = false - end - raise Conflict, "Environment already exists" if exists - - env.cdb_save - self.status = 201 - display({:uri => absolute_url(:environment, env.name)}) - end - - # PUT /environments/:id - def update - raise MethodNotAllowed if params[:id] == "_default" - begin - env = Chef::Environment.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound - raise NotFound, "Cannot load environment #{params[:id]}" - end - - env.update_from!(params["inflated_object"]) - env.cdb_save - env.couchdb_rev = nil - self.status = 200 - display(env) - end - - # DELETE /environments/:id - def destroy - raise MethodNotAllowed if params[:id] == "_default" - begin - env = Chef::Environment.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound - raise NotFound, "Cannot load environment #{params[:id]}" - end - env.cdb_destroy - display(env) - end - - # GET /environments/:environment_id/cookbooks - # returns data in the format of: - # {"apache2" => { - # :url => "http://url", - # :versions => [{:url => "http://url/1.0.0", :version => "1.0.0"}, {:url => "http://url/0.0.1", :version=>"0.0.1"}] - # } - # } - def list_cookbooks - begin - filtered_cookbooks = Chef::Environment.cdb_load_filtered_cookbook_versions(params[:environment_id]) - rescue Chef::Exceptions::CouchDBNotFound - raise NotFound, "Cannot load environment #{params[:environment_id]}" - end - num_versions = num_versions! - display(filtered_cookbooks.inject({}) {|res, (cookbook_name,versions)| - versions.map!{|v| v.version.to_s} - res[cookbook_name] = expand_cookbook_urls(cookbook_name, versions, num_versions) - res - }) - end - - # GET /environments/:environment_id/cookbooks/:cookbook_id - # returns data in the format of: - # {"apache2" => { - # :url => "http://url", - # :versions => [{:url => "http://url/1.0.0", :version => "1.0.0"}, {:url => "http://url/0.0.1", :version=>"0.0.1"}] - # } - # } - def cookbook - cookbook_name = params[:cookbook_id] - begin - filtered_cookbooks = Chef::Environment.cdb_load_filtered_cookbook_versions(params[:environment_id]) - rescue Chef::Exceptions::CouchDBNotFound - raise NotFound, "Cannot load environment #{params[:environment_id]}" - end - raise NotFound, "Cannot load cookbook #{cookbook_name}" unless filtered_cookbooks.has_key?(cookbook_name) - versions = filtered_cookbooks[cookbook_name].map{|v| v.version.to_s} - num_versions = num_versions!("all") - display({ cookbook_name => expand_cookbook_urls(cookbook_name, versions, num_versions) }) - end - - # GET /environments/:environment/recipes - def list_recipes - display(Chef::Environment.cdb_load_filtered_recipe_list(params[:environment_id])) - end - - # GET /environments/:environment_id/nodes - def list_nodes - node_list = Chef::Node.cdb_list_by_environment(params[:environment_id]) - display(node_list.inject({}) {|r,n| r[n] = absolute_url(:node, n); r}) - end - - # GET /environments/:environment_id/roles/:role_id - def role - begin - role = Chef::Role.cdb_load(params[:role_id]) - rescue Chef::Exceptions::CouchDBNotFound - raise NotFound, "Cannot load role #{params[:role_id]}" - end - display("run_list" => role.env_run_lists[params[:environment_id]]) - end - - # POST /environments/:environment_id/cookbook_versions - # - # Take the given run_list and return the versions of cookbooks that would - # be used after applying the constraints of the given environment. - # - # INPUT: - # :run_list = an Array of String's, e.g., - # ["recipe[apache2]", "recipe[runit]"] - # - # OUT: - # Hash of cookbook names cookbook manifest - # - # NOTE: This method is a POST, not because it's a mutator (it's idempotent), - # but the run_list can likely exceed Merb's query string limit for GET - # of 1024 characters. - def cookbook_versions_for_run_list - begin - # not possible to be nil due to the route to get us to this API - # endpoint - environment_input = params[:environment_id] - - run_list_input = params[:run_list] - raise BadRequest, "Missing param: run_list" unless run_list_input - raise BadRequest, "Param run_list is not an Array: #{run_list_input.class}" unless run_list_input.is_a?(Array) - - # Convert the input array of strings to a RunList containing - # RunListItem's. - run_list = Chef::RunList.new - run_list_input.each do |run_list_item_string| - run_list << run_list_item_string - end - - # Expand the run list in the scope of the specified environment. - names_to_cookbook_version = Chef::CookbookVersionSelector.expand_to_cookbook_versions(run_list, environment_input) - rescue Chef::Exceptions::CouchDBNotFound - raise NotFound, "Cannot load environment #{params[:environment_id]}" - rescue Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems => e - raise PreconditionFailed, e.to_json - rescue Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem => e - raise PreconditionFailed, e.to_json - end - - # Convert from - # name => CookbookVersion - # to - # name => cookbook manifest - # and display. - display(names_to_cookbook_version.inject({}) do |res, (cookbook_name, cookbook_version)| - res[cookbook_name] = cookbook_version.generate_manifest_with_urls {|opts| absolute_url(:cookbook_file, opts) } - res - end) - end -end diff --git a/chef-server-api/app/controllers/exceptions.rb b/chef-server-api/app/controllers/exceptions.rb deleted file mode 100644 index db1acdb167..0000000000 --- a/chef-server-api/app/controllers/exceptions.rb +++ /dev/null @@ -1,40 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Copyright:: Copyright (c) 2008 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 Exceptions < Application - - provides :json - - def not_acceptable - if request.accept =~ /application\/json/ - display({ "error" => request.exceptions }) - else - render - end - end - - def standard_error - if request.accept =~ /application\/json/ - display({ "error" => request.exceptions }) - else - raise request.exceptions.first - end - end - -end diff --git a/chef-server-api/app/controllers/main.rb b/chef-server-api/app/controllers/main.rb deleted file mode 100644 index 2c5158fc21..0000000000 --- a/chef-server-api/app/controllers/main.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Main < Application - - provides :html, :json - - def index - case content_type - when :json - display absolute_url(:nodes) => "Manage Nodes", - absolute_url(:roles) => "Manage Roles", - absolute_url(:cookbooks) => "Manage Cookbooks", - absolute_url(:data) => "Manage Data Bags", - absolute_url(:search) => "Search" - else - @webui_url = if Chef::Config[:chef_webui_url] - Chef::Config[:chef_webui_url] - elsif request.host =~ /(.*):4000/ - absolute_url(:top, :host => "#{$1}:4040") - else - nil - end - render - end - end - -end diff --git a/chef-server-api/app/controllers/nodes.rb b/chef-server-api/app/controllers/nodes.rb deleted file mode 100644 index 72564f02fe..0000000000 --- a/chef-server-api/app/controllers/nodes.rb +++ /dev/null @@ -1,115 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'chef/node' -require 'chef/version_class' -require 'chef/version_constraint' -require 'chef/cookbook_version_selector' - -class Nodes < Application - - provides :json - - before :authenticate_every - before :admin_or_requesting_node, :only => [ :update, :destroy, :cookbooks ] - - def index - @node_list = Chef::Node.cdb_list - display(@node_list.inject({}) do |r,n| - r[n] = absolute_url(:node, n); r - end) - end - - def show - begin - @node = Chef::Node.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load node #{params[:id]}" - end - @node.couchdb_rev = nil - display @node - end - - def create - @node = params["inflated_object"] - begin - Chef::Node.cdb_load(@node.name) - raise Conflict, "Node already exists" - rescue Chef::Exceptions::CouchDBNotFound - end - self.status = 201 - @node.cdb_save - display({ :uri => absolute_url(:node, @node.name) }) - end - - def update - begin - @node = Chef::Node.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load node #{params[:id]}" - end - - @node.update_from!(params['inflated_object']) - @node.cdb_save - @node.couchdb_rev = nil - display(@node) - end - - def destroy - begin - @node = Chef::Node.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load node #{params[:id]}" - end - @node.cdb_destroy - @node.couchdb_rev = nil - display @node - end - - # Return a hash, cookbook_name => cookbook manifest, of the cookbooks - # appropriate for this node, using its run_list and environment. - def cookbooks - begin - @node = Chef::Node.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load node #{params[:id]}" - end - - # Get the mapping of cookbook_name => CookbookVersion applicable to - # this node's run_list and its environment. - begin - included_cookbooks = Chef::CookbookVersionSelector.expand_to_cookbook_versions(@node.run_list, @node.chef_environment) - rescue Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems => e - raise PreconditionFailed, e.to_json - rescue Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem => e - raise PreconditionFailed, e.to_json - end - - # Convert from - # name => CookbookVersion - # to - # name => cookbook manifest - # and display. - display(included_cookbooks.inject({}) do |acc, (cookbook_name, cookbook_version)| - acc[cookbook_name.to_s] = cookbook_version.generate_manifest_with_urls{|opts| absolute_url(:cookbook_file, opts) } - acc - end) - end - -end diff --git a/chef-server-api/app/controllers/roles.rb b/chef-server-api/app/controllers/roles.rb deleted file mode 100644 index 6dfe5ec03e..0000000000 --- a/chef-server-api/app/controllers/roles.rb +++ /dev/null @@ -1,91 +0,0 @@ -require 'chef/role' - -class Roles < Application - provides :json - - before :authenticate_every - before :is_admin, :only => [ :create, :update, :destroy ] - - # GET /roles - def index - @role_list = Chef::Role.cdb_list(true) - display(@role_list.inject({}) { |r,role| r[role.name] = absolute_url(:role, role.name); r }) - end - - # GET /roles/:id - def show - begin - @role = Chef::Role.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load role #{params[:id]}" - end - @role.couchdb_rev = nil - display @role - end - - # POST /roles - def create - @role = params["inflated_object"] - exists = true - begin - Chef::Role.cdb_load(@role.name) - rescue Chef::Exceptions::CouchDBNotFound - exists = false - end - raise Conflict, "Role already exists" if exists - - @role.cdb_save - - self.status = 201 - display({ :uri => absolute_url(:role, :id => @role.name) }) - end - - # PUT /roles/:id - def update - begin - @role = Chef::Role.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load role #{params[:id]}" - end - - @role.update_from!(params["inflated_object"]) - @role.cdb_save - self.status = 200 - @role.couchdb_rev = nil - display(@role) - end - - # DELETE /roles/:id - def destroy - begin - @role = Chef::Role.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load role #{params[:id]}" - end - @role.cdb_destroy - display @role - end - - # GET /roles/:id/environments/:env_id - def environment - begin - @role = Chef::Role.cdb_load(params[:role_id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load role #{params[:role_id]}" - end - display("run_list" => @role.env_run_lists[params[:env_id]]) - end - - # GET /roles/:id/environments - def environments - begin - @role = Chef::Role.cdb_load(params[:role_id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load role #{params[:role_id]}" - end - - display(@role.env_run_lists.keys.sort) - end - - -end diff --git a/chef-server-api/app/controllers/sandboxes.rb b/chef-server-api/app/controllers/sandboxes.rb deleted file mode 100644 index c1eb552b9c..0000000000 --- a/chef-server-api/app/controllers/sandboxes.rb +++ /dev/null @@ -1,161 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -require 'chef/sandbox' -require 'chef/checksum' - -# Sandboxes are used to upload files to the server (e.g., cookbook upload). -class Sandboxes < Application - - provides :json - - before :authenticate_every - - include Chef::Mixin::Checksum - include Merb::TarballHelper - - def index - couch_sandbox_list = Chef::Sandbox::cdb_list(true) - - sandbox_list = Hash.new - couch_sandbox_list.each do |sandbox| - sandbox_list[sandbox.guid] = absolute_url(:sandbox, :sandbox_id => sandbox.guid) - end - display sandbox_list - end - - def show - begin - sandbox = Chef::Sandbox.cdb_load(params[:sandbox_id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot find a sandbox named #{params[:sandbox_id]}" - end - - display sandbox - end - - def create - checksums = params[:checksums] - - raise BadRequest, "missing required parameter: checksums" unless checksums - raise BadRequest, "required parameter checksums is not a hash: #{checksums.class.name}" unless checksums.is_a?(Hash) - - new_sandbox = Chef::Sandbox.new - result_checksums = Hash.new - - all_existing_checksums = Chef::Checksum.cdb_all_checksums - checksums.keys.each do |checksum| - if all_existing_checksums[checksum] - result_checksums[checksum] = { - :needs_upload => false - } - else - result_checksums[checksum] = { - :url => absolute_url(:sandbox_checksum, :sandbox_id => new_sandbox.guid, :checksum => checksum), - :needs_upload => true - } - new_sandbox.checksums << checksum - end - end - - FileUtils.mkdir_p(sandbox_location(new_sandbox.guid)) - - new_sandbox.cdb_save - - # construct successful response - self.status = 201 - location = absolute_url(:sandbox, :sandbox_id => new_sandbox.guid) - headers['Location'] = location - result = { 'uri' => location, 'checksums' => result_checksums, 'sandbox_id' => new_sandbox.guid } - #result = { 'uri' => location } - - display result - end - - def upload_checksum - sandbox_file = ChefServerApi::SandboxFile.new(self.request.env["rack.input"], params) - raise BadRequest, sandbox_file.error if sandbox_file.invalid_params? - raise NotFound, sandbox_file.error if sandbox_file.invalid_sandbox? - raise BadRequest, sandbox_file.error if sandbox_file.invalid_file? - - sandbox_file.commit_to(sandbox_checksum_location(sandbox_file.sandbox_id, sandbox_file.expected_checksum)) - - url = absolute_url(:sandbox_checksum, sandbox_file.resource_params) - result = { 'uri' => url } - display result - end - - def update - # look up the sandbox by its guid - existing_sandbox = Chef::Sandbox.cdb_load(params[:sandbox_id]) - raise NotFound, "cannot find sandbox with guid #{params[:sandbox_id]}" unless existing_sandbox - - if existing_sandbox.is_completed - Chef::Log.warn("Sandbox finalization: #{params[:sandbox_id]} is already complete, ignoring") - return display(existing_sandbox) - end - - if params[:is_completed] - existing_sandbox.is_completed = (params[:is_completed] == true) - - if existing_sandbox.is_completed - # Check if files were uploaded to sandbox directory before we - # commit the sandbox. Fail if any weren't. - existing_sandbox.checksums.each do |checksum| - checksum_filename = sandbox_checksum_location(existing_sandbox.guid, checksum) - if !File.exists?(checksum_filename) - raise BadRequest, "cannot update sandbox #{params[:sandbox_id]}: checksum #{checksum} was not uploaded" - end - end - - # If we've gotten here all the files have been uploaded. - # Track the steps to undo everything we've done. If any steps fail, - # we will undo the successful steps that came before it - begin - undo_steps = Array.new - existing_sandbox.checksums.each do |file_checksum| - checksum_filename_in_sandbox = sandbox_checksum_location(existing_sandbox.guid, file_checksum) - checksum = Chef::Checksum.new(file_checksum) - - checksum.commit_sandbox_file(checksum_filename_in_sandbox) - - undo_steps << proc { checksum.revert_sandbox_file_commit } - end - rescue - # undo the successful moves we did before - Chef::Log.error("Sandbox finalization: got exception moving files, undoing previous changes: #{$!} -- #{$!.backtrace.join("\n")}") - undo_steps.each do |undo_step| - undo_step.call - end - raise - end - - end - end - - existing_sandbox.cdb_save - - display existing_sandbox - end - - def destroy - raise NotFound, "Destroy not implemented" - end - -end - diff --git a/chef-server-api/app/controllers/search.rb b/chef-server-api/app/controllers/search.rb deleted file mode 100644 index 77f83d0da0..0000000000 --- a/chef-server-api/app/controllers/search.rb +++ /dev/null @@ -1,58 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Copyright:: Copyright (c) 2008 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. - - -require 'chef/solr_query' - -class Search < Application - provides :json - - before :authenticate_every - before :is_admin, :only => [:reindex] - - def index - indexes = valid_indexes - display(indexes.inject({}) { |r,i| r[i] = absolute_url(:search_show, i); r }) - end - - def valid_indexes - indexes = Chef::DataBag.cdb_list(false) - indexes += %w{ role node client environment} - end - - def show - unless valid_indexes.include?(params[:id]) - raise NotFound, "I don't know how to search for #{params[:id]} data objects." - end - params[:type] = params.delete(:id) - display(Chef::SolrQuery.from_params(params).search) - rescue Chef::Exceptions::QueryParseError => e - # we set status rather than raising BadRequest to avoid a - # stacktrace in the server log - self.status = 400 - e_msg = e.message.gsub(/\n/, " ") - msg = "invalid search query: '#{params[:q]}' #{e_msg}" - Chef::Log.warn("400 #{msg}") - display({ "error" => [msg] }) - end - - def reindex - display(Chef::SolrQuery.new.rebuild_index) - end - -end diff --git a/chef-server-api/app/controllers/users.rb b/chef-server-api/app/controllers/users.rb deleted file mode 100644 index a336f04f03..0000000000 --- a/chef-server-api/app/controllers/users.rb +++ /dev/null @@ -1,78 +0,0 @@ -# -# Author:: Nuo Yan (<nuo@opscode.com>) -# Copyright:: Copyright (c) 2009 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. - - -require File.join("chef", "webui_user") - -class Users < Application - provides :json - - before :authenticate_every - before :is_admin, :only => [ :create, :destroy, :update ] - - # GET to /users - def index - @user_list = Chef::WebUIUser.cdb_list - display(@user_list.inject({}) { |r,n| r[n] = absolute_url(:user, n); r }) - end - - # GET to /users/:id - def show - begin - @user = Chef::WebUIUser.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load user #{params[:id]}" - end - display @user - end - - # PUT to /users/:id - def update - begin - Chef::WebUIUser.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load user #{params[:id]}" - end - @user = params['inflated_object'] - @user.cdb_save - display(@user) - end - - # POST to /users - def create - @user = params["inflated_object"] - begin - Chef::WebUIUser.cdb_load(@user.name) - rescue Chef::Exceptions::CouchDBNotFound - @user.cdb_save - self.status = 201 - else - raise Conflict, "User already exists" - end - display({ :uri => absolute_url(:user, @user.name) }) - end - - def destroy - begin - @user = Chef::WebUIUser.cdb_load(params[:id]) - rescue Chef::Exceptions::CouchDBNotFound => e - raise NotFound, "Cannot load user #{params[:id]}" - end - @user.cdb_destroy - display @user - end -end diff --git a/chef-server-api/app/helpers/cookbook_version_helper.rb b/chef-server-api/app/helpers/cookbook_version_helper.rb deleted file mode 100644 index 76c70ddc06..0000000000 --- a/chef-server-api/app/helpers/cookbook_version_helper.rb +++ /dev/null @@ -1,72 +0,0 @@ -# -# Author:: Stephen Delano (<stephen@opscode.com>) -# 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. -# - -module Merb - module CookbookVersionHelper - - include Merb::ControllerExceptions - - # takes a cookbook_name and an array of versions and returns a hash - # params: - # - cookbook_name: the name of the cookbook - # - versions: a sorted list of version strings - # - # returns: - # { - # :url => http://url, - # :versions => [ - # { :version => version, :url => http://url/version }, - # { :version => version, :url => http://url/version } - # ] - # } - def expand_cookbook_urls(cookbook_name, versions, num_versions) - versions = versions[0...num_versions.to_i] unless num_versions == "all" - version_list = versions.inject([]) do |res, version| - res.push({ - :url => absolute_url(:cookbook_version, :cookbook_name => cookbook_name, :cookbook_version => version), - :version => version - }) - res - end - url = absolute_url(:cookbook, :cookbook_name => cookbook_name) - {:url => url, :versions => version_list} - end - - # validate and return the number of versions requested - # by the user - # - # raises an exception if an invalid number is requested - # - # params: - # - default: the number of versions to default to - # - # valid num_versions query parameter: - # - an integer >= 0 - # - the string "all" - def num_versions!(default="1") - input = params[:num_versions] - result = if input - valid_input = (input == "all" || Integer(input) >= 0) rescue false - raise BadRequest, "You have requested an invalid number of versions (x >= 0 || 'all')" unless valid_input - input - else - default - end - end - end -end
\ No newline at end of file diff --git a/chef-server-api/app/helpers/tarball_helper.rb b/chef-server-api/app/helpers/tarball_helper.rb deleted file mode 100644 index a3dff2a137..0000000000 --- a/chef-server-api/app/helpers/tarball_helper.rb +++ /dev/null @@ -1,100 +0,0 @@ -# -# Author:: Christopher Walters (<cw@opscode.com>) -# Copyright:: Copyright (c) 2009 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. -# - -module Merb - module TarballHelper - - class FileParameterException < StandardError ; end - - def validate_file_parameter(cookbook_name, file_param) - raise FileParameterException, "missing required parameter: file" unless file_param - raise FileParameterException, "invalid parameter: file must be a File" unless file_param.respond_to?(:has_key?) && file_param[:tempfile].respond_to?(:read) - tarball_path = file_param[:tempfile].path - raise FileParameterException, "invalid tarball: (try creating with 'tar czf cookbook.tar.gz cookbook/')" unless system("tar", "tzf", tarball_path) - entry_roots = `tar tzf #{tarball_path}`.split("\n").map{|e|(e.split('/')-['.']).first}.uniq - raise FileParameterException, "invalid tarball: tarball root must contain #{cookbook_name}" unless entry_roots.include?(cookbook_name) - end - - def sandbox_base - Chef::Config.sandbox_path - end - - def sandbox_location(sandbox_guid) - File.join(sandbox_base, sandbox_guid) - end - - def sandbox_checksum_location(sandbox_guid, checksum) - File.join(sandbox_location(sandbox_guid), checksum) - end - - def cookbook_base - [Chef::Config.cookbook_path].flatten.first - end - - def cookbook_location(cookbook_name) - File.join(cookbook_base, cookbook_name) - end - - def cookbook_base - [Chef::Config.cookbook_path].flatten.first - end - - def cookbook_location(cookbook_name) - File.join(cookbook_base, cookbook_name) - end - - def cookbook_location(cookbook_name) - File.join(cookbook_base, cookbook_name) - end - - def get_or_create_cookbook_tarball_location(cookbook_name) - tarball_location = cookbook_tarball_location(cookbook_name) - unless File.exists? tarball_location - args = ["tar", "-C", cookbook_base, "-czf", tarball_location, cookbook_name] - Chef::Log.debug("Tarball for #{cookbook_name} not found, so creating at #{tarball_location} with '#{args.join(' ')}'") - FileUtils.mkdir_p(Chef::Config.cookbook_tarball_path) - system(*args) - end - tarball_location - end - - def expand_tarball_and_put_in_repository(cookbook_name, file) - # untar cookbook tarball into tempdir - tempdir = File.join("#{file.path}.data") - Chef::Log.debug("Creating #{tempdir} and untarring #{file.path} into it") - FileUtils.mkdir_p(tempdir) - raise "Could not untar file" unless system("tar", "xzf", file.path, "-C", tempdir) - - cookbook_path = cookbook_location(cookbook_name) - tarball_path = cookbook_tarball_location(cookbook_name) - - # clear any existing cookbook components and move tempdir into the repository - Chef::Log.debug("Moving #{tempdir} to #{cookbook_path}") - FileUtils.rm_rf(cookbook_path) - FileUtils.mkdir_p(cookbook_path) - Dir[File.join(tempdir, cookbook_name, "*")].each{|e| FileUtils.mv(e, cookbook_path)} - - # clear the existing tarball (if exists) and move the downloaded tarball to the cache - Chef::Log.debug("Moving #{file.path} to #{tarball_path}") - FileUtils.mkdir_p(Chef::Config.cookbook_tarball_path) - FileUtils.rm_f(tarball_path) - FileUtils.mv(file.path, tarball_path) - end - - end -end diff --git a/chef-server-api/app/models/sandbox_file.rb b/chef-server-api/app/models/sandbox_file.rb deleted file mode 100644 index 43671acb34..0000000000 --- a/chef-server-api/app/models/sandbox_file.rb +++ /dev/null @@ -1,120 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -require 'chef/sandbox' -require 'chef/exceptions' -require 'chef/checksum_cache' - -module ChefServerApi - class SandboxFile - attr_reader :sandbox_id - attr_reader :expected_checksum - attr_reader :error - - def initialize(input, params={}) - @input = input - @sandbox_id = params[:sandbox_id] - @expected_checksum = params[:checksum] - @sandbox_loaded = false - @error = nil - end - - def resource_params - {:sandbox_id => sandbox_id, :checksum => expected_checksum} - end - - def sandbox - unless @sandbox_loaded - load_sandbox - @sandbox_loaded = true - end - @sandbox - end - - def commit_to(destination_file_path) - if @input.respond_to?(:path) && @input.path - commit_tempfile_to(destination_file_path) - else - commit_stringio_to(destination_file_path) - end - end - - def actual_checksum - @actual_checksum ||= begin - @input.rewind - Chef::ChecksumCache.instance.generate_md5_checksum(@input) - end - end - - def invalid_file? - if expected_checksum != actual_checksum - @error = "Uploaded file is invalid: expected a md5 sum '#{expected_checksum}', but it was '#{actual_checksum}'" - else - false - end - end - - def invalid_params? - if @sandbox_id.nil? - @error = "Cannot upload file with checksum '#{expected_checksum}': you must provide a sandbox_id" - elsif @expected_checksum.nil? - @error = "Cannot upload file to sandbox '#{sandbox_id}': you must provide the file's checksum" - else - false - end - end - - def invalid_sandbox? - if sandbox.nil? - @error = "Cannot find sandbox with id '#{sandbox_id}' in the database" - elsif !sandbox.member?(@expected_checksum) - @error = "Cannot upload file: checksum '#{expected_checksum}' isn't a part of sandbox '#{sandbox_id}'" - else - false - end - end - - private - - def load_sandbox - @sandbox = Chef::Sandbox.cdb_load(@sandbox_id) - rescue Chef::Exceptions::CouchDBNotFound - @sandbox = nil - end - - def commit_stringio_to(destination_file_path) - Tempfile.open("sandbox") do |src| - @input.rewind - while chunk = @input.read(8184) - src.write(chunk) - end - src.close - Chef::Log.info("upload_checksum: move #{src.path} to #{destination_file_path}") - FileUtils.mv(src.path, destination_file_path) - end - end - - def commit_tempfile_to(destination_file_path) - Chef::Log.debug("Sandbox file provided as tempfile: #{@input.inspect}") - Chef::Log.info("upload_checksum: move #{@input.path} to #{destination_file_path}") - FileUtils.mv(@input.path, destination_file_path) - end - - end - -end diff --git a/chef-server-api/app/views/exceptions/bad_request.json.erb b/chef-server-api/app/views/exceptions/bad_request.json.erb deleted file mode 100644 index f266cf99b9..0000000000 --- a/chef-server-api/app/views/exceptions/bad_request.json.erb +++ /dev/null @@ -1 +0,0 @@ -<%= { :error => params[:exception], :code => 400 }.to_json %>
\ No newline at end of file diff --git a/chef-server-api/app/views/exceptions/internal_server_error.html.erb b/chef-server-api/app/views/exceptions/internal_server_error.html.erb deleted file mode 100644 index aadbfad350..0000000000 --- a/chef-server-api/app/views/exceptions/internal_server_error.html.erb +++ /dev/null @@ -1,216 +0,0 @@ -<html> -<head> - <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> - <title><%= @exception_name %></title> - <style type="text/css" media="screen"> - body { - font-family:arial; - font-size:11px; - } - h1 { - font-size:48px; - letter-spacing:-4px; - margin:0; - line-height:36px; - color:#333; - } - h1 sup { - font-size: 0.5em; - } - h1 sup.error_500, h1 sup.error_400 { - color:#990E05; - } - h1 sup.error_100, h1 sup.error_200 { - color:#00BF10; - } - h1 sup.error_300 { - /* pretty sure you cant 'see' status 300 - errors but if you could I think they - would be blue */ - color:#1B2099; - } - h2 { - font-size:36px; - letter-spacing:-3px; - margin:0; - line-height:28px; - color:#444; - } - a, a:visited { - color:#00BF10; - } - .internalError { - width:800px; - margin:50px auto; - } - .header { - border-bottom:10px solid #333; - margin-bottom:1px; - background-image: url("data:image/gif;base64,R0lGODlhAwADAIAAAP///8zMzCH5BAAAAAAALAAAAAADAAMAAAIEBHIJBQA7"); - padding:20px; - } - table.trace { - width:100%; - font-family:courier, monospace; - letter-spacing:-1px; - border-collapse: collapse; - border-spacing:0; - } - table.trace tr td{ - padding:0; - height:26px; - font-size:13px; - vertical-align:middle; - } - table.trace tr.file{ - border-top:2px solid #fff; - background-color:#F3F3F3; - } - table.trace tr.source { - background-color:#F8F8F8; - display:none; - } - table.trace .open tr.source { - display:table-row; - } - table.trace tr.file td.expand { - width:23px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdVJREFUeNqMVL+TwUAYxaRIOlEhlZHGDAUzzOQ61+AqXMV1lJSU7q/QRqm8KFUcJTNn5qJkaPyoKKVz7y4mF8na5Kt29tt9+/Z97/u81+vVQ4r9frdarS6Xi7ETDIZisRjxMGPfmk4niNPpZE+xLAugbPaZ53nzvtfMBe/3+/3dbuehBrAKhZdUKkVAWa9Xsiybv0CPZDJZLr/qa5/BwgwRjYqOKIvFYjQa/aNommZh0Ww2K5UqzwfoQOPxaLPZ3FAmk0+7lplMpt1u53J5OpBOR0eZEE9wHJfP5zud93g88QhluwWbjW+5VOmKBgKBer3eaDTDYeGBQF8+x7rqIYoiPgixWJazpA6HA+MSxRArkUgMh0M409g8Ho8+9wYxxCqVSq1W26EDHGM2m4HOHQrEc38f/Yn7cLmlIRhBENzcx8cVRZnPZ/YUep2BWkjTIfA+PKVpZAXR5QxsjiqCKvGEqqp443w+0dvy17swqD0HB3S73V5PpkNg1qBqt8kwGCjmPkinM0QJbIoEa7U6UG6ToVgs4V9G2g0ESoP5Aoi7KYX5oCgf8IKbkvn9/mr1LRQKESamzgJy0g0tSZIuB3nuGqRU9Vv9C4sKkUhEkp4soxvxI8AAhWrrtXa3X8EAAAAASUVORK5CYII=); - background-position:top left; - background-repeat:no-repeat; - } - table.trace .open tr.file td.expand { - width:19px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXZJREFUeNrslK1ywkAUhcMOBomEOiSdqLxEBJX0NaijOsjyHGGmCGyQQYaiiiw4gktkcOmZbpsuuzQ/M5XnqJ2d3S/n3nM3rTzPLUP7/Tt0+pLcGQwG3W53OLyHzPMtjYL7q9UqSRLrD4E1Gj1orCvKYuFHUWTVkOM44/HjDcp8/lL4r6NerzeZPMm1KFw0QkDn83m5fP2lHA4fNQvRtNvtjsfDd0WzmSfb2e/fdTqdOvdh/HLJZLOn0+d2HJ+KRGzbdl23EpFlmed5cp2maRzHQq1lvQ5KMi6EUZBGfup6E1pTfd+vrGW7jbQ2C9hTt9BpqNyIWaAwAy6xg2eBz5iRC/NomiZhGN5sqmnkauo0BUGgVQoBjQ80oCACgNQdZHfTYBkF2mxCtWWAqunWpahxIDUt3QYUxIFQpJHyIWpXjinabKbbwItMHT+NyjchrP8QKaSQQgoppJBCCimkkEIKKaSQQgoppJBCCimkkEIKKaSo+hRgAEFD17X08O2NAAAAAElFTkSuQmCC); - background-position:top left; - background-repeat:no-repeat; - } - table.trace tr.source td.collapse { - width:19px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs0zFygkAUBmBlUkgJHdABlQwVkVJKKUxBYWbkALTxMJwhltyDFkss03IF8pudIcwaDaDl/6pd2P327b7d+eHwMXs4lNkzggoVKlSoUKFChQoVKlSoUKFChQoVKlSoUKFChQqVEYqm6ft9+qiSJEkYho7jTlcw2fd9NOI4nq4gEdFwXXe1Cqco63VkWVbXRTqLhTpOwQRpF7quR1E0TgGhqvLKUFCyoQqG/rks3O6kZKW/eRFpevOCoGTXVTcMQ5EyxyDEkML1c5RzuZOICIyXqn7JBVez6282MWrx731HOv2qB8Hri2lamNk0DfpVVdV1Peodappmmua8bdvzuc7zfNprzrLMth1FnGh/X8MjCAIQv/cFz/+65PcDh7rbvYv2ZUfdj+PxsyzLgVl0hKwgTqeqKApx2LeOc7t98zyv/1FWOgvx9RPii23bmL9cetJ8Ed8CDAC6aFW8bCzFhwAAAABJRU5ErkJggg==); - background-position:bottom left; - background-repeat:no-repeat; - background-color:#6F706F; - } - table.trace tr td.path { - padding-left:10px; - } - table.trace tr td.code { - padding-left:35px; - white-space: pre; - line-height:9px; - padding-bottom:10px; - } - table.trace tr td.code em { - font-weight:bold; - color:#00BF10; - } - table.trace tr td.code a { - width: 20px; - float: left; - } - table.trace tr td.code .more { - color:#666; - } - table.trace tr td.line { - width:30px; - text-align:right; - padding-right:4px; - } - .footer { - margin-top:5px; - font-size:11px; - color:#444; - text-align:right; - } - </style> -</head> -<body> - <div class="internalError"> - - <div class="header"> - <h1><%= @exception_name %> <sup class="error_<%= @exception.class::STATUS %>"><%= @exception.class::STATUS %></sup></h1> - <% if show_details = ::Merb::Config[:exception_details] -%> - <h2><%= @exception.message %></h2> - <% else -%> - <h2>Sorry about that...</h2> - <% end -%> - <h3>Parameters</h3> - <ul> - <% params[:original_params].each do |param, value| %> - <li><strong><%= param %>:</strong> <%= value.inspect %></li> - <% end %> - <%= "<li>None</li>" if params[:original_params].empty? %> - </ul> - - <h3>Session</h3> - <ul> - <% params[:original_session].each do |param, value| %> - <li><strong><%= param %>:</strong> <%= value.inspect %></li> - <% end %> - <%= "<li>None</li>" if params[:original_session].empty? %> - </ul> - - <h3>Cookies</h3> - <ul> - <% params[:original_cookies].each do |param, value| %> - <li><strong><%= param %>:</strong> <%= value.inspect %></li> - <% end %> - <%= "<li>None</li>" if params[:original_cookies].empty? %> - </ul> - </div> - - <% if show_details %> - <table class="trace"> - <% @exception.backtrace.each_with_index do |line, index| %> - <tbody class="close"> - <tr class="file"> - <td class="expand"> - </td> - <td class="path"> - <%= (line.match(/^([^:]+)/)[1] rescue 'unknown').sub(/\/((opt|usr)\/local\/lib\/(ruby\/)?(gems\/)?(1.8\/)?(gems\/)?|.+\/app\/)/, '') %> - <% unless line.match(/\.erb:/) %> - in "<strong><%= line.match(/:in `(.+)'$/)[1] rescue '?' %></strong>" - <% else %> - (<strong>ERB Template</strong>) - <% end %> - </td> - <td class="line"> - <a href="txmt://open?url=file://<%=file = (line.match(/^([^:]+)/)[1] rescue 'unknown')%>&line=<%= lineno = line.match(/:([0-9]+):/)[1] rescue '?' %>"><%=lineno%></a> - </td> - </tr> - <tr class="source"> - <td class="collapse"> - </td> - <td class="code" colspan="2"><% (__caller_lines__(file, lineno, 5) rescue []).each do |llineno, lcode, lcurrent| %> -<a href="txmt://open?url=file://<%=file%>&line=<%=llineno%>"><%= llineno %></a><%='<em>' if llineno==lineno.to_i %><%= lcode.size > 90 ? CGI.escapeHTML(lcode[0..90])+'<span class="more">......</span>' : CGI.escapeHTML(lcode) %><%='</em>' if llineno==lineno.to_i %> -<% end %> - -</td> - </tr> - </tbody> - <% end %> - </table> - <script type="text/javascript" charset="utf-8"> - // swop the open & closed classes - els = document.getElementsByTagName('td'); - for(i=0; i<els.length; i++){ - if(els[i].className=='expand' || els[i].className=='collapse'){ - els[i].onclick = function(e){ - tbody = this.parentNode.parentNode; - if(tbody.className=='open'){ - tbody.className='closed'; - }else{ - tbody.className='open'; - } - } - } - } - </script> - <% end %> - <div class="footer"> - lots of love, from <a href="#">merb</a> - </div> - </div> -</body> -</html>
\ No newline at end of file diff --git a/chef-server-api/app/views/exceptions/not_acceptable.html.haml b/chef-server-api/app/views/exceptions/not_acceptable.html.haml deleted file mode 100644 index b3e5b966c1..0000000000 --- a/chef-server-api/app/views/exceptions/not_acceptable.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.block#block-text - .content - %h2.title Content-Type Unacceptable. - .inner - The Chef Server's REST API only responds to requests for JSON data. Set the 'Accept' header on your request to 'application/json' and try again. diff --git a/chef-server-api/app/views/exceptions/not_found.html.erb b/chef-server-api/app/views/exceptions/not_found.html.erb deleted file mode 100644 index 388c72c31d..0000000000 --- a/chef-server-api/app/views/exceptions/not_found.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -<div id="container"> - <div id="header-container"> - <img src="/images/merb.jpg" /> - <!-- <h1>Mongrel + Erb</h1> --> - <h2>pocket rocket web framework</h2> - <hr /> - </div> - - <div id="left-container"> - <h3>Exception:</h3> - <p><%= params[:exception] %></p> - </div> - - <div id="main-container"> - <h3>Welcome to Merb!</h3> - <p>Merb is a light-weight MVC framework written in Ruby. We hope you enjoy it.</p> - - <h3>Where can I find help?</h3> - <p>If you have any questions or if you can't figure something out, please take a - look at our <a href="http://merbivore.com/"> project page</a>, - feel free to come chat at irc.freenode.net, channel #merb, - or post to <a href="http://groups.google.com/group/merb">merb mailing list</a> - on Google Groups.</p> - - <h3>What if I've found a bug?</h3> - <p>If you want to file a bug or make your own contribution to Merb, - feel free to register and create a ticket at our - <a href="http://merb.lighthouseapp.com/">project development page</a> - on Lighthouse.</p> - - <h3>How do I edit this page?</h3> - <p>You're seeing this page because you need to edit the following files: - <ul> - <li>config/router.rb <strong><em>(recommended)</em></strong></li> - <li>app/views/exceptions/not_found.html.erb <strong><em>(recommended)</em></strong></li> - <li>app/views/layout/application.html.erb <strong><em>(change this layout)</em></strong></li> - </ul> - </p> - </div> - - <div id="footer-container"> - <hr /> - <div class="left"></div> - <div class="right">© 2007 the merb dev team</div> - <p> </p> - </div> -</div> diff --git a/chef-server-api/app/views/exceptions/standard_error.html.erb b/chef-server-api/app/views/exceptions/standard_error.html.erb deleted file mode 100644 index edb45ddf90..0000000000 --- a/chef-server-api/app/views/exceptions/standard_error.html.erb +++ /dev/null @@ -1,217 +0,0 @@ -<html> -<head> - <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> - <title><%= @exception_name %></title> - <style type="text/css" media="screen"> - body { - font-family:arial; - font-size:11px; - } - h1 { - font-size:48px; - letter-spacing:-4px; - margin:0; - line-height:36px; - color:#333; - } - h1 sup { - font-size: 0.5em; - } - h1 sup.error_500, h1 sup.error_400 { - color:#990E05; - } - h1 sup.error_100, h1 sup.error_200 { - color:#00BF10; - } - h1 sup.error_300 { - /* pretty sure you cant 'see' status 300 - errors but if you could I think they - would be blue */ - color:#1B2099; - } - h2 { - font-size:36px; - letter-spacing:-3px; - margin:0; - line-height:28px; - color:#444; - } - a, a:visited { - color:#00BF10; - } - .internalError { - width:800px; - margin:50px auto; - } - .header { - border-bottom:10px solid #333; - margin-bottom:1px; - background-image: url("data:image/gif;base64,R0lGODlhAwADAIAAAP///8zMzCH5BAAAAAAALAAAAAADAAMAAAIEBHIJBQA7"); - padding:20px; - } - table.trace { - width:100%; - font-family:courier, monospace; - letter-spacing:-1px; - border-collapse: collapse; - border-spacing:0; - } - table.trace tr td{ - padding:0; - height:26px; - font-size:13px; - vertical-align:middle; - } - table.trace tr.file{ - border-top:2px solid #fff; - background-color:#F3F3F3; - } - table.trace tr.source { - background-color:#F8F8F8; - display:none; - } - table.trace .open tr.source { - display:table-row; - } - table.trace tr.file td.expand { - width:23px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdVJREFUeNqMVL+TwUAYxaRIOlEhlZHGDAUzzOQ61+AqXMV1lJSU7q/QRqm8KFUcJTNn5qJkaPyoKKVz7y4mF8na5Kt29tt9+/Z97/u81+vVQ4r9frdarS6Xi7ETDIZisRjxMGPfmk4niNPpZE+xLAugbPaZ53nzvtfMBe/3+/3dbuehBrAKhZdUKkVAWa9Xsiybv0CPZDJZLr/qa5/BwgwRjYqOKIvFYjQa/aNommZh0Ww2K5UqzwfoQOPxaLPZ3FAmk0+7lplMpt1u53J5OpBOR0eZEE9wHJfP5zud93g88QhluwWbjW+5VOmKBgKBer3eaDTDYeGBQF8+x7rqIYoiPgixWJazpA6HA+MSxRArkUgMh0M409g8Ho8+9wYxxCqVSq1W26EDHGM2m4HOHQrEc38f/Yn7cLmlIRhBENzcx8cVRZnPZ/YUep2BWkjTIfA+PKVpZAXR5QxsjiqCKvGEqqp443w+0dvy17swqD0HB3S73V5PpkNg1qBqt8kwGCjmPkinM0QJbIoEa7U6UG6ToVgs4V9G2g0ESoP5Aoi7KYX5oCgf8IKbkvn9/mr1LRQKESamzgJy0g0tSZIuB3nuGqRU9Vv9C4sKkUhEkp4soxvxI8AAhWrrtXa3X8EAAAAASUVORK5CYII=); - background-position:top left; - background-repeat:no-repeat; - } - table.trace .open tr.file td.expand { - width:19px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXZJREFUeNrslK1ywkAUhcMOBomEOiSdqLxEBJX0NaijOsjyHGGmCGyQQYaiiiw4gktkcOmZbpsuuzQ/M5XnqJ2d3S/n3nM3rTzPLUP7/Tt0+pLcGQwG3W53OLyHzPMtjYL7q9UqSRLrD4E1Gj1orCvKYuFHUWTVkOM44/HjDcp8/lL4r6NerzeZPMm1KFw0QkDn83m5fP2lHA4fNQvRtNvtjsfDd0WzmSfb2e/fdTqdOvdh/HLJZLOn0+d2HJ+KRGzbdl23EpFlmed5cp2maRzHQq1lvQ5KMi6EUZBGfup6E1pTfd+vrGW7jbQ2C9hTt9BpqNyIWaAwAy6xg2eBz5iRC/NomiZhGN5sqmnkauo0BUGgVQoBjQ80oCACgNQdZHfTYBkF2mxCtWWAqunWpahxIDUt3QYUxIFQpJHyIWpXjinabKbbwItMHT+NyjchrP8QKaSQQgoppJBCCimkkEIKKaSQQgoppJBCCimkkEIKKaSo+hRgAEFD17X08O2NAAAAAElFTkSuQmCC); - background-position:top left; - background-repeat:no-repeat; - } - table.trace tr.source td.collapse { - width:19px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs0zFygkAUBmBlUkgJHdABlQwVkVJKKUxBYWbkALTxMJwhltyDFkss03IF8pudIcwaDaDl/6pd2P327b7d+eHwMXs4lNkzggoVKlSoUKFChQoVKlSoUKFChQoVKlSoUKFChQqVEYqm6ft9+qiSJEkYho7jTlcw2fd9NOI4nq4gEdFwXXe1Cqco63VkWVbXRTqLhTpOwQRpF7quR1E0TgGhqvLKUFCyoQqG/rks3O6kZKW/eRFpevOCoGTXVTcMQ5EyxyDEkML1c5RzuZOICIyXqn7JBVez6282MWrx731HOv2qB8Hri2lamNk0DfpVVdV1Peodappmmua8bdvzuc7zfNprzrLMth1FnGh/X8MjCAIQv/cFz/+65PcDh7rbvYv2ZUfdj+PxsyzLgVl0hKwgTqeqKApx2LeOc7t98zyv/1FWOgvx9RPii23bmL9cetJ8Ed8CDAC6aFW8bCzFhwAAAABJRU5ErkJggg==); - background-position:bottom left; - background-repeat:no-repeat; - background-color:#6F706F; - } - table.trace tr td.path { - padding-left:10px; - } - table.trace tr td.code { - padding-left:35px; - white-space: pre; - line-height:9px; - padding-bottom:10px; - } - table.trace tr td.code em { - font-weight:bold; - color:#00BF10; - } - table.trace tr td.code a { - width: 20px; - float: left; - } - table.trace tr td.code .more { - color:#666; - } - table.trace tr td.line { - width:30px; - text-align:right; - padding-right:4px; - } - .footer { - margin-top:5px; - font-size:11px; - color:#444; - text-align:right; - } - </style> -</head> -<body> - <div class="internalError"> - - <div class="header"> - <h1><%= @exception_name %> <sup class="error_<%= @exception.class::STATUS %>"><%= @exception.class::STATUS %></sup></h1> - <% if show_details = ::Merb::Config[:exception_details] -%> - <h2><%= @exception.message %></h2> - <% else -%> - <h2>Sorry about that...</h2> - <% end -%> - <h3>Parameters</h3> - <ul> - <% params[:original_params].each do |param, value| %> - <li><strong><%= param %>:</strong> <%= value.inspect %></li> - <% end %> - <%= "<li>None</li>" if params[:original_params].empty? %> - </ul> - - <h3>Session</h3> - <ul> - <% params[:original_session].each do |param, value| %> - <li><strong><%= param %>:</strong> <%= value.inspect %></li> - <% end %> - <%= "<li>None</li>" if params[:original_session].empty? %> - </ul> - - <h3>Cookies</h3> - <ul> - <% params[:original_cookies].each do |param, value| %> - <li><strong><%= param %>:</strong> <%= value.inspect %></li> - <% end %> - <%= "<li>None</li>" if params[:original_cookies].empty? %> - </ul> - </div> - - <% if show_details %> - <table class="trace"> - <% @exception.backtrace.each_with_index do |line, index| %> - <tbody class="close"> - <tr class="file"> - <td class="expand"> - </td> - <td class="path"> - <%= (line.match(/^([^:]+)/)[1] rescue 'unknown').sub(/\/((opt|usr)\/local\/lib\/(ruby\/)?(gems\/)?(1.8\/)?(gems\/)?|.+\/app\/)/, '') %> - <% unless line.match(/\.erb:/) %> - in "<strong><%= line.match(/:in `(.+)'$/)[1] rescue '?' %></strong>" - <% else %> - (<strong>ERB Template</strong>) - <% end %> - </td> - <td class="line"> - <a href="txmt://open?url=file://<%=file = (line.match(/^([^:]+)/)[1] rescue 'unknown')%>&line=<%= lineno = line.match(/:([0-9]+):/)[1] rescue '?' %>"><%=lineno%></a> - </td> - </tr> - <tr class="source"> - <td class="collapse"> - </td> - <td class="code" colspan="2"><% (__caller_lines__(file, lineno, 5) rescue []).each do |llineno, lcode, lcurrent| %> -<a href="txmt://open?url=file://<%=file%>&line=<%=llineno%>"><%= llineno %></a><%='<em>' if llineno==lineno.to_i %><%= lcode.size > 90 ? CGI.escapeHTML(lcode[0..90])+'<span class="more">......</span>' : CGI.escapeHTML(lcode) %><%='</em>' if llineno==lineno.to_i %> -<% end %> - -</td> - </tr> - </tbody> - <% end %> - </table> - <script type="text/javascript" charset="utf-8"> - // swop the open & closed classes - els = document.getElementsByTagName('td'); - for(i=0; i<els.length; i++){ - if(els[i].className=='expand' || els[i].className=='collapse'){ - els[i].onclick = function(e){ - tbody = this.parentNode.parentNode; - if(tbody.className=='open'){ - tbody.className='closed'; - }else{ - tbody.className='open'; - } - } - } - } - </script> - <% end %> - <div class="footer"> - lots of love, from <a href="#">merb</a> - </div> - </div> -</body> -</html> - diff --git a/chef-server-api/app/views/layout/application.html.erb b/chef-server-api/app/views/layout/application.html.erb deleted file mode 100644 index e577a24e12..0000000000 --- a/chef-server-api/app/views/layout/application.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version='1.0' encoding='utf-8' ?> -<!DOCTYPE html> -<html> - <head> - <meta content='text/html; charset=utf-8' http-equiv='content-type' /> - <title>Chef Server</title> - <link href="/stylesheets/base.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" /> - <link href="/stylesheets/themes/djime-cerulean/style.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" /> - <link href="/stylesheets/chef.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" /> - </head> - <body> - <div id='container'> - <div id='header'> - <h1><a href="<%= absolute_url(:top) -%>">Chef REST API</a></h1> - </div> - <div id='main-navigation'> - <div class='clear'></div> - </div> - <div id='wrapper'> - <div id='main'> - <div class='block' id='block-text'> - <div class='content'> - <h2 class='title'>The REST API</h2> - <div class='inner'> - This is the Chef API Server. - <% if @webui_url %> - <a href="<%= @webui_url -%>">Are you looking for the Web UI?</a> - <% end %> - </div> - <div class='inner'> - For more information about Chef, head on over to the <a href="http://wiki.opscode.com/">wiki.</a> - </div> - </div> - </div> - <div id='footer'> - <div class='block'> - <p>Copyright © 2009-2011 Opscode, Inc.</p> - </div> - </div> - </div> - <div id='sidebar'> - <div class='block notice' id='sidebar_block_notice'></div> - <div class='block' id='sidebar_block'></div> - </div> - <div class='clear'></div> - </div> - </div> - </body> -</html> diff --git a/chef-server-api/app/views/main/index.html.erb b/chef-server-api/app/views/main/index.html.erb deleted file mode 100644 index e69de29bb2..0000000000 --- a/chef-server-api/app/views/main/index.html.erb +++ /dev/null diff --git a/chef-server-api/bin/chef-server b/chef-server-api/bin/chef-server deleted file mode 100755 index 948af4b1f0..0000000000 --- a/chef-server-api/bin/chef-server +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env ruby -# -# ./chef-server - Serving up piping hot infrastructure! -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. - -# Based on the 'merb' command, by Ezra - -require "rubygems" -require "merb-core" - -# Load chef and chef-server-api from source rather than gem, if present -$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../../chef/lib/')) -$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../../chef-solr/lib/')) -$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib')) - -# Print the version if we have -v or --version -if ARGV.any? { |arg| arg =~ /\-v|\-\-version/ } - require 'chef-server-api/version' - puts "Chef Server (API) Version: #{ChefServerApi::VERSION}" - exit 1 -end - -require 'chef' -require 'chef-server-api' - -# Ensure the chef gem we load is the same version as the chef server -unless defined?(Chef) - gem "chef", "=" + CHEF_SERVER_VERSION - require 'chef' -end - -# Print the help message if our argv looks fishy -if ARGV[0] && ARGV[0] =~ /^[^-]/ - ARGV.push "-H" -end - -# Default to thin -unless %w[-a --adapter -i --irb-console -r --script-runner].any? { |o| ARGV.index(o) } - ARGV.push *%w[-a thin] -end - -# Tell merb where to root -ARGV.push *[ "-m", CHEF_SERVER_API_ROOT] - -# attempt to find the user and group that this process will become. Fixes CHEF-1015 -if (index = ARGV.index("-u")) - Chef::Config[:signing_ca_user] = ARGV[index+1] -end -if (index = ARGV.index("-G")) - Chef::Config[:signing_ca_group] = ARGV[index+1] -end - -# Find and load the config -if index = ARGV.index("-C") - config = ARGV[index+1] - ARGV.delete("-C") - ARGV.delete(config) - Chef::Config.from_file(File.expand_path(config)) -else - Chef::Config.from_file( - File.join("/etc", "chef", "server.rb") - ) -end - -Chef::Log.init(Chef::Config[:log_location]) -Chef::Log.level = Chef::Config[:log_level] - -begin - Merb.start -rescue RuntimeError => e - if e.message =~ /no acceptor/ - Chef::Log.fatal("Another process is already listening on port #{Merb::Config[:port]}. Is chef-server already running?") - exit 127 - else - raise - end -end diff --git a/chef-server-api/chef-server-api.gemspec b/chef-server-api/chef-server-api.gemspec deleted file mode 100644 index a10556559c..0000000000 --- a/chef-server-api/chef-server-api.gemspec +++ /dev/null @@ -1,33 +0,0 @@ -require File.dirname(__FILE__) + '/lib/chef-server-api/version' - -Gem::Specification.new do |s| - s.name = "chef-server-api" - s.version = ChefServerApi::VERSION - s.platform = Gem::Platform::RUBY - s.has_rdoc = true - s.extra_rdoc_files = ["README.rdoc", "LICENSE", "config.ru", "development.ru" ] - s.summary = "A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure." - s.description = s.summary - s.author = "Opscode" - s.email = "chef@opscode.com" - s.homepage = "http://wiki.opscode.com/display/chef" - - s.add_dependency "merb-core", "~> 1.1.0" - s.add_dependency "merb-assets", "~> 1.1.0" - s.add_dependency "merb-helpers", "~> 1.1.0" - s.add_dependency "merb-param-protection", "~> 1.1.0" - - s.add_dependency "mixlib-authentication", '>= 1.1.3' - - s.add_dependency "dep_selector", ">= 0.0.3" - - s.add_dependency "uuidtools", "~> 2.1.1" - - s.add_dependency "thin" - - s.bindir = "bin" - s.executables = %w( chef-server ) - - s.require_path = 'lib' - s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{config,lib,spec,app,public,stubs}/**/*") -end diff --git a/chef-server-api/config.ru b/chef-server-api/config.ru deleted file mode 100644 index 4c6aa6d86c..0000000000 --- a/chef-server-api/config.ru +++ /dev/null @@ -1,21 +0,0 @@ -require 'rubygems' -require 'merb-core' -require 'chef' - -Chef::Config.from_file(File.join("/etc", "chef", "server.rb")) - -Merb::Config.setup(:merb_root => File.expand_path(File.dirname(__FILE__)), - :environment => 'production', - :fork_for_class_load => false, - :init_file => File.dirname(__FILE__) / "config/init.rb") -Merb.environment = Merb::Config[:environment] -Merb.root = Merb::Config[:merb_root] -Merb::BootLoader.run - -# Uncomment if your app is mounted at a suburi -#if prefix = ::Merb::Config[:path_prefix] -# use Merb::Rack::PathPrefix, prefix -#end - -run Merb::Rack::Application.new - diff --git a/chef-server-api/config/environments/development.rb b/chef-server-api/config/environments/development.rb deleted file mode 100644 index 3a5baab15c..0000000000 --- a/chef-server-api/config/environments/development.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -Chef::Log.info("") -Chef::Log.info("*" * 80) -Chef::Log.info("* Starting Chef Server in Development Mode.") -Chef::Log.info("* Start the server with `-e production` for normal use") -Chef::Log.info("*" * 80) -Chef::Log.info("") - -Merb::Config.use do |c| - c[:exception_details] = true - c[:reload_classes] = true - c[:log_level] = :debug -end diff --git a/chef-server-api/config/init.rb b/chef-server-api/config/init.rb deleted file mode 100644 index 01114ac7c1..0000000000 --- a/chef-server-api/config/init.rb +++ /dev/null @@ -1,94 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2008-2010 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. -# - -require 'merb-assets' -require 'merb-helpers' -require 'merb-param-protection' - -require 'bunny' -require 'uuidtools' -require 'ohai' -require 'openssl' - -require 'chef' -require 'chef/role' -require 'chef/data_bag' -require 'chef/data_bag_item' -require 'chef/api_client' -require 'chef/webui_user' -require 'chef/certificate' -require 'chef/data_bag' -require 'chef/data_bag_item' -require 'chef/cookbook_version' -require 'chef/sandbox' -require 'chef/checksum' -require 'chef/environment' -require 'chef/monkey_patches/regexp' - - -require 'mixlib/authentication' - -Mixlib::Authentication::Log.logger = Ohai::Log.logger = Chef::Log.logger - -# Only used for the error page when visiting with a browser... -use_template_engine :haml - -Merb::Config.use do |c| - c[:name] = "chef-server (api)" - c[:fork_for_class_load] = false - c[:session_id_key] = '_chef_server_session_id' - c[:session_secret_key] = Chef::Config.manage_secret_key - c[:session_store] = 'cookie' - c[:exception_details] = true - c[:reload_classes] = false - c[:log_level] = Chef::Config[:log_level] - if Chef::Config[:log_location].kind_of?(String) - c[:log_file] = Chef::Config[:log_location] - end -end - -unless Merb::Config.environment == "test" - # create the couch design docs for nodes, roles, and databags - Chef::CouchDB.new.create_db - Chef::CouchDB.new.create_id_map - Chef::Node.create_design_document - Chef::Role.create_design_document - Chef::DataBag.create_design_document - Chef::ApiClient.create_design_document - Chef::WebUIUser.create_design_document - Chef::CookbookVersion.create_design_document - Chef::Sandbox.create_design_document - Chef::Checksum.create_design_document - Chef::Environment.create_design_document - - # Create the signing key and certificate - Chef::Certificate.generate_signing_ca - - # Generate the validation key - Chef::Certificate.gen_validation_key - - # Generate the Web UI Key - Chef::Certificate.gen_validation_key(Chef::Config[:web_ui_client_name], Chef::Config[:web_ui_key], true) - - # Create the '_default' Environment - Chef::Environment.create_default_environment - - Chef::Log.info('Loading roles') - Chef::Role.sync_from_disk_to_couchdb -end diff --git a/chef-server-api/config/rack.rb b/chef-server-api/config/rack.rb deleted file mode 100644 index 995f32d613..0000000000 --- a/chef-server-api/config/rack.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -# Correctly set a content length. -use Rack::ContentLength - -# Serve assets for the html page from /public -use Merb::Rack::Static, Merb.dir_for(:public) - -# this is our main merb application -run Merb::Rack::Application.new diff --git a/chef-server-api/config/router.rb b/chef-server-api/config/router.rb deleted file mode 100644 index 78a8de3f8c..0000000000 --- a/chef-server-api/config/router.rb +++ /dev/null @@ -1,151 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2008-2010 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. -# - -Merb::Router.prepare do - resources :users - - # Nodes - resources :nodes, :id => /[^\/]+/ - match('/nodes/:id/cookbooks', - :id => /[^\/]+/, - :method => 'get'). - to(:controller => "nodes", :action => "cookbooks") - # Roles - resources :roles do |r| - r.match('/environments', :method => 'get').to(:controller => "roles", :action => "environments") - r.match('/environments/:env_id', :method => 'get').to(:controller=>"roles", :action=>"environment") - end - - # Environments - resources :environments do |e| - e.match("/cookbooks", :method => "get").to(:controller=>"environments", :action=>"list_cookbooks") - e.match("/cookbooks/:cookbook_id", :method => "get").to(:controller=>"environments", :action=>"cookbook") - e.match("/recipes", :method => "get").to(:controller=>"environments", :action=>"list_recipes") - e.match("/nodes", :method => "get").to(:controller=>"environments", :action=>"list_nodes") - e.match("/roles/:role_id", :method => "get").to(:controller=>"environments", :action => "role") - e.match("/cookbook_versions", :method => "post").to(:controller=>"environments", :action=>"cookbook_versions_for_run_list") - end - - # Status - match("/status").to(:controller => "status", :action => "index").name(:status) - - # Clients - match("/clients", :method=>"post").to(:controller=>'clients', :action=>'create') - match("/clients", :method=>"get").to(:controller=>'clients', :action=>'index').name(:clients) - match("/clients/:id", :id => /[\w\.-]+/, :method=>"get").to(:controller=>'clients', :action=>'show').name(:client) - match("/clients/:id", :id => /[\w\.-]+/, :method=>"put").to(:controller=>'clients', :action=>'update') - match("/clients/:id", :id => /[\w\.-]+/, :method=>"delete").to(:controller=>'clients', :action=>'destroy') - - # Search - #resources :search - match('/search', :method => 'get').to(:controller => 'search', :action => 'index').name(:search) - match('/search/:id', :method => 'get').to(:controller => 'search', :action => 'show').name(:search_show) - match('/search/reindex', :method => 'post').to(:controller => "search", :action => "reindex") - - # Cookbooks - match('/nodes/:id/cookbooks', :method => 'get').to(:controller => "nodes", :action => "cookbooks") - - match("/cookbooks", - :method => 'get' - ).to(:controller => "cookbooks", :action => "index").name(:cookbooks) - - match("/cookbooks/_recipes", :method=>'get').to(:controller=>'cookbooks',:action=>'index_recipes') - - match("/cookbooks/:cookbook_name/:cookbook_version", - :method => 'put', - :cookbook_name => /[\w\.]+/, - :cookbook_version => /^(\d+.\d+(?:.\d+)?)$/ - ).to(:controller => "cookbooks", :action => "update") - - match("/cookbooks/:cookbook_name/:cookbook_version", - :method => 'get', - :cookbook_name => /[\w\.]+/, - :cookbook_version => /^((?:\d+.\d+(?:.\d+)?)|_latest)$/ - ).to(:controller => "cookbooks", :action => "show").name(:cookbook_version) - - match("/cookbooks/:cookbook_name/:cookbook_version", - :method => 'delete', - :cookbook_name => /[\w\.]+/, - :cookbook_version => /^((?:\d+.\d+(?:.\d+)?)|_latest)$/ - ).to(:controller => "cookbooks", :action => "destroy") - - match("/cookbooks/:cookbook_name", - :method => 'get', - :cookbook_name => /[\w\.]+/ - ).to(:controller => "cookbooks", :action => "show_versions").name(:cookbook) - - match("/cookbooks/:cookbook_name/:cookbook_version/files/:checksum", - :cookbook_name => /[\w\.]+/, - :cookbook_version => /^((?:\d+.\d+(?:.\d+)?)|_latest)$/ - ).to( - :controller => "cookbooks", - :action => "show_file" - ).name(:cookbook_file) - - # Sandbox - match('/sandboxes', :method => 'get').to(:controller => "sandboxes", :action => "index").name(:sandboxes) - match('/sandboxes', :method => 'post').to(:controller => "sandboxes", :action => "create") - match('/sandboxes/:sandbox_id', :method => 'get', :sandbox_id => /[\w\.]+/).to(:controller => "sandboxes", :action => "show").name(:sandbox) - match('/sandboxes/:sandbox_id', :method => 'put', :sandbox_id => /[\w\.]+/).to(:controller => "sandboxes", :action => "update") - match('/sandboxes/:sandbox_id/:checksum', :method => 'put', :sandbox_id => /[\w\.]+/, :checksum => /[\w\.]+/).to(:controller => "sandboxes", :action => "upload_checksum").name(:sandbox_checksum) - match('/sandboxes/:sandbox_id/:checksum', :method => 'get', :sandbox_id => /[\w\.]+/, :checksum => /[\w\.]+/).to(:controller => "sandboxes", :action => "download_checksum") - - # Data - match("/data/:data_bag_id/:id", :method => 'get').to(:controller => "data_item", :action => "show").name("data_bag_item") - match("/data/:data_bag_id", :method => 'post').to(:controller => "data_item", :action => "create").name("create_data_bag_item") - match("/data/:data_bag_id/:id", :method => 'put').to(:controller => "data_item", :action => "update").name("update_data_bag_item") - match("/data/:data_bag_id/:id", :method => 'delete').to(:controller => "data_item", :action => "destroy").name("destroy_data_bag_item") - resources :data, :controller => "data_bags" - - match('/').to(:controller => 'main', :action =>'index').name(:top) - - # Need to monkey patch Merb so that it inflates JSON input with a higher - # recursion depth allowed (the default is 19). See CHEF-1292/PL-538. - module Merb - class Request - # ==== Returns - # Hash:: Parameters from body if this is a JSON request. - # - # ==== Notes - # If the JSON object parses as a Hash, it will be merged with the - # parameters hash. If it parses to anything else (such as an Array, or - # if it inflates to an Object) it will be accessible via the inflated_object - # parameter. - # - # :api: private - def json_params - @json_params ||= begin - if Merb::Const::JSON_MIME_TYPE_REGEXP.match(content_type) - begin - # Call Chef's JSON utility instead of the default in Merb, - # JSON.parse. - jobj = Chef::JSONCompat.from_json(raw_post) - jobj = Mash.from_hash(jobj) if jobj.is_a?(Hash) - rescue JSON::ParserError - jobj = Mash.new - end - jobj.is_a?(Hash) ? jobj : { :inflated_object => jobj } - end - end - end - - end - end - -end diff --git a/chef-server-api/development.ru b/chef-server-api/development.ru deleted file mode 100644 index 889a2d6542..0000000000 --- a/chef-server-api/development.ru +++ /dev/null @@ -1,30 +0,0 @@ -require 'rubygems' - -$:.unshift(File.dirname(__FILE__) + '/../chef/lib') - -require 'merb-core' -require 'chef' - -#Chef::Config.from_file(File.join("/etc", "chef", "server.rb")) -Chef::Config.from_file(File.dirname(__FILE__) + '/../features/data/config/server.rb') - -Chef::Config[:log_location] = '/tmp/fuuu' -Chef::Config[:log_level] = :debug -Chef::Log.level = :debug - -Merb::Config.setup(:merb_root => File.expand_path(File.dirname(__FILE__)), - :environment => 'development', - :fork_for_class_load => false, - :init_file => File.dirname(__FILE__) / "config/init.rb") -Merb.environment = Merb::Config[:environment] -Merb.root = Merb::Config[:merb_root] - -Merb::BootLoader.run - -# Uncomment if your app is mounted at a suburi -#if prefix = ::Merb::Config[:path_prefix] -# use Merb::Rack::PathPrefix, prefix -#end - -run Merb::Rack::Application.new - diff --git a/chef-server-api/lib/chef-server-api.rb b/chef-server-api/lib/chef-server-api.rb deleted file mode 100644 index b32d2240c5..0000000000 --- a/chef-server-api/lib/chef-server-api.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'chef-server-api/version' - -CHEF_SERVER_VERSION = ChefServerApi::VERSION -CHEF_SERVER_API_ROOT = File.expand_path(File.dirname(__FILE__) + '/../') diff --git a/chef-server-api/lib/chef-server-api/version.rb b/chef-server-api/lib/chef-server-api/version.rb deleted file mode 100644 index 4bf1b38a18..0000000000 --- a/chef-server-api/lib/chef-server-api/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module ChefServerApi - VERSION = '11.0.0.alpha' -end diff --git a/chef-server-api/public/images/avatar.png b/chef-server-api/public/images/avatar.png Binary files differdeleted file mode 100644 index 66488481ae..0000000000 --- a/chef-server-api/public/images/avatar.png +++ /dev/null diff --git a/chef-server-api/public/images/indicator.gif b/chef-server-api/public/images/indicator.gif Binary files differdeleted file mode 100644 index 085ccaecaf..0000000000 --- a/chef-server-api/public/images/indicator.gif +++ /dev/null diff --git a/chef-server-api/public/images/merb.jpg b/chef-server-api/public/images/merb.jpg Binary files differdeleted file mode 100644 index a19dcf4048..0000000000 --- a/chef-server-api/public/images/merb.jpg +++ /dev/null diff --git a/chef-server-api/public/stylesheets/base.css b/chef-server-api/public/stylesheets/base.css deleted file mode 100644 index 0da62086ed..0000000000 --- a/chef-server-api/public/stylesheets/base.css +++ /dev/null @@ -1,336 +0,0 @@ -* {margin:0;padding:0} -.clear { clear: both; height: 0; } - -h1 { margin: 15px 0; font-size: 22px; font-weight: normal; } -h2 { font-size: 22px; margin: 15px 0; font-weight: normal;} -h3 { font-size: 18px; margin: 10px 0; font-weight: normal;} -h4 { font-size: 16px; margin: 10px 0; font-weight: normal;} -hr {height: 1px; border: 0; } -p { margin: 15px 0;} -a img { border: none; } - -body { - font-size: 12px; - font-family: sans-serif; -} - -#container { - min-width: 960px; -} - -#header, #wrapper { - padding: 0 20px; -} - -#header { - position: relative; - padding-top: 1px; -} - -#header h1 { - margin: 0; - padding: 10px 0; - font-size: 30px; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - text-decoration: none; -} - -#main { - width: 80%; - float: left; -} - -.actions-bar { - padding: 10px 1px; -} - -.actions-bar .actions { - float: left; -} - - -.actions-bar .pagination { - float: right; - padding: 1px 0; -} - -#sidebar { - width: 15%; - float: right; -} - -#sidebar h3 { - padding: 10px 15px; - margin: 0; - font-size: 13px; -} - -#sidebar .block { - margin-bottom: 20px; - padding-bottom: 10px; -} - -#sidebar .block .content { - padding: 0 15px; -} - -#sidebar ul.navigation li a:link, #sidebar ul.navigation li a:visited { - display: block; - padding: 10px 15px; -} - -#sidebar .block .sidebar-block, #sidebar .notice { - padding:10px; -} - -#wrapper { - padding-top: 20px; -} - -#main .block { - margin-bottom: 20px; - padding-top: 1px; -} - -#main .block .content .inner { - padding: 0 15px 15px; -} - -#main .main p.first { - margin-top: 0; -} - -#user-navigation { - position: absolute; - top: 0px; - right: 20px; -} - -#main-navigation { - width: 100%; -} - -#user-navigation ul, #main-navigation ul, .secondary-navigation ul, #sidebar ul.navigation { - margin: 0; - padding: 0; - list-style-type: none; -} - -#user-navigation ul li, #main-navigation ul li, .secondary-navigation ul li { - float: left; -} - -#main-navigation ul li { - margin-right: 5px; -} - -#user-navigation ul li { - padding: 5px 10px; -} - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; -} - -#main-navigation ul li a { - font-size: 15px; - display: block; - padding: 8px 15px; -} - -.secondary-navigation { - font-size: 13px; - border-bottom-width: 10px; - border-bottom-style: solid; -} - -.secondary-navigation ul li a { - display: block; - padding: 10px 15px; -} - -#footer { - padding-bottom: 20px; -} - -/* pagination */ - -.pagination a, .pagination span { - padding: 2px 5px; - margin-right: 5px; - display: block; - float: left; - border-style: solid; - border-width: 1px; -} - -.pagination span.current { - font-weight: bold; -} - -.pagination a { - text-decoration: none; -} - -/* tables */ -.table { - width: 100%; - border-collapse: collapse; - margin-bottom: 15px; -} - -.table th { - padding: 10px; - font-weight: bold; - text-align: left; -} - -.table th.first { - width: 30px; -} - -.table th.last { - width: 200px; -} - -.table .checkbox { - margin-left: 10px; -} - -.table td { - padding: 10px; -} - -.table td.last { - text-align: right; -} - -/* forms */ - -input.checkbox { - margin: 0; - padding: 0; -} - -.form .group { - margin-bottom: 15px; -} - -.form div.left { - width: 20%; - float: left; -} - -.form div.right { - width: 75%; - float: right; -} - -.form .columns .column { - width: 48%; -} - -.form .columns .left { - float: left; -} - -.form .columns .right { - float: right; -} - -.form label.label, .form input.text_field, .form textarea.text_area { - font-size: 1.2em; - padding: 1px 0; - margin: 0; -} - -.form label.right { - text-align: right; -} - -.form input.checkbox, .form input.radio { - margin-right: 5px; -} - -.form label.checkbox, .form label.radio { - line-height: 1.5em; -} - -.form label.label { - display: block; - padding-bottom: 2px; - font-weight: bold; -} - -.form div.fieldWithErrors label.label { - display: inline; -} - -.form .fieldWithErrors .error { - color: red; -} - -.form input.text_field, .form textarea.text_area { - width: 100%; - border-width: 1px; - border-style: solid; -} - -/* lists */ - -ul.list { - margin: 0; - padding: 0; - list-style-type: none; -} - -ul.list li { - clear: left; - padding-bottom: 5px; -} - -ul.list li .left { - float: left; -} - -ul.list li .left .avatar { - width: 50px; - height: 50px; -} - -ul.list li .item { - margin-left: 80px; -} - -ul.list li .item .avatar { - float: left; - margin: 0 5px 5px 0; - width: 30px; - height: 30px; -} - -/* box */ - -#box { - width: 500px; - margin: 50px auto; -} - -#box .block { - margin-bottom: 20px; -} - -#box .block h2 { - padding: 10px 15px; - margin: 0; -} - -#box .block .content { - padding: 10px 20px; -} - - diff --git a/chef-server-api/public/stylesheets/chef.css b/chef-server-api/public/stylesheets/chef.css deleted file mode 100644 index 52a06d056c..0000000000 --- a/chef-server-api/public/stylesheets/chef.css +++ /dev/null @@ -1,157 +0,0 @@ -.ruby .normal {} -.ruby .comment { color: #005; font-style: italic; } -.ruby .keyword { color: #A00; font-weight: bold; } -.ruby .method { color: #077; } -.ruby .class { color: #074; } -.ruby .module { color: #050; } -.ruby .punct { color: #447; font-weight: bold; } -.ruby .symbol { color: #099; } -.ruby .string { color: #944; background: #FFE; } -.ruby .char { color: #F07; } -.ruby .ident { color: #004; } -.ruby .constant { color: #07F; } -.ruby .regex { color: #B66; background: #FEF; } -.ruby .number { color: #F99; } -.ruby .attribute { color: #7BB; } -.ruby .global { color: #7FB; } -.ruby .expr { color: #227; } -.ruby .escape { color: #277; } - -.files { - padding-left: 20px; -} - -.code { - overflow: auto; - font-size: 0.8em; -} - -.search td { - /*overflow: auto;*/ - font-size: 0.8em; -} - -dl dt { font-weight: bold; } -.content td dl { margin: 0; padding: 0; } -.content td dt { - background: transparent url(/images/toggle-collapse.gif) 0 3px no-repeat; - clear: left; color: #333; cursor: pointer; line-height: 1em; - margin-left: -12px; padding-left: 14px; -} -.content td dd { margin: 0; - padding: 0 0 0 1em; -} -.content td dt.collapsed { - background-image: url(/images/toggle-expand.gif); -} -.content td dt.inline { background-image: none; cursor: default; - float: left; margin-left: 0; padding-left: 2px; padding-right: .5em; - padding-top: 2px; -} - -div.sortable { - height: 200px; - width: 225px; - margin-right: 10px; - border: 1px solid black; - overflow: scroll; - background: #777777; -} - -div.sortable.run-list { - height: 430px; - width: 225px; - margin-right: 10px; - border: 1px solid black; - overflow: scroll; - background: #777777; -} - -div.clear { - clear: left; -} - -table.form th { - /* vertical-align: top; */ - font-weight: bold; - text-align: right; - padding-right: 10px; -} - -div.help { - padding: 10px; - text-align: left; - vertical-align: top; -} - -table.form td { - text-align: left; - /* vertical-align: top; */ -} - -table.sortable td { - vertical-align: top; -} - -table.sortable ul { - background: #ff00ff; - margin: 5px; - padding: 5px; -} - -td.table-key { - font-weight: bold; -} - -div.json-attr { - overflow: auto; - max-width: 400px; -} - -td.position { - font-weight: bold; -} - -div#tree { - float: left; -} - -div#jform { - float: left; - margin-left: 50px; -} - -div.editor { - border: 1px solid black; -} - -#node_available_roles, #node_available_recipes, #for_node, #for_role, #available_recipes { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 200px;} - -#node_available_roles li, #node_available_recipes li, #for_node li, #for_role li, #available_recipes li { margin: 0 5px 5px 5px; padding: 5px; width: 175px; } - -#sidebar_block { - display: none; -} - -#sidebar_block_notice { - display: none; -} - -div.tooltip { - background-color: #000; - outline: 1px solid #669; - border: 2px solid #fff; - padding: 10px 15px; - /* width: 200px; */ - display: none; - color: #fff; - text-align: left; - font-size: 12px; - outline-radius: 4px; - -moz-outline-radius: 4px; - -webkit-outline-radius: 4px; -} - -table.tooltip { - width: 190px; -} diff --git a/chef-server-api/public/stylesheets/themes/bec-green/style.css b/chef-server-api/public/stylesheets/themes/bec-green/style.css deleted file mode 100644 index 225b6d4e35..0000000000 --- a/chef-server-api/public/stylesheets/themes/bec-green/style.css +++ /dev/null @@ -1,290 +0,0 @@ -a:link, a:visited, a:hover, a:active { color: #33f; } -h1, h2, h3 {color:#444} - -body { - color: #222; - background: #e5e5e5; - font-family: "Bitstream Vera Sans", verdana, sans-serif; -} - -hr { - background: #f0f0ee; -} - -p { - font-size: 14px; - line-height: 20px; -} - -input.checkbox { - vertical-align:middle; -} - -#header h1 { - font-size: 28px; - padding: 5px 0; - margin: 5px 0; -} - -.hightlight { - background-color: #ffc; -} -.small { - font-size: 11px; -} -.gray { - color: #999; -} -#header { - background: #48625B; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - color: #FFF; -} - -#main { - background: #e5e5e5; - width: 69%; -} - -#main .block { - -moz-border-radius-topleft: 4px; - -moz-border-radius-topright: 4px; - padding: 0; - margin-bottom:20px; - padding-bottom: 20px; - background: #fff; -} - -#main .block h2.title { - margin: 0 0 20px 0; - background-color: #E9FAE6; - padding: 5px 5px 5px 15px; - font-size:18px; -} - -.main_container { - padding:10px; -} - -/* #sidebar .block { background: #FFF; padding-bottom:0px; } */ - -#sidebar .notice { - background-color: #ffc; - padding: 0 10px; - border-bottom:1px solid #ddd; - border-right:1px solid #ddd; - border-top:1px solid #fff; - border-left:1px solid #fff; -} -#sidebar .notice h2 { - font-size:16px; - margin: 5px 0; - border-bottom:1px solid #aaa; -} -#sidebar .notice p { - font-size:12px; -} - -#sidebar .block { - padding-bottom: 0; -} - -#sidebar .block .content { - padding: 0 10px; -} - - -#sidebar h3 { - background: #c7d8d8; - border-bottom:1px solid #999; - padding: 5px 10px; -} - -#sidebar ul li a:link, #sidebar ul li a:visited { - font-size:14px; -} - -#sidebar ul li a:hover, #sidebar ul li a:active { - background: #E9FAE6; - color: #444; - font-size:14px; - text-decoration:underline; -} -#sidebar ul.navigation li.last a { - border-bottom: none; -} - -#sidebar ul.navigation li a:link,#sidebar ul.navigation li a:visited { - padding: 5px 10px; - color:#444; - text-decoration: none; -} -#sidebar ul.navigation li a:hover { - text-decoration:underline; -} -#sidebar .block .sidebar-block h4 { - border-bottom: 1px solid #bbb; -} -#main-navigation ul li { - background: #30423E; -} - -#main-navigation ul li:hover { - background: #23302D; -} - -#main-navigation ul li.active { - background: #e5e5e5; -} - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; - color: #FFF; -} - -#main-navigation ul li a { - font-size: 14px; - padding: 4px 10px; -} - -#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { - color: #333; -} -#user-navigation ul li a:hover { - text-decoration: underline; -} -.secondary-navigation { - background: #48625B; - border-bottom-color: #30423e; - border-bottom: 5px solid #30423e; -} - -.secondary-navigation ul li.active { - background-color: #30423e; -} - -.secondary-navigation ul li:hover { - background-color: #23302d; -} - -/* pagination */ - -.pagination span.current { - background: #30423e; - color: #FFF; - border: 1px solid #30423e; - -moz-border-radius:5px; -} - -.pagination a { - color: #364B69; - border: 1px solid #ddd; - -moz-border-radius:5px; -} - -.pagination a:hover { - color: #444; - background: #E9FAE6; -} - -/* tables */ - -.table th { - background: #48625B; - color: #FFF; - font-weight:normal; - padding:3px; -} - -.table th a.toggle { - display: block; - width: 12px; - height: 12px; - background: transparent url('images/tick.png') center no-repeat; - text-indent: -9999px; - -moz-outline: none; -} - -.table th.first { - width: 30px; - text-align: center; -} - -.table td { - border-bottom: 1px solid #F0F0EE; -} - -/* forms */ - -.form input.text, .form textarea.textarea { - border: 1px solid #ddd; - padding: 5px; - width: 95%; -} - -.form .navform { - padding:10px; - background-color: #E9FAE6; - font-size:14px; - border-bottom:1px solid #ddd; - border-right:1px solid #ddd; - border-top:1px solid #eee; - border-left:1px solid #eee; -} -.form .navform input { - font-size:14px; -} - -/* flash-messages */ -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin:0 auto 5px; - width:80%; -} -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #fffaaa; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #ddf; - background-color: #eef; -} - -/* lists */ - -ul.list li { - border-bottom-color: #F0F0EE; -} - -ul.list li .item .avatar { - border-color: #F0F0EE; - margin: 3px 10px 0 0; -} - -ul.list li .left { - padding: 5px 5px; -} - -/* box */ - -#box .block { - background: #FFF; -} - -#box .block h2 { - background: #48625B; - color: #FFF; -} diff --git a/chef-server-api/public/stylesheets/themes/bec/style.css b/chef-server-api/public/stylesheets/themes/bec/style.css deleted file mode 100644 index c94474866a..0000000000 --- a/chef-server-api/public/stylesheets/themes/bec/style.css +++ /dev/null @@ -1,301 +0,0 @@ -a:link, a:visited, a:hover, a:active { color: #33f; } -h1, h2, h3 {color:#444} - -body { - color: #333; - background: #e5e5e5; - font-family: Verdana, Arial, "Bitstream Vera Sans", sans-serif; -} - -hr { - background: #f0f0ee; -} - -p { - font-size: 12px; - line-height: 20px; -} - -input.checkbox { - vertical-align:middle; -} - -#header h1 { - font-size: 28px; - padding: 5px 0; - margin: 5px 0; -} - -.hightlight { - background-color: #ffc; -} -.small { - font-size: 11px; -} -.gray { - color: #999; -} -#header { - background: #006666; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - color: #FFF; -} - -#main { - background: #e5e5e5; - width: 73%; -} - -#main .block { - -moz-border-radius-topleft: 4px; - -moz-border-radius-topright: 4px; - padding: 0; - margin-bottom:20px; - padding-bottom: 20px; - background: #fff; -} - -#main .block h2.title { - margin: 0 0 20px 0; - background-color: #E6FAFA; - padding: 5px 5px 5px 15px; - font-size:18px; -} - -.main_container { - padding:10px; -} - -#footer .block p { - color:#aaa; - font-size:11px; -} - -/* #sidebar .block { background: #FFF; padding-bottom:0px; } */ - -#sidebar .notice { - background-color: #ffc; - padding: 0 10px; - border-bottom:1px solid #ddd; - border-right:1px solid #ddd; - border-top:1px solid #fff; - border-left:1px solid #fff; -} -#sidebar .notice h2 { - font-size:16px; - margin: 5px 0; - border-bottom:1px solid #aaa; -} -#sidebar .notice p { - font-size:12px; -} - -#sidebar .block { - padding-bottom: 0; -} - -#sidebar .block .content { - padding: 0 10px; -} - - -#sidebar h3 { - background: #c7d8d8; - border-bottom:1px solid #999; - padding: 5px 10px; -} - -#sidebar ul li a:link, #sidebar ul li a:visited { - font-size:12px; -} - -#sidebar ul li a:hover, #sidebar ul li a:active { - background: #e1efef; - color: #444; - font-size:12px; - text-decoration:underline; -} -#sidebar ul.navigation li.last a { - border-bottom: none; -} - -#sidebar ul.navigation li a:link,#sidebar ul.navigation li a:visited { - padding: 5px 10px; - color:#444; - text-decoration: none; -} -#sidebar ul.navigation li a:hover { - text-decoration:underline; -} -#sidebar .block .sidebar-block h4 { - border-bottom: 1px solid #bbb; -} -#main-navigation ul li { - background: #008c8c; -} - -#main-navigation ul li:hover { - background: #00b2b2; -} - -#main-navigation ul li.active { - background: #f0f0ee; -} - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; - color: #FFF; -} - -#main-navigation ul li a { - font-size: 12px; - padding: 4px 10px; -} - -#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { - color: #364b69; -} -#user-navigation ul li a:hover { - text-decoration: underline; -} -.secondary-navigation { - background: #006666; - border-bottom-color: #008c8c; - border-bottom: 5px solid #008c8c; -} - -.secondary-navigation ul li.active { - background-color: #008c8c; -} - -.secondary-navigation ul li:hover { - background-color: #00b2b2; -} - -/* pagination */ - -.pagination span.current { - background: #008c8c; - color: #FFF; - border: 1px solid #008c8c; - -moz-border-radius:5px; -} - -.pagination a { - color: #364B69; - border: 1px solid #ddd; - -moz-border-radius:5px; - font-size:11px; -} - -.pagination a:hover { - color: #444; - background: #E6FAFA; -} - -/* tables */ - -.table th { - background: #006666; - color: #FFF; - font-weight:normal; - padding:3px; -} - -.table th a.toggle { - display: block; - width: 12px; - height: 12px; - background: transparent url('images/tick.png') center no-repeat; - text-indent: -9999px; - -moz-outline: none; -} - -.table th.first { - width: 30px; - text-align: center; -} - -.table td { - border-bottom: 1px solid #F0F0EE; -} - -/* forms */ - -.form input.text, .form textarea.textarea { - border: 1px solid #ddd; - padding: 5px; - width:99%; -} - -.form .navform { - padding:10px; - background-color: #f1f8f8; - font-size:14px; - border-bottom:1px solid #ddd; - border-right:1px solid #ddd; - border-top:1px solid #eee; - border-left:1px solid #eee; -} -.form .navform input { - font-size:14px; -} - -.description { - color:#aaa; - font-family:Georgia, serif; -} - -/* flash-messages */ -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin:0 auto 5px; - width:80%; -} -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #fffaaa; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #ddf; - background-color: #eef; -} - -/* lists */ - -ul.list li { - border-bottom-color: #F0F0EE; -} - -ul.list li .item .avatar { - border-color: #F0F0EE; - margin: 3px 10px 0 0; -} - -ul.list li .left { - padding: 5px 5px; -} - -/* box */ - -#box .block { - background: #FFF; -} - -#box .block h2 { - background: #006666; - color: #FFF; -} diff --git a/chef-server-api/public/stylesheets/themes/blue/style.css b/chef-server-api/public/stylesheets/themes/blue/style.css deleted file mode 100644 index d7169d3f37..0000000000 --- a/chef-server-api/public/stylesheets/themes/blue/style.css +++ /dev/null @@ -1,280 +0,0 @@ -.small { font-size:12px; } -.gray { color:#999999; } -.hightlight { background-color:#FFFFCC; } - -a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #2F427A; } -a { -moz-outline: none; } - -body { - color: #222; - background: #f0f0ee; - font-family: helvetica, arial, sans-serif; - font-size: 14px; -} - -hr { - background: #f0f0ee; - color: #f0f0ee; -} - -#header { - background: #2F427A; -} - -#header h1 { - padding: 20px 0; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - color: #FFF; -} - -#user-navigation { - top: auto; - bottom: 5px; - right: 25px; -} - -#main .block .content { - background: #FFF; - padding-top: 1px; -} - -#main .block .content h2 { - margin-left: 15px; -} - -#sidebar .block { - background: #FFF; -} - -#sidebar .notice { - background: #FFFFCC; -} - -#sidebar h3 { - background: #2F427A; - color: #FFF; - border-bottom: 10px solid #262626; - font-size: 15px; -} - -#main-navigation ul li { - padding-left: 15px; -} - -#main-navigation ul li a { - padding: 8px 0; -} - -#main-navigation ul li.active { - padding: 0; - margin-left: 15px; -} - -#main-navigation ul li.active { - margin-left: 15px; -} - -#main-navigation ul li.active a { - padding: 8px 15px; -} - -#sidebar ul li a:link, #sidebar ul li a:visited { - background: #FFF; - border-bottom: 1px solid #F0F0EE; - text-decoration: none; -} - -#sidebar ul li a:hover, #sidebar ul li a:active { - background: #316291; - color: #FFF; -} - -#main-navigation { - background: #262626; -} - -#main-navigation ul li { - background: #262626; - margin-right: 0; -} - -#main-navigation ul li.active { - background: #f0f0ee; -} - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; - color: #FFF; -} - -.secondary-navigation li a:hover { - background: #5C637A; -} - -#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { - color: #262626; -} - -.secondary-navigation { - background: #2F427A; - border-bottom-color: #262626; - font-size: 15px; -} - -.secondary-navigation ul li.active, .secondary-navigation ul li.active a:hover { - background-color: #262626; -} - -#footer .block { - color: #FFF; - background: #262626; -} - -#footer .block p { - margin: 0; - padding: 10px; -} - -/* pagination */ - -.pagination span, .pagination a { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - padding-top: 4px; -} - -.pagination span.current { - background: #262626; - color: #FFF; - border-color: #262626; -} - -.pagination a { - color: #262626; - border-color: #262626; -} - -.pagination a:hover { - color: #FFF; - background: #262626; -} - -/* tables */ - -.table th { - background: #262626; - color: #FFF; -} - -.table td { - border-bottom:1px solid #F0F0EE; -} - -/* forms */ - -.form input.text_field, .form textarea.text_area { - width: 100%; - border: 1px solid #262626; -} - -.form input.button { - background: #EEE; - color: #262626; - padding: 2px 5px; - border: 1px solid #262626; - cursor: pointer; -} - -.form .description { - font-style: italic; - color: #8C8C8C; - font-size: .9em; -} - -/* flash-messages */ -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin: 0 auto 15px; - -} - -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #fffaaa; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #1FDF00; - background-color: #BBFFB6; -} - -/* lists */ - -ul.list li { - border-bottom-color: #F0F0EE; - border-bottom-width: 1px; - border-bottom-style: solid; -} - -ul.list li .item .avatar { - border-color: #F0F0EE; - border-width: 1px; - border-style: solid; - padding: 2px; -} - -/* box */ - -#box .block { - background: #FFF; -} - -#box .block h2 { - background: #2F427A; - color: #FFF; -} - - -/* rounded borders */ - -#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li, -#footer .block, .form input.button, #box .block, #box .block h2 { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -.table th.last { - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation ul li.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -#sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block { - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; -} diff --git a/chef-server-api/public/stylesheets/themes/default/style.css b/chef-server-api/public/stylesheets/themes/default/style.css deleted file mode 100644 index 552321745f..0000000000 --- a/chef-server-api/public/stylesheets/themes/default/style.css +++ /dev/null @@ -1,267 +0,0 @@ -.small { font-size:11px; } -.gray { color:#999999; } -.hightlight { background-color:#FFFFCC; } - -a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #7A1818; } -a { -moz-outline: none; } - -body { - color: #222; - background: #f0f0ee; - font-family: helvetica, arial, sans-serif; -} - -hr { - background: #f0f0ee; - color: #f0f0ee; -} - -#header { - background: #7A1818; -} - -#header h1 { - padding: 20px 0; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - color: #FFF; -} - -#user-navigation { - top: auto; - bottom: 5px; - right: 25px; -} - -#main .block .content { - background: #FFF; - padding-top: 1px; -} - -#main .block .content h2 { - margin-left: 15px; -} - -#sidebar .block { - background: #FFF; -} - -#sidebar h3 { - background: #7A1818; - color: #FFF; - border-bottom: 10px solid #262626; -} - -#main-navigation ul li { - padding-left: 15px; -} - -#main-navigation ul li a { - padding: 8px 0; -} - -#main-navigation ul li.active { - padding: 0; - margin-left: 15px; -} - -#main-navigation ul li.active { - margin-left: 15px; -} - -#main-navigation ul li.active a { - padding: 8px 15px; -} - -#sidebar ul li a:link, #sidebar ul li a:visited { - background: #FFF; - border-bottom: 1px solid #F0F0EE; - text-decoration: none; -} - -#sidebar ul li a:hover, #sidebar ul li a:active { - background: #470E0E; - color: #FFF; -} - -#main-navigation { - background: #262626; -} - -#main-navigation ul li { - background: #262626; - margin-right: 0; -} - -#main-navigation ul li.active { - background: #f0f0ee; -} - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; - color: #FFF; -} - -.secondary-navigation li a:hover { - background: #470E0E; -} - -#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { - color: #262626; -} - -.secondary-navigation { - background: #7A1818; - border-bottom-color: #262626; -} - -.secondary-navigation ul li.active, .secondary-navigation ul li.active a:hover { - background-color: #262626; -} - -#footer .block { - color: #FFF; - background: #262626; -} - -#footer .block p { - margin: 0; - padding: 10px; -} - -/* pagination */ - -.pagination span.current { - background: #262626; - color: #FFF; - border-color: #262626; -} - -.pagination a { - color: #262626; - border-color: #262626; -} - -.pagination a:hover { - color: #FFF; - background: #262626; -} - -/* tables */ - -.table th { - background: #262626; - color: #FFF; -} - -.table td { - border-bottom:1px solid #F0F0EE; -} - -/* forms */ - -.form input.text_field, .form textarea.text_area { - width: 100%; - border: 1px solid #262626; -} - -.form input.button { - background: #EEE; - color: #262626; - padding: 2px 5px; - border: 1px solid #262626; - cursor: pointer; -} - -.form .description { - font-style: italic; - color: #8C8C8C; - font-size: .9em; -} - -/* flash-messages */ -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin: 0 auto 15px; - -} - -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #fffaaa; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #1FDF00; - background-color: #BBFFB6; -} - -/* lists */ - -ul.list li { - border-bottom-color: #F0F0EE; - border-bottom-width: 1px; - border-bottom-style: solid; -} - -ul.list li .item .avatar { - border-color: #F0F0EE; - border-width: 1px; - border-style: solid; - padding: 2px; -} - -/* box */ - -#box .block { - background: #FFF; -} - -#box .block h2 { - background: #7A1818; - color: #FFF; -} - - -/* rounded borders */ - -#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li, -#footer .block, .form input.button, #box .block, #box .block h2 { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -.table th.last { - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation ul li.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -#sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block { - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; -} diff --git a/chef-server-api/public/stylesheets/themes/djime-cerulean/style.css b/chef-server-api/public/stylesheets/themes/djime-cerulean/style.css deleted file mode 100644 index 5c5538a6f3..0000000000 --- a/chef-server-api/public/stylesheets/themes/djime-cerulean/style.css +++ /dev/null @@ -1,298 +0,0 @@ -/** - * Cerulean web-app-theme made for Djime: http://github.com/mikl/djime/ - * - * Please note that we're using CSSEdit's @group comment syntax. - * - * Colour sheme: - * Cerulean: #007BA7 - * Bright blue: #01B8DE - * Near-white: #F7F7F8 - * Silver grey: #C2C8D1 - * Dark blue: #001C26 - * - * http://www.colourlovers.com/palette/646252/Cerulean_touch - */ - -/* @group General styles */ - -.small { font-size:11px; } -.gray { color:#999; } -.hightlight { background-color:#ffc; } - -a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #007BA7; } - -body { - color: #222; - background: #C2C8D1; - font-family: "Helvetica Neue",Helvetica,Arial,"Bitstream Vera Sans",sans-serif; -} - -hr { - background: #EEF0F0; - color: #EEF0F0; -} - -/* @end */ - -/* @group Header */ - -#header { - background: #007BA7; -} - -#header h1 { - padding: 20px 0; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - color: #F7F7F8; -} - -/* @end */ - -#user-navigation { - top: auto; - bottom: 5px; - right: 25px; -} - -#main .block .content { - background: #F7F7F8; - padding-top: 1px; -} - -#main .block .content h2 { - margin-left: 15px; -} - - - -/* @group Main navigation */ - -#main-navigation ul li { - padding-left: 0; -} - -#main-navigation ul li a { - padding: 8px 0; -} - -#main-navigation ul li a { - padding: 8px 15px; -} - -#main-navigation { - background-color: #005573; -} - -#main-navigation ul li a:hover { - background-color: #001C26; -} - -#main-navigation ul li.active a { - background-color: #C2C8D1; - background: -webkit-gradient(linear, left top, left bottom, from(#C2C8D1), to(#C2C8D1), color-stop(0.5, #F7F7F8), color-stop(0.5, #F7F7F8)); - -} - -/* @end */ - -/* @group Secondary navigation */ - -.secondary-navigation li a:hover { - background: #005573; -} - -.secondary-navigation { - background: #007BA7; - border-bottom-width: 7px; - border-bottom-color: #005573; -} - -.secondary-navigation ul li.active, .secondary-navigation ul li.active a:hover { - background-color: #005573; -} - -/* @end */ - -/* @group Sidebar */ - -#sidebar .block { - background: #F7F7F8; -} - -#sidebar h3 { - background: #007BA7; - color: #F7F7F8; - border-bottom: 7px solid #005573; -} - -#sidebar ul li a:link, #sidebar ul li a:visited { - background: #F7F7F8; - border-bottom: 1px solid #EEF0F0; - text-decoration: none; -} - -#sidebar ul li a:hover, #sidebar ul li a:active { - background: #005573; - color: #F7F7F8; -} - -/* @end */ - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; - color: #F7F7F8; -} - -#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { - color: #001C26; -} - -#footer .block { - color: #F7F7F8; - background: #005573; -} - -#footer .block p { - margin: 0; - padding: 10px; -} - -/* pagination */ - -.pagination span.current { - background: #005573; - color: #F7F7F8; - border-color: #005573; -} - -.pagination a, -.pagination span { - color: #001C26; - border-color: #005573; -} - -.pagination a:hover { - color: #F7F7F8; - background: #005573; -} - -/* tables */ - -.table th { - background: #C2C8D1; - color: #001C26; -} - -.table td { - border-bottom:1px solid #EEF0F0; -} - -/* forms */ - -.form input.text_field, .form textarea.text_area { - width: 100%; - border: 1px solid #001C26; -} - -.form input.button { - background: #EEE; - color: #001C26; - padding: 2px 5px; - border: 1px solid #001C26; - cursor: pointer; -} - -.form .description { - color: #8C8C8C; - font-size: .9em; -} - -/* @group Flash messages */ - -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin: 0 auto 15px; -} - -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #e0d300; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #8ec4df; - background-color: #dffaff; -} - -/* @end */ - -/* lists */ - -ul.list li { - border-bottom-color: #EEF0F0; - border-bottom-width: 1px; - border-bottom-style: solid; -} - -ul.list li .item .avatar { - border-color: #EEF0F0; - border-width: 1px; - border-style: solid; - padding: 2px; -} - -/* box */ - -#box .block { - background: #F7F7F8; -} - -#box .block h2 { - background: #005573; - color: #F7F7F8; -} - - -/* rounded borders */ - -#main, #main-navigation, #main-navigation li, #main-navigation li a, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li, -#footer .block, .form input.button, #box .block, #box .block h2 { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -.table th.last { - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation ul li.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -#sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block { - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; -} diff --git a/chef-server-api/public/stylesheets/themes/kathleene/style.css b/chef-server-api/public/stylesheets/themes/kathleene/style.css deleted file mode 100644 index e68a545431..0000000000 --- a/chef-server-api/public/stylesheets/themes/kathleene/style.css +++ /dev/null @@ -1,272 +0,0 @@ -.small { font-size:11px; } -.gray { color:#999999; } -.hightlight { background-color:#FFFFCC; } - -a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #AF0000; } -a { -moz-outline: none; } - -body { - color: #222; - background: #f0f0ee; - font-family: helvetica, arial, sans-serif; -} - -hr { - background: #f0f0ee; - color: #f0f0ee; -} - -#header { - background: #AF0000; -} - -#header h1 { - padding: 20px 0; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - color: #FFF; -} - -#user-navigation { - top: auto; - bottom: 5px; - right: 25px; -} - -#main .block .content { - background: #FFF; - padding-top: 1px; -} - -#main .block .content h2 { - margin-left: 15px; -} - -#sidebar .block { - background: #FFF; -} - -#sidebar h3 { - background: #AF0000; - color: #FFF; - border-bottom: 5px solid #2a0000; -} - -#main-navigation ul li { - padding-left: 15px; -} - -#main-navigation ul li a { - padding: 8px 0; -} - -#main-navigation ul li.active { - padding: 0; - margin-left: 15px; -} - -#main-navigation ul li.active { - margin-left: 15px; -} - -#main-navigation ul li.active a { - padding: 8px 15px; -} - -#sidebar ul li a:link, #sidebar ul li a:visited { - background: #FFF; - border-bottom: 1px solid #F0F0EE; - text-decoration: none; -} - -#sidebar ul li a:hover, #sidebar ul li a:active { - background: #470E0E; - color: #FFF; -} - -#main-navigation { - background: #2a0000; -} - -#main-navigation ul li { - background: #2a0000; - margin-right: 0; -} - -#main-navigation ul li.active { - background: #f0f0ee; -} - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; - color: #FFF; -} - -.secondary-navigation li a:hover { - background: #470E0E; -} - -#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { - color: #2a0000; -} - -.secondary-navigation { - background: #AF0000; - border-bottom-color: #2a0000; -} - -.secondary-navigation ul li.active, .secondary-navigation ul li.active a:hover { - background-color: #2a0000; -} - -#footer .block { - color: #FFF; - background: #2a0000; -} - -#footer .block p { - margin: 0; - padding: 10px; -} - -/* pagination */ - -.pagination span.current { - background: #2a0000; - color: #FFF; - border-color: #2a0000; -} - -.pagination a { - color: #2a0000; - border-color: #2a0000; -} - -.pagination a:hover { - color: #FFF; - background: #2a0000; -} - -/* tables */ - -.table th { - background: #100000; - border-bottom: 3px solid #700000; - color: #FFF; -} - -.table td { - border-bottom:1px solid #F0F0EE; -} - -/* forms */ - -.form input.text_field, .form textarea.text_area { - width: 100%; - border: 1px solid #2a0000; -} - -.form input.button { - background: #EEE; - color: #2a0000; - padding: 2px 5px; - border: 1px solid #2a0000; - cursor: pointer; -} - -.form .description { - font-style: italic; - color: #8C8C8C; - font-size: .9em; -} - -/* flash-messages */ -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin: 0 auto 15px; - -} - -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #fffaaa; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #1FDF00; - background-color: #BBFFB6; -} - -/* lists */ - -ul.list li { - border-bottom-color: #F0F0EE; - border-bottom-width: 1px; - border-bottom-style: solid; -} - -ul.list li .item .avatar { - border-color: #F0F0EE; - border-width: 1px; - border-style: solid; - padding: 2px; -} - -/* box */ - -#box .block { - background: #FFF; -} - -#box .block h2 { - background: #AF0000; - color: #FFF; -} - - -/* rounded borders */ - -#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li, -#footer .block, .form input.button, #box .block, #box .block h2 { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -.table th.last { - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation ul li.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -#sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block { - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; -} - -.secondary-navigation { - border-bottom-width: 5px; -} diff --git a/chef-server-api/public/stylesheets/themes/orange/style.css b/chef-server-api/public/stylesheets/themes/orange/style.css deleted file mode 100644 index e7d51f51dc..0000000000 --- a/chef-server-api/public/stylesheets/themes/orange/style.css +++ /dev/null @@ -1,263 +0,0 @@ -.small { font-size:11px; } -.gray { color:#999999; } -.hightlight { background-color:#FFFFCC; } - -a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #ff7900; } -a { -moz-outline: none; } - -body { - color: #222; - background: #f0f0ee; - font-family: helvetica, arial, sans-serif; -} - -hr { - background: #f0f0ee; - color: #f0f0ee; -} - -#header { - background: #ff7900; -} - -#header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited { - color: #FFF; -} - -#user-navigation { - top: auto; - bottom: 5px; - right: 25px; -} - -#main .block .content { - background: #FFF; - padding-top: 1px; -} - -#main .block .content h2 { - margin-left: 15px; -} - -#sidebar .block { - background: #FFF; -} - -#sidebar h3 { - background: #ff7900; - color: #FFF; - border-bottom: 10px solid #262626; -} - -#main-navigation ul li { - padding-left: 15px; -} - -#main-navigation ul li a { - padding: 8px 0; -} - -#main-navigation ul li.active { - padding: 0; - margin-left: 15px; -} - -#main-navigation ul li.active { - margin-left: 15px; -} - -#main-navigation ul li.active a { - padding: 8px 15px; -} - -#sidebar ul li a:link, #sidebar ul li a:visited { - background: #FFF; - border-bottom: 1px solid #F0F0EE; - text-decoration: none; -} - -#sidebar ul li a:hover, #sidebar ul li a:active { - background: #863800; - color: #FFF; -} - -#main-navigation { - background: #262626; -} - -#main-navigation ul li { - background: #262626; - margin-right: 0; -} - -#main-navigation ul li.active { - background: #f0f0ee; -} - -#main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active, -#user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active { - text-decoration: none; - color: #FFF; -} - -.secondary-navigation li a:hover { - background: #863800; -} - -#main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active { - color: #262626; -} - -.secondary-navigation { - background: #ff7900; - border-bottom-color: #262626; -} - -.secondary-navigation ul li.active, .secondary-navigation ul li.active a:hover { - background-color: #262626; -} - -#footer .block { - color: #FFF; - background: #262626; - width: 70%; -} - -#footer .block p { - margin: 0; - padding: 10px; -} - -/* pagination */ - -.pagination span.current { - background: #262626; - color: #FFF; - border-color: #262626; -} - -.pagination a { - color: #262626; - border-color: #262626; -} - -.pagination a:hover { - color: #FFF; - background: #262626; -} - -/* tables */ - -.table th { - background: #262626; - color: #FFF; -} - -.table td { - border-bottom:1px solid #F0F0EE; -} - -/* forms */ - -.form input.text, .form textarea { - width: 100%; - border: 1px solid #262626; -} - -.form input.button { - background: #EEE; - color: #262626; - padding: 2px 5px; - border: 1px solid #262626; - cursor: pointer; -} - -.form .description { - font-style: italic; - color: #8C8C8C; - font-size: .9em; -} - -/* flash-messages */ -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin:0 auto 5px; - -} -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #fffaaa; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #1FDF00; - background-color: #BBFFB6; -} - -/* lists */ - -ul.list li { - border-bottom-color: #F0F0EE; - border-bottom-width: 1px; - border-bottom-style: solid; -} - -ul.list li .item .avatar { - border-color: #F0F0EE; - border-width: 1px; - border-style: solid; - padding: 2px; -} - -/* box */ - -#box .block { - background: #FFF; -} - -#box .block h2 { - background: #ff7900; - color: #FFF; -} - - -/* rounded borders */ - -#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li, -#footer .block, .form input.button, #box .block, #box .block h2 { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -.table th.last { - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation ul li.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -#sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block { - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; -} diff --git a/chef-server-api/public/stylesheets/themes/reidb-greenish/style.css b/chef-server-api/public/stylesheets/themes/reidb-greenish/style.css deleted file mode 100644 index 23e5245eb4..0000000000 --- a/chef-server-api/public/stylesheets/themes/reidb-greenish/style.css +++ /dev/null @@ -1,301 +0,0 @@ -.small { font-size:11px; } -.gray { color:#a2b0b6; } -.hightlight { background-color:#d6e7c7; } - -a:link, a:visited, a:hover, a:active { color: #81B953; } -h1, h2, h3 { color: #3B5526; } -a { -moz-outline: none; } - -body { - color: #222; - background: #e4ebe4; - font-family: helvetica, arial, sans-serif; -} - -hr { - background: #f0f0ee; - color: #f0f0ee; -} - -#header { - background: #c9deb7; - -} - -#header h1{ - padding: 20px 0; - font-weight: bold; - -} - -#header h1 a:link, #header h1 a:active, -#header h1 a:hover, #header h1 a:visited { - color: #3B5526; -} - -#main .block .content { - background: #FFF; - padding-top: 1px; -} - -#main .block .content h2 { - margin-left: 15px; -} - -#main .content { border: 1px solid #81B953;} - -#sidebar .block { - background: #FFF; - border: none; -} - -#sidebar h3 { - padding: 8px 12px; - background: #3B5526; - color: #FFF; - font-weight: bold; - border-bottom: 5px solid #81B953; -} - - -#sidebar ul li a:link, -#sidebar ul li a:visited { - background: #FFF; - border-bottom: 1px solid #F0F0EE; - text-decoration: none; -} - -#sidebar ul li a:hover, -#sidebar ul li a:active { - background: #D3E8C1; - color: #FFF; -} - -#main-navigation { - background: #44721e; - margin-right: 20px; - padding: 7px 7px 0 7px; -} - -#main-navigation ul li { - background: #91B96F; - margin-right: 7px; -} - -#main-navigation ul li a { - padding: 10px 10px 5px 10px; -} - -#main-navigation ul li.active { - background: #e4ebe4; - border: 1px solid #91B96F; - border-bottom: none; - font-weight: bold; -} - -#main-navigation ul li a:hover, -#main-navigation ul li a:link, -#main-navigation ul li a:visited, -#main-navigation ul li a:active, -.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, -.secondary-navigation ul li a:hover, .secondary-navigation ul li a:active { - text-decoration: none; - color: #FFF; -} - -#user-navigation ul li a:link, -#user-navigation ul li a:visited, -#user-navigation ul li a:active { - color: #3B5526; -} - -#user-navigation ul li a:hover { color: #fff; } - -#main-navigation ul li.active a:link, -#main-navigation ul li.active a:visited, -#main-navigation ul li.active a:hover, -#main-navigation ul li.active a:active { - color: #262626; -} - -.secondary-navigation { - background: #3B5526; - border-bottom: 5px solid #81b953; -} - -.secondary-navigation ul li a { -display:block; -padding: 8px 12px; -} - -.secondary-navigation ul li.active {background: #81b953; font-weight: bold;} -.secondary-navigation ul li.active a:hover { - background-color: #81B953; -} - -.secondary-navigation li a:hover { - background: #81B953; -} - -#footer .block { - color: #FFF; - background: #3B5526; -} - -#footer .block p { - margin: 0; - padding: 5px; -} - -/* pagination */ - -.pagination span.current { - background: #262626; - color: #FFF; - border-color: #262626; -} - -.pagination a { - color: #262626; - border-color: #262626; -} - -.pagination a:hover { - color: #FFF; - background: #262626; -} - -/* tables */ - - -.table th { - background: #253618; - color: #FFF; -} - -.table tr th { padding: 5px; } - -.table td { - border-bottom:1px solid #F0F0EE; -} -.table tr.odd {background: #ebfadf;} -.table tr.even {background: #d3e8c1;} - - -/* forms */ - -.form input.text_field, .form textarea.text_area { - width: 100%; - border: 1px solid #262626; -} - -.form input.button { - background: #EEE; - color: #262626; - padding: 2px 5px; - border: 1px solid #262626; - cursor: pointer; -} - -.form .description { - font-style: italic; - color: #8C8C8C; - font-size: .9em; -} - -/* flash-messages */ -.flash .message { - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - text-align:center; - margin: 0 auto 15px; - -} - -.flash .message p { - margin:8px; -} -.flash .error { - border: 1px solid #fbb; - background-color: #fdd; -} -.flash .warning { - border: 1px solid #fffaaa; - background-color: #ffffcc; -} -.flash .notice { - border: 1px solid #1FDF00; - background-color: #BBFFB6; -} - -/* lists */ - -ul.list li { - border-bottom-color: #F0F0EE; - border-bottom-width: 1px; - border-bottom-style: solid; -} - -ul.list li .item .avatar { - border-color: #F0F0EE; - border-width: 1px; - border-style: solid; - padding: 2px; -} - -/* box */ - -#box .block { - background: #FFF; -} - -#box .block h2 { - color: #fff; - background: #3B5526; - border-bottom: 5px solid #81b953; -} - -#box .block .content { border: 1px solid #81b953; border} - -/* login */ - -#block-login { } -#block-login h2 { background: #3B5526;border-bottom: 5px solid #81b953;} - -/* rounded borders */ - -#main, #main-navigation, #main-navigation li, -.secondary-navigation, #main .block, #sidebar .block, -#sidebar h3, ul.list li, #footer .block, -.form input.button, #box .block, #box .block h2 { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation li.first a, -.secondary-navigation ul li.first, -.table th.first, .table th.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -.table th.last { - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; -} - -.secondary-navigation ul li.first { - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; -} - -#sidebar, #sidebar .block, #main .block, -#sidebar ul.navigation, ul.list li, -#footer .block, .form input.button, #box .block { - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; -}
\ No newline at end of file diff --git a/chef-server-api/spec/spec.opts b/chef-server-api/spec/spec.opts deleted file mode 100644 index e64d3e1f1b..0000000000 --- a/chef-server-api/spec/spec.opts +++ /dev/null @@ -1,3 +0,0 @@ --c --b --fs
\ No newline at end of file diff --git a/chef-server-api/spec/spec_helper.rb b/chef-server-api/spec/spec_helper.rb deleted file mode 100644 index c6d59514cf..0000000000 --- a/chef-server-api/spec/spec_helper.rb +++ /dev/null @@ -1,100 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# 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. -# - -require "rubygems" -require "merb-core" -require "rspec" - -Merb.push_path(:spec_helpers, "spec" / "spec_helpers", "**/*.rb") -Merb.push_path(:spec_fixtures, "spec" / "fixtures", "**/*.rb") - -$:.unshift(File.expand_path('../../app/', __FILE__)) - -Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test') - -RSpec.configure do |config| - config.include(Merb::Test::RouteHelper) - config.include(Merb::Test::ControllerHelper) -end - -def get_json(path, params = {}, env = {}, &block) - request_json("GET", path, params, env, &block) -end - -def post_json(path, post_body, env = {}, &block) - request_json("POST", path, {}, env) do |controller| - # Merb FakeRequest allows me no way to pass JSON across the - # FakeRequest/StringIO boundary, so we hack it here. - if post_body.is_a?(Hash) - controller.params.merge!(post_body) - else - controller.params['inflated_object'] = post_body - end - block.call if block - end -end - -def put_json(path, put_body, env = {}, &block) - request_json("PUT", path, {}, env) do |controller| - # Merb FakeRequest allows me no way to pass JSON across the - # FakeRequest/StringIO boundary, so we hack it here. - if put_body.is_a?(Hash) - controller.params.merge!(put_body) - else - controller.params['inflated_object'] = put_body - end - block.call if block - end -end - -# Make an HTTP call of <method>, assign the accept header to -# application/json, and return the JSON-parsed output. -# -# Side effects: -# Raw textual output available in @response_raw -# Controller used available in @controller -def request_json(method, path, params, env, &block) - @controller = mock_request(path, params, env.merge({'HTTP_ACCEPT' => "application/json", :request_method => method})) do |controller| - stub_authentication(controller) - block.call(controller) if block - end - - @response_raw = @controller.body - @response_json = Chef::JSONCompat.from_json(@response_raw) -end - -def stub_authentication(controller,user=nil) - username = "tester" - - unless user - user = Chef::ApiClient.new - user.name(username) - user.admin(true) - end - - # authenticate_every has a side-effect of setting @auth_user - controller.stub!(:authenticate_every).and_return(true) - controller.instance_variable_set(:@auth_user, user) -end - -def root_url - # include organization name to run these tests in the platform - "http://localhost" -end - - diff --git a/chef-server-api/spec/spec_model_helper.rb b/chef-server-api/spec/spec_model_helper.rb deleted file mode 100644 index 31aed31604..0000000000 --- a/chef-server-api/spec/spec_model_helper.rb +++ /dev/null @@ -1,90 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# 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. -# - -# Set of methods to create model objects for spec tests. -# None of these methods save or otherwise commit the objects they -# create; they simply initialize the respective model object and -# set its name (and other important attributes, where appropriate). - -def make_node(name) - res = Chef::Node.new - res.name(name) - res -end - -def make_role(name) - res = Chef::Role.new - res.name(name) - res -end - -def make_environment(name) - res = Chef::Environment.new - res.name(name) - res -end - -def make_cookbook(name, version) - res = Chef::CookbookVersion.new(name) - res.version = version - res -end - -def make_runlist(*items) - res = Chef::RunList.new - items.each do |item| - res << item - end - res -end - -def make_client(name,admin=false) - res = Chef::ApiClient.new - res.name(name) - res.admin(admin) - res -end - -def stub_checksum(checksum, present = true) - Chef::Checksum.should_receive(:new).with(checksum).and_return do - obj = stub(Chef::Checksum) - obj.should_receive(:storage).and_return do - storage = stub("storage") - if present - storage.should_receive(:file_location).and_return("/var/chef/checksums/#{checksum[0..1]}/#{checksum}") - else - storage.should_receive(:file_location).and_raise(Errno::ENOENT) - end - storage - end - obj - end -end - -# Take an Array of cookbook_versions, -# And return a hash like: -# { -# "cookbook_name" => [CookbookVersion, CookbookVersion], -# } -def make_filtered_cookbook_hash(*array_cookbook_versions) - array_cookbook_versions.inject({}) do |res, cookbook_version| - res[cookbook_version.name] ||= Array.new - res[cookbook_version.name] << cookbook_version - res - end -end diff --git a/chef-server-api/spec/unit/clients_controller_spec.rb b/chef-server-api/spec/unit/clients_controller_spec.rb deleted file mode 100644 index bd02be638e..0000000000 --- a/chef-server-api/spec/unit/clients_controller_spec.rb +++ /dev/null @@ -1,74 +0,0 @@ -# -# Author:: Michael Ivey (<ivey@gweezlebur.com>) -# Copyright:: Copyright (c) 2012 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. -# - -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -require File.expand_path(File.dirname(__FILE__) + '/../spec_model_helper') -require 'pp' - -describe "Clients Controller" do - before do - Merb.logger.set_log(StringIO.new) - end - - describe "when deleting a client" do - before do - @client = make_client("deleted_client") - @caller = make_client("deleting_client") - end - - describe "from an admin client" do - before do - @caller.admin(true) - end - - it "should delete the client" do - Chef::ApiClient.stub!(:cdb_load).and_return(@client) - @client.should_receive(:cdb_destroy).and_return(true) - @controller = mock_request("/clients/deleted_client", {}, {'HTTP_ACCEPT' => "application/json", :request_method => "DELETE"}) do |controller| - stub_authentication(controller, @caller) - end - @response_raw = @controller.body - @response_json = Chef::JSONCompat.from_json(@response_raw) - end - end - - describe "from a non-admin client" do - it "should not delete the client" do - Chef::ApiClient.stub!(:cdb_load).and_return(@client) - lambda { - @controller = mock_request("/clients/deleted_client", {}, {'HTTP_ACCEPT' => "application/json", :request_method => "DELETE"}) do |controller| - stub_authentication(controller, @caller) - end - }.should raise_error(Merb::ControllerExceptions::Forbidden, /You are not the correct node.*not an API admin/) - end - end - - describe "from the same client as it is trying to delete" do - it "should delete the client" do - Chef::ApiClient.stub!(:cdb_load).and_return(@client) - @client.should_receive(:cdb_destroy).and_return(true) - @controller = mock_request("/clients/deleted_client", {}, {'HTTP_ACCEPT' => "application/json", :request_method => "DELETE"}) do |controller| - stub_authentication(controller, @client) - end - @response_raw = @controller.body - @response_json = Chef::JSONCompat.from_json(@response_raw) - end - end - - end -end diff --git a/chef-server-api/spec/unit/cookbooks_controller_spec.rb b/chef-server-api/spec/unit/cookbooks_controller_spec.rb deleted file mode 100644 index e7dda61676..0000000000 --- a/chef-server-api/spec/unit/cookbooks_controller_spec.rb +++ /dev/null @@ -1,147 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@opscode.com>) -# 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. -# - -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -require File.expand_path(File.dirname(__FILE__) + '/../spec_model_helper') -require 'chef/node' -require 'pp' - -describe "Cookbooks Controller" do - before do - Merb.logger.set_log(StringIO.new) - end - - MAXMAJOR=25 - describe "when several versions of multiple cookbooks exist" do - before do - @cookbook_a_versions = (0...7).map { |i| "1.0.#{i}"} - @cookbook_b_versions = (0...3).map { |i| "#{MAXMAJOR}.0.#{i}" } - Chef::CookbookVersion.stub!(:cdb_list).and_return("cookbook-a" => @cookbook_a_versions, "cookbook-b" => @cookbook_b_versions) - Chef::CookbookVersion.stub!(:cdb_list_latest).and_return('cookbook-a' => '1.0.6', 'cookbook-b' => '#{MAXMAJOR}.0.2') - Chef::CookbookVersion.stub!(:cdb_by_name).with('cookbook-a').and_return("cookbook-a" => @cookbook_a_versions) - end - - describe "when handling requests from 0.10 and newer clients" do - it "lists the latest version of all cookbooks" do - expected = {} - expected_cookbook_a_data = [ @cookbook_a_versions.map {|v| {"url" => "#{root_url}/cookbooks/cookbook-a/#{v}", "version" => v}}.last ] - expected['cookbook-a'] = {"url" => "#{root_url}/cookbooks/cookbook-a", "versions" => expected_cookbook_a_data} - expected_cookbook_b_data = [ @cookbook_b_versions.map {|v| {"url" => "#{root_url}/cookbooks/cookbook-b/#{v}", "version" => v}}.last ] - expected['cookbook-b'] = {"url" => "#{root_url}/cookbooks/cookbook-b", "versions" => expected_cookbook_b_data} - get_json('/cookbooks').should == expected - end - - it "shows the versions of a cookbook" do - expected = {} - expected_cookbook_a_data = @cookbook_a_versions.map {|v| {"url" => "#{root_url}/cookbooks/cookbook-a/#{v}", "version" => v}}.reverse - expected['cookbook-a'] = {"url" => "#{root_url}/cookbooks/cookbook-a", "versions" => expected_cookbook_a_data} - get_json('/cookbooks/cookbook-a').should == expected - end - - cookbook_version = "#{MAXMAJOR}.0.3" - it "downloads a file from a cookbook" do - cookbook = make_cookbook("cookbook-a", "#{cookbook_version}") - cookbook.checksums["1234"] = nil - stub_checksum("1234") - Chef::CookbookVersion.should_receive(:cdb_load).with("cookbook-a", "#{cookbook_version}").and_return(cookbook) - expected = {} - expected_cookbook_a_data = @cookbook_a_versions.map {|v| {"url" => "#{root_url}/cookbooks/cookbook-a/#{v}", "version" => v}}.reverse - expected['cookbook-a'] = {"url" => "#{root_url}/cookbooks/cookbook-a", "versions" => expected_cookbook_a_data} - response = get("/cookbooks/cookbook-a/#{cookbook_version}/files/1234") do |controller| - stub_authentication(controller) - controller.should_receive(:send_file).with("/var/chef/checksums/12/1234").and_return("file-content") - end - response.status.should == 200 - response.body.should == "file-content" - end - - it "gets an error in case of missing file on download" do - cookbook = make_cookbook("cookbook-a", "#{cookbook_version}") - cookbook.checksums["1234"] = nil - stub_checksum("1234", false) - Chef::CookbookVersion.should_receive(:cdb_load).with("cookbook-a", "#{cookbook_version}").and_return(cookbook) - expected = {} - expected_cookbook_a_data = @cookbook_a_versions.map {|v| {"url" => "#{root_url}/cookbooks/cookbook-a/#{v}", "version" => v}}.reverse - expected['cookbook-a'] = {"url" => "#{root_url}/cookbooks/cookbook-a", "versions" => expected_cookbook_a_data} - lambda do - response = get("/cookbooks/cookbook-a/#{cookbook_version}/files/1234") do |controller| - stub_authentication(controller) - end - end.should raise_error(Merb::ControllerExceptions::InternalServerError, /File with checksum 1234 not found in the repository/) - end - end - - describe "when handling requests from 0.9 clients" do - it "lists the latest versions of cookbooks by URL" do - expected = {} - expected['cookbook-a'] = "#{root_url}/cookbooks/cookbook-a" - expected['cookbook-b'] = "#{root_url}/cookbooks/cookbook-b" - get_json('/cookbooks', {}, {'HTTP_X_CHEF_VERSION' => '0.9.14'} ).should == expected - end - - it "shows the versions of a cookbook by URL" do - expected = {'cookbook-a' => @cookbook_a_versions} - get_json('/cookbooks/cookbook-a', {}, {'HTTP_X_CHEF_VERSION' => '0.9.14'}).should == expected - end - end - end - - describe "when uploading a cookbook" do - before do - @cookbook = make_cookbook("cookbook1", "1.0.0") - end - - describe "and the cookbook is new" do - it "should upload a standard cookbook" do - Chef::CookbookVersion.stub!(:cdb_load).and_raise(Chef::Exceptions::CouchDBNotFound) - @cookbook.should_receive(:cdb_save).and_return(true) - response = put_json("/cookbooks/#{@cookbook.name}/#{@cookbook.version}", @cookbook) - end - - it "should upload a frozen cookbook" do - @cookbook.freeze_version - Chef::CookbookVersion.stub!(:cdb_load).and_raise(Chef::Exceptions::CouchDBNotFound) - @cookbook.should_receive(:cdb_save).and_return(true) - response = put_json("/#{@cookbook.save_url}", @cookbook) - end - end - - describe "and the cookbook already exists" do - it "should overwrite the existing version" do - Chef::CookbookVersion.stub!(:cdb_load).and_return(@cookbook) - @cookbook.should_receive(:cdb_save).and_return(true) - response = put_json("/#{@cookbook.save_url}", @cookbook) - end - - it "should not overwrite a frozen version" do - @cookbook.freeze_version - Chef::CookbookVersion.stub!(:cdb_load).and_return(@cookbook) - lambda do - put_json("/#{@cookbook.save_url}", @cookbook) - end.should raise_error(Merb::ControllerExceptions::Conflict, /The cookbook (\S+) at version (\S+) is frozen/) - end - - it "should overwrite a frozen version if forced" do - @cookbook.freeze_version - Chef::CookbookVersion.stub!(:cdb_load).and_return(@cookbook) - @cookbook.should_receive(:cdb_save).and_return(true) - response = put_json("/#{@cookbook.force_save_url}", @cookbook) - end - end - end -end diff --git a/chef-server-api/spec/unit/environments_controller_spec.rb b/chef-server-api/spec/unit/environments_controller_spec.rb deleted file mode 100644 index 0cf26f6717..0000000000 --- a/chef-server-api/spec/unit/environments_controller_spec.rb +++ /dev/null @@ -1,146 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# 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. -# - -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -require File.expand_path(File.dirname(__FILE__) + '/../spec_model_helper') -require 'chef/node' -require 'pp' - -describe "Environments controller" do - before do - Merb.logger.set_log(StringIO.new) - - @env1 = make_environment("env1") - - @cookbook1_v1 = make_cookbook("cookbook1", "1.0.0") - @cookbook2_v1 = make_cookbook("cookbook2", "1.0.0") - @filtered_cookbook_list_env1 = make_filtered_cookbook_hash(@cookbook1_v1, @cookbook2_v1) - @filtered_cookbook_list_env1["cookbook_noversions"] = Array.new - - @cookbook1_v2 = make_cookbook("cookbook1", "2.0.0") - @cookbook2_v2 = make_cookbook("cookbook2", "2.0.0") - @filtered_cookbook_list_env2 = make_filtered_cookbook_hash(@cookbook1_v2, @cookbook2_v2) - - @cookbook1_v3 = make_cookbook("cookbook1", "3.0.0") - @cookbook1_v4 = make_cookbook("cookbook1", "4.0.0") - @filtered_cookbook_list_env_many_versions = make_filtered_cookbook_hash(@cookbook1_v1, - @cookbook1_v2, - @cookbook1_v3, - @cookbook1_v4) - - @cookbook_deps_on_nosuch = make_cookbook("cookbook_deps_on_nosuch", "1.0.0") - @cookbook_deps_on_nosuch.metadata.depends("cookbook_nosuch") - - @cookbook_deps_on_badver = make_cookbook("cookbook_deps_on_badver", "1.0.0") - @cookbook_deps_on_badver.metadata.depends("cookbook1", ">= 3.0.0") - end - - describe "when handling Environments API calls" do - it "should expand the passed-in run_list using the correct environment: one run_list item" do - # Env1 pins both versions at 1.0.0. Expect only the one we ask for, cookbook1, - # back in the result. - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env1", nil).and_return(@filtered_cookbook_list_env1) - Chef::MinimalCookbookVersion.should_receive(:load_full_versions_of).with([@cookbook1_v1], nil).and_return([@cookbook1_v1]) - response = post_json("/environments/env1/cookbook_versions", {"run_list" => ["recipe[cookbook1]"]}) - response.should be_kind_of(Hash) - response.keys.size.should == 1 - response["cookbook1"].should_not == nil - response["cookbook1"]['version'].should == "1.0.0" - end - - it "should expect the passed-in run_list using the correct environment: two run_list items" do - # Ask for both cookbook1 and cookbook2 back. Expect version 2.0.0 for - # each, as those are what's appropriate for the environment. - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env2", nil).and_return(@filtered_cookbook_list_env2) - Chef::MinimalCookbookVersion.should_receive(:load_full_versions_of).with([@cookbook2_v2, @cookbook1_v2], nil).and_return([@cookbook2_v2, @cookbook1_v2]) - response = post_json("/environments/env2/cookbook_versions", {"run_list" => ["recipe[cookbook2]", "recipe[cookbook1]"]}) - response.should be_kind_of(Hash) - response.keys.size.should == 2 - response["cookbook1"].should_not == nil - response["cookbook1"]['version'].should == "2.0.0" - response["cookbook2"].should_not == nil - response["cookbook2"]['version'].should == "2.0.0" - end - - it "should return the newest version of a cookbook when given multiple versions" do - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env_many_versions", nil).and_return(@filtered_cookbook_list_env_many_versions) - Chef::MinimalCookbookVersion.should_receive(:load_full_versions_of).with([@cookbook1_v4], nil).and_return([@cookbook1_v4]) - response = post_json("/environments/env_many_versions/cookbook_versions", {"run_list" => ["recipe[cookbook1]"]}) - - response.should be_kind_of(Hash) - response.keys.size.should == 1 - response["cookbook1"].should_not == nil - response["cookbook1"]['version'].should == "4.0.0" - end - - it "should return the asked-for, older version of a cookbook if the version is specified in the run_list" do - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env_many_versions", nil).and_return(@filtered_cookbook_list_env_many_versions) - Chef::MinimalCookbookVersion.should_receive(:load_full_versions_of).with([@cookbook1_v1], nil).and_return([@cookbook1_v1]) - response = post_json("/environments/env_many_versions/cookbook_versions", {"run_list" => ["recipe[cookbook1@1.0.0]"]}) - - response.should be_kind_of(Hash) - response.keys.size.should == 1 - response["cookbook1"].should_not == nil - response["cookbook1"]['version'].should == "1.0.0" - end - - it "should report no_such_cookbook if given a dependency on a non-existant cookbook" do - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env1", nil).and_return(@filtered_cookbook_list_env1) - expected_error = { - "message" => "Run list contains invalid items: no such cookbook cookbook_nosuch.", - "non_existent_cookbooks" => ["cookbook_nosuch"], - "cookbooks_with_no_versions" => [] - }.to_json - - lambda { - response = post_json("/environments/env1/cookbook_versions", {"run_list" => ["recipe[cookbook_nosuch]"]}) - }.should raise_error(Merb::ControllerExceptions::PreconditionFailed, expected_error) - end - - it "should report no_such_version if given a dependency on a cookbook that doesn't have any valid versions for an environment" do - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env1", nil).and_return(@filtered_cookbook_list_env1) - expected_error = { - "message" => "Run list contains invalid items: no versions match the constraints on cookbook cookbook_noversions.", - "non_existent_cookbooks" => [], - "cookbooks_with_no_versions" => ["cookbook_noversions"] - }.to_json - - lambda { - response = post_json("/environments/env1/cookbook_versions", {"run_list" => ["recipe[cookbook_noversions]"]}) - }.should raise_error(Merb::ControllerExceptions::PreconditionFailed, expected_error) - end - - # TODO; have top-level cookbooks depend on other, non-existent cookbooks, - # to get the other kind of exceptions. - it "should report multiple failures (compound exceptions) if there is more than one error in dependencies" do - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env1", nil).and_return(@filtered_cookbook_list_env1) - - expected_error = { - "message" => "Run list contains invalid items: no such cookbooks cookbook_nosuch_1, cookbook_nosuch_2; no versions match the constraints on cookbook cookbook_noversions.", - "non_existent_cookbooks" => ["cookbook_nosuch_1", "cookbook_nosuch_2"], - "cookbooks_with_no_versions" => ["cookbook_noversions"] - }.to_json - - lambda { - response = post_json("/environments/env1/cookbook_versions", - {"run_list" => ["recipe[cookbook_nosuch_1]", "recipe[cookbook_nosuch_2]", "recipe[cookbook_noversions]"]}) - }.should raise_error(Merb::ControllerExceptions::PreconditionFailed, expected_error) - end - end -end - diff --git a/chef-server-api/spec/unit/nodes_controller_environments_spec.rb b/chef-server-api/spec/unit/nodes_controller_environments_spec.rb deleted file mode 100644 index e635c9b465..0000000000 --- a/chef-server-api/spec/unit/nodes_controller_environments_spec.rb +++ /dev/null @@ -1,136 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# 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. -# - -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -require File.expand_path(File.dirname(__FILE__) + '/../spec_model_helper') -require 'chef/node' -require 'pp' - -describe "Nodes controller - environments and run_list expansion" do - before do - Merb.logger.set_log(StringIO.new) - - # Node 'node1': - # contains 'role[role1]' - # - # Role 'role1': - # for env '_default', contains 'recipe[cb_for_default]' - # for env 'env1', contains 'recipe[cb_for_env1]' - # for env 'env_fallback', contains nothing (should fall back to _default). - # - # Check that the node returns the right expanded run list no matter the - # environment it's in. - @node1 = make_node("node1") - @node1.run_list << "role[role1]" - - @node_containing_nosuch_cookbook = make_node("node_containing_nosuch_cookbook") - @node_containing_nosuch_cookbook.run_list << "recipe[cookbook_nosuch]" - - @node_containing_role_containing_nosuch_cookbook = make_node("node_containing_role_containing_nosuch_cookbook") - @node_containing_role_containing_nosuch_cookbook.run_list << "role[role_containing_nosuch_cookbook]" - - @role1 = make_role("role1") - @role1.env_run_lists({"_default" => make_runlist("recipe[cb_for_default]"), "env1" => make_runlist("recipe[cb_for_env1]")}) - - @role_containing_nosuch_cookbook = make_role("role_containing_nosuch_cookbook") - @role_containing_nosuch_cookbook.env_run_lists({"_default" => make_runlist("recipe[cookbook_nosuch]")}) - - @cb_for_default = make_cookbook("cb_for_default", "1.0.0") - @cb_for_env1 = make_cookbook("cb_for_env1", "1.0.0") - @all_filtered_cookbook_list = - make_filtered_cookbook_hash(@cb_for_default, @cb_for_env1) - end - - describe "when handling Node API calls" do - it "should expand role and cookbook dependencies using the _default environment" do - # Test that node@_default resolves to use cookbook cb_for_default - Chef::Node.should_receive(:cdb_load).with("node1").and_return(@node1) - Chef::Role.should_receive(:cdb_load).with("role1", nil).and_return(@role1) - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("_default", nil).and_return(@all_filtered_cookbook_list) - Chef::MinimalCookbookVersion.should_receive(:load_full_versions_of).with([@cb_for_default], nil).and_return([@cb_for_default]) - - response = get_json("/nodes/node1/cookbooks") - response.should be_kind_of(Hash) - response["cb_for_default"].should_not == nil - response["cb_for_env1"].should == nil - end - - it "should expand role and cookbook dependencies using the env1 environment" do - # Test that node@env1 resolves to use cookbook cb_for_env1 - @node1.chef_environment("env1") - Chef::Node.should_receive(:cdb_load).with("node1").and_return(@node1) - Chef::Role.should_receive(:cdb_load).with("role1", nil).and_return(@role1) - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env1", nil).and_return(@all_filtered_cookbook_list) - Chef::MinimalCookbookVersion.should_receive(:load_full_versions_of).with([@cb_for_env1], nil).and_return([@cb_for_env1]) - - response = get_json("/nodes/node1/cookbooks") - response.should be_kind_of(Hash) - response["cb_for_default"].should == nil - response["cb_for_env1"].should_not == nil - end - - it "should expand role and cookbook dependencies using the _default environment, when passed an empty environment" do - # Test that node@env_fallback resolves to use cookbook cb_for_default - # because env_fallback falls back to _default - @node1.chef_environment("env_fallback") - Chef::Node.should_receive(:cdb_load).with("node1").and_return(@node1) - Chef::Role.should_receive(:cdb_load).with("role1", nil).and_return(@role1) - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("env_fallback", nil).and_return(@all_filtered_cookbook_list) - Chef::MinimalCookbookVersion.should_receive(:load_full_versions_of).with([@cb_for_default], nil).and_return([@cb_for_default]) - - response = get_json("/nodes/node1/cookbooks") - response.should be_kind_of(Hash) - response["cb_for_default"].should_not == nil - response["cb_for_env1"].should == nil - end - - it "should throw the proper exception when a node's run_list contains a non-existent cookbook" do - expected_error = { - "message" => "Run list contains invalid items: no such cookbook cookbook_nosuch.", - "non_existent_cookbooks" => ["cookbook_nosuch"], - "cookbooks_with_no_versions" => [] - }.to_json - - Chef::Node.should_receive(:cdb_load).with("node_containing_nosuch_cookbook").and_return(@node_containing_nosuch_cookbook) - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("_default", nil).and_return(@all_filtered_cookbook_list) - - lambda { - response = get_json("/nodes/node_containing_nosuch_cookbook/cookbooks") - }.should raise_error(Merb::ControllerExceptions::PreconditionFailed, expected_error) - end - - - it "should throw the proper exception when a node's run_list contains a role that contains a non-existent cookbook" do - expected_error = { - "message" => "Run list contains invalid items: no such cookbook cookbook_nosuch.", - "non_existent_cookbooks" => ["cookbook_nosuch"], - "cookbooks_with_no_versions" => [] - }.to_json - - Chef::Node.should_receive(:cdb_load).with("node_containing_role_containing_nosuch_cookbook").and_return(@node_containing_role_containing_nosuch_cookbook) - Chef::Role.should_receive(:cdb_load).with("role_containing_nosuch_cookbook", nil).and_return(@role_containing_nosuch_cookbook) - Chef::Environment.should_receive(:cdb_minimal_filtered_versions).with("_default", nil).and_return(@all_filtered_cookbook_list) - - lambda { - response = get_json("/nodes/node_containing_role_containing_nosuch_cookbook/cookbooks") - }.should raise_error(Merb::ControllerExceptions::PreconditionFailed, expected_error) - end - - end -end - diff --git a/chef-server-api/spec/unit/nodes_controller_spec.rb b/chef-server-api/spec/unit/nodes_controller_spec.rb deleted file mode 100644 index 47350752d0..0000000000 --- a/chef-server-api/spec/unit/nodes_controller_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# 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. -# - -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -require File.expand_path(File.dirname(__FILE__) + '/../spec_model_helper') -require 'chef/node' -require 'pp' - -describe "Nodes controller" do - before do - Merb.logger.set_log(StringIO.new) - end - - describe "when handling Node API calls" do - it "returns a list of nodes" do - returned_node_list = ["node1", "node2"] - Chef::Node.stub!(:cdb_list).and_return(returned_node_list) - - res = get_json("/nodes") - - expected_response = returned_node_list.inject({}) do |res,node_name| - res[node_name] = "#{root_url}/nodes/#{node_name}" - res - end - res.should == expected_response - end - - it "returns an existing node" do - returned_node = make_node("node1") - Chef::Node.stub!(:cdb_load).and_return(returned_node) - - response = get_json("/nodes/node1") - response.name.should == returned_node.name - end - - it "returns a 404 when a non-existant node is shown" do - Chef::Node.should_receive(:cdb_load).with("node1").and_raise(Chef::Exceptions::CouchDBNotFound) - - lambda { - get_json("/nodes/node1") - }.should raise_error(Merb::ControllerExceptions::NotFound) - end - - it "creates a node if no same-named node exists" do - create_node = make_node("node1") - - Chef::Node.should_receive(:cdb_load).with("node1").and_raise(Chef::Exceptions::CouchDBNotFound) - create_node.should_receive(:cdb_save) - - response = post_json("/nodes", create_node) - response.should == {"uri" => "#{root_url}/nodes/node1"} - end - - it "raises a Conflict if you create a node whose name already exists" do - create_node = make_node("node1") - existing_node = make_node("node1") - - Chef::Node.should_receive(:cdb_load).with("node1").and_return(existing_node) - - lambda { - post_json("/nodes", create_node) - }.should raise_error(Merb::ControllerExceptions::Conflict) - end - end -end - diff --git a/chef-server-api/spec/unit/sandbox_file_spec.rb b/chef-server-api/spec/unit/sandbox_file_spec.rb deleted file mode 100644 index 3d506158ee..0000000000 --- a/chef-server-api/spec/unit/sandbox_file_spec.rb +++ /dev/null @@ -1,144 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -require 'models/sandbox_file' - -describe ChefServerApi::SandboxFile do - before do - @input = StringIO.new - @params = {:sandbox_id => '1234', :checksum => '2342'} - @sandbox_file = ChefServerApi::SandboxFile.new(@input, @params) - end - - describe "when first created" do - it "gets a sandbox guid from the parameters" do - @sandbox_file.sandbox_id.should == '1234' - end - - it "gets a checksum from the provided parameters" do - @sandbox_file.expected_checksum.should == '2342' - end - - it "returns the parameters that idendify the resource in the api" do - @sandbox_file.resource_params.should == {:sandbox_id => '1234', :checksum => '2342'} - end - - it "loads an existing sandbox from couchdb" do - Chef::Sandbox.should_receive(:cdb_load).with('1234').once.and_return(:ohai2u) - @sandbox_file.sandbox.should == :ohai2u - @sandbox_file.sandbox.should == :ohai2u - end - - # BadRequest in the controller - it "is invalid if no sandbox_id is given" do - @params.delete(:sandbox_id) - sandbox_file = ChefServerApi::SandboxFile.new(@input, @params) - sandbox_file.invalid_params?.should_not be_false - sandbox_file.invalid_params?.should == "Cannot upload file with checksum '2342': you must provide a sandbox_id" - end - - # BadRequest in the controller - it "is invalid if no expected checksum is given" do - @params.delete(:checksum) - sandbox_file = ChefServerApi::SandboxFile.new(@input, @params) - sandbox_file.invalid_params?.should_not be_false - sandbox_file.invalid_params?.should == "Cannot upload file to sandbox '1234': you must provide the file's checksum" - end - - it "considers the params valid when both the checksum and sandbox_id are provided" do - @sandbox_file.invalid_params?.should be_false - end - - # NotFound in the controller - it "is invalid if the provided sandbox_id doesn't exist in the database" do - err = Chef::Exceptions::CouchDBNotFound.new "Cannot find sandbox 1234 in CouchDB!" - Chef::Sandbox.should_receive(:cdb_load).with('1234').once.and_raise(err) - @sandbox_file.invalid_sandbox?.should == "Cannot find sandbox with id '1234' in the database" - end - - # NotFound in the controller - it "is invalid if the sandbox exists, but the given checksum isn't a member of it" do - sandbox = Chef::Sandbox.new('1234') - sandbox.checksums << 'not-2342' - Chef::Sandbox.should_receive(:cdb_load).with('1234').once.and_return(sandbox) - @sandbox_file.invalid_sandbox?.should == "Cannot upload file: checksum '2342' isn't a part of sandbox '1234'" - end - - it "is valid when the sandbox exists and the checksum is a member of it" do - sandbox = Chef::Sandbox.new('1234') - sandbox.checksums << '2342' - Chef::Sandbox.should_receive(:cdb_load).with('1234').once.and_return(sandbox) - @sandbox_file.invalid_sandbox?.should be_false - end - - end - - context "when created with valid parameters and a valid sandbox" do - before do - @sandbox = Chef::Sandbox.new('1234') - @sandbox_file.stub!(:sandbox).and_return(@sandbox) - @input.string.replace("riseofthemachines\nriseofthechefs\n") - end - - it "checksums the uploaded data" do - @sandbox_file.actual_checksum.should == '0e157ac1e2dd73191b76067fb6b4bceb' - end - - # BadRequest in the controller - it "considers the uploaded file invalid if its checksum doesn't match" do - message = "Uploaded file is invalid: expected a md5 sum '2342', but it was '0e157ac1e2dd73191b76067fb6b4bceb'" - @sandbox_file.invalid_file?.should == message - end - - it "is valid if the expected and actual checksums match" do - @sandbox_file.expected_checksum.replace('0e157ac1e2dd73191b76067fb6b4bceb') - @sandbox_file.invalid_file?.should be_false - end - - context "and a string io for input" do - it "writes the StringIO's contents to a tempfile, then moves it into place" do - @tempfile = StringIO.new - @tempfile.stub!(:path).and_return("/tmpfile/source") - Tempfile.should_receive(:open).with("sandbox").and_yield(@tempfile) - FileUtils.should_receive(:mv).with("/tmpfile/source", "/tmp/final_home") - @sandbox_file.commit_to('/tmp/final_home') - @tempfile.string.should == "riseofthemachines\nriseofthechefs\n" - end - - it "calls #read and not #string on the rack input [CHEF-1363 regression test]" do - @input.should_not_receive(:string) - @tempfile = StringIO.new - @tempfile.stub!(:path).and_return("/tmpfile/source") - Tempfile.stub!(:open).and_yield(@tempfile) - FileUtils.stub!(:mv) - @sandbox_file.commit_to('/tmp/final_home') - end - end - - context "and a tempfile for input" do - it "moves the tempfile into place" do - @input.stub!(:path).and_return('/existing/tempfile') - FileUtils.should_receive(:mv).with("/existing/tempfile", "/tmp/final_home") - @sandbox_file.commit_to('/tmp/final_home') - end - end - - end - -end diff --git a/chef-server/LICENSE b/chef-server/LICENSE deleted file mode 100644 index 11069edd79..0000000000 --- a/chef-server/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-server/README.rdoc b/chef-server/README.rdoc deleted file mode 100644 index ca7e43be75..0000000000 --- a/chef-server/README.rdoc +++ /dev/null @@ -1,28 +0,0 @@ -= Chef Server - -== Description -Chef Server is a meta package. It only exists to depend on the other packages needed to run a chef server, so they may be installed and upgraded more easily: -* chef-server-api: The primary chef server, clients and the webui interact with it via a JSON REST API. -* chef-server-webui: Web (HTML and javascript) interface to the chef-server-api -* chef-solr: A wrapper to the Solr full text indexer -* chef-solr-indexer: Listens to rabbitmq for updates to indexed data (sent by chef-server-api), and denormalizes data for searchability. - -= LICENSE: - -Chef Server - The server component of the Chef configuration management system - -Author:: Adam Jacob (<adam@opscode.com>) -Copyright:: Copyright (c) 2008-2012 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. diff --git a/chef-server/Rakefile b/chef-server/Rakefile deleted file mode 100644 index fb3100269a..0000000000 --- a/chef-server/Rakefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# Author:: Daniel Deleo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -require File.dirname(__FILE__) + '/lib/chef-server/version' -require 'rake/gempackagetask' - -GEM_NAME = "chef-server" - -spec = eval(File.read("chef-server.gemspec")) - -desc "Install the gem" -task :install => :package do - sh %{gem install pkg/#{GEM_NAME}-#{ChefServer::VERSION} --no-rdoc --no-ri} -end - -desc "Uninstall the gem" -task :uninstall do - sh %{gem uninstall #{GEM_NAME} -x -v #{ChefServer::VERSION} } -end - -Rake::GemPackageTask.new(spec) do |pkg| - pkg.gem_spec = spec -end diff --git a/chef-server/chef-server.gemspec b/chef-server/chef-server.gemspec deleted file mode 100644 index 1776ca7e1f..0000000000 --- a/chef-server/chef-server.gemspec +++ /dev/null @@ -1,23 +0,0 @@ -require File.dirname(__FILE__) + '/lib/chef-server/version' - -Gem::Specification.new do |s| - s.name = "chef-server" - s.version = ChefServer::VERSION - s.platform = Gem::Platform::RUBY - s.has_rdoc = true - s.extra_rdoc_files = ["README.rdoc", "LICENSE" ] - s.summary = "A meta-gem to install all server components of the Chef configuration management system" - s.description = s.summary - s.author = "Opscode" - s.email = "chef@opscode.com" - s.homepage = "http://wiki.opscode.com/display/chef" - - s.add_dependency "chef-server-api", "= #{ChefServer::VERSION}" - s.add_dependency "chef-server-webui", "= #{ChefServer::VERSION}" - s.add_dependency "chef-expander", "= #{ChefServer::VERSION}" - s.add_dependency "chef-solr", "= #{ChefServer::VERSION}" - - s.files = %w(LICENSE README.rdoc Rakefile lib/chef-server.rb lib/chef-server/version.rb) - s -end - diff --git a/chef-server/lib/chef-server.rb b/chef-server/lib/chef-server.rb deleted file mode 100644 index 78af080dfb..0000000000 --- a/chef-server/lib/chef-server.rb +++ /dev/null @@ -1,20 +0,0 @@ -# -# Author:: Daniel Deleo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -module ChefServer -end diff --git a/chef-server/lib/chef-server/version.rb b/chef-server/lib/chef-server/version.rb deleted file mode 100644 index 55823c607b..0000000000 --- a/chef-server/lib/chef-server/version.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Author:: Daniel Deleo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -module ChefServer - VERSION = '11.0.0.alpha' -end diff --git a/chef/Gemfile b/chef/Gemfile index b538e0bc1f..40868b9677 100644 --- a/chef/Gemfile +++ b/chef/Gemfile @@ -2,7 +2,6 @@ source :rubygems gemspec -gem "dep_selector", :group => :server, :platform => "ruby" gem "activesupport", :group => :compat_testing, :platform => "ruby" gem "ronn" diff --git a/chef/README.rdoc b/chef/README.rdoc index 43feffebaf..4a1801643c 100644 --- a/chef/README.rdoc +++ b/chef/README.rdoc @@ -2,9 +2,9 @@ == DESCRIPTION: -Chef is a configuration management tool designed to bring automation to your entire infrastructure. +Chef is a configuration management tool designed to bring automation to your entire infrastructure. -The Chef Wiki is the definitive source of user documentation. +The Chef Wiki is the definitive source of user documentation. * http://wiki.opscode.com/display/chef/Home @@ -22,7 +22,7 @@ You will also need to set up the repository with the appropriate branches. We do * http://wiki.opscode.com/display/opscode/Working+with+Git -Once your repository is set up, you can start working on the code. We do use BDD/TDD with RSpec and Cucumber, so you'll need to get a development environment running. +Once your repository is set up, you can start working on the code. We do use TDD with RSpec, so you'll need to get a development environment running. == REQUIREMENTS: @@ -39,16 +39,12 @@ In order to have a development environment where changes to the Chef code can be Install these via your platform's preferred method; for example apt, yum, ports, emerge, etc. * Git[http://git-scm.com/] -* Erlang/OTP[http://www.erlang.org/] -* CouchDB[http://couchdb.apache.org/] -* RabbitMQ[http://www.rabbitmq.com/] * GCC and C Standard Libraries, header files, etc. (i.e., build-essential on debian/ubuntu) * Ruby development package === Runtime Rubygem Dependencies ==== Chef Client and Solo * ohai -* bunny * erubis * highline * json (1.4.4 - 1.4.6) @@ -63,61 +59,12 @@ Install these via your platform's preferred method; for example apt, yum, ports, * net-ssh * fog -==== Chef Server, WebUI and Solr -All of the above, plus the following: -* coderay -* haml -* merb-assets -* merb-core -* merb-haml -* merb-helpers -* merb-param-protection -* ruby-openid -* thin - === Development Rubygem Dependencies * rake[http://rake.rubyforge.org/] * rspec[http://rspec.info/] -* cucumber[http://cukes.info/] Ohai is also by Opscode and available on GitHub, http://github.com/opscode/ohai/tree/master. -== Starting the Environment: - -=== On Mac OS X: -For ease of debugging, Chef includes a script to start each of the required -daemons in a separate Terminal.app tab via applescript: - - scripts/mac-dev-start features - -=== On Linux and BSD - -run the dev:features rake task. You may need to run it as root depending on how -your system is configured. - - rake dev:features - -=== Daemons -After starting the environment, you should have the following processes running: -* couchdb listening on port 5984 -* rabbitmq listening on port 5672 -* solr listening on port 8983 -* chef-solr-indexer connected as a client to rabbitmq -* chef-server listening on port 4000 -* chef-server-webui listening on port 4040 - -You'll know its running when you see: - - merb : chef-server (api) : worker (port 4000) ~ Starting Thin at port 4000 - merb : chef-server (api) : worker (port 4000) ~ Using Thin adapter on host 0.0.0.0 and port 4000. - merb : chef-server (api) : worker (port 4000) ~ Successfully bound to port 4000 - -You'll want to leave this terminal running the dev environment. - -=== Web Interface: - -With the dev environment running, you can now access the web interface via http://localhost:4040/. - == Spec testing: We use RSpec for unit/spec tests. It is not necessary to start the development @@ -125,23 +72,6 @@ environment to run the specs--they are completely standalone. rake spec -== Integration testing: - -We test integration with Cucumber. To run the full suite, run the rake task: - - rake features - -Subsets of the integration tests can be run with the various tasks in the -features namespace. To see the full list, run - - rake -T - -To run individual feature tests, you can take advantage of cucumber's tagging -support. Tag the feature you wish to run (tags are denoted with a leading `@' -sign), then use the cucumber command: - - cucumber -t @my_tag - == LINKS: Source: diff --git a/chef/chef.gemspec b/chef/chef.gemspec index 732601cc79..c807a85bf2 100644 --- a/chef/chef.gemspec +++ b/chef/chef.gemspec @@ -21,10 +21,8 @@ Gem::Specification.new do |s| s.add_dependency "ohai", ">= 0.6.0" s.add_dependency "rest-client", ">= 1.0.4", "< 1.7.0" - s.add_dependency "bunny", ">= 0.6.0", "< 0.8.0" s.add_dependency "json", ">= 1.4.4", "<= 1.6.1" s.add_dependency "yajl-ruby", "~> 1.1" - s.add_dependency "treetop", "~> 1.4.9" s.add_dependency "net-ssh", "~> 2.2.2" s.add_dependency "net-ssh-multi", "~> 1.1.0" # CHEF-3027: The knife-cloud plugins require newer features from highline, core chef should not. diff --git a/chef/lib/chef.rb b/chef/lib/chef.rb index e56e805dee..ef173c4212 100644 --- a/chef/lib/chef.rb +++ b/chef/lib/chef.rb @@ -6,9 +6,9 @@ # 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. @@ -27,8 +27,6 @@ require 'chef/resources' require 'chef/shell_out' require 'chef/daemon' -require 'chef/webui_user' -require 'chef/openid_registration' require 'chef/run_status' require 'chef/handler' diff --git a/chef/lib/chef/api_client.rb b/chef/lib/chef/api_client.rb index f95978afba..da05939c24 100644 --- a/chef/lib/chef/api_client.rb +++ b/chef/lib/chef/api_client.rb @@ -20,9 +20,6 @@ require 'chef/config' require 'chef/mixin/params_validate' require 'chef/mixin/from_file' -require 'chef/couchdb' -require 'chef/certificate' -require 'chef/index_queue' require 'chef/mash' require 'chef/json_compat' require 'chef/search/query' @@ -32,51 +29,13 @@ class Chef include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate - include Chef::IndexQueue::Indexable - - - DESIGN_DOCUMENT = { - "version" => 1, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "client") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "client") { - emit(doc.name, doc.name); - } - } - EOJS - } - } - } - - INDEX_OBJECT_TYPE = 'client'.freeze - - def self.index_object_type - INDEX_OBJECT_TYPE - end - - attr_accessor :couchdb_rev, :couchdb_id, :couchdb # Create a new Chef::ApiClient object. - def initialize(couchdb=nil) + def initialize @name = '' @public_key = nil @private_key = nil - @couchdb_rev = nil - @couchdb_id = nil @admin = false - @couchdb = (couchdb || Chef::CouchDB.new) end # Gets or sets the client name. @@ -127,17 +86,6 @@ class Chef ) end - # Creates a new public/private key pair, and populates the public_key and - # private_key attributes. - # - # @return [True] - def create_keys - results = Chef::Certificate.gen_keypair(self.name) - self.public_key(results[0].to_s) - self.private_key(results[1].to_s) - true - end - # The hash representation of the object. Includes the name and public_key, # but never the private key. # @@ -150,7 +98,6 @@ class Chef 'json_class' => self.class.name, "chef_type" => "client" } - result["_rev"] = @couchdb_rev if @couchdb_rev result end @@ -166,20 +113,9 @@ class Chef client.name(o["name"] || o["clientname"]) client.public_key(o["public_key"]) client.admin(o["admin"]) - client.couchdb_rev = o["_rev"] - client.couchdb_id = o["_id"] - client.index_id = client.couchdb_id client end - # List all the Chef::ApiClient objects in the CouchDB. If inflate is set - # to true, you will get the full list of all ApiClients, fully inflated. - def self.cdb_list(inflate=false, couchdb=nil) - rs = (couchdb || Chef::CouchDB.new).list("clients", inflate) - lookup = (inflate ? "value" : "key") - rs["rows"].collect { |r| r[lookup] } - end - def self.list(inflate=false) if inflate response = Hash.new @@ -193,14 +129,6 @@ class Chef end end - # Load a client by name from CouchDB - # - # @params [String] The name of the client to load - # @return [Chef::ApiClient] The resulting Chef::ApiClient object - def self.cdb_load(name, couchdb=nil) - (couchdb || Chef::CouchDB.new).load("client", name) - end - # Load a client by name via the API def self.load(name) response = Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("clients/#{name}") @@ -213,24 +141,11 @@ class Chef end end - # Remove this client from the CouchDB - # - # @params [String] The name of the client to delete - # @return [Chef::ApiClient] The last version of the object - def cdb_destroy - @couchdb.delete("client", @name, @couchdb_rev) - end - # Remove this client via the REST API def destroy Chef::REST.new(Chef::Config[:chef_server_url]).delete_rest("clients/#{@name}") end - # Save this client to the CouchDB - def cdb_save - @couchdb_rev = @couchdb.store("client", @name, self)["rev"] - end - # Save this client via the REST API, returns a hash including the private key def save(new_key=false, validation=false) if validation @@ -256,11 +171,6 @@ class Chef Chef::REST.new(Chef::Config[:chef_server_url]).post_rest("clients", self) end - # Set up our CouchDB design document - def self.create_design_document(couchdb=nil) - (couchdb ||= Chef::CouchDB.new).create_design_document("clients", DESIGN_DOCUMENT) - end - # As a string def to_s "client[#{@name}]" diff --git a/chef/lib/chef/certificate.rb b/chef/lib/chef/certificate.rb deleted file mode 100644 index 7943589c8e..0000000000 --- a/chef/lib/chef/certificate.rb +++ /dev/null @@ -1,161 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Copyright:: Copyright (c) 2009 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. -# - -require 'chef/log' -require 'chef/config' -require 'chef/api_client' -require 'openssl' -require 'fileutils' - -class Chef - class Certificate - class << self - - # Generates a new CA Certificate and Key, and writes them out to - # Chef::Config[:signing_ca_cert] and Chef::Config[:signing_ca_key]. - def generate_signing_ca - ca_cert_file = Chef::Config[:signing_ca_cert] - ca_keypair_file = Chef::Config[:signing_ca_key] - - unless File.exists?(ca_cert_file) && File.exists?(ca_keypair_file) - Chef::Log.info("Creating new signing certificate") - - [ ca_cert_file, ca_keypair_file ].each do |f| - ca_basedir = File.dirname(f) - FileUtils.mkdir_p ca_basedir - end - - keypair = OpenSSL::PKey::RSA.generate(1024) - - ca_cert = OpenSSL::X509::Certificate.new - ca_cert.version = 3 - ca_cert.serial = 1 - info = [ - ["C", Chef::Config[:signing_ca_country]], - ["ST", Chef::Config[:signing_ca_state]], - ["L", Chef::Config[:signing_ca_location]], - ["O", Chef::Config[:signing_ca_org]], - ["OU", "Certificate Service"], - ["CN", "#{Chef::Config[:signing_ca_domain]}/emailAddress=#{Chef::Config[:signing_ca_email]}"] - ] - ca_cert.subject = ca_cert.issuer = OpenSSL::X509::Name.new(info) - ca_cert.not_before = Time.now - ca_cert.not_after = Time.now + 10 * 365 * 24 * 60 * 60 # 10 years - ca_cert.public_key = keypair.public_key - - ef = OpenSSL::X509::ExtensionFactory.new - ef.subject_certificate = ca_cert - ef.issuer_certificate = ca_cert - ca_cert.extensions = [ - ef.create_extension("basicConstraints", "CA:TRUE", true), - ef.create_extension("subjectKeyIdentifier", "hash"), - ef.create_extension("keyUsage", "cRLSign,keyCertSign", true), - ] - ca_cert.add_extension ef.create_extension("authorityKeyIdentifier", "keyid:always,issuer:always") - ca_cert.sign keypair, OpenSSL::Digest::SHA1.new - - File.open(ca_cert_file, "w") { |f| f.write ca_cert.to_pem } - File.open(ca_keypair_file, File::WRONLY|File::EXCL|File::CREAT, 0600) { |f| f.write keypair.to_pem } - if (Chef::Config[:signing_ca_user] && Chef::Config[:signing_ca_group]) - FileUtils.chown(Chef::Config[:signing_ca_user], Chef::Config[:signing_ca_group], ca_keypair_file) - end - end - self - end - - # Creates a new key pair, and signs them with the signing certificate - # and key generated from generate_signing_ca above. - # - # All arguments are unused, though two arguments are accepted for compatibility. - # - # returns an array of [public_key, private_key] - def gen_keypair(common_name=nil, subject_alternative_name = nil) - - Chef::Log.info("Creating new key pair for #{common_name}") - - # generate client keypair - client_keypair = OpenSSL::PKey::RSA.generate(2048) - - return client_keypair.public_key, client_keypair - end - - def gen_validation_key(name=Chef::Config[:validation_client_name], key_file=Chef::Config[:validation_key], admin=false) - # Create the validation key - api_client = Chef::ApiClient.new - api_client.name(name) - api_client.admin(admin) - - begin - # If both the couch record and file exist, don't do anything. Otherwise, - # re-generate the validation key. - Chef::ApiClient.cdb_load(name) - - # The couch document was loaded successfully if we got to here; if we - # can't also load the file on the filesystem, we'll regenerate it all. - File.open(key_file, "r") do |file| - end - rescue Chef::Exceptions::CouchDBNotFound - create_validation_key(api_client, key_file) - rescue - if $!.class.name =~ /Errno::/ - Chef::Log.error("Error opening validation key: #{$!} -- destroying and regenerating") - begin - api_client.cdb_destroy - rescue Bunny::ServerDownError => e - # create_validation_key is gonna fail anyway, so let's just bail out. - Chef::Log.fatal("Could not de-index (to rabbitmq) previous validation key - rabbitmq is down! Start rabbitmq then restart chef-server to re-generate it") - raise - end - - create_validation_key(api_client, key_file) - else - raise - end - end - end - - private - def create_validation_key(api_client, key_file) - Chef::Log.info("Creating validation key...") - - api_client.create_keys - begin - api_client.cdb_save - rescue Bunny::ServerDownError => e - # If rabbitmq is down, the client will have been saved in CouchDB, - # but not in the index. - Chef::Log.fatal("Could not index (to rabbitmq) validation key - rabbitmq is down! Start rabbitmq then restart chef-server to re-generate it") - - # re-raise so the error bubbles out and nukes chef-server - raise e - end - - key_dir = File.dirname(key_file) - FileUtils.mkdir_p(key_dir) unless File.directory?(key_dir) - File.open(key_file, File::WRONLY|File::CREAT, 0600) do |f| - f.print(api_client.private_key) - end - if (Chef::Config[:signing_ca_user] && Chef::Config[:signing_ca_group]) - FileUtils.chown(Chef::Config[:signing_ca_user], Chef::Config[:signing_ca_group], key_file) - end - end - - end - end -end diff --git a/chef/lib/chef/checksum.rb b/chef/lib/chef/checksum.rb deleted file mode 100644 index fc1931174b..0000000000 --- a/chef/lib/chef/checksum.rb +++ /dev/null @@ -1,167 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2010 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. - -require 'chef/log' -require 'chef/checksum/storage' -require 'uuidtools' - -class Chef - # == Chef::Checksum - # Checksum for an individual file; e.g., used for sandbox/cookbook uploading - # to track which files the system already manages. - class Checksum - attr_accessor :checksum, :create_time - attr_accessor :couchdb_id, :couchdb_rev - - attr_reader :storage - - # When a Checksum commits a sandboxed file to its final home in the checksum - # repo, this attribute will have the original on-disk path where the file - # was stored; it will be used if the commit is reverted to restore the sandbox - # to the pre-commit state. - attr_reader :original_committed_file_location - - DESIGN_DOCUMENT = { - "version" => 1, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "checksum") { - emit(doc.checksum, doc); - } - } - EOJS - }, - } - } - - # Creates a new Chef::Checksum object. - # === Arguments - # checksum::: the MD5 content hash of the file - # couchdb::: An instance of Chef::CouchDB - # - # === Returns - # object<Chef::Checksum>:: Duh. :) - def initialize(checksum=nil, couchdb=nil) - @create_time = Time.now.iso8601 - @checksum = checksum - @original_committed_file_location = nil - @storage = Storage::Filesystem.new(Chef::Config.checksum_path, checksum) - end - - def to_json(*a) - result = { - :checksum => checksum, - :create_time => create_time, - :json_class => self.class.name, - :chef_type => 'checksum', - - # For Chef::CouchDB (id_to_name, name_to_id) - :name => checksum - } - result.to_json(*a) - end - - def self.json_create(o) - checksum = new(o['checksum']) - checksum.create_time = o['create_time'] - - if o.has_key?('_rev') - checksum.couchdb_rev = o["_rev"] - o.delete("_rev") - end - if o.has_key?("_id") - checksum.couchdb_id = o["_id"] - o.delete("_id") - end - checksum - end - - # Moves the given +sandbox_file+ into the checksum repo using the path - # given by +file_location+ and saves the Checksum to the database - def commit_sandbox_file(sandbox_file) - @original_committed_file_location = sandbox_file - Chef::Log.info("Commiting sandbox file: move #{sandbox_file} to #{@storage}") - @storage.commit(sandbox_file) - cdb_save - end - - # Moves the checksum file back to its pre-commit location and deletes - # the checksum object from the database, effectively undoing +commit_sandbox_file+. - # Raises Chef::Exceptions::IllegalChecksumRevert if the original file location - # is unknown, which is will be the case if commit_sandbox_file was not - # previously called - def revert_sandbox_file_commit - unless original_committed_file_location - raise Chef::Exceptions::IllegalChecksumRevert, "Checksum #{self.inspect} cannot be reverted because the original sandbox file location is not known" - end - - Chef::Log.warn("Reverting sandbox file commit: moving #{@storage} back to #{original_committed_file_location}") - @storage.revert(original_committed_file_location) - cdb_destroy - end - - # Removes the on-disk file backing this checksum object, then removes it - # from the database - def purge - purge_file - cdb_destroy - end - - ## - # Couchdb - ## - - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("checksums", DESIGN_DOCUMENT) - end - - def self.cdb_list(inflate=false, couchdb=nil) - rs = (couchdb || Chef::CouchDB.new).list("checksums", inflate) - lookup = (inflate ? "value" : "key") - rs["rows"].collect { |r| r[lookup] } - end - - def self.cdb_all_checksums(couchdb = nil) - rs = (couchdb || Chef::CouchDB.new).list("checksums", true) - rs["rows"].inject({}) { |hash_result, r| hash_result[r['key']] = 1; hash_result } - end - - def self.cdb_load(checksum, couchdb=nil) - # Probably want to look for a view here at some point - (couchdb || Chef::CouchDB.new).load("checksum", checksum) - end - - def cdb_destroy(couchdb=nil) - (couchdb || Chef::CouchDB.new).delete("checksum", checksum, @couchdb_rev) - end - - def cdb_save(couchdb=nil) - @couchdb_rev = (couchdb || Chef::CouchDB.new).store("checksum", checksum, self)["rev"] - end - - - private - - def purge_file - @storage.purge - end - - end -end diff --git a/chef/lib/chef/config.rb b/chef/lib/chef/config.rb index 924a20ab3b..61c8806a66 100644 --- a/chef/lib/chef/config.rb +++ b/chef/lib/chef/config.rb @@ -130,8 +130,6 @@ class Chef # Used when OpenID authentication is enabled in the Web UI authorized_openid_identifiers nil authorized_openid_providers nil - openid_cstore_couchdb false - openid_cstore_path "/var/chef/openid/cstore" # The number of times the client should retry when registering with the server client_registration_retries 5 @@ -150,11 +148,6 @@ class Chef # Where cookbook files are stored on the server (by content checksum) checksum_path "/var/chef/checksums" - # CouchDB database name to use - couchdb_database "chef" - - couchdb_url "http://localhost:5984" - # Where chef's cache files should be stored file_cache_path platform_specific_path("/var/chef/cache") @@ -173,7 +166,6 @@ class Chef ## Daemonization Settings ## # What user should Chef run as? user nil - # What group should the chef-server, -solr, -solr-indexer run as group nil umask 0022 @@ -212,7 +204,7 @@ class Chef client_fork false enable_reporting true enable_reporting_url_fatals false - + # Set these to enable SSL authentication / mutual-authentication # with the server ssl_client_cert nil @@ -230,23 +222,6 @@ class Chef # Where should chef-solo download recipes from? recipe_url nil - solr_url "http://localhost:8983/solr" - solr_jetty_path "/var/chef/solr-jetty" - solr_data_path "/var/chef/solr/data" - solr_home_path "/var/chef/solr" - solr_heap_size "256M" - solr_java_opts nil - - # Parameters for connecting to RabbitMQ - amqp_host '0.0.0.0' - amqp_port '5672' - amqp_user 'chef' - amqp_pass 'testing' - amqp_vhost '/chef' - # Setting this to a UUID string also makes the queue durable - # (persist across rabbitmq restarts) - amqp_consumer_id "default" - # Sets the version of the signed header authentication protocol to use (see # the 'mixlib-authorization' project for more detail). Currently, versions # 1.0 and 1.1 are available; however, the chef-server must first be diff --git a/chef/lib/chef/cookbook_uploader.rb b/chef/lib/chef/cookbook_uploader.rb index 351a239bb8..8dd50ac043 100644 --- a/chef/lib/chef/cookbook_uploader.rb +++ b/chef/lib/chef/cookbook_uploader.rb @@ -4,7 +4,6 @@ require 'rest_client' require 'chef/exceptions' require 'chef/knife/cookbook_metadata' require 'chef/checksum_cache' -require 'chef/sandbox' require 'chef/cookbook_version' require 'chef/cookbook/syntax_check' require 'chef/cookbook/file_system_file_vendor' diff --git a/chef/lib/chef/cookbook_version.rb b/chef/lib/chef/cookbook_version.rb index a6f95e2c3b..0e11174a07 100644 --- a/chef/lib/chef/cookbook_version.rb +++ b/chef/lib/chef/cookbook_version.rb @@ -24,86 +24,11 @@ require 'chef/node' require 'chef/resource_definition_list' require 'chef/recipe' require 'chef/cookbook/file_vendor' -require 'chef/checksum' require 'chef/cookbook/metadata' require 'chef/version_class' class Chef - #== Chef::MinimalCookbookVersion - # MinimalCookbookVersion is a duck type of CookbookVersion, used - # internally by Chef Server as an optimization when determining the - # optimal cookbook set for a chef-client. - # - # MinimalCookbookVersion objects contain only enough information to - # solve the cookbook collection for a given run list. They *do not* - # contain enough information to generate the response. - # - # See also: Chef::CookbookVersionSelector - class MinimalCookbookVersion - - include Comparable - - ID = "id".freeze - NAME = 'name'.freeze - KEY = 'key'.freeze - VERSION = 'version'.freeze - VALUE = 'value'.freeze - DEPS = 'deps'.freeze - - DEPENDENCIES = 'dependencies'.freeze - - # Loads the full list of cookbooks, using a couchdb view to fetch - # only the id, name, version, and dependency constraints. This is - # enough information to solve for the cookbook collection for a - # given run list. After solving for the cookbook collection, you - # need to call +load_full_versions_of+ to convert - # MinimalCookbookVersion objects to their non-minimal counterparts - def self.load_all(couchdb) - # Example: - # {"id"=>"1a806f1c-b409-4d8e-abab-fa414ff5b96d", "key"=>"activemq", "value"=>{"version"=>"0.3.3", "deps"=>{"java"=>">= 0.0.0", "runit"=>">= 0.0.0"}}} - couchdb ||= Chef::CouchDB.new - couchdb.get_view("cookbooks", "all_with_version_and_deps")["rows"].map {|params| self.new(params) } - end - - # Loads the non-minimal CookbookVersion objects corresponding to - # +minimal_cookbook_versions+ from couchdb using a bulk GET. - def self.load_full_versions_of(minimal_cookbook_versions, couchdb) - database_ids = Array(minimal_cookbook_versions).map {|mcv| mcv.couchdb_id } - couchdb ||= Chef::CouchDB.new - couchdb.bulk_get(*database_ids) - end - - attr_reader :couchdb_id - attr_reader :name - attr_reader :version - attr_reader :deps - - def initialize(params) - @couchdb_id = params[ID] - @name = params[KEY] - @version = params[VALUE][VERSION] - @deps = params[VALUE][DEPS] - end - - # Returns the Cookbook::MinimalMetadata object for this cookbook - # version. - def metadata - @metadata ||= Cookbook::MinimalMetadata.new(@name, DEPENDENCIES => @deps) - end - - def legit_version - @legit_version ||= Chef::Version.new(@version) - end - - def <=>(o) - raise Chef::Exceptions::CookbookVersionNameMismatch if self.name != o.name - raise "Unexpected comparison to #{o}" unless o.respond_to?(:legit_version) - legit_version <=> o.legit_version - end - end - - # == Chef::CookbookVersion # CookbookVersion is a model object encapsulating the data about a Chef # cookbook. Chef supports maintaining multiple versions of a cookbook on a @@ -113,140 +38,10 @@ class Chef # TODO: timh/cw: 5-24-2010: mutators for files (e.g., recipe_filenames=, # recipe_filenames.insert) should dirty the manifest so it gets regenerated. class CookbookVersion - include Chef::IndexQueue::Indexable include Comparable COOKBOOK_SEGMENTS = [ :resources, :providers, :recipes, :definitions, :libraries, :attributes, :files, :templates, :root_files ] - DESIGN_DOCUMENT = { - "version" => 8, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "cookbook_version") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "cookbook_version") { - emit(doc.name, doc.name); - } - } - EOJS - }, - "all_with_version" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "cookbook_version") { - emit(doc.cookbook_name, doc.version); - } - } - EOJS - }, - "all_with_version_and_deps" => { - "map" => <<-JS - function(doc) { - if (doc.chef_type == "cookbook_version") { - emit(doc.cookbook_name, {version: doc.version, deps: doc.metadata.dependencies}); - } - } - JS - }, - "all_latest_version" => { - "map" => %q@ - function(doc) { - if (doc.chef_type == "cookbook_version") { - emit(doc.cookbook_name, doc.version); - } - } - @, - "reduce" => %q@ - function(keys, values, rereduce) { - var result = null; - - for (var idx in values) { - var value = values[idx]; - - if (idx == 0) { - result = value; - continue; - } - - var valueParts = value.split('.').map(function(v) { return parseInt(v); }); - var resultParts = result.split('.').map(function(v) { return parseInt(v); }); - - if (valueParts[0] != resultParts[0]) { - if (valueParts[0] > resultParts[0]) { - result = value; - } - } - else if (valueParts[1] != resultParts[1]) { - if (valueParts[1] > resultParts[1]) { - result = value; - } - } - else if (valueParts[2] != resultParts[2]) { - if (valueParts[2] > resultParts[2]) { - result = value; - } - } - } - return result; - } - @ - }, - "all_latest_version_by_id" => { - "map" => %q@ - function(doc) { - if (doc.chef_type == "cookbook_version") { - emit(doc.cookbook_name, {version: doc.version, id:doc._id}); - } - } - @, - "reduce" => %q@ - function(keys, values, rereduce) { - var result = null; - - for (var idx in values) { - var value = values[idx]; - - if (idx == 0) { - result = value; - continue; - } - - var valueParts = value.version.split('.').map(function(v) { return parseInt(v); }); - var resultParts = result.version.split('.').map(function(v) { return parseInt(v); }); - - if (valueParts[0] != resultParts[0]) { - if (valueParts[0] > resultParts[0]) { - result = value; - } - } - else if (valueParts[1] != resultParts[1]) { - if (valueParts[1] > resultParts[1]) { - result = value; - } - } - else if (valueParts[2] != resultParts[2]) { - if (valueParts[2] > resultParts[2]) { - result = value; - } - } - } - return result; - } - @ - }, - } - } - attr_accessor :root_dir attr_accessor :definition_filenames attr_accessor :template_filenames @@ -259,10 +54,6 @@ class Chef attr_accessor :metadata attr_accessor :metadata_filenames attr_accessor :status - attr_accessor :couchdb_rev - attr_accessor :couchdb - - attr_reader :couchdb_id # attribute_filenames also has a setter that has non-default # functionality. @@ -401,7 +192,7 @@ class Chef # # === Returns # object<Chef::CookbookVersion>:: Duh. :) - def initialize(name, couchdb=nil) + def initialize(name) @name = name @frozen = false @attribute_filenames = Array.new @@ -416,9 +207,6 @@ class Chef @metadata_filenames = Array.new @root_dir = nil @root_filenames = Array.new - @couchdb_id = nil - @couchdb = couchdb || Chef::CouchDB.new - @couchdb_rev = nil @status = :ready @manifest = nil @file_vendor = nil @@ -761,7 +549,6 @@ class Chef result = manifest.dup result['frozen?'] = frozen_version? result['chef_type'] = 'cookbook_version' - result["_rev"] = couchdb_rev if couchdb_rev result.to_hash end @@ -773,15 +560,6 @@ class Chef def self.json_create(o) cookbook_version = new(o["cookbook_name"]) - if o.has_key?('_rev') - cookbook_version.couchdb_rev = o["_rev"] if o.has_key?("_rev") - o.delete("_rev") - end - if o.has_key?("_id") - cookbook_version.couchdb_id = o["_id"] if o.has_key?("_id") - cookbook_version.index_id = cookbook_version.couchdb_id - o.delete("_id") - end # We want the Chef::Cookbook::Metadata object to always be inflated cookbook_version.metadata = Chef::Cookbook::Metadata.from_hash(o["metadata"]) cookbook_version.manifest = o @@ -888,83 +666,6 @@ class Chef chef_server_rest.get_rest('cookbooks/_latest') end - ## - # Couchdb - ## - - def self.cdb_by_name(cookbook_name, couchdb=nil) - cdb = (couchdb || Chef::CouchDB.new) - options = { :startkey => cookbook_name, :endkey => cookbook_name } - rs = cdb.get_view("cookbooks", "all_with_version", options) - rs["rows"].inject({}) { |memo, row| memo.has_key?(row["key"]) ? memo[row["key"]] << row["value"] : memo[row["key"]] = [ row["value"] ]; memo } - end - - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("cookbooks", DESIGN_DOCUMENT) - end - - def self.cdb_list_latest(inflate=false, couchdb=nil) - couchdb ||= Chef::CouchDB.new - if inflate - doc_ids = cdb_list_latest_ids.map {|i|i["id"]} - couchdb.bulk_get(doc_ids) - else - results = couchdb.get_view("cookbooks", "all_latest_version", :group=>true)["rows"] - results.inject({}) { |mapped, row| mapped[row["key"]] = row["value"]; mapped} - end - end - - def self.cdb_list_latest_ids(inflate=false, couchdb=nil) - couchdb ||= Chef::CouchDB.new - results = couchdb.get_view("cookbooks", "all_latest_version_by_id", :group=>true)["rows"] - results.map { |name_and_id| name_and_id["value"]} - end - - def self.cdb_list(inflate=false, couchdb=nil) - couchdb ||= Chef::CouchDB.new - if inflate - couchdb.list("cookbooks", true)["rows"].collect{|r| r["value"]} - else - # If you modify this, please make sure the desc sorted order on the versions doesn't get broken. - couchdb.get_view("cookbooks", "all_with_version")["rows"].inject({}) { |mapped, row| mapped[row["key"]]||=Array.new; mapped[row["key"]].push(Chef::Version.new(row["value"])); mapped[row["key"]].sort!.reverse!; mapped} - end - end - - def self.cdb_load(name, version='latest', couchdb=nil) - cdb = couchdb || Chef::CouchDB.new - if version == "latest" || version == "_latest" - rs = cdb.get_view("cookbooks", "all_latest_version", :key => name, :descending => true, :group => true, :reduce => true)["rows"].first - cdb.load("cookbook_version", "#{rs["key"]}-#{rs["value"]}") - else - cdb.load("cookbook_version", "#{name}-#{version}") - end - end - - def cdb_destroy - (couchdb || Chef::CouchDB.new).delete("cookbook_version", full_name, couchdb_rev) - end - - # Runs on Chef Server (API); deletes the cookbook from couchdb and also destroys associated - # checksum documents - def purge - checksums.keys.each do |checksum| - begin - Chef::Checksum.cdb_load(checksum, couchdb).purge - rescue Chef::Exceptions::CouchDBNotFound - end - end - cdb_destroy - end - - def cdb_save - @couchdb_rev = couchdb.store("cookbook_version", full_name, self)["rev"] - end - - def couchdb_id=(value) - @couchdb_id = value - @index_id = value - end - def <=>(o) raise Chef::Exceptions::CookbookVersionNameMismatch if self.name != o.name # FIXME: can we change the interface to the Metadata class such diff --git a/chef/lib/chef/cookbook_version_selector.rb b/chef/lib/chef/cookbook_version_selector.rb deleted file mode 100644 index 9e60f85639..0000000000 --- a/chef/lib/chef/cookbook_version_selector.rb +++ /dev/null @@ -1,168 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# 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. - -require 'dep_selector' - -class Chef - module CookbookVersionSelector - # This method replaces verbiage from DepSelector messages with - # Chef-domain-specific verbiage, such as replacing package with - # cookbook. - # - # TODO [cw, 2011/2/25]: this is a near-term hack. In the long run, - # we'll do this better. - def self.filter_dep_selector_message(message) - m = message - m.gsub!("Package", "Cookbook") - m.gsub!("package", "cookbook") - m.gsub!("Solution constraint", "Run list item") - m.gsub!("solution constraint", "run list item") - m - end - - # all_cookbooks - a hash mapping cookbook names to an array of - # available CookbookVersions. - # - # Creates a DependencyGraph from CookbookVersion objects - def self.create_dependency_graph_from_cookbooks(all_cookbooks) - dep_graph = DepSelector::DependencyGraph.new - - all_cookbooks.each do |cb_name, cb_versions| - cb_versions.each do |cb_version| - cb_version_deps = cb_version.metadata.dependencies - # TODO [cw. 2011/2/10]: CookbookVersion#version returns a - # String even though we're storing as a DepSelector::Version - # object underneath. This should be changed so that we - # return the object and handle proper serialization and - # de-serialization. For now, I'm just going to create a - # Version object from the String representation. - pv = dep_graph.package(cb_name).add_version(Chef::Version.new(cb_version.version)) - cb_version_deps.each_pair do |dep_name, constraint_str| - # if the dependency is specified as cookbook::recipe, - # extract the cookbook component - dep_cb_name = dep_name.split("::").first - constraint = Chef::VersionConstraint.new(constraint_str) - pv.dependencies << DepSelector::Dependency.new(dep_graph.package(dep_cb_name), constraint) - end - end - end - - dep_graph - end - - # Return a hash mapping cookbook names to a CookbookVersion - # object. If there is no solution that satisfies the constraints, - # the first run list item that caused unsatisfiability is - # returned. - # - # This is the final version-resolved list of cookbooks for the - # RunList. - # - # all_cookbooks - a hash mapping cookbook names to an array of - # available CookbookVersions. - # - # recipe_constraints - an array of hashes describing the expanded - # run list. Each element is a hash containing keys :name and - # :version_constraint. The :name component is either the - # fully-qualified recipe name (e.g. "cookbook1::non_default_recipe") - # or just a cookbook name, indicating the default recipe is to be - # run (e.g. "cookbook1"). - def self.constrain(all_cookbooks, recipe_constraints) - dep_graph = create_dependency_graph_from_cookbooks(all_cookbooks) - - # extract cookbook names from (possibly) fully-qualified recipe names - cookbook_constraints = recipe_constraints.map do |recipe_spec| - cookbook_name = (recipe_spec[:name][/^(.+)::/, 1] || recipe_spec[:name]) - DepSelector::SolutionConstraint.new(dep_graph.package(cookbook_name), - recipe_spec[:version_constraint]) - end - - # Pass in the list of all available cookbooks (packages) so that - # DepSelector can distinguish between "no version available for - # cookbook X" and "no such cookbook X" when an environment - # filters out all versions for a given cookbook. - all_packages = all_cookbooks.inject([]) do |acc, (cookbook_name, cookbook_versions)| - acc << dep_graph.package(cookbook_name) - acc - end - - # find a valid assignment of CoookbookVersions. If no valid - # assignment exists, indicate which run_list_item causes the - # unsatisfiability and try to hint at what might be wrong. - soln = - begin - DepSelector::Selector.new(dep_graph).find_solution(cookbook_constraints, all_packages) - rescue DepSelector::Exceptions::InvalidSolutionConstraints => e - non_existent_cookbooks = e.non_existent_packages.map {|constraint| constraint.package.name} - cookbooks_with_no_matching_versions = e.constrained_to_no_versions.map {|constraint| constraint.package.name} - - # Spend a whole lot of effort for pluralizing and - # prettifying the message. - message = "" - if non_existent_cookbooks.length > 0 - message += "no such " + (non_existent_cookbooks.length > 1 ? "cookbooks" : "cookbook") - message += " #{non_existent_cookbooks.join(", ")}" - end - - if cookbooks_with_no_matching_versions.length > 0 - if message.length > 0 - message += "; " - end - - message += "no versions match the constraints on " + (cookbooks_with_no_matching_versions.length > 1 ? "cookbooks" : "cookbook") - message += " #{cookbooks_with_no_matching_versions.join(", ")}" - end - - message = "Run list contains invalid items: #{message}." - - raise Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems.new(message, non_existent_cookbooks, cookbooks_with_no_matching_versions) - rescue DepSelector::Exceptions::NoSolutionExists => e - raise Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem.new(filter_dep_selector_message(e.message), e.unsatisfiable_solution_constraint, e.disabled_non_existent_packages, e.disabled_most_constrained_packages) - end - - - # map assignment back to CookbookVersion objects - selected_cookbooks = {} - soln.each_pair do |cb_name, cb_version| - # TODO [cw, 2011/2/10]: related to the TODO in - # create_dependency_graph_from_cookbooks, cbv.version - # currently returns a String, so we must compare to - # cb_version.to_s, since it's a for-real Version object. - selected_cookbooks[cb_name] = all_cookbooks[cb_name].find{|cbv| cbv.version == cb_version.to_s} - end - selected_cookbooks - end - - # Expands the run_list, constrained to the environment's CookbookVersion - # constraints. - # - # Returns: - # Hash of: name to CookbookVersion - def self.expand_to_cookbook_versions(run_list, environment, couchdb=nil) - # expand any roles in this run_list. - expanded_run_list = run_list.expand(environment, 'couchdb', :couchdb => couchdb).recipes.with_version_constraints - - cookbooks_for_environment = Chef::Environment.cdb_minimal_filtered_versions(environment, couchdb) - cookbook_collection = constrain(cookbooks_for_environment, expanded_run_list) - full_cookbooks = Chef::MinimalCookbookVersion.load_full_versions_of(cookbook_collection.values, couchdb) - full_cookbooks.inject({}) do |cb_map, cookbook_version| - cb_map[cookbook_version.name] = cookbook_version - cb_map - end - end - end -end diff --git a/chef/lib/chef/couchdb.rb b/chef/lib/chef/couchdb.rb deleted file mode 100644 index 71ee196462..0000000000 --- a/chef/lib/chef/couchdb.rb +++ /dev/null @@ -1,246 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Brown (<cb@opscode.com>) -# Copyright:: Copyright (c) 2008 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. - -require 'chef/mixin/params_validate' -require 'chef/config' -require 'chef/rest' -require 'chef/log' -require 'digest/sha2' -require 'chef/json_compat' - -# We want to fail on create if uuidtools isn't installed -begin - require 'uuidtools' -rescue LoadError -end - -class Chef - class CouchDB - include Chef::Mixin::ParamsValidate - - def initialize(url=nil, db=Chef::Config[:couchdb_database]) - url ||= Chef::Config[:couchdb_url] - @db = db - @rest = Chef::REST.new(url, nil, nil) - end - - def couchdb_database(args=nil) - @db = args || @db - end - - def create_id_map - create_design_document( - "id_map", - { - "version" => 1, - "language" => "javascript", - "views" => { - "name_to_id" => { - "map" => <<-EOJS - function(doc) { - emit([ doc.chef_type, doc.name], doc._id); - } - EOJS - }, - "id_to_name" => { - "map" => <<-EOJS - function(doc) { - emit(doc._id, [ doc.chef_type, doc.name ]); - } - EOJS - } - } - } - ) - end - - def create_db(check_for_existing=true) - @database_list = @rest.get_rest("_all_dbs") - if !check_for_existing || !@database_list.any? { |db| db == couchdb_database } - response = @rest.put_rest(couchdb_database, Hash.new) - end - couchdb_database - end - - def create_design_document(name, data) - to_update = true - begin - old_doc = @rest.get_rest("#{couchdb_database}/_design/#{name}") - if data["version"] != old_doc["version"] - data["_rev"] = old_doc["_rev"] - Chef::Log.debug("Updating #{name} views") - else - to_update = false - end - rescue - Chef::Log.debug("Creating #{name} views for the first time because: #{$!}") - end - if to_update - @rest.put_rest("#{couchdb_database}/_design%2F#{name}", data) - end - true - end - - # Save the object to Couch. Add to index if the object supports it. - def store(obj_type, name, object) - validate( - { - :obj_type => obj_type, - :name => name, - :object => object, - }, - { - :object => { :respond_to => :to_json }, - } - ) - rows = get_view("id_map", "name_to_id", :key => [ obj_type, name ])["rows"] - uuid = rows.empty? ? UUIDTools::UUID.random_create.to_s : rows.first.fetch("id") - - db_put_response = @rest.put_rest("#{couchdb_database}/#{uuid}", object) - - if object.respond_to?(:add_to_index) - Chef::Log.info("Sending #{obj_type}(#{uuid}) to the index queue for addition.") - object.add_to_index(:database => couchdb_database, :id => uuid, :type => obj_type) - end - - db_put_response - end - - def load(obj_type, name) - validate( - { - :obj_type => obj_type, - :name => name, - }, - { - :obj_type => { :kind_of => String }, - :name => { :kind_of => String }, - } - ) - doc = find_by_name(obj_type, name) - doc.couchdb = self if doc.respond_to?(:couchdb) - doc - end - - def delete(obj_type, name, rev=nil) - validate( - { - :obj_type => obj_type, - :name => name, - }, - { - :obj_type => { :kind_of => String }, - :name => { :kind_of => String }, - } - ) - del_id = nil - object, uuid = find_by_name(obj_type, name, true) - unless rev - if object.respond_to?(:couchdb_rev) - rev = object.couchdb_rev - else - rev = object['_rev'] - end - end - response = @rest.delete_rest("#{couchdb_database}/#{uuid}?rev=#{rev}") - response.couchdb = self if response.respond_to?(:couchdb=) - - if object.respond_to?(:delete_from_index) - Chef::Log.info("Sending #{obj_type}(#{uuid}) to the index queue for deletion..") - object.delete_from_index(:database => couchdb_database, :id => uuid, :type => obj_type) - end - - response - end - - def list(view, inflate=false) - validate( - { - :view => view, - }, - { - :view => { :kind_of => String } - } - ) - if inflate - r = @rest.get_rest(view_uri(view, "all")) - r["rows"].each { |i| i["value"].couchdb = self if i["value"].respond_to?(:couchdb=) } - r - else - r = @rest.get_rest(view_uri(view, "all_id")) - end - r - end - - def has_key?(obj_type, name) - validate( - { - :obj_type => obj_type, - :name => name, - }, - { - :obj_type => { :kind_of => String }, - :name => { :kind_of => String }, - } - ) - begin - find_by_name(obj_type, name) - true - rescue - false - end - end - - def find_by_name(obj_type, name, with_id=false) - r = get_view("id_map", "name_to_id", :key => [ obj_type, name ], :include_docs => true) - if r["rows"].length == 0 - raise Chef::Exceptions::CouchDBNotFound, "Cannot find #{obj_type} #{name} in CouchDB!" - end - if with_id - [ r["rows"][0]["doc"], r["rows"][0]["id"] ] - else - r["rows"][0]["doc"] - end - end - - def get_view(design, view, options={}) - view_string = view_uri(design, view) - view_string << "?" if options.length != 0 - view_string << options.map { |k,v| "#{k}=#{URI.escape(v.to_json)}"}.join('&') - @rest.get_rest(view_string) - end - - def bulk_get(*to_fetch) - response = @rest.post_rest("#{couchdb_database}/_all_docs?include_docs=true", { "keys" => to_fetch.flatten }) - response["rows"].collect { |r| r["doc"] } - end - - def view_uri(design, view) - "#{couchdb_database}/_design/#{design}/_view/#{view}" - end - - def server_stats - @rest.get_rest('/') - end - - def db_stats - @rest.get_rest("/#{@db}") - end - - end -end diff --git a/chef/lib/chef/data_bag.rb b/chef/lib/chef/data_bag.rb index 32188c0861..9ce6215b20 100644 --- a/chef/lib/chef/data_bag.rb +++ b/chef/lib/chef/data_bag.rb @@ -21,9 +21,7 @@ require 'chef/config' require 'chef/mixin/params_validate' require 'chef/mixin/from_file' -require 'chef/couchdb' require 'chef/data_bag_item' -require 'chef/index_queue' require 'chef/mash' require 'chef/json_compat' @@ -32,58 +30,18 @@ class Chef include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate - include Chef::IndexQueue::Indexable VALID_NAME = /^[\-[:alnum:]_]+$/ - DESIGN_DOCUMENT = { - "version" => 2, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "data_bag") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "data_bag") { - emit(doc.name, doc.name); - } - } - EOJS - }, - "entries" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "data_bag_item") { - emit(doc.data_bag, doc.raw_data.id); - } - } - EOJS - } - } - } - def self.validate_name!(name) unless name =~ VALID_NAME raise Exceptions::InvalidDataBagName, "DataBags must have a name matching #{VALID_NAME.inspect}, you gave #{name.inspect}" end end - attr_accessor :couchdb_rev, :couchdb_id, :couchdb - # Create a new Chef::DataBag - def initialize(couchdb=nil) + def initialize @name = '' - @couchdb_rev = nil - @couchdb_id = nil - @couchdb = (couchdb || Chef::CouchDB.new) end def name(arg=nil) @@ -100,7 +58,6 @@ class Chef 'json_class' => self.class.name, "chef_type" => "data_bag", } - result["_rev"] = @couchdb_rev if @couchdb_rev result end @@ -121,20 +78,9 @@ class Chef def self.json_create(o) bag = new bag.name(o["name"]) - bag.couchdb_rev = o["_rev"] if o.has_key?("_rev") - bag.couchdb_id = o["_id"] if o.has_key?("_id") - bag.index_id = bag.couchdb_id bag end - # List all the Chef::DataBag objects in the CouchDB. If inflate is set to true, you will get - # the full list of all Roles, fully inflated. - def self.cdb_list(inflate=false, couchdb=nil) - rs = (couchdb || Chef::CouchDB.new).list("data_bags", inflate) - lookup = (inflate ? "value" : "key") - rs["rows"].collect { |r| r[lookup] } - end - def self.list(inflate=false) if inflate # Can't search for all data bags like other objects, fall back to N+1 :( @@ -147,11 +93,6 @@ class Chef end end - # Load a Data Bag by name from CouchDB - def self.cdb_load(name, couchdb=nil) - (couchdb || Chef::CouchDB.new).load("data_bag", name) - end - # Load a Data Bag by name via either the RESTful API or local data_bag_path if run in solo mode def self.load(name) if Chef::Config[:solo] @@ -169,27 +110,10 @@ class Chef end end - # Remove this Data Bag from CouchDB - def cdb_destroy - removed = @couchdb.delete("data_bag", @name, @couchdb_rev) - rs = @couchdb.get_view("data_bags", "entries", :include_docs => true, :startkey => @name, :endkey => @name) - rs["rows"].each do |row| - row["doc"].couchdb = couchdb - row["doc"].cdb_destroy - end - removed - end - def destroy chef_server_rest.delete_rest("data/#{@name}") end - # Save this Data Bag to the CouchDB - def cdb_save - results = @couchdb.store("data_bag", @name, self) - @couchdb_rev = results["rev"] - end - # Save the Data Bag via RESTful API def save begin @@ -211,24 +135,6 @@ class Chef self end - # List all the items in this Bag from CouchDB - # The self.load method does this through the REST API - def list(inflate=false) - rs = nil - if inflate - rs = @couchdb.get_view("data_bags", "entries", :include_docs => true, :startkey => @name, :endkey => @name) - rs["rows"].collect { |r| r["doc"] } - else - rs = @couchdb.get_view("data_bags", "entries", :startkey => @name, :endkey => @name) - rs["rows"].collect { |r| r["value"] } - end - end - - # Set up our CouchDB design document - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("data_bags", DESIGN_DOCUMENT) - end - # As a string def to_s "data_bag[#{@name}]" diff --git a/chef/lib/chef/data_bag_item.rb b/chef/lib/chef/data_bag_item.rb index 87bde509a5..3528ba724a 100644 --- a/chef/lib/chef/data_bag_item.rb +++ b/chef/lib/chef/data_bag_item.rb @@ -23,8 +23,6 @@ require 'forwardable' require 'chef/config' require 'chef/mixin/params_validate' require 'chef/mixin/from_file' -require 'chef/couchdb' -require 'chef/index_queue' require 'chef/data_bag' require 'chef/mash' require 'chef/json_compat' @@ -36,35 +34,9 @@ class Chef include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate - include Chef::IndexQueue::Indexable VALID_ID = /^[\-[:alnum:]_]+$/ - DESIGN_DOCUMENT = { - "version" => 1, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "data_bag_item") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "data_bag_item") { - emit(doc.name, doc.name); - } - } - EOJS - } - } - } - def self.validate_id!(id_str) if id_str.nil? || ( id_str !~ VALID_ID ) raise Exceptions::InvalidDataBagItemID, "Data Bag items must have an id matching #{VALID_ID.inspect}, you gave: #{id_str.inspect}" @@ -74,16 +46,12 @@ class Chef # Define all Hash's instance methods as delegating to @raw_data def_delegators(:@raw_data, *(Hash.instance_methods - Object.instance_methods)) - attr_accessor :couchdb_rev, :couchdb_id, :couchdb attr_reader :raw_data # Create a new Chef::DataBagItem - def initialize(couchdb=nil) - @couchdb_rev = nil - @couchdb_id = nil + def initialize @data_bag = nil @raw_data = Mash.new - @couchdb = couchdb || Chef::CouchDB.new end def chef_server_rest @@ -138,7 +106,6 @@ class Chef result = self.raw_data result["chef_type"] = "data_bag_item" result["data_bag"] = self.data_bag - result["_rev"] = @couchdb_rev if @couchdb_rev result end @@ -151,7 +118,6 @@ class Chef "data_bag" => self.data_bag, "raw_data" => self.raw_data } - result["_rev"] = @couchdb_rev if @couchdb_rev result.to_json(*a) end @@ -169,24 +135,11 @@ class Chef o.delete("chef_type") o.delete("json_class") o.delete("name") - if o.has_key?("_rev") - bag_item.couchdb_rev = o["_rev"] - o.delete("_rev") - end - if o.has_key?("_id") - bag_item.couchdb_id = o["_id"] - bag_item.index_id = bag_item.couchdb_id - o.delete("_id") - end + bag_item.raw_data = Mash.new(o["raw_data"]) bag_item end - # Load a Data Bag Item by name from CouchDB - def self.cdb_load(data_bag, name, couchdb=nil) - (couchdb || Chef::CouchDB.new).load("data_bag_item", object_name(data_bag, name)) - end - # Load a Data Bag Item by name via either the RESTful API or local data_bag_path if run in solo mode def self.load(data_bag, name) if Chef::Config[:solo] @@ -205,21 +158,10 @@ class Chef end end - # Remove this Data Bag Item from CouchDB - def cdb_destroy - Chef::Log.debug "Destroying data bag item: #{self.inspect}" - @couchdb.delete("data_bag_item", object_name, @couchdb_rev) - end - def destroy(data_bag=data_bag, databag_item=name) chef_server_rest.delete_rest("data/#{data_bag}/#{databag_item}") end - # Save this Data Bag Item to CouchDB - def cdb_save - @couchdb_rev = @couchdb.store("data_bag_item", object_name, self)["rev"] - end - # Save this Data Bag Item via RESTful API def save(item_id=@raw_data['id']) r = chef_server_rest @@ -242,11 +184,6 @@ class Chef self end - # Set up our CouchDB design document - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("data_bag_items", DESIGN_DOCUMENT) - end - def ==(other) other.respond_to?(:to_hash) && other.respond_to?(:data_bag) && diff --git a/chef/lib/chef/environment.rb b/chef/lib/chef/environment.rb index 1e2cea282b..00cc253083 100644 --- a/chef/lib/chef/environment.rb +++ b/chef/lib/chef/environment.rb @@ -22,8 +22,6 @@ require 'chef/config' require 'chef/mash' require 'chef/mixin/params_validate' require 'chef/mixin/from_file' -require 'chef/couchdb' -require 'chef/index_queue' require 'chef/version_constraint' class Chef @@ -33,52 +31,15 @@ class Chef include Chef::Mixin::ParamsValidate include Chef::Mixin::FromFile - include Chef::IndexQueue::Indexable COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/.freeze - attr_accessor :couchdb, :couchdb_rev - attr_reader :couchdb_id - - DESIGN_DOCUMENT = { - "version" => 1, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "environment") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "environment") { - emit(doc.name, doc.name); - } - } - EOJS - } - } - } - - def initialize(couchdb=nil) + def initialize @name = '' @description = '' @default_attributes = Mash.new @override_attributes = Mash.new @cookbook_versions = Hash.new - @couchdb_rev = nil - @couchdb_id = nil - @couchdb = couchdb || Chef::CouchDB.new - end - - def couchdb_id=(value) - @couchdb_id = value - self.index_id = value end def chef_server_rest @@ -163,7 +124,6 @@ class Chef "default_attributes" => @default_attributes, "override_attributes" => @override_attributes } - result["_rev"] = couchdb_rev if couchdb_rev result end @@ -260,17 +220,9 @@ class Chef environment.cookbook_versions(o["cookbook_versions"]) environment.default_attributes(o["default_attributes"]) environment.override_attributes(o["override_attributes"]) - environment.couchdb_rev = o["_rev"] if o.has_key?("_rev") - environment.couchdb_id = o["_id"] if o.has_key?("_id") environment end - def self.cdb_list(inflate=false, couchdb=nil) - es = (couchdb || Chef::CouchDB.new).list("environments", inflate) - lookup = (inflate ? "value" : "key") - es["rows"].collect { |e| e[lookup] } - end - def self.list(inflate=false) if inflate response = Hash.new @@ -283,34 +235,14 @@ class Chef end end - def self.cdb_load(name, couchdb=nil) - (couchdb || Chef::CouchDB.new).load("environment", name) - end - def self.load(name) chef_server_rest.get_rest("environments/#{name}") end - def self.exists?(name, couchdb) - begin - self.cdb_load(name, couchdb) - rescue Chef::Exceptions::CouchDBNotFound - nil - end - end - - def cdb_destroy - couchdb.delete("environment", @name, couchdb_rev) - end - def destroy chef_server_rest.delete_rest("environments/#{@name}") end - def cdb_save - self.couchdb_rev = couchdb.store("environment", @name, self)["rev"] - end - def save begin chef_server_rest.put_rest("environments/#{@name}", self) @@ -326,106 +258,6 @@ class Chef self end - # Set up our CouchDB design document - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("environments", DESIGN_DOCUMENT) - end - - # Loads the set of Chef::CookbookVersion objects available to a given environment - # === Returns - # Hash - # i.e. - # { - # "cookbook_name" => [ Chef::CookbookVersion ... ] ## the array of CookbookVersions is sorted highest to lowest - # } - # - # There will be a key for every cookbook. If no CookbookVersions - # are available for the specified environment the value will be an - # empty list. - # - def self.cdb_load_filtered_cookbook_versions(name, couchdb=nil) - version_constraints = cdb_load(name, couchdb).cookbook_versions.inject({}) {|res, (k,v)| res[k] = Chef::VersionConstraint.new(v); res} - - # inject all cookbooks into the hash while filtering out restricted versions, then sort the individual arrays - cookbook_list = Chef::CookbookVersion.cdb_list(true, couchdb) - - filtered_list = cookbook_list.inject({}) do |res, cookbook| - # FIXME: should cookbook.version return a Chef::Version? - version = Chef::Version.new(cookbook.version) - requirement_satisfied = version_constraints.has_key?(cookbook.name) ? version_constraints[cookbook.name].include?(version) : true - # we want a key for every cookbook, even if no versions are available - res[cookbook.name] ||= [] - res[cookbook.name] << cookbook if requirement_satisfied - res - end - - sorted_list = filtered_list.inject({}) do |res, (cookbook_name, versions)| - res[cookbook_name] = versions.sort.reverse - res - end - - sorted_list - end - - # Like +cdb_load_filtered_cookbook_versions+, loads the set of - # cookbooks available in a given environment. The difference is that - # this method will load Chef::MinimalCookbookVersion objects that - # contain only the information necessary for solving a cookbook - # collection for a given run list. The user of this method must call - # Chef::MinimalCookbookVersion.load_full_versions_of() after solving - # the cookbook collection to get the full objects. - # === Returns - # Hash - # i.e. - # { - # "cookbook_name" => [ Chef::CookbookVersion ... ] ## the array of CookbookVersions is sorted highest to lowest - # } - # - # There will be a key for every cookbook. If no CookbookVersions - # are available for the specified environment the value will be an - # empty list. - def self.cdb_minimal_filtered_versions(name, couchdb=nil) - version_constraints = cdb_load(name, couchdb).cookbook_versions.inject({}) {|res, (k,v)| res[k] = Chef::VersionConstraint.new(v); res} - - # inject all cookbooks into the hash while filtering out restricted versions, then sort the individual arrays - cookbook_list = Chef::MinimalCookbookVersion.load_all(couchdb) - - filtered_list = cookbook_list.inject({}) do |res, cookbook| - # FIXME: should cookbook.version return a Chef::Version? - version = Chef::Version.new(cookbook.version) - requirement_satisfied = version_constraints.has_key?(cookbook.name) ? version_constraints[cookbook.name].include?(version) : true - # we want a key for every cookbook, even if no versions are available - res[cookbook.name] ||= [] - res[cookbook.name] << cookbook if requirement_satisfied - res - end - - sorted_list = filtered_list.inject({}) do |res, (cookbook_name, versions)| - res[cookbook_name] = versions.sort.reverse - res - end - - sorted_list - end - - def self.cdb_load_filtered_recipe_list(name, couchdb=nil) - cdb_load_filtered_cookbook_versions(name, couchdb).map do |cb_name, cb| - if cb.empty? # no available versions - [] # empty list elided with flatten - else - latest_version = cb.first - latest_version.recipe_filenames_by_name.keys.map do |recipe| - case recipe - when DEFAULT - cb_name - else - "#{cb_name}::#{recipe}" - end - end - end - end.flatten - end - def self.load_filtered_recipe_list(environment) chef_server_rest.get_rest("environments/#{environment}/recipes") end @@ -451,16 +283,5 @@ class Chef end end - def self.create_default_environment(couchdb=nil) - couchdb = couchdb || Chef::CouchDB.new - begin - Chef::Environment.cdb_load('_default', couchdb) - rescue Chef::Exceptions::CouchDBNotFound - env = Chef::Environment.new(couchdb) - env.name '_default' - env.description 'The default Chef environment' - env.cdb_save - end - end end end diff --git a/chef/lib/chef/exceptions.rb b/chef/lib/chef/exceptions.rb index c5d213f8b3..87802639d3 100644 --- a/chef/lib/chef/exceptions.rb +++ b/chef/lib/chef/exceptions.rb @@ -54,7 +54,6 @@ class Chef class Group < RuntimeError; end class Link < RuntimeError; end class Mount < RuntimeError; end - class CouchDBNotFound < RuntimeError; end class PrivateKeyMissing < RuntimeError; end class CannotWritePrivateKey < RuntimeError; end class RoleNotFound < RuntimeError; end @@ -112,7 +111,7 @@ class Chef # File operation attempted but no permissions to perform it class InsufficientPermissions < RuntimeError; end - + # Ifconfig failed class Ifconfig < RuntimeError; end diff --git a/chef/lib/chef/index_queue.rb b/chef/lib/chef/index_queue.rb deleted file mode 100644 index b350949aae..0000000000 --- a/chef/lib/chef/index_queue.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@kallistec.com>) -# Copyright:: Copyright (c) 2009 Daniel DeLeo -# 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. -# - -require "singleton" -require "bunny" - -require "chef/index_queue/amqp_client" -require "chef/index_queue/indexable" -require "chef/index_queue/consumer" - -class Chef - module IndexQueue - end -end diff --git a/chef/lib/chef/index_queue/amqp_client.rb b/chef/lib/chef/index_queue/amqp_client.rb deleted file mode 100644 index a7d155f4d1..0000000000 --- a/chef/lib/chef/index_queue/amqp_client.rb +++ /dev/null @@ -1,116 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@kallistec.com>) -# Copyright:: Copyright (c) 2009 Daniel DeLeo -# 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 Chef - module IndexQueue - class AmqpClient - VNODES = 1024 - - include Singleton - - def initialize - reset! - end - - def reset! - @amqp_client && amqp_client.connected? && amqp_client.stop - @amqp_client = nil - @exchange = nil - end - - def stop - @amqp_client && @amqp_client.stop - end - - def amqp_client - unless @amqp_client - begin - @amqp_client = Bunny.new(amqp_opts) - Chef::Log.debug "Starting AMQP connection with client settings: #{@amqp_client.inspect}" - @amqp_client.start - @amqp_client.qos(:prefetch_count => 1) - rescue Bunny::ServerDownError => e - Chef::Log.fatal "Could not connect to rabbitmq. Is it running, reachable, and configured correctly?" - raise e - rescue Bunny::ProtocolError => e - Chef::Log.fatal "Connection to rabbitmq refused. Check your rabbitmq configuration and chef's amqp* settings" - raise e - end - end - @amqp_client - end - - def exchange - @exchange ||= amqp_client.exchange("chef-indexer", :durable => true, :type => :fanout) - end - - def disconnected! - Chef::Log.error("Disconnected from the AMQP Broker (RabbitMQ)") - @amqp_client = nil - reset! - end - - def queue_for_object(obj_id) - retries = 0 - vnode_tag = obj_id_to_int(obj_id) % VNODES - begin - yield amqp_client.queue("vnode-#{vnode_tag}", :passive => false, :durable => true, :exclusive => false, :auto_delete => false) - rescue Bunny::ServerDownError, Bunny::ConnectionError, Errno::ECONNRESET - disconnected! - if (retries += 1) < 2 - Chef::Log.info("Attempting to reconnect to the AMQP broker") - retry - else - Chef::Log.fatal("Could not re-connect to the AMQP broker, giving up") - raise - end - end - end - - private - - # Sometimes object ids are "proper" UUIDs, like "64bc00eb-120b-b6a2-ec0e-34fc90d151be" - # and sometimes they omit the dashes, like "64bc00eb120bb6a2ec0e34fc90d151be" - # UUIDTools uses different methods to parse the different styles. - def obj_id_to_int(obj_id) - UUIDTools::UUID.parse(obj_id).to_i - rescue ArgumentError - UUIDTools::UUID.parse_hexdigest(obj_id).to_i - end - - def durable_queue? - !!Chef::Config[:amqp_consumer_id] - end - - def consumer_id - Chef::Config[:amqp_consumer_id] || UUIDTools::UUID.random_create.to_s - end - - def amqp_opts - { :spec => '08', - :host => Chef::Config[:amqp_host], - :port => Chef::Config[:amqp_port], - :user => Chef::Config[:amqp_user], - :pass => Chef::Config[:amqp_pass], - :vhost => Chef::Config[:amqp_vhost]} - end - - end - end -end - diff --git a/chef/lib/chef/index_queue/consumer.rb b/chef/lib/chef/index_queue/consumer.rb deleted file mode 100644 index 8701cffa47..0000000000 --- a/chef/lib/chef/index_queue/consumer.rb +++ /dev/null @@ -1,76 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@kallistec.com>) -# Copyright:: Copyright (c) 2009 Daniel DeLeo -# 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 Chef - module IndexQueue - module Consumer - module ClassMethods - def expose(*methods) - @exposed_methods = Array(@exposed_methods) - @exposed_methods += methods - end - - def exposed_methods - @exposed_methods || [] - end - - def whitelisted?(method_name) - exposed_methods.include?(method_name) - end - end - - def self.included(including_class) - including_class.send(:extend, ClassMethods) - end - - def run - Chef::Log.debug("Starting Index Queue Consumer") - AmqpClient.instance.queue # triggers connection setup - - begin - AmqpClient.instance.queue.subscribe(:ack => true, :timeout => false) do |message| - call_action_for_message(message) - end - rescue Bunny::ConnectionError, Errno::ECONNRESET, Bunny::ServerDownError - AmqpClient.instance.disconnected! - Chef::Log.warn "Connection to rabbitmq lost. attempting to reconnect" - sleep 1 - retry - end - end - alias :start :run - - def call_action_for_message(message) - amqp_payload = Chef::JSONCompat.from_json(message[:payload], :create_additions => false, :max_nesting => false) - action = amqp_payload["action"].to_sym - app_payload = amqp_payload["payload"] - assert_method_whitelisted(action) - send(action, app_payload) - end - - private - - def assert_method_whitelisted(method_name) - unless self.class.whitelisted?(method_name) - raise ArgumentError, "non-exposed method #{method_name} called via index queue" - end - end - - end - end -end diff --git a/chef/lib/chef/index_queue/indexable.rb b/chef/lib/chef/index_queue/indexable.rb deleted file mode 100644 index 73fd08bbb5..0000000000 --- a/chef/lib/chef/index_queue/indexable.rb +++ /dev/null @@ -1,109 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@kallistec.com>) -# Author:: Seth Falcon (<seth@opscode.com>) -# Copyright:: Copyright (c) 2009 Daniel DeLeo -# Copyright:: Copyright (c) 2010 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. -# -require 'chef/json_compat' - -class Chef - module IndexQueue - module Indexable - - module ClassMethods - - def index_object_type(explicit_type_name=nil) - @index_object_type = explicit_type_name.to_s if explicit_type_name - @index_object_type - end - - # Resets all metadata used for indexing to nil. Used for testing - def reset_index_metadata! - @index_object_type = nil - end - - end - - def self.included(including_class) - including_class.send(:extend, ClassMethods) - end - - attr_accessor :index_id - - def index_object_type - self.class.index_object_type || Mixin::ConvertToClassName.snake_case_basename(self.class.name) - end - - def with_indexer_metadata(indexer_metadata={}) - # changing input param symbol keys to strings, as the keys in hash that goes to solr are expected to be strings [cb] - # Ruby 1.9 hates you, cb [dan] - with_metadata = {} - indexer_metadata.each_key do |key| - with_metadata[key.to_s] = indexer_metadata[key] - end - - with_metadata["type"] ||= self.index_object_type - with_metadata["id"] ||= self.index_id - with_metadata["database"] ||= Chef::Config[:couchdb_database] - with_metadata["item"] ||= self.to_hash - with_metadata["enqueued_at"] ||= Time.now.utc.to_i - - raise ArgumentError, "Type, Id, or Database missing in index operation: #{with_metadata.inspect}" if (with_metadata["id"].nil? or with_metadata["type"].nil?) - with_metadata - end - - def add_to_index(metadata={}) - Chef::Log.debug("Pushing item to index queue for addition: #{self.with_indexer_metadata(metadata)}") - object_with_metadata = with_indexer_metadata(metadata) - obj_id = object_with_metadata["id"] - obj = {:action => :add, :payload => self.with_indexer_metadata(metadata)} - - publish_object(obj_id, obj) - end - - def delete_from_index(metadata={}) - Chef::Log.debug("Pushing item to index queue for deletion: #{self.with_indexer_metadata(metadata)}") - object_with_metadata = with_indexer_metadata(metadata) - obj_id = object_with_metadata["id"] - obj = {:action => :delete, :payload => self.with_indexer_metadata(metadata)} - - publish_object(obj_id, obj) - end - - private - - # Uses the publisher to update the object's queue. If - # Chef::Config[:persistent_queue] is true, the update is wrapped - # in a transaction. - def publish_object(object_id, object) - publisher = AmqpClient.instance - begin - publisher.amqp_client.tx_select if Chef::Config[:persistent_queue] - publisher.queue_for_object(object_id) do |queue| - queue.publish(Chef::JSONCompat.to_json(object), :persistent => Chef::Config[:persistent_queue]) - end - publisher.amqp_client.tx_commit if Chef::Config[:persistent_queue] - rescue - publisher.amqp_client.tx_rollback if Chef::Config[:persistent_queue] - raise - end - - true - end - - end - end -end diff --git a/chef/lib/chef/node.rb b/chef/lib/chef/node.rb index 1229e0db28..92a2374bce 100644 --- a/chef/lib/chef/node.rb +++ b/chef/lib/chef/node.rb @@ -28,11 +28,9 @@ require 'chef/mixin/from_file' require 'chef/mixin/deep_merge' require 'chef/dsl/include_attribute' require 'chef/environment' -require 'chef/couchdb' require 'chef/rest' require 'chef/run_list' require 'chef/node/attribute' -require 'chef/index_queue' require 'chef/mash' require 'chef/json_compat' require 'chef/search/query' @@ -44,8 +42,7 @@ class Chef def_delegators :attributes, :keys, :each_key, :each_value, :key?, :has_key? - attr_accessor :recipe_list, :couchdb, :couchdb_rev, :run_state, :run_list - attr_reader :couchdb_id + attr_accessor :recipe_list, :run_state, :run_list attr_accessor :run_context @@ -54,103 +51,9 @@ class Chef include Chef::Mixin::CheckHelper include Chef::Mixin::ParamsValidate - include Chef::IndexQueue::Indexable - - DESIGN_DOCUMENT = { - "version" => 11, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "node") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "node") { - emit(doc.name, doc.name); - } - } - EOJS - }, - "status" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "node") { - var to_emit = { "name": doc.name, "chef_environment": doc.chef_environment }; - if (doc["attributes"]["fqdn"]) { - to_emit["fqdn"] = doc["attributes"]["fqdn"]; - } else { - to_emit["fqdn"] = "Undefined"; - } - if (doc["attributes"]["ipaddress"]) { - to_emit["ipaddress"] = doc["attributes"]["ipaddress"]; - } else { - to_emit["ipaddress"] = "Undefined"; - } - if (doc["attributes"]["ohai_time"]) { - to_emit["ohai_time"] = doc["attributes"]["ohai_time"]; - } else { - to_emit["ohai_time"] = "Undefined"; - } - if (doc["attributes"]["uptime"]) { - to_emit["uptime"] = doc["attributes"]["uptime"]; - } else { - to_emit["uptime"] = "Undefined"; - } - if (doc["attributes"]["platform"]) { - to_emit["platform"] = doc["attributes"]["platform"]; - } else { - to_emit["platform"] = "Undefined"; - } - if (doc["attributes"]["platform_version"]) { - to_emit["platform_version"] = doc["attributes"]["platform_version"]; - } else { - to_emit["platform_version"] = "Undefined"; - } - if (doc["run_list"]) { - to_emit["run_list"] = doc["run_list"]; - } else { - to_emit["run_list"] = "Undefined"; - } - emit(doc.name, to_emit); - } - } - EOJS - }, - "by_run_list" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "node") { - if (doc['run_list']) { - for (var i=0; i < doc.run_list.length; i++) { - emit(doc['run_list'][i], doc.name); - } - } - } - } - EOJS - }, - "by_environment" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "node") { - var env = (doc['chef_environment'] == null ? "_default" : doc['chef_environment']); - emit(env, doc.name); - } - } - EOJS - } - }, - } # Create a new Chef::Node object. - def initialize(couchdb=nil) + def initialize @name = nil @chef_environment = '_default' @@ -158,18 +61,9 @@ class Chef @attributes = Chef::Node::Attribute.new({}, {}, {}, {}) - @couchdb_rev = nil - @couchdb_id = nil - @couchdb = couchdb || Chef::CouchDB.new - @run_state = {} end - def couchdb_id=(value) - @couchdb_id = value - @index_id = value - end - # Used by DSL def node self @@ -470,7 +364,6 @@ class Chef #Render correctly for run_list items so malformed json does not result "run_list" => run_list.run_list.map { |item| item.to_s } } - result["_rev"] = couchdb_rev if couchdb_rev result.to_json(*a) end @@ -502,17 +395,9 @@ class Chef else o["recipes"].each { |r| node.recipes << r } end - node.couchdb_rev = o["_rev"] if o.has_key?("_rev") - node.couchdb_id = o["_id"] if o.has_key?("_id") - node.index_id = node.couchdb_id node end - def self.cdb_list_by_environment(environment, inflate=false, couchdb=nil) - rs = (couchdb || Chef::CouchDB.new).get_view("nodes", "by_environment", :include_docs => inflate, :startkey => environment, :endkey => environment) - inflate ? rs["rows"].collect {|r| r["doc"]} : rs["rows"].collect {|r| r["value"]} - end - def self.list_by_environment(environment, inflate=false) if inflate response = Hash.new @@ -523,14 +408,6 @@ class Chef end end - # List all the Chef::Node objects in the CouchDB. If inflate is set to true, you will get - # the full list of all Nodes, fully inflated. - def self.cdb_list(inflate=false, couchdb=nil) - rs =(couchdb || Chef::CouchDB.new).list("nodes", inflate) - lookup = (inflate ? "value" : "key") - rs["rows"].collect { |r| r[lookup] } - end - def self.list(inflate=false) if inflate response = Hash.new @@ -543,19 +420,6 @@ class Chef end end - # Load a node by name from CouchDB - def self.cdb_load(name, couchdb=nil) - (couchdb || Chef::CouchDB.new).load("node", name) - end - - def self.exists?(nodename, couchdb) - begin - self.cdb_load(nodename, couchdb) - rescue Chef::Exceptions::CouchDBNotFound - nil - end - end - def self.find_or_create(node_name) load(node_name) rescue Net::HTTPServerException => e @@ -576,21 +440,11 @@ class Chef Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("nodes/#{name}") end - # Remove this node from the CouchDB - def cdb_destroy - couchdb.delete("node", name, couchdb_rev) - end - # Remove this node via the REST API def destroy chef_server_rest.delete_rest("nodes/#{name}") end - # Save this node to the CouchDB - def cdb_save - @couchdb_rev = couchdb.store("node", name, self)["rev"] - end - # Save this node via the REST API def save # Try PUT. If the node doesn't yet exist, PUT will return 404, @@ -614,11 +468,6 @@ class Chef self end - # Set up our CouchDB design document - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("nodes", DESIGN_DOCUMENT) - end - def to_s "node[#{name}]" end diff --git a/chef/lib/chef/openid_registration.rb b/chef/lib/chef/openid_registration.rb deleted file mode 100644 index f7bb9595d9..0000000000 --- a/chef/lib/chef/openid_registration.rb +++ /dev/null @@ -1,187 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'chef/config' -require 'chef/mixin/params_validate' -require 'chef/couchdb' -require 'chef/index_queue' -require 'digest/sha1' -require 'chef/json_compat' - -class Chef - class OpenIDRegistration - - attr_accessor :name, :salt, :validated, :password, :couchdb_rev, :admin - - include Chef::Mixin::ParamsValidate - include Chef::IndexQueue::Indexable - - DESIGN_DOCUMENT = { - "version" => 3, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "openid_registration") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "openid_registration") { - emit(doc.name, doc.name); - } - } - EOJS - }, - "validated" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "openid_registration") { - if (doc.validated == true) { - emit(doc.name, doc); - } - } - } - EOJS - }, - "unvalidated" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "openid_registration") { - if (doc.validated == false) { - emit(doc.name, doc); - } - } - } - EOJS - }, - }, - } - - # Create a new Chef::OpenIDRegistration object. - def initialize() - @name = nil - @salt = nil - @password = nil - @validated = false - @admin = false - @couchdb_rev = nil - @couchdb = Chef::CouchDB.new - end - - def name=(n) - @name = n.gsub(/\./, '_') - end - - # Set the password for this object. - def set_password(password) - @salt = generate_salt - @password = encrypt_password(@salt, password) - end - - # Serialize this object as a hash - def to_json(*a) - attributes = Hash.new - recipes = Array.new - result = { - 'name' => @name, - 'json_class' => self.class.name, - 'salt' => @salt, - 'password' => @password, - 'validated' => @validated, - 'admin' => @admin, - 'chef_type' => 'openid_registration', - } - result["_rev"] = @couchdb_rev if @couchdb_rev - result.to_json(*a) - end - - # Create a Chef::Node from JSON - def self.json_create(o) - me = new - me.name = o["name"] - me.salt = o["salt"] - me.password = o["password"] - me.validated = o["validated"] - me.admin = o["admin"] - me.couchdb_rev = o["_rev"] if o.has_key?("_rev") - me - end - - # List all the Chef::OpenIDRegistration objects in the CouchDB. If inflate is set to true, you will get - # the full list of all registration objects. Otherwise, you'll just get the IDs - def self.list(inflate=false) - rs = Chef::CouchDB.new.list("registrations", inflate) - if inflate - rs["rows"].collect { |r| r["value"] } - else - rs["rows"].collect { |r| r["key"] } - end - end - - def self.cdb_list(*args) - list(*args) - end - - # Load an OpenIDRegistration by name from CouchDB - def self.load(name) - Chef::CouchDB.new.load("openid_registration", name) - end - - # Whether or not there is an OpenID Registration with this key. - def self.has_key?(name) - Chef::CouchDB.new.has_key?("openid_registration", name) - end - - # Remove this OpenIDRegistration from the CouchDB - def destroy - @couchdb.delete("openid_registration", @name, @couchdb_rev) - end - - # Save this OpenIDRegistration to the CouchDB - def save - results = @couchdb.store("openid_registration", @name, self) - @couchdb_rev = results["rev"] - end - - # Set up our CouchDB design document - def self.create_design_document(couchdb=nil) - couchdb ||= Chef::CouchDB.new - couchdb.create_design_document("registrations", DESIGN_DOCUMENT) - end - - protected - - def generate_salt - salt = Time.now.to_s - chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a - 1.upto(30) { |i| salt << chars[rand(chars.size-1)] } - salt - end - - def encrypt_password(salt, password) - Digest::SHA1.hexdigest("--#{salt}--#{password}--") - end - - end -end diff --git a/chef/lib/chef/role.rb b/chef/lib/chef/role.rb index c428472f1f..78bbfadb88 100644 --- a/chef/lib/chef/role.rb +++ b/chef/lib/chef/role.rb @@ -21,9 +21,7 @@ require 'chef/config' require 'chef/mixin/params_validate' require 'chef/mixin/from_file' -require 'chef/couchdb' require 'chef/run_list' -require 'chef/index_queue' require 'chef/mash' require 'chef/json_compat' require 'chef/search/query' @@ -33,51 +31,14 @@ class Chef include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate - include Chef::IndexQueue::Indexable - - DESIGN_DOCUMENT = { - "version" => 6, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "role") { - emit(doc.name, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "role") { - emit(doc.name, doc.name); - } - } - EOJS - } - } - } - - attr_accessor :couchdb_rev, :couchdb - attr_reader :couchdb_id # Create a new Chef::Role object. - def initialize(couchdb=nil) + def initialize @name = '' @description = '' @default_attributes = Mash.new @override_attributes = Mash.new @env_run_lists = {"_default" => Chef::RunList.new} - @couchdb_rev = nil - @couchdb_id = nil - @couchdb = couchdb || Chef::CouchDB.new - end - - def couchdb_id=(value) - @couchdb_id = value - self.index_id = value end def chef_server_rest @@ -177,7 +138,6 @@ class Chef accumulator end } - result["_rev"] = couchdb_rev if couchdb_rev result end @@ -214,20 +174,9 @@ class Chef end role.env_run_lists(env_run_list_hash) - role.couchdb_rev = o["_rev"] if o.has_key?("_rev") - role.index_id = role.couchdb_id - role.couchdb_id = o["_id"] if o.has_key?("_id") role end - # List all the Chef::Role objects in the CouchDB. If inflate is set to true, you will get - # the full list of all Roles, fully inflated. - def self.cdb_list(inflate=false, couchdb=nil) - rs = (couchdb || Chef::CouchDB.new).list("roles", inflate) - lookup = (inflate ? "value" : "key") - rs["rows"].collect { |r| r[lookup] } - end - # Get the list of all roles from the API. def self.list(inflate=false) if inflate @@ -241,24 +190,11 @@ class Chef end end - # Load a role by name from CouchDB - def self.cdb_load(name, couchdb=nil) - (couchdb || Chef::CouchDB.new).load("role", name) - end - # Load a role by name from the API def self.load(name) chef_server_rest.get_rest("roles/#{name}") end - def self.exists?(rolename, couchdb) - begin - self.cdb_load(rolename, couchdb) - rescue Chef::Exceptions::CouchDBNotFound - nil - end - end - def environment(env_name) chef_server_rest.get_rest("roles/#{@name}/environments/#{env_name}") end @@ -267,21 +203,11 @@ class Chef chef_server_rest.get_rest("roles/#{@name}/environments") end - # Remove this role from the CouchDB - def cdb_destroy - couchdb.delete("role", @name, couchdb_rev) - end - # Remove this role via the REST API def destroy chef_server_rest.delete_rest("roles/#{@name}") end - # Save this role to the CouchDB - def cdb_save - self.couchdb_rev = couchdb.store("role", @name, self)["rev"] - end - # Save this role via the REST API def save begin @@ -299,11 +225,6 @@ class Chef self end - # Set up our CouchDB design document - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("roles", DESIGN_DOCUMENT) - end - # As a string def to_s "role[#{@name}]" @@ -328,22 +249,5 @@ class Chef end end - # Sync all the json roles with couchdb from disk - def self.sync_from_disk_to_couchdb - Dir[File.join(Chef::Config[:role_path], "*.json")].each do |role_file| - short_name = File.basename(role_file, ".json") - Chef::Log.warn("Loading #{short_name}") - r = Chef::Role.from_disk(short_name, "json") - begin - couch_role = Chef::Role.cdb_load(short_name) - r.couchdb_rev = couch_role.couchdb_rev - Chef::Log.debug("Replacing role #{short_name} with data from #{role_file}") - rescue Chef::Exceptions::CouchDBNotFound - Chef::Log.debug("Creating role #{short_name} with data from #{role_file}") - end - r.cdb_save - end - end - end end diff --git a/chef/lib/chef/run_list.rb b/chef/lib/chef/run_list.rb index 1e4bdd255a..684c5e19fc 100644 --- a/chef/lib/chef/run_list.rb +++ b/chef/lib/chef/run_list.rb @@ -155,8 +155,6 @@ class Chef RunListExpansionFromDisk.new(environment, @run_list_items) when 'server' RunListExpansionFromAPI.new(environment, @run_list_items, opts[:rest]) - when 'couchdb' - RunListExpansionFromCouchDB.new(environment, @run_list_items, opts[:couchdb]) end end diff --git a/chef/lib/chef/run_list/run_list_expansion.rb b/chef/lib/chef/run_list/run_list_expansion.rb index 690eb3392b..7b8108a2d4 100644 --- a/chef/lib/chef/run_list/run_list_expansion.rb +++ b/chef/lib/chef/run_list/run_list_expansion.rb @@ -21,7 +21,6 @@ require 'chef/mash' require 'chef/mixin/deep_merge' require 'chef/role' -require 'chef/couchdb' require 'chef/rest' class Chef @@ -188,19 +187,5 @@ class Chef end end - # Expand a run list from couchdb. Used in chef-server-api - class RunListExpansionFromCouchDB < RunListExpansion - - def couchdb - source - end - - def fetch_role(name, included_by) - Chef::Role.cdb_load(name, couchdb) - rescue Chef::Exceptions::CouchDBNotFound - role_not_found(name, included_by) - end - - end end end diff --git a/chef/lib/chef/sandbox.rb b/chef/lib/chef/sandbox.rb deleted file mode 100644 index 4d05a1db70..0000000000 --- a/chef/lib/chef/sandbox.rb +++ /dev/null @@ -1,153 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2010 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. - -require 'chef/log' -require 'uuidtools' - -class Chef - class Sandbox - attr_accessor :is_completed, :create_time - alias_method :is_completed?, :is_completed - attr_reader :guid - - alias :name :guid - - attr_accessor :couchdb, :couchdb_id, :couchdb_rev - - # list of checksum ids - attr_accessor :checksums - - DESIGN_DOCUMENT = { - "version" => 1, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "sandbox") { - emit(doc.guid, doc); - } - } - EOJS - }, - "all_id" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "sandbox") { - emit(doc.guid, doc.guid); - } - } - EOJS - }, - "all_incomplete" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "sandbox" && !doc.is_completed) { - emit(doc.guid, doc.guid); - } - } - EOJS - }, - "all_completed" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "sandbox" && doc.is_completed) { - emit(doc.guid, doc.guid); - } - } - EOJS - }, - } - } - - # Creates a new Chef::Sandbox object. - # - # === Returns - # object<Chef::Sandbox>:: Duh. :) - def initialize(guid=nil, couchdb=nil) - @guid = guid || UUIDTools::UUID.random_create.to_s.gsub(/\-/,'').downcase - @is_completed = false - @create_time = Time.now.iso8601 - @checksums = Array.new - end - - def include?(checksum) - @checksums.include?(checksum) - end - - alias :member? :include? - - def to_json(*a) - result = { - :guid => guid, - :name => name, # same as guid, used for id_map - :checksums => checksums, - :create_time => create_time, - :is_completed => is_completed, - :json_class => self.class.name, - :chef_type => 'sandbox' - } - result["_rev"] = @couchdb_rev if @couchdb_rev - result.to_json(*a) - end - - def self.json_create(o) - sandbox = new(o['guid']) - sandbox.checksums = o['checksums'] - sandbox.create_time = o['create_time'] - sandbox.is_completed = o['is_completed'] - if o.has_key?('_rev') - sandbox.couchdb_rev = o["_rev"] - o.delete("_rev") - end - if o.has_key?("_id") - sandbox.couchdb_id = o["_id"] - #sandbox.index_id = sandbox.couchdb_id - o.delete("_id") - end - sandbox - end - - ## - # Couchdb - ## - - def self.create_design_document(couchdb=nil) - (couchdb || Chef::CouchDB.new).create_design_document("sandboxes", DESIGN_DOCUMENT) - end - - def self.cdb_list(inflate=false, couchdb=nil) - rs = (couchdb || Chef::CouchDB.new).list("sandboxes", inflate) - lookup = (inflate ? "value" : "key") - rs["rows"].collect { |r| r[lookup] } - end - - def self.cdb_load(guid, couchdb=nil) - # Probably want to look for a view here at some point - (couchdb || Chef::CouchDB.new).load("sandbox", guid) - end - - def cdb_destroy - (couchdb || Chef::CouchDB.new).delete("sandbox", guid, @couchdb_rev) - end - - def cdb_save(couchdb=nil) - @couchdb_rev = (couchdb || Chef::CouchDB.new).store("sandbox", guid, self)["rev"] - end - - end -end diff --git a/chef/lib/chef/solr_query.rb b/chef/lib/chef/solr_query.rb deleted file mode 100644 index 3360ecc24d..0000000000 --- a/chef/lib/chef/solr_query.rb +++ /dev/null @@ -1,187 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Author:: Seth Falcon (<seth@opscode.com>) -# Copyright:: Copyright (c) 2009-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. -# - -require 'chef/mixin/xml_escape' -require 'chef/log' -require 'chef/config' -require 'chef/couchdb' -require 'chef/solr_query/solr_http_request' -require 'chef/solr_query/query_transform' - -class Chef - class SolrQuery - - ID_KEY = "X_CHEF_id_CHEF_X" - DEFAULT_PARAMS = Mash.new(:start => 0, :rows => 1000, :sort => "#{ID_KEY} asc", :wt => 'json', :indent => 'off').freeze - FILTER_PARAM_MAP = {:database => 'X_CHEF_database_CHEF_X', :type => "X_CHEF_type_CHEF_X", :data_bag => 'data_bag'} - VALID_PARAMS = [:start,:rows,:sort,:q,:type] - BUILTIN_SEARCH_TYPES = ["role","node","client","environment"] - DATA_BAG_ITEM = 'data_bag_item' - - include Chef::Mixin::XMLEscape - - attr_accessor :query - attr_accessor :params - - # Create a new Query object - takes the solr_url and optional - # Chef::CouchDB object to inflate objects into. - def initialize(couchdb = nil) - @filter_query = {} - @params = {} - - if couchdb.nil? - @database = Chef::Config[:couchdb_database] - @couchdb = Chef::CouchDB.new(nil, Chef::Config[:couchdb_database]) - else - unless couchdb.respond_to?(:couchdb_database) - Chef::Log.warn("Passing the database name to Chef::Solr::Query initialization is deprecated. Please pass in the Chef::CouchDB object instead.") - @database = couchdb - @couchdb = Chef::CouchDB.new(nil, couchdb) - else - @database = couchdb.couchdb_database - @couchdb = couchdb - end - end - end - - def self.from_params(params, couchdb=nil) - query = new(couchdb) - query.params = VALID_PARAMS.inject({}) do |p, param_name| - p[param_name] = params[param_name] if params.key?(param_name) - p - end - query.update_filter_query_from_params - query.update_query_from_params - query - end - - def filter_by(filter_query_params) - filter_query_params.each do |key, value| - @filter_query[FILTER_PARAM_MAP[key]] = value - end - end - - def filter_query - @filter_query.map { |param, value| "+#{param}:#{value}" }.join(' ') - end - - def filter_by_type(type) - case type - when *BUILTIN_SEARCH_TYPES - filter_by(:type => type) - else - filter_by(:type => DATA_BAG_ITEM, :data_bag => type) - end - end - - def update_filter_query_from_params - filter_by(:database => @database) - filter_by_type(params.delete(:type)) - end - - def update_query_from_params - original_query = URI.decode(params.delete(:q) || "*:*") - @query = Chef::SolrQuery::QueryTransform.transform(original_query) - end - - def objects - if !object_ids.empty? - @bulk_objects ||= @couchdb.bulk_get(object_ids) - Chef::Log.debug { "Bulk get of objects: #{@bulk_objects.inspect}" } - @bulk_objects - else - [] - end - end - - def object_ids - @object_ids ||= results["response"]["docs"].map { |d| d[ID_KEY] } - end - - def results - @results ||= SolrHTTPRequest.select(self.to_hash) - end - - # Search Solr for objects of a given type, for a given query. - def search - { "rows" => objects, "start" => results["response"]["start"], - "total" => results["response"]["numFound"] } - end - - def to_hash - options = DEFAULT_PARAMS.merge(params) - options[:fq] = filter_query - options[:q] = @query - options - end - - START_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".freeze - START_DELETE_BY_QUERY = "<delete><query>".freeze - END_DELETE_BY_QUERY = "</query></delete>\n".freeze - COMMIT = "<commit/>\n".freeze - - def commit(opts={}) - SolrHTTPRequest.update("#{START_XML}#{COMMIT}") - end - - def delete_database(db) - query_data = xml_escape("X_CHEF_database_CHEF_X:#{db}") - xml = "#{START_XML}#{START_DELETE_BY_QUERY}#{query_data}#{END_DELETE_BY_QUERY}" - SolrHTTPRequest.update(xml) - commit - end - - def rebuild_index(db=Chef::Config[:couchdb_database]) - delete_database(db) - - results = {} - [Chef::ApiClient, Chef::Node, Chef::Role, Chef::Environment].each do |klass| - results[klass.name] = reindex_all(klass) ? "success" : "failed" - end - databags = Chef::DataBag.cdb_list(true) - Chef::Log.info("Reloading #{databags.size.to_s} #{Chef::DataBag} objects into the indexer") - databags.each { |i| i.add_to_index; i.list(true).each { |x| x.add_to_index } } - results[Chef::DataBag.name] = "success" - results - end - - def reindex_all(klass, metadata={}) - begin - items = klass.cdb_list(true) - Chef::Log.info("Reloading #{items.size.to_s} #{klass.name} objects into the indexer") - items.each { |i| i.add_to_index } - rescue Net::HTTPServerException => e - # 404s are okay, there might not be any of that kind of object... - if e.message =~ /Not Found/ - Chef::Log.warn("Could not load #{klass.name} objects from couch for re-indexing (this is ok if you don't have any of these)") - return false - else - raise e - end - rescue Exception => e - Chef::Log.fatal("Chef encountered an error while attempting to load #{klass.name} objects back into the index") - raise e - end - true - end - - - end -end diff --git a/chef/lib/chef/solr_query/lucene.treetop b/chef/lib/chef/solr_query/lucene.treetop deleted file mode 100644 index 99d3e1f709..0000000000 --- a/chef/lib/chef/solr_query/lucene.treetop +++ /dev/null @@ -1,150 +0,0 @@ -# -# Author:: Seth Falcon (<seth@opscode.com>) -# Copyright:: Copyright (c) 2010-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. -# - -grammar Lucene - - rule body - (expression / space)* <Body> - end - - rule expression - operation / group / field / field_range / term / string - end - - rule term - keyword valid_letter+ <Term> / !keyword !"?" valid_letter <Term> - end - - rule field - field_name ":" (term/string/group) <Field> - end - - rule field_range - field_name ":" "[" range_value " TO " range_value "]" <InclFieldRange> - / - field_name ":" "{" range_value " TO " range_value "}" <ExclFieldRange> - end - - rule field_name - !keyword valid_letter+ <FieldName> - end - - rule range_value - valid_letter+ <RangeValue> / "*" <RangeValue> - end - - rule group - space? '(' body ')' space? <Group> - end - - rule operation - binary_op / unary_op / fuzzy_op / boost_op - end - - rule unary_op - not_op / required_op / prohibited_op - end - - rule binary_op - (group / field / field_range / term) space? boolean_operator space+ body <BinaryOp> - end - - rule boolean_operator - and_operator / or_operator - end - - rule and_operator - 'AND' <AndOperator> / '&&' <AndOperator> - end - - rule or_operator - 'OR' <OrOperator> / '||' <OrOperator> - end - - rule not_op - not_operator space (group / field / field_range / term / string) <UnaryOp> - / - bang_operator space? (group / field / field_range / term / string) <UnaryOp> - end - - rule not_operator - 'NOT' <NotOperator> - end - - rule bang_operator - '!' <NotOperator> - end - - rule required_op - !valid_letter required_operator (term/string) <UnaryOp> - / - required_operator (term/string) <UnaryOp> - end - - rule required_operator - '+' <RequiredOperator> - end - - rule prohibited_op - !valid_letter prohibited_operator (field/field_range/term/string) <UnaryOp> - end - - rule prohibited_operator - '-' <ProhibitedOperator> - end - - rule boost_op - (term/string) '^' fuzzy_param <BoostOp> - end - - rule fuzzy_op - (term/string) '~' fuzzy_param? (space / !valid_letter) <FuzzyOp> - end - - rule fuzzy_param - [0-9] '.'? [0-9] <FuzzyParam> / [0-9]+ <FuzzyParam> - end - - rule string - '"' term (space term)* '"' <Phrase> - end - - rule keyword - 'AND' / 'OR' / 'NOT' - end - - rule valid_letter - start_letter+ ([a-zA-Z0-9@*?_.-] / '\\' special_char)* - end - - rule start_letter - [a-zA-Z0-9@._*] / '\\' special_char - end - - rule end_letter - [a-zA-Z0-9*?_.] / '\\' special_char - end - - rule special_char - [-+&|!(){}\[\]^"~*?:\\] - end - - rule space - [\s]+ - end -end diff --git a/chef/lib/chef/solr_query/lucene_nodes.rb b/chef/lib/chef/solr_query/lucene_nodes.rb deleted file mode 100644 index c2d7777365..0000000000 --- a/chef/lib/chef/solr_query/lucene_nodes.rb +++ /dev/null @@ -1,285 +0,0 @@ -# -# Author:: Seth Falcon (<seth@opscode.com>) -# Copyright:: Copyright (c) 2010-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. -# - -require 'treetop' - -module Lucene - SEP = "__=__" - - class Term < Treetop::Runtime::SyntaxNode - def to_array - "T:#{self.text_value}" - end - - def transform - self.text_value - end - end - - class Field < Treetop::Runtime::SyntaxNode - def to_array - field = self.elements[0].text_value - term = self.elements[1].to_array - "(F:#{field} #{term})" - end - - def transform - field = self.elements[0].text_value - term = self.elements[1] - if term.is_a? Phrase - str = term.transform - # remove quotes - str = str[1 ... (str.length - 1)] - "content:\"#{field}#{SEP}#{str}\"" - else - "content:#{field}#{SEP}#{term.transform}" - end - end - end - - class FieldRange < Treetop::Runtime::SyntaxNode - - def to_array - field = self.elements[0].text_value - range_start = self.elements[1].to_array - range_end = self.elements[2].to_array - "(FR:#{field} #{left}#{range_start}#{right} #{left}#{range_end}#{right})" - end - - def transform - field = self.elements[0].text_value - range_start = self.elements[1].transform - range_end = self.elements[2].transform - # FIXME: handle special cases for missing start/end - if ("*" == range_start && "*" == range_end) - "content:#{field}#{SEP}*" - elsif "*" == range_end - "content:#{left}#{field}#{SEP}#{range_start} TO #{field}#{SEP}\\ufff0#{right}" - elsif "*" == range_start - "content:#{left}#{field}#{SEP} TO #{field}#{SEP}#{range_end}#{right}" - else - "content:#{left}#{field}#{SEP}#{range_start} TO #{field}#{SEP}#{range_end}#{right}" - end - end - - end - - class InclFieldRange < FieldRange - def left - "[" - end - def right - "]" - end - end - - class ExclFieldRange < FieldRange - def left - "{" - end - def right - "}" - end - end - - class RangeValue < Treetop::Runtime::SyntaxNode - def to_array - self.text_value - end - - def transform - to_array - end - end - - class FieldName < Treetop::Runtime::SyntaxNode - def to_array - self.text_value - end - - def transform - to_array - end - end - - - class Body < Treetop::Runtime::SyntaxNode - def to_array - self.elements.map { |x| x.to_array }.join(" ") - end - - def transform - self.elements.map { |x| x.transform }.join(" ") - end - end - - class Group < Treetop::Runtime::SyntaxNode - def to_array - "(" + self.elements[0].to_array + ")" - end - - def transform - "(" + self.elements[0].transform + ")" - end - end - - class BinaryOp < Treetop::Runtime::SyntaxNode - def to_array - op = self.elements[1].to_array - a = self.elements[0].to_array - b = self.elements[2].to_array - "(#{op} #{a} #{b})" - end - - def transform - op = self.elements[1].transform - a = self.elements[0].transform - b = self.elements[2].transform - "#{a} #{op} #{b}" - end - end - - class AndOperator < Treetop::Runtime::SyntaxNode - def to_array - "OP:AND" - end - - def transform - "AND" - end - end - - class OrOperator < Treetop::Runtime::SyntaxNode - def to_array - "OP:OR" - end - - def transform - "OR" - end - end - - class FuzzyOp < Treetop::Runtime::SyntaxNode - def to_array - a = self.elements[0].to_array - param = self.elements[1] - if param - "(OP:~ #{a} #{param.to_array})" - else - "(OP:~ #{a})" - end - end - - def transform - a = self.elements[0].transform - param = self.elements[1] - if param - "#{a}~#{param.transform}" - else - "#{a}~" - end - end - end - - class BoostOp < Treetop::Runtime::SyntaxNode - def to_array - a = self.elements[0].to_array - param = self.elements[1] - "(OP:^ #{a} #{param.to_array})" - end - - def transform - a = self.elements[0].transform - param = self.elements[1] - "#{a}^#{param.transform}" - end - end - - class FuzzyParam < Treetop::Runtime::SyntaxNode - def to_array - self.text_value - end - - def transform - self.text_value - end - end - - class UnaryOp < Treetop::Runtime::SyntaxNode - def to_array - op = self.elements[0].to_array - a = self.elements[1].to_array - "(#{op} #{a})" - end - - def transform - op = self.elements[0].transform - a = self.elements[1].transform - spc = case op - when "+", "-" - "" - else - " " - end - "#{op}#{spc}#{a}" - end - - end - - class NotOperator < Treetop::Runtime::SyntaxNode - def to_array - "OP:NOT" - end - - def transform - "NOT" - end - - end - - class RequiredOperator < Treetop::Runtime::SyntaxNode - def to_array - "OP:+" - end - - def transform - "+" - end - - end - - class ProhibitedOperator < Treetop::Runtime::SyntaxNode - def to_array - "OP:-" - end - - def transform - "-" - end - end - - class Phrase < Treetop::Runtime::SyntaxNode - def to_array - "STR:#{self.text_value}" - end - - def transform - "#{self.text_value}" - end - end -end diff --git a/chef/lib/chef/solr_query/query_transform.rb b/chef/lib/chef/solr_query/query_transform.rb deleted file mode 100644 index 529f9de482..0000000000 --- a/chef/lib/chef/solr_query/query_transform.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# Author:: Seth Falcon (<seth@opscode.com>) -# Copyright:: Copyright (c) 2010-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. -# -require 'treetop' -require 'chef/solr_query/lucene_nodes' - -class Chef - class Exceptions - class QueryParseError < StandardError - end - end -end - -class Chef - class SolrQuery - class QueryTransform - @@base_path = File.expand_path(File.dirname(__FILE__)) - Treetop.load(File.join(@@base_path, 'lucene.treetop')) - @@parser = LuceneParser.new - - def self.parse(data) - tree = @@parser.parse(data) - msg = "Parse error at offset: #{@@parser.index}\n" - msg += "Reason: #{@@parser.failure_reason}" - raise Chef::Exceptions::QueryParseError, msg if tree.nil? - self.clean_tree(tree) - tree.to_array - end - - def self.transform(data) - return "*:*" if data == "*:*" - tree = @@parser.parse(data) - msg = "Parse error at offset: #{@@parser.index}\n" - msg += "Reason: #{@@parser.failure_reason}" - raise Chef::Exceptions::QueryParseError, msg if tree.nil? - self.clean_tree(tree) - tree.transform - end - - private - - def self.clean_tree(root_node) - return if root_node.elements.nil? - root_node.elements.delete_if do |node| - node.class.name == "Treetop::Runtime::SyntaxNode" - end - root_node.elements.each { |node| self.clean_tree(node) } - end - end - end -end diff --git a/chef/lib/chef/solr_query/solr_http_request.rb b/chef/lib/chef/solr_query/solr_http_request.rb deleted file mode 100644 index e7ce1d5675..0000000000 --- a/chef/lib/chef/solr_query/solr_http_request.rb +++ /dev/null @@ -1,132 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2009-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. -# - -require 'net/http' -require 'uri' -require 'chef/json_compat' -require 'chef/config' - -class Chef - class SolrQuery - class SolrHTTPRequest - CLASS_FOR_METHOD = {:GET => Net::HTTP::Get, :POST => Net::HTTP::Post} - - TEXT_XML = {"Content-Type" => "text/xml"} - - def self.solr_url=(solr_url) - @solr_url = solr_url - @http_client = nil - @url_prefix = nil - end - - def self.solr_url - @solr_url || Chef::Config[:solr_url] - end - - def self.http_client - @http_client ||= begin - uri = URI.parse(solr_url) - http_client = Net::HTTP.new(uri.host, uri.port) - http_client.use_ssl = true if uri.port == 443 - http_client - end - end - - def self.url_prefix - @url_prefix ||= begin - uri = URI.parse(solr_url) - if uri.path == "" - "/solr" - else - uri.path.gsub(%r{/$}, '') - end - end - end - - def self.select(params={}) - url = "#{url_prefix}/select?#{url_join(params)}" - Chef::Log.debug("Sending #{url} to Solr") - request = new(:GET, url) - json_response = request.run("Search Query to Solr '#{solr_url}#{url}'") - Chef::JSONCompat.from_json(json_response) - end - - def self.update(doc) - url = "#{url_prefix}/update" - Chef::Log.debug("POSTing document to SOLR:\n#{doc}") - request = new(:POST, url, TEXT_XML) { |req| req.body = doc.to_s } - request.run("POST to Solr '#{solr_url}#{url}', data: #{doc}") - end - - def self.url_join(params_hash={}) - params = params_hash.inject("") do |param_str, params| - param_str << "#{params[0]}=#{escape(params[1])}&" - end - params.chop! # trailing & - params - end - - def self.escape(s) - s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) { - '%'+$1.unpack('H2'*$1.size).join('%').upcase - }.tr(' ', '+') - end - - def initialize(method, url, headers=nil) - args = headers ? [url, headers] : url - @request = CLASS_FOR_METHOD[method].new(*args) - yield @request if block_given? - end - - def http_client - self.class.http_client - end - - def solr_url - self.class.solr_url - end - - def run(description="HTTP Request to Solr") - response = http_client.request(@request) - request_failed!(response, description) unless response.kind_of?(Net::HTTPSuccess) - response.body - rescue NoMethodError => e - # http://redmine.ruby-lang.org/issues/show/2708 - # http://redmine.ruby-lang.org/issues/show/2758 - if e.to_s =~ /#{Regexp.escape(%q|undefined method 'closed?' for nil:NilClass|)}/ - Chef::Log.fatal("#{description} failed. Chef::Exceptions::SolrConnectionError exception: Errno::ECONNREFUSED (net/http undefined method closed?) attempting to contact #{solr_url}") - Chef::Log.debug("Rescued error in http connect, treating it as Errno::ECONNREFUSED to hide bug in net/http") - Chef::Log.debug(e.backtrace.join("\n")) - raise Chef::Exceptions::SolrConnectionError, "Errno::ECONNREFUSED: Connection refused attempting to contact #{solr_url}" - else - raise - end - end - - def request_failed!(response, description='HTTP call') - Chef::Log.fatal("#{description} failed (#{response.class} #{response.code} #{response.message})") - response.error! - rescue Timeout::Error, Errno::EINVAL, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT => e - Chef::Log.debug(e.backtrace.join("\n")) - raise Chef::Exceptions::SolrConnectionError, "#{e.class.name}: #{e.to_s}" - end - - end - end -end diff --git a/chef/lib/chef/webui_user.rb b/chef/lib/chef/webui_user.rb deleted file mode 100644 index e0dbde4a61..0000000000 --- a/chef/lib/chef/webui_user.rb +++ /dev/null @@ -1,156 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Nuo Yan (<nuo@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'chef/config' -require 'chef/mixin/params_validate' -require 'chef/index_queue' -require 'digest/sha1' -require 'chef/json_compat' - - -class Chef - class WebUIUser - - attr_accessor :name, :validated, :admin, :openid, :couchdb - attr_reader :password, :salt, :couchdb_id, :couchdb_rev - - include Chef::Mixin::ParamsValidate - - # Create a new Chef::WebUIUser object. - def initialize(opts={}) - @name, @salt, @password = opts['name'], opts['salt'], opts['password'] - @openid = opts['openid'] - @admin = false - end - - def name=(n) - @name = n.gsub(/\./, '_') - end - - def admin? - admin - end - - # Set the password for this object. - def set_password(password, confirm_password=password) - raise ArgumentError, "Passwords do not match" unless password == confirm_password - raise ArgumentError, "Password cannot be blank" if (password.nil? || password.length==0) - raise ArgumentError, "Password must be a minimum of 6 characters" if password.length < 6 - generate_salt - @password = encrypt_password(password) - end - - def set_openid(given_openid) - @openid = given_openid - end - - def verify_password(given_password) - encrypt_password(given_password) == @password - end - - # Serialize this object as a hash - def to_json(*a) - attributes = Hash.new - recipes = Array.new - result = { - 'name' => name, - 'json_class' => self.class.name, - 'salt' => salt, - 'password' => password, - 'openid' => openid, - 'admin' => admin, - 'chef_type' => 'webui_user', - } - result["_id"] = @couchdb_id if @couchdb_id - result["_rev"] = @couchdb_rev if @couchdb_rev - result.to_json(*a) - end - - # Create a Chef::WebUIUser from JSON - def self.json_create(o) - me = new(o) - me.admin = o["admin"] - me - end - - def chef_server_rest - Chef::REST.new(Chef::Config[:chef_server_url]) - end - - def self.chef_server_rest - Chef::REST.new(Chef::Config[:chef_server_url]) - end - - def self.list(inflate=false) - if inflate - response = Hash.new - Chef::Search::Query.new.search(:user) do |n| - response[n.name] = n unless n.nil? - end - response - else - chef_server_rest.get_rest("users") - end - end - - # Load a User by name - def self.load(name) - chef_server_rest.get_rest("users/#{name}") - end - - # Remove this WebUIUser via the REST API - def destroy - chef_server_rest.delete_rest("users/#{@name}") - end - - # Save this WebUIUser via the REST API - def save - begin - chef_server_rest.put_rest("users/#{@name}", self) - rescue Net::HTTPServerException => e - if e.response.code == "404" - chef_server_rest.post_rest("users", self) - else - raise e - end - end - self - end - - # Create the WebUIUser via the REST API - def create - chef_server_rest.post_rest("users", self) - self - end - - protected - - def generate_salt - @salt = Time.now.to_s - chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a - 1.upto(30) { |i| @salt << chars[rand(chars.size-1)] } - @salt - end - - def encrypt_password(password) - Digest::SHA1.hexdigest("--#{salt}--#{password}--") - end - - end -end diff --git a/chef/spec/unit/api_client_spec.rb b/chef/spec/unit/api_client_spec.rb index b9d9cecc01..e01243152e 100644 --- a/chef/spec/unit/api_client_spec.rb +++ b/chef/spec/unit/api_client_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -57,8 +57,8 @@ describe Chef::ApiClient do end it "should return the current admin value" do - @client.admin true - @client.admin.should == true + @client.admin true + @client.admin.should == true end it "should default to false" do @@ -82,7 +82,7 @@ describe Chef::ApiClient do it "should throw an ArgumentError if you feed it something lame" do lambda { @client.public_key Hash.new }.should raise_error(ArgumentError) - end + end end describe "private_key" do @@ -97,27 +97,6 @@ describe Chef::ApiClient do it "should throw an ArgumentError if you feed it something lame" do lambda { @client.private_key Hash.new }.should raise_error(ArgumentError) - end - end - - describe "create_keys" do - before(:each) do - Chef::Certificate.stub!(:gen_keypair).and_return(["cert", "key"]) - end - - it "should create a certificate based on the client name" do - Chef::Certificate.should_receive(:gen_keypair).with(@client.name) - @client.create_keys - end - - it "should set the private key" do - @client.create_keys - @client.private_key.should == "key" - end - - it "should set the public key" do - @client.create_keys - @client.public_key.should == "cert" end end @@ -136,7 +115,7 @@ describe Chef::ApiClient do %w{ name public_key - }.each do |t| + }.each do |t| it "should include '#{t}'" do @serial.should =~ /"#{t}":"#{@client.send(t.to_sym)}"/ end @@ -168,7 +147,7 @@ describe Chef::ApiClient do name public_key admin - }.each do |t| + }.each do |t| it "should match '#{t}'" do @deserial.send(t.to_sym).should == @client.send(t.to_sym) end diff --git a/chef/spec/unit/certificate_spec.rb b/chef/spec/unit/certificate_spec.rb deleted file mode 100644 index 4f0b07519f..0000000000 --- a/chef/spec/unit/certificate_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2009 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. -# - -require 'spec_helper' - -require 'chef/certificate' -require 'ostruct' -require 'tempfile' - -class FakeFile - attr_accessor :data - - def write(arg) - @data = arg - end -end - -describe Chef::Certificate do - describe "generate_signing_ca" do - before(:each) do - Chef::Config[:signing_ca_user] = nil - Chef::Config[:signing_ca_group] = nil - FileUtils.stub!(:mkdir_p).and_return(true) - FileUtils.stub!(:chown).and_return(true) - File.stub!(:open).and_return(true) - File.stub!(:exists?).and_return(false) - @ca_cert = FakeFile.new - @ca_key = FakeFile.new - end - - it "should generate a ca certificate" do - File.should_receive(:open).with(Chef::Config[:signing_ca_cert], "w").and_yield(@ca_cert) - Chef::Certificate.generate_signing_ca - @ca_cert.data.should =~ /BEGIN CERTIFICATE/ - end - - it "should generate an RSA private key" do - File.should_receive(:open).with(Chef::Config[:signing_ca_key], File::WRONLY|File::EXCL|File::CREAT, 0600).and_yield(@ca_key) - FileUtils.should_not_receive(:chown) - Chef::Certificate.generate_signing_ca - @ca_key.data.should =~ /BEGIN RSA PRIVATE KEY/ - end - - it "should generate an RSA private key with user and group" do - Chef::Config[:signing_ca_user] = "funky" - Chef::Config[:signing_ca_group] = "fresh" - File.should_receive(:open).with(Chef::Config[:signing_ca_key], File::WRONLY|File::EXCL|File::CREAT, 0600).and_yield(@ca_key) - FileUtils.should_receive(:chown).with(Chef::Config[:signing_ca_user], Chef::Config[:signing_ca_group], Chef::Config[:signing_ca_key]) - Chef::Certificate.generate_signing_ca - @ca_key.data.should =~ /BEGIN RSA PRIVATE KEY/ - end - end - - describe "generate_keypair" do - it "should return a client certificate" do - public_key, private_key = Chef::Certificate.gen_keypair("oasis") - public_key.to_s.should =~ /(BEGIN RSA PUBLIC KEY|BEGIN PUBLIC KEY)/ - private_key.to_s.should =~ /BEGIN RSA PRIVATE KEY/ - end - end -end diff --git a/chef/spec/unit/checksum_spec.rb b/chef/spec/unit/checksum_spec.rb deleted file mode 100644 index aad559cf3d..0000000000 --- a/chef/spec/unit/checksum_spec.rb +++ /dev/null @@ -1,94 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -require 'spec_helper' -require 'chef/checksum' - -describe Chef::Checksum do - - before do - Chef::Log.logger = Logger.new(StringIO.new) - - @now = Time.now - - Time.stub!(:now).and_return(@now) - - @checksum_of_the_file = "3fafecfb15585ede6b840158cbc2f399" - @checksum = Chef::Checksum.new(@checksum_of_the_file) - end - - it "has no original committed file location" do - @checksum.original_committed_file_location.should be_nil - end - - it "has the MD5 checksum of the file it represents" do - @checksum.checksum.should == @checksum_of_the_file - end - - it "stores the time it was created" do - @checksum.create_time.should == @now.iso8601 - end - - it "commits a sandbox file from a given location to the checksum repo location" do - @checksum.storage.should_receive(:commit).with("/tmp/arbitrary_file_location") - @checksum.should_receive(:cdb_save) - @checksum.commit_sandbox_file("/tmp/arbitrary_file_location") - @checksum.original_committed_file_location.should == "/tmp/arbitrary_file_location" - end - - it "reverts committing a sandbox file" do - @checksum.storage.should_receive(:commit).with("/tmp/arbitrary_file_location") - @checksum.should_receive(:cdb_save) - @checksum.commit_sandbox_file("/tmp/arbitrary_file_location") - @checksum.original_committed_file_location.should == "/tmp/arbitrary_file_location" - - @checksum.storage.should_receive(:revert).with("/tmp/arbitrary_file_location") - @checksum.should_receive(:cdb_destroy) - @checksum.revert_sandbox_file_commit - end - - it "raises an error when trying to revert a checksum that was not previously committed" do - lambda {@checksum.revert_sandbox_file_commit}.should raise_error(Chef::Exceptions::IllegalChecksumRevert) - end - - it "deletes the file and its document from couchdb" do - @checksum.should_receive(:cdb_destroy) - @checksum.storage.should_receive(:purge) - @checksum.purge - end - - describe "when converted to json" do - before do - @checksum_as_json = @checksum.to_json - @checksum_as_hash_from_json = Chef::JSONCompat.from_json(@checksum_as_json, :create_additions => false) - end - - it "contains the file's MD5 checksum" do - @checksum_as_hash_from_json["checksum"].should == @checksum_of_the_file - end - - it "contains the creation time" do - @checksum_as_hash_from_json["create_time"].should == @now.iso8601 - end - - it "uses the file's MD5 checksum for its 'name' property" do - @checksum_as_hash_from_json["name"].should == @checksum_of_the_file - end - end - -end diff --git a/chef/spec/unit/client_spec.rb b/chef/spec/unit/client_spec.rb index e8a75b7009..9d0c88dad1 100644 --- a/chef/spec/unit/client_spec.rb +++ b/chef/spec/unit/client_spec.rb @@ -41,7 +41,7 @@ shared_examples_for Chef::Client do ohai_data.stub!(:data).and_return(ohai_data) Ohai::System.stub!(:new).and_return(ohai_data) - @node = Chef::Node.new(@hostname) + @node = Chef::Node.new @node.name(@fqdn) @node.chef_environment("_default") @@ -90,7 +90,7 @@ shared_examples_for Chef::Client do Chef::REST.should_receive(:new).with(Chef::Config[:client_url], Chef::Config[:validation_client_name], Chef::Config[:validation_key]).exactly(1).and_return(mock_chef_rest_for_client) mock_chef_rest_for_client.should_receive(:register).with(@fqdn, Chef::Config[:client_key]).exactly(1).and_return(true) # Client.register will then turn around create another - + # Chef::REST object, this time with the client key it got from the # previous step. Chef::REST.should_receive(:new).with(Chef::Config[:chef_server_url], @fqdn, Chef::Config[:client_key]).exactly(1).and_return(mock_chef_rest_for_node) @@ -139,7 +139,6 @@ shared_examples_for Chef::Client do res.replace(string) end pipe_sim.should_receive(:gets).and_return(res) - Chef::CouchDB.should_receive(:new).and_return(nil) IO.should_receive(:pipe).and_return([pipe_sim, pipe_sim]) IO.should_receive(:select).and_return(true) end @@ -151,7 +150,7 @@ shared_examples_for Chef::Client do block.call end end - + # This is what we're testing. @client.run @@ -160,7 +159,7 @@ shared_examples_for Chef::Client do @node.automatic_attrs[:platform_version].should == "example-platform-1.0" end end - + describe "when notifying other objects of the status of the chef run" do before do Chef::Client.clear_notifications @@ -235,7 +234,7 @@ shared_examples_for Chef::Client do describe "when a run list override is provided" do before do - @node = Chef::Node.new(@hostname) + @node = Chef::Node.new @node.name(@fqdn) @node.chef_environment("_default") @node.automatic_attrs[:platform] = "example-platform" @@ -265,7 +264,7 @@ shared_examples_for Chef::Client do @node.should_receive(:save).and_return(nil) @client.build_node - + @node[:roles].should_not be_nil @node[:roles].should eql(['test_role']) @node[:recipes].should eql(['cookbook1']) diff --git a/chef/spec/unit/cookbook_version_spec.rb b/chef/spec/unit/cookbook_version_spec.rb index 90f411d8b2..85e1db1fae 100644 --- a/chef/spec/unit/cookbook_version_spec.rb +++ b/chef/spec/unit/cookbook_version_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -17,56 +17,10 @@ require 'spec_helper' -describe Chef::MinimalCookbookVersion do - describe "when first created" do - before do - @params = { "id"=>"1a806f1c-b409-4d8e-abab-fa414ff5b96d", - "key"=>"activemq", - "value"=>{"version"=>"0.3.3", "deps"=>{"java"=>">= 0.0.0", "runit"=>">= 0.0.0"}}} - @minimal_cookbook_version = Chef::MinimalCookbookVersion.new(@params) - end - - it "has a name" do - @minimal_cookbook_version.name.should == 'activemq' - end - - it "has a version" do - @minimal_cookbook_version.version.should == '0.3.3' - end - - it "has a list of dependencies" do - @minimal_cookbook_version.deps.should == {"java" => ">= 0.0.0", "runit" => ">= 0.0.0"} - end - - it "has cookbook metadata" do - metadata = @minimal_cookbook_version.metadata - - metadata.name.should == 'activemq' - metadata.dependencies['java'].should == '>= 0.0.0' - metadata.dependencies['runit'].should == '>= 0.0.0' - end - end - - describe "when created from cookbooks with old style version contraints" do - before do - @params = { "id"=>"1a806f1c-b409-4d8e-abab-fa414ff5b96d", - "key"=>"activemq", - "value"=>{"version"=>"0.3.3", "deps"=>{"apt" => ">> 1.0.0"}}} - @minimal_cookbook_version = Chef::MinimalCookbookVersion.new(@params) - end - - it "translates the version constraints" do - metadata = @minimal_cookbook_version.metadata - metadata.dependencies['apt'].should == '> 1.0.0' - end - end -end - describe Chef::CookbookVersion do describe "when first created" do before do - @couchdb_driver = Chef::CouchDB.new - @cookbook_version = Chef::CookbookVersion.new("tatft", @couchdb_driver) + @cookbook_version = Chef::CookbookVersion.new("tatft") end it "has a name" do @@ -114,14 +68,6 @@ describe Chef::CookbookVersion do @cookbook_version.should be_frozen_version end - it "has no couchdb id" do - @cookbook_version.couchdb_id.should be_nil - end - - it "has the couchdb driver it was given on create" do - @cookbook_version.couchdb.should equal(@couchdb_driver) - end - it "is \"ready\"" do # WTF is this? what are the valid states? and why aren't they set with encapsulating methods? # [Dan 15-Jul-2010] @@ -133,19 +79,19 @@ describe Chef::CookbookVersion do end it "creates a manifest hash of its contents" do - expected = {"recipes"=>[], - "definitions"=>[], - "libraries"=>[], - "attributes"=>[], - "files"=>[], - "templates"=>[], - "resources"=>[], - "providers"=>[], - "root_files"=>[], - "cookbook_name"=>"tatft", + expected = {"recipes"=>[], + "definitions"=>[], + "libraries"=>[], + "attributes"=>[], + "files"=>[], + "templates"=>[], + "resources"=>[], + "providers"=>[], + "root_files"=>[], + "cookbook_name"=>"tatft", "metadata"=>Chef::Cookbook::Metadata.new, - "version"=>"0.0.0", - "name"=>"tatft-0.0.0"} + "version"=>"0.0.0", + "name"=>"tatft-0.0.0"} @cookbook_version.manifest.should == expected end end @@ -280,7 +226,7 @@ describe Chef::CookbookVersion do useful_explanation = Regexp.new(Regexp.escape("Cookbook 'tatft' (0.0.0) does not contain")) @attempt_to_load_file.should raise_error(Chef::Exceptions::FileNotFound, useful_explanation) end - + it "lists suggested places to look" do useful_explanation = Regexp.new(Regexp.escape("files/default/no-such-thing.txt")) @attempt_to_load_file.should raise_error(Chef::Exceptions::FileNotFound, useful_explanation) @@ -325,7 +271,7 @@ describe Chef::CookbookVersion do b.version = "1.2.0" a.should == b end - + it "should not allow you to sort cookbooks with different names" do apt = Chef::CookbookVersion.new "apt" @@ -358,54 +304,4 @@ describe Chef::CookbookVersion do end - describe "when deleting in the database" do - before do - @couchdb_driver = Chef::CouchDB.new - @cookbook_version = Chef::CookbookVersion.new("tatft", @couchdb_driver) - @cookbook_version.version = "1.2.3" - @couchdb_rev = "_123456789" - @cookbook_version.couchdb_rev = @couchdb_rev - end - - it "deletes its document from couchdb" do - @couchdb_driver.should_receive(:delete).with("cookbook_version", "tatft-1.2.3", @couchdb_rev) - @cookbook_version.cdb_destroy - end - - it "deletes associated checksum objects when purged" do - checksums = {"12345" => "/tmp/foo", "23456" => "/tmp/bar", "34567" => "/tmp/baz"} - @cookbook_version.stub!(:checksums).and_return(checksums) - - chksum_docs = checksums.map do |md5, path| - cksum_doc = mock("Chef::Checksum for #{md5} at #{path}") - Chef::Checksum.should_receive(:cdb_load).with(md5, @couchdb_driver).and_return(cksum_doc) - cksum_doc.should_receive(:purge) - cksum_doc - end - - @cookbook_version.should_receive(:cdb_destroy) - @cookbook_version.purge - end - - it "successfully purges when associated checksum objects are missing" do - checksums = {"12345" => "/tmp/foo", "23456" => "/tmp/bar", "34567" => "/tmp/baz"} - - chksum_docs = checksums.map do |md5, path| - cksum_doc = mock("Chef::Checksum for #{md5} at #{path}") - Chef::Checksum.should_receive(:cdb_load).with(md5, @couchdb_driver).and_return(cksum_doc) - cksum_doc.should_receive(:purge) - cksum_doc - end - - missing_checksum = {"99999" => "/tmp/qux"} - Chef::Checksum.should_receive(:cdb_load).with("99999", @couchdb_driver).and_raise(Chef::Exceptions::CouchDBNotFound) - - @cookbook_version.stub!(:checksums).and_return(checksums.merge(missing_checksum)) - - @cookbook_version.should_receive(:cdb_destroy) - lambda {@cookbook_version.purge}.should_not raise_error - end - - end - end diff --git a/chef/spec/unit/couchdb_spec.rb b/chef/spec/unit/couchdb_spec.rb deleted file mode 100644 index 480dd61980..0000000000 --- a/chef/spec/unit/couchdb_spec.rb +++ /dev/null @@ -1,274 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'spec_helper' - -describe Chef::CouchDB do - before(:each) do - Chef::Config[:couchdb_database] = "chef" - @rest = mock("Chef::REST") - @rest.stub!(:run_request).and_return({"couchdb" => "Welcome", "version" =>"0.9.0"}) - @rest.stub!(:url).and_return("http://localhost:5984") - Chef::REST.stub!(:new).and_return(@rest) - @couchdb = Chef::CouchDB.new - end - - describe "new" do - it "should create a new Chef::REST object from the default url" do - old_url = Chef::Config[:couchdb_url] - Chef::Config[:couchdb_url] = "http://monkey" - Chef::REST.should_receive(:new).with("http://monkey", nil, nil) - Chef::CouchDB.new - Chef::Config[:couchdb_url] = old_url - end - - it "should create a new Chef::REST object from a provided url" do - Chef::REST.should_receive(:new).with("http://monkeypants", nil, nil) - Chef::CouchDB.new("http://monkeypants") - end - end - - describe "create_db" do - before(:each) do - @couchdb.stub!(:create_design_document).and_return(true) - end - - it "should get a list of current databases" do - @rest.should_receive(:get_rest).and_return(["chef"]) - @couchdb.create_db - end - - it "should create the chef database if it does not exist" do - @rest.stub!(:get_rest).and_return([]) - @rest.should_receive(:put_rest).with("chef", {}).and_return(true) - @couchdb.create_db - end - - it "should not create the chef database if it does exist" do - @rest.stub!(:get_rest).and_return(["chef"]) - @rest.should_not_receive(:put_rest) - @couchdb.create_db - end - - it "should return 'chef'" do - @rest.should_receive(:get_rest).with("_all_dbs").and_return(%w{chef}) - @couchdb.create_db.should eql("chef") - end - end - - describe "create_design_document" do - before(:each) do - @mock_design = { - "version" => 1, - "_rev" => 1 - } - @mock_data = { - "version" => 1, - "language" => "javascript", - "views" => { - "all" => { - "map" => <<-EOJS - function(doc) { - if (doc.chef_type == "node") { - emit(doc.name, doc); - } - } - EOJS - }, - } - } - @rest.stub!(:get_rest).and_return(@mock_design) - @rest.stub!(:put_rest).and_return(true) - @couchdb.stub!(:create_db).and_return(true) - end - - def do_create_design_document - @couchdb.create_design_document("bob", @mock_data) - end - - it "should fetch the existing design document" do - @rest.should_receive(:get_rest).with("chef/_design/bob") - do_create_design_document - end - - it "should populate the _rev in the new design if the versions dont match" do - @mock_data["version"] = 2 - do_create_design_document - @mock_data["_rev"].should eql(1) - end - - it "should create the view if it requires updating" do - @mock_data["version"] = 2 - @rest.should_receive(:put_rest).with("chef/_design%2Fbob", @mock_data) - do_create_design_document - end - - it "should not create the view if it does not require updating" do - @mock_data["version"] = 1 - @rest.should_not_receive(:put_rest) - do_create_design_document - end - end - - describe "store" do - before(:each) do - @mock_results = { - "rows" => [ - "id" => 'a0934635-e111-45d9-8223-cb58e1c9434c' - ] - } - @couchdb.stub!(:get_view).with("id_map", "name_to_id", :key => [ "node", "bob" ]).and_return(@mock_results) - end - - it "should put the object into couchdb with a pre-existing GUID" do - item_to_store = {} - item_to_store.should_receive(:add_to_index) - @rest.should_receive(:put_rest).with("chef/#{@mock_results["rows"][0]["id"]}", item_to_store).and_return(true) - @couchdb.store("node", "bob", item_to_store) - end - - it "should put the object into couchdb with a new GUID" do - @mock_results = { "rows" => [] } - item_to_store = {} - item_to_store.should_receive(:add_to_index).with(:database => "chef", :id => "aaaaaaaa-xxxx-xxxx-xxxx-xxxxxxxxxxx", :type => "node") - @couchdb.stub!(:get_view).with("id_map", "name_to_id", :key => [ "node", "bob" ]).and_return(@mock_results) - UUIDTools::UUID.stub!(:random_create).and_return("aaaaaaaa-xxxx-xxxx-xxxx-xxxxxxxxxxx") - @rest.should_receive(:put_rest).with("chef/aaaaaaaa-xxxx-xxxx-xxxx-xxxxxxxxxxx", item_to_store).and_return(true) - @couchdb.store("node", "bob", item_to_store) - end - - end - - describe "when fetching the database status" do - it "gets couchdb's version string'" do - @rest.should_receive(:get_rest).with('/').and_return({"couchdb" => "Welcome","version" => "1.0.1"}) - @couchdb.server_stats.should == {"couchdb" => "Welcome","version" => "1.0.1"} - end - - it "gets database stats" do - db_stats = {"db_name" => "opscode_account","doc_count" => 206,"doc_del_count" => 1,"update_seq" => 208,"purge_seq" => 0, - "compact_running" => false,"disk_size" => 122969,"instance_start_time" => "1298070021394804","disk_format_version" => 5,"committed_update_seq" => 208} - @rest.should_receive(:get_rest).with('/chef').and_return(db_stats) - @couchdb.db_stats.should == db_stats - end - - end - - describe "load" do - before(:each) do - @mock_node = Chef::Node.new() - @mock_node.name("bob") - @couchdb.stub!(:find_by_name).with("node", "bob").and_return(@mock_node) - end - - it "should load the object from couchdb" do - @couchdb.load("node", "bob").should eql(@mock_node) - end - end - - describe "delete" do - before(:each) do - @mock_current = { - "version" => 1, - "_rev" => 1 - } - @rest.stub!(:get_rest).and_return(@mock_current) - @rest.stub!(:delete_rest).and_return(true) - @node = Chef::Node.new() - @node.name("bob") - @node.couchdb_rev = 15 - @couchdb.stub!(:find_by_name).with("node", "bob", true).and_return([ @node, "ax" ]) - end - - def do_delete(rev=nil) - @couchdb.delete("node", "bob", rev) - end - - it "should remove the object from couchdb with a specific revision" do - @node.should_receive(:delete_from_index) - @rest.should_receive(:delete_rest).with("chef/ax?rev=1") - do_delete(1) - end - - it "should remove the object from couchdb based on the couchdb_rev of the current obj" do - @node.should_receive(:delete_from_index) - @rest.should_receive(:delete_rest).with("chef/ax?rev=15") - do_delete - end - end - - describe "list" do - before(:each) do - Chef::Config.stub!(:[]).with(:couchdb_database).and_return("chef") - @mock_response = {"rows" => []} - end - - describe "on couchdb 0.9+" do - before do - Chef::Config.stub!(:[]).with(:couchdb_version).and_return(0.9) - end - - it "should get the view for all objects if inflate is true" do - @rest.should_receive(:get_rest).with("chef/_design/node/_view/all").and_return(@mock_response) - @couchdb.list("node", true) - end - - it "should get the view for just the object id's if inflate is false" do - @rest.should_receive(:get_rest).with("chef/_design/node/_view/all_id").and_return(@mock_response) - @couchdb.list("node", false) - end - end - end - - describe "has_key?" do - it "should return true if the object exists" do - @couchdb.stub!(:find_by_name).with("node", "bob").and_return(true) - @couchdb.has_key?("node", "bob").should eql(true) - end - - it "should return false if the object does not exist" do - @couchdb.stub!(:find_by_name).and_raise(Chef::Exceptions::CouchDBNotFound) - @couchdb.has_key?("node", "bob").should eql(false) - end - end - - describe "get_view" do - it "should construct a call to the view for the proper design document" do - @rest.should_receive(:get_rest).with("chef/_design/nodes/_view/mastodon") - @couchdb.get_view("nodes", "mastodon") - end - - it "should allow arguments to the view" do - @rest.should_receive(:get_rest).with("chef/_design/nodes/_view/mastodon?startkey=%22dont%20stay%22") - @couchdb.get_view("nodes", "mastodon", :startkey => "dont stay") - end - - end - - describe "view_uri" do - it "should output an appropriately formed view URI" do - @couchdb.should_receive(:view_uri).with("nodes", "all").and_return("chef/_design/nodes/_view/all") - @couchdb.view_uri("nodes", "all") - end - end - -end - - - - diff --git a/chef/spec/unit/environment_spec.rb b/chef/spec/unit/environment_spec.rb index 7b0a835e8c..97f0c3395e 100644 --- a/chef/spec/unit/environment_spec.rb +++ b/chef/spec/unit/environment_spec.rb @@ -235,107 +235,6 @@ describe Chef::Environment do end end - describe "when listing the available cookbooks filtered by policy" do - before(:each) do - @environment.name "prod" - @environment.cookbook_versions({ - "apt" => "= 1.0.0", - "apache2" => "= 2.0.0" - }) - Chef::Environment.stub!(:cdb_load).and_return @environment - - @all_cookbooks = [] - @all_cookbooks << begin - cv = Chef::CookbookVersion.new("apt") - cv.version = "1.0.0" - cv.recipe_filenames = ["default.rb", "only-in-1-0.rb"] - cv - end - @all_cookbooks << begin - cv = Chef::CookbookVersion.new("apt") - cv.version = "1.1.0" - cv.recipe_filenames = ["default.rb", "only-in-1-1.rb"] - cv - end - @all_cookbooks << begin - cv = Chef::CookbookVersion.new("apache2") - cv.version = "2.0.0" - cv.recipe_filenames = ["default.rb", "mod_ssl.rb"] - cv - end - @all_cookbooks << begin - cv = Chef::CookbookVersion.new("god") - cv.version = "4.2.0" - cv.recipe_filenames = ["default.rb"] - cv - end - Chef::CookbookVersion.stub!(:cdb_list).and_return @all_cookbooks - end - - it "should load the environment" do - Chef::Environment.should_receive(:cdb_load).with("prod", nil) - Chef::Environment.cdb_load_filtered_cookbook_versions("prod") - end - - it "should handle cookbooks with no available version" do - @environment.cookbook_versions({ - "apt" => "> 999.0.0", - "apache2" => "= 2.0.0" - }) - Chef::Environment.should_receive(:cdb_load).with("prod", nil) - recipes = Chef::Environment.cdb_load_filtered_recipe_list("prod") - # order doesn't matter - recipes.should =~ ["god", "apache2", "apache2::mod_ssl"] - end - - - it "should load all the cookbook versions" do - Chef::CookbookVersion.should_receive(:cdb_list) - Chef::Environment.cdb_load_filtered_cookbook_versions("prod") - recipes = Chef::Environment.cdb_load_filtered_recipe_list("prod") - recipes.should =~ ["apache2", "apache2::mod_ssl", "apt", - "apt::only-in-1-0", "god"] - end - - it "should load all the cookbook versions with no policy" do - @environment.cookbook_versions({}) - Chef::CookbookVersion.should_receive(:cdb_list) - Chef::Environment.cdb_load_filtered_cookbook_versions("prod") - recipes = Chef::Environment.cdb_load_filtered_recipe_list("prod") - recipes.should =~ ["apache2", "apache2::mod_ssl", "apt", - "apt::only-in-1-1", "god"] - end - - it "should restrict the cookbook versions, as specified in the environment" do - res = Chef::Environment.cdb_load_filtered_cookbook_versions("prod") - res["apt"].detect {|cb| cb.version == "1.0.0"}.should_not == nil - res["apache2"].detect {|cb| cb.version == "2.0.0"}.should_not == nil - res["god"].detect {|cb| cb.version == "4.2.0"}.should_not == nil - end - - it "should produce correct results, regardless of the cookbook order in couch" do - # a bug present before the environments feature defaulted to the last CookbookVersion - # object for a cookbook as returned from couchdb when fetching cookbooks for a node - # this is a regression test - @all_cookbooks << begin - cv = Chef::CookbookVersion.new("god") - cv.version = "0.0.1" - cv - end - res = Chef::Environment.cdb_load_filtered_cookbook_versions("prod") - res["apt"].detect {|cb| cb.version == "1.0.0"}.should_not == nil - res["apache2"].detect {|cb| cb.version == "2.0.0"}.should_not == nil - res["god"].detect {|cb| cb.version == "4.2.0"}.should_not == nil - end - - it "should return all versions of a cookbook that meet the version requirement" do - @environment.cookbook "apt", ">= 1.0.0" - res = Chef::Environment.cdb_load_filtered_cookbook_versions("prod") - res["apt"].detect {|cb| cb.version == "1.0.0"}.should_not == nil - res["apt"].detect {|cb| cb.version == "1.1.0"}.should_not == nil - end - end - describe "self.validate_cookbook_versions" do before(:each) do @cookbook_versions = { @@ -376,35 +275,6 @@ describe Chef::Environment do end end - describe "self.create_default_environment" do - it "should check if the '_default' environment exists" do - @couchdb = Chef::CouchDB.new - Chef::CouchDB.stub!(:new).and_return @couchdb - Chef::Environment.should_receive(:cdb_load).with('_default', Chef::CouchDB.new) - Chef::Environment.create_default_environment - end - - it "should not re-create the environment if it exists" do - @couchdb = Chef::CouchDB.new - Chef::CouchDB.stub!(:new).and_return @couchdb - Chef::Environment.should_receive(:cdb_load).with('_default', Chef::CouchDB.new).and_return true - Chef::Environment.should_not_receive(:new) - Chef::Environment.create_default_environment - end - - it "should create the environment if it doesn't exist" do - @env = Chef::Environment.new - @env.stub!(:cdb_save).and_return true - @couchdb = Chef::CouchDB.new - Chef::Environment.stub!(:new).and_return @env - Chef::CouchDB.stub!(:new).and_return @couchdb - - Chef::Environment.should_receive(:cdb_load).with('_default', Chef::CouchDB.new).and_raise(Chef::Exceptions::CouchDBNotFound) - Chef::Environment.should_receive(:new) - Chef::Environment.create_default_environment - end - end - describe "when updating from a parameter hash" do before do @environment = Chef::Environment.new diff --git a/chef/spec/unit/exceptions_spec.rb b/chef/spec/unit/exceptions_spec.rb index fe920fd817..a979d2f6b9 100644 --- a/chef/spec/unit/exceptions_spec.rb +++ b/chef/spec/unit/exceptions_spec.rb @@ -8,9 +8,9 @@ # 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. @@ -40,7 +40,6 @@ describe Chef::Exceptions do Chef::Exceptions::Group => RuntimeError, Chef::Exceptions::Link => RuntimeError, Chef::Exceptions::Mount => RuntimeError, - Chef::Exceptions::CouchDBNotFound => RuntimeError, Chef::Exceptions::PrivateKeyMissing => RuntimeError, Chef::Exceptions::CannotWritePrivateKey => RuntimeError, Chef::Exceptions::RoleNotFound => RuntimeError, diff --git a/chef/spec/unit/index_queue_spec.rb b/chef/spec/unit/index_queue_spec.rb deleted file mode 100644 index 3043585757..0000000000 --- a/chef/spec/unit/index_queue_spec.rb +++ /dev/null @@ -1,391 +0,0 @@ -# -# Author:: Daniel DeLeo (<dan@kallistec.com>) -# Copyright:: Copyright (c) 2009 Daniel DeLeo -# 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. -# - -require 'spec_helper' - -class Chef - class IndexableTestHarness - include Chef::IndexQueue::Indexable - attr_reader :couchdb_id - def couchdb_id=(value) - self.index_id = @couchdb_id = value - end - attr_reader :index_id - def index_id=(value) - @index_id = value - end - - def to_hash - {"ohai_world" => "I am IndexableTestHarness", "object_id" => object_id} - end - - end -end - -class IndexQueueSpecError < RuntimeError ; end - -class FauxQueue - - attr_reader :published_message, :publish_options - - # Note: If publish is not called, this published_message will cause - # JSON parsing to die with "can't convert Symbol into String" - def initialize - @published_message = :epic_fail! - @publish_options = :epic_fail! - end - - def publish(message, options=nil) - @published_message = message - @publish_options = options - end -end - -class IndexConsumerTestHarness - include Chef::IndexQueue::Consumer - - attr_reader :last_indexed_object, :unexposed_attr - - expose :index_this - - def index_this(object_to_index) - @last_indexed_object = object_to_index - end - - def not_exposed(arg) - @unexposed_attr = arg - end -end - -describe Chef::IndexQueue::Indexable do - def a_uuid - /[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}/ - end - - before do - Chef::IndexableTestHarness.reset_index_metadata! - @publisher = Chef::IndexQueue::AmqpClient.instance - @indexable_obj = Chef::IndexableTestHarness.new - @item_as_hash = {"ohai_world" => "I am IndexableTestHarness", "object_id" => @indexable_obj.object_id} - - @now = Time.now - Time.stub!(:now).and_return(@now) - end - - it "downcases the class name for the index_object_type when it's not explicitly set" do - @indexable_obj.index_object_type.should == "indexable_test_harness" - end - - it "uses an explicitly set index_object_type" do - Chef::IndexableTestHarness.index_object_type :a_weird_name - @indexable_obj.index_object_type.should == "a_weird_name" - end - - it "adds 'database', 'type', and 'id' (UUID) keys to the published object" do - with_metadata = @indexable_obj.with_indexer_metadata(:database => "foo", :id=>UUIDTools::UUID.random_create.to_s) - with_metadata.should have(5).keys - with_metadata.keys.should include("type", "id", "item", "database", "enqueued_at") - with_metadata["type"].should == "indexable_test_harness" - with_metadata["database"].should == "foo" - with_metadata["item"].should == @item_as_hash - with_metadata["id"].should match(a_uuid) - with_metadata["enqueued_at"].should == @now.utc.to_i - end - - it "uses the couchdb_id if available" do - expected_uuid = "0000000-1111-2222-3333-444444444444" - @indexable_obj.couchdb_id = expected_uuid - metadata_id = @indexable_obj.with_indexer_metadata["id"] - metadata_id.should == expected_uuid - end - - describe "adds and removes items to and from the index and respects Chef::Config[:persistent_queue]" do - before do - @exchange = mock("Bunny::Exchange") - @amqp_client = mock("Bunny::Client", :start => true, :exchange => @exchange) - @publisher.stub!(:amqp_client).and_return(@amqp_client) - @queue = FauxQueue.new - @publisher.should_receive(:queue_for_object).with("0000000-1111-2222-3333-444444444444").and_yield(@queue) - Chef::Config[:persistent_queue] = false - end - - it "adds items to the index" do - @amqp_client.should_not_receive(:tx_select) - @amqp_client.should_not_receive(:tx_commit) - @amqp_client.should_not_receive(:tx_rollback) - - @indexable_obj.add_to_index(:database => "couchdb@localhost,etc.", :id=>"0000000-1111-2222-3333-444444444444") - - published_message = Chef::JSONCompat.from_json(@queue.published_message) - published_message.should == {"action" => "add", "payload" => {"item" => @item_as_hash, - "type" => "indexable_test_harness", - "database" => "couchdb@localhost,etc.", - "id" => "0000000-1111-2222-3333-444444444444", - "enqueued_at" => @now.utc.to_i}} - @queue.publish_options[:persistent].should == false - end - - it "adds items to the index transactionactionally when Chef::Config[:persistent_queue] == true" do - @amqp_client.should_receive(:tx_select) - @amqp_client.should_receive(:tx_commit) - @amqp_client.should_not_receive(:tx_rollback) - - # set and restore Chef::Config[:persistent_queue] to true - orig_value = Chef::Config[:persistent_queue] - Chef::Config[:persistent_queue] = true - begin - @indexable_obj.add_to_index(:database => "couchdb@localhost,etc.", :id=>"0000000-1111-2222-3333-444444444444") - ensure - Chef::Config[:persistent_queue] = orig_value - end - - published_message = Chef::JSONCompat.from_json(@queue.published_message) - published_message.should == {"action" => "add", "payload" => {"item" => @item_as_hash, - "type" => "indexable_test_harness", - "database" => "couchdb@localhost,etc.", - "id" => "0000000-1111-2222-3333-444444444444", - "enqueued_at" => @now.utc.to_i}} - @queue.publish_options[:persistent].should == true - end - - it "adds items to the index transactionally when Chef::Config[:persistent_queue] == true and rolls it back when there is a failure" do - @amqp_client.should_receive(:tx_select) - @amqp_client.should_receive(:tx_rollback) - @amqp_client.should_not_receive(:tx_commit) - - # cause the publish to fail, and make sure the failure is our own - # by using a specific class - @queue.should_receive(:publish).and_raise(IndexQueueSpecError) - - # set and restore Chef::Config[:persistent_queue] to true - orig_value = Chef::Config[:persistent_queue] - Chef::Config[:persistent_queue] = true - begin - lambda{ - @indexable_obj.add_to_index(:database => "couchdb@localhost,etc.", :id=>"0000000-1111-2222-3333-444444444444") - }.should raise_error(IndexQueueSpecError) - ensure - Chef::Config[:persistent_queue] = orig_value - end - end - - it "removes items from the index" do - @amqp_client.should_not_receive(:tx_select) - @amqp_client.should_not_receive(:tx_commit) - @amqp_client.should_not_receive(:tx_rollback) - - @indexable_obj.delete_from_index(:database => "couchdb2@localhost", :id=>"0000000-1111-2222-3333-444444444444") - published_message = Chef::JSONCompat.from_json(@queue.published_message) - published_message.should == {"action" => "delete", "payload" => { "item" => @item_as_hash, - "type" => "indexable_test_harness", - "database" => "couchdb2@localhost", - "id" => "0000000-1111-2222-3333-444444444444", - "enqueued_at" => @now.utc.to_i}} - @queue.publish_options[:persistent].should == false - end - - it "removes items from the index transactionactionally when Chef::Config[:persistent_queue] == true" do - @amqp_client.should_receive(:tx_select) - @amqp_client.should_receive(:tx_commit) - @amqp_client.should_not_receive(:tx_rollback) - - # set and restore Chef::Config[:persistent_queue] to true - orig_value = Chef::Config[:persistent_queue] - Chef::Config[:persistent_queue] = true - begin - @indexable_obj.delete_from_index(:database => "couchdb2@localhost", :id=>"0000000-1111-2222-3333-444444444444") - ensure - Chef::Config[:persistent_queue] = orig_value - end - - published_message = Chef::JSONCompat.from_json(@queue.published_message) - published_message.should == {"action" => "delete", "payload" => { "item" => @item_as_hash, - "type" => "indexable_test_harness", - "database" => "couchdb2@localhost", - "id" => "0000000-1111-2222-3333-444444444444", - "enqueued_at" => @now.utc.to_i}} - @queue.publish_options[:persistent].should == true - end - - it "remove items from the index transactionally when Chef::Config[:persistent_queue] == true and rolls it back when there is a failure" do - @amqp_client.should_receive(:tx_select) - @amqp_client.should_receive(:tx_rollback) - @amqp_client.should_not_receive(:tx_commit) - - # cause the publish to fail, and make sure the failure is our own - # by using a specific class - @queue.should_receive(:publish).and_raise(IndexQueueSpecError) - - # set and restore Chef::Config[:persistent_queue] to true - orig_value = Chef::Config[:persistent_queue] - Chef::Config[:persistent_queue] = true - begin - lambda{ - @indexable_obj.delete_from_index(:database => "couchdb2@localhost", :id=>"0000000-1111-2222-3333-444444444444") }.should raise_error(IndexQueueSpecError) - ensure - Chef::Config[:persistent_queue] = orig_value - end - end - end - -end - -describe Chef::IndexQueue::Consumer do - before do - @amqp_client = Chef::IndexQueue::AmqpClient.instance - @consumer = IndexConsumerTestHarness.new - end - - it "keeps a whitelist of exposed methods" do - IndexConsumerTestHarness.exposed_methods.should == [:index_this] - IndexConsumerTestHarness.whitelisted?(:index_this).should be_true - IndexConsumerTestHarness.whitelisted?(:not_exposed).should be_false - end - - it "doesn't route non-whitelisted methods" do - payload_json = {"payload" => {"a_placeholder" => "object"}, "action" => "not_exposed"}.to_json - received_message = {:payload => payload_json} - lambda {@consumer.call_action_for_message(received_message)}.should raise_error(ArgumentError) - @consumer.unexposed_attr.should be_nil - end - - it "routes message payloads to the correct method" do - payload_json = {"payload" => {"a_placeholder" => "object"}, "action" => "index_this"}.to_json - received_message = {:payload => payload_json} - @consumer.call_action_for_message(received_message) - @consumer.last_indexed_object.should == {"a_placeholder" => "object"} - - end - - it "subscribes to the queue for the indexer" do - payload_json = {"payload" => {"a_placeholder" => "object"}, "action" => "index_this"}.to_json - message = {:payload => payload_json} - queue = mock("Bunny::Queue") - @amqp_client.stub!(:queue).and_return(queue) - queue.should_receive(:subscribe).with(:timeout => false, :ack => true).and_yield(message) - @consumer.run - @consumer.last_indexed_object.should == {"a_placeholder" => "object"} - end - -end - - -describe Chef::IndexQueue::AmqpClient do - before do - Chef::Config[:amqp_host] = '4.3.2.1' - Chef::Config[:amqp_port] = '1337' - Chef::Config[:amqp_user] = 'teh_rspecz' - Chef::Config[:amqp_pass] = 'access_granted2rspec' - Chef::Config[:amqp_vhost] = '/chef-specz' - Chef::Config[:amqp_consumer_id] = nil - - @publisher = Chef::IndexQueue::AmqpClient.instance - @exchange = mock("Bunny::Exchange") - - @amqp_client = mock("Bunny::Client", :start => true, :exchange => @exchange) - def @amqp_client.connected?; false; end # stubbing predicate methods not working? - Bunny.stub!(:new).and_return(@amqp_client) - - @publisher.reset! - end - - after do - @publisher.disconnected! - end - - it "is a singleton" do - lambda {Chef::IndexQueue::Indexable::AmqpClient.new}.should raise_error - end - - it "creates an amqp client object on demand, starts a connection, and caches it" do - @amqp_client.should_receive(:start).once - @amqp_client.should_receive(:qos).with(:prefetch_count => 1) - ::Bunny.should_receive(:new).once.and_return(@amqp_client) - @publisher.amqp_client.should == @amqp_client - @publisher.amqp_client - end - - it "configures the amqp client with credentials from the config file" do - @publisher.reset! - Bunny.should_receive(:new).with(:spec => '08', :host => '4.3.2.1', :port => '1337', :user => "teh_rspecz", - :pass => "access_granted2rspec", :vhost => '/chef-specz').and_return(@amqp_client) - @amqp_client.should_receive(:qos).with(:prefetch_count => 1) - @publisher.amqp_client.should == @amqp_client - end - - it "creates an amqp exchange on demand and caches it" do - @amqp_client.stub!(:qos) - @publisher.exchange.should == @exchange - @amqp_client.should_not_receive(:exchange) - @publisher.exchange.should == @exchange - end - - describe "publishing" do - - before do - @queue_1 = FauxQueue.new - @queue_2 = FauxQueue.new - - @amqp_client.stub!(:qos) - #@amqp_client.stub!(:queue).and_return(@queue) - @data = {"some_data" => "in_a_hash"} - end - - it "resets the client upon a Bunny::ServerDownError when publishing" do - Bunny.stub!(:new).and_return(@amqp_client) - @amqp_client.should_receive(:queue).with("vnode-68", {:passive=>false, :durable=>true, :exclusive=>false, :auto_delete=>false}).twice.and_return(@queue_1, @queue_2) - - @queue_1.should_receive(:publish).with(@data).and_raise(Bunny::ServerDownError) - @queue_2.should_receive(:publish).with(@data).and_raise(Bunny::ServerDownError) - - @publisher.should_receive(:disconnected!).at_least(3).times - lambda {@publisher.queue_for_object("00000000-1111-2222-3333-444444444444") {|q| q.publish(@data)}}.should raise_error(Bunny::ServerDownError) - end - - it "resets the client upon a Bunny::ConnectionError when publishing" do - Bunny.stub!(:new).and_return(@amqp_client) - @amqp_client.should_receive(:queue).with("vnode-68", {:passive=>false, :durable=>true, :exclusive=>false, :auto_delete=>false}).twice.and_return(@queue_1, @queue_2) - - @queue_1.should_receive(:publish).with(@data).and_raise(Bunny::ConnectionError) - @queue_2.should_receive(:publish).with(@data).and_raise(Bunny::ConnectionError) - - @publisher.should_receive(:disconnected!).at_least(3).times - lambda {@publisher.queue_for_object("00000000-1111-2222-3333-444444444444") {|q| q.publish(@data)}}.should raise_error(Bunny::ConnectionError) - end - - it "resets the client upon a Errno::ECONNRESET when publishing" do - Bunny.stub!(:new).and_return(@amqp_client) - @amqp_client.should_receive(:queue).with("vnode-68", {:passive=>false, :durable=>true, :exclusive=>false, :auto_delete=>false}).twice.and_return(@queue_1, @queue_2) - - @queue_1.should_receive(:publish).with(@data).and_raise(Errno::ECONNRESET) - @queue_2.should_receive(:publish).with(@data).and_raise(Errno::ECONNRESET) - - @publisher.should_receive(:disconnected!).at_least(3).times - lambda {@publisher.queue_for_object("00000000-1111-2222-3333-444444444444") {|q| q.publish(@data)}}.should raise_error(Errno::ECONNRESET) - end - - end - - it "stops bunny and clears subscriptions" do - bunny_client = mock("Bunny::Client") - @publisher.instance_variable_set(:@amqp_client, bunny_client) - bunny_client.should_receive(:stop) - @publisher.stop - end - -end diff --git a/chef/spec/unit/knife/ssh_spec.rb b/chef/spec/unit/knife/ssh_spec.rb index a4853e11cc..6e90a87f01 100644 --- a/chef/spec/unit/knife/ssh_spec.rb +++ b/chef/spec/unit/knife/ssh_spec.rb @@ -36,10 +36,10 @@ describe Chef::Knife::Ssh do @knife = Chef::Knife::Ssh.new @knife.config.clear @knife.config[:attribute] = "fqdn" - @node_foo = Chef::Node.new('foo') + @node_foo = Chef::Node.new @node_foo.automatic_attrs[:fqdn] = "foo.example.org" @node_foo.automatic_attrs[:ipaddress] = "10.0.0.1" - @node_bar = Chef::Node.new('bar') + @node_bar = Chef::Node.new @node_bar.automatic_attrs[:fqdn] = "bar.example.org" @node_bar.automatic_attrs[:ipaddress] = "10.0.0.2" end @@ -64,7 +64,7 @@ describe Chef::Knife::Ssh do @knife.should_receive(:session_from_list).with(['10.0.0.1', '10.0.0.2']) @knife.configure_session end - + it "returns an array of the attributes specified on the command line even when a config value is set" do @knife.config[:attribute] = "config_file" # this value will be the config file @knife.config[:override_attribute] = "ipaddress" # this is the value of the command line via #configure_attribute diff --git a/chef/spec/unit/lwrp_spec.rb b/chef/spec/unit/lwrp_spec.rb index 76834cf182..da2278e547 100644 --- a/chef/spec/unit/lwrp_spec.rb +++ b/chef/spec/unit/lwrp_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -94,7 +94,7 @@ describe "LWRP" do end it "should have access to the run context and node during class definition" do - node = Chef::Node.new(nil) + node = Chef::Node.new node.normal[:penguin_name] = "jackass" run_context = Chef::RunContext.new(node, Chef::CookbookCollection.new, @events) diff --git a/chef/spec/unit/mixin/params_validate_spec.rb b/chef/spec/unit/mixin/params_validate_spec.rb index dd0366c37c..b79156109b 100644 --- a/chef/spec/unit/mixin/params_validate_spec.rb +++ b/chef/spec/unit/mixin/params_validate_spec.rb @@ -330,10 +330,12 @@ describe Chef::Mixin::ParamsValidate do it "asserts that a value returns false from a predicate method" do lambda do - @vo.validate({:not_blank => "should pass"}, {:not_blank => {:cannot_be => :blank}}) + @vo.validate({:not_blank => "should pass"}, + {:not_blank => {:cannot_be => :nil, :cannot_be => :empty}}) end.should_not raise_error lambda do - @vo.validate({:not_blank => ""}, {:not_blank => {:cannot_be => :blank}}) + @vo.validate({:not_blank => ""}, + {:not_blank => {:cannot_be => :nil, :cannot_be => :empty}}) end.should raise_error(Chef::Exceptions::ValidationFailed) end diff --git a/chef/spec/unit/node_spec.rb b/chef/spec/unit/node_spec.rb index 4577d5098b..b6f63c9651 100644 --- a/chef/spec/unit/node_spec.rb +++ b/chef/spec/unit/node_spec.rb @@ -681,80 +681,4 @@ describe Chef::Node do end end - describe "acting as a CouchDB-backed model" do - before(:each) do - @couchdb = Chef::CouchDB.new - @mock_couch = mock('couch mock') - end - - describe "list" do - before(:each) do - @mock_couch.stub!(:list).and_return( - { "rows" => [ { "value" => "a", "key" => "avenue" } ] } - ) - Chef::CouchDB.stub!(:new).and_return(@mock_couch) - end - - it "should retrieve a list of nodes from CouchDB" do - Chef::Node.cdb_list.should eql(["avenue"]) - end - - it "should return just the ids if inflate is false" do - Chef::Node.cdb_list(false).should eql(["avenue"]) - end - - it "should return the full objects if inflate is true" do - Chef::Node.cdb_list(true).should eql(["a"]) - end - end - - describe "when loading a given node" do - it "should load a node from couchdb by name" do - @couchdb.should_receive(:load).with("node", "coffee").and_return(true) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - Chef::Node.cdb_load("coffee") - end - end - - describe "when destroying a Node" do - it "should delete this node from couchdb" do - @couchdb.should_receive(:delete).with("node", "bob", 1).and_return(true) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - node = Chef::Node.new - node.name "bob" - node.couchdb_rev = 1 - node.cdb_destroy - end - end - - describe "when saving a Node" do - before(:each) do - @couchdb.stub!(:store).and_return({ "rev" => 33 }) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - @node = Chef::Node.new - @node.name "bob" - @node.couchdb_rev = 1 - end - - it "should save the node to couchdb" do - @couchdb.should_receive(:store).with("node", "bob", @node).and_return({ "rev" => 33 }) - @node.cdb_save - end - - it "should store the new couchdb_rev" do - @node.cdb_save - @node.couchdb_rev.should eql(33) - end - end - - describe "create_design_document" do - it "should create our design document" do - @couchdb.should_receive(:create_design_document).with("nodes", Chef::Node::DESIGN_DOCUMENT) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - Chef::Node.create_design_document - end - end - - end - end diff --git a/chef/spec/unit/openid_registration_spec.rb b/chef/spec/unit/openid_registration_spec.rb deleted file mode 100644 index 70d4964104..0000000000 --- a/chef/spec/unit/openid_registration_spec.rb +++ /dev/null @@ -1,153 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'spec_helper' - -describe Chef::OpenIDRegistration, "initialize" do - it "should return a new Chef::OpenIDRegistration object" do - Chef::OpenIDRegistration.new.should be_kind_of(Chef::OpenIDRegistration) - end -end - -describe Chef::OpenIDRegistration, "set_password" do - it "should generate a salt for this object" do - oreg = Chef::OpenIDRegistration.new - oreg.salt.should eql(nil) - oreg.set_password("foolio") - oreg.salt.should_not eql(nil) - end - - it "should encrypt the password with the salt and the plaintext password" do - oreg = Chef::OpenIDRegistration.new - oreg.set_password("foolio") - oreg.password.should_not eql(nil) - end -end - -describe Chef::OpenIDRegistration, "to_json" do - it "should serialize itself as json" do - oreg = Chef::OpenIDRegistration.new - oreg.set_password("monkey") - json = oreg.to_json - %w{json_class chef_type name salt password validated}.each do |verify| - json.should =~ /#{verify}/ - end - end -end - -describe Chef::OpenIDRegistration, "from_json" do - it "should serialize itself as json" do - oreg = Chef::OpenIDRegistration.new() - oreg.name = "foobar" - oreg.set_password("monkey") - oreg_json = oreg.to_json - nreg = Chef::JSONCompat.from_json(oreg_json) - nreg.should be_a_kind_of(Chef::OpenIDRegistration) - %w{name salt password validated}.each do |verify| - nreg.send(verify.to_sym).should eql(oreg.send(verify.to_sym)) - end - end -end - -describe Chef::OpenIDRegistration, "list" do - before(:each) do - @mock_couch = mock("Chef::CouchDB") - @mock_couch.stub!(:list).and_return({ - "rows" => [ - { - "value" => "a", - "key" => "avenue" - } - ] - }) - Chef::CouchDB.stub!(:new).and_return(@mock_couch) - end - - it "should retrieve a list of nodes from CouchDB" do - Chef::OpenIDRegistration.list.should eql(["avenue"]) - end - - it "should return just the ids if inflate is false" do - Chef::OpenIDRegistration.list(false).should eql(["avenue"]) - end - - it "should return the full objects if inflate is true" do - Chef::OpenIDRegistration.list(true).should eql(["a"]) - end -end - -describe Chef::OpenIDRegistration, "load" do - it "should load a registration from couchdb by name" do - @mock_couch = mock("Chef::CouchDB") - Chef::CouchDB.stub!(:new).and_return(@mock_couch) - @mock_couch.should_receive(:load).with("openid_registration", "coffee").and_return(true) - Chef::OpenIDRegistration.load("coffee") - end -end - -describe Chef::OpenIDRegistration, "destroy" do - it "should delete this registration from couchdb" do - @mock_couch = mock("Chef::CouchDB") - @mock_couch.should_receive(:delete).with("openid_registration", "bob", 1).and_return(true) - Chef::CouchDB.stub!(:new).and_return(@mock_couch) - reg = Chef::OpenIDRegistration.new - reg.name = "bob" - reg.couchdb_rev = 1 - reg.destroy - end -end - -describe Chef::OpenIDRegistration, "save" do - before(:each) do - @mock_couch = mock("Chef::CouchDB") - Chef::CouchDB.stub!(:new).and_return(@mock_couch) - @reg = Chef::OpenIDRegistration.new - @reg.name = "bob" - @reg.couchdb_rev = 1 - end - - it "should save the registration to couchdb" do - @mock_couch.should_receive(:store).with("openid_registration", "bob", @reg).and_return({ "rev" => 33 }) - @reg.save - end - - it "should store the new couchdb_rev" do - @mock_couch.stub!(:store).with("openid_registration", "bob", @reg).and_return({ "rev" => 33 }) - @reg.save - @reg.couchdb_rev.should eql(33) - end -end - -describe Chef::OpenIDRegistration, "create_design_document" do - it "should create our design document" do - mock_couch = mock("Chef::CouchDB") - mock_couch.should_receive(:create_design_document).with("registrations", Chef::OpenIDRegistration::DESIGN_DOCUMENT) - Chef::CouchDB.stub!(:new).and_return(mock_couch) - Chef::OpenIDRegistration.create_design_document - end -end - -describe Chef::OpenIDRegistration, "has_key?" do - it "should check with CouchDB for a registration with this key" do - @mock_couch = mock("Chef::CouchDB") - @mock_couch.should_receive(:has_key?).with("openid_registration", "bob").and_return(true) - Chef::CouchDB.stub!(:new).and_return(@mock_couch) - Chef::OpenIDRegistration.has_key?("bob") - end -end - diff --git a/chef/spec/unit/provider/ohai_spec.rb b/chef/spec/unit/provider/ohai_spec.rb index c86ad288eb..8402c92e97 100644 --- a/chef/spec/unit/provider/ohai_spec.rb +++ b/chef/spec/unit/provider/ohai_spec.rb @@ -34,7 +34,7 @@ describe Chef::Provider::Ohai do :platform => @platform, :platform_version => @platform_version, :data => { - :origdata => "somevalue" + :origdata => "somevalue" }, :data2 => { :origdata => "somevalue", @@ -49,7 +49,7 @@ describe Chef::Provider::Ohai do Chef::Platform.stub!(:find_platform_and_version).and_return({ "platform" => @platform, "platform_version" => @platform_version}) # Fake node with a dummy save - @node = Chef::Node.new(@hostname) + @node = Chef::Node.new @node.name(@fqdn) @node.stub!(:save).and_return(@node) @events = Chef::EventDispatch::Dispatcher.new diff --git a/chef/spec/unit/run_list_spec.rb b/chef/spec/unit/run_list_spec.rb index cc261edbd8..f18f21a82b 100644 --- a/chef/spec/unit/run_list_spec.rb +++ b/chef/spec/unit/run_list_spec.rb @@ -23,13 +23,6 @@ require 'spec_helper' require 'chef/version_class' require 'chef/version_constraint' -# dep_selector/gecode on many platforms is currenly a bowel of hurt -begin -require 'chef/cookbook_version_selector' -rescue LoadError - STDERR.puts "\n*** dep_selector not installed. marking all unit tests 'pending' that have a transitive dependency on dep_selector. ***\n\n" -end - describe Chef::RunList do before(:each) do @run_list = Chef::RunList.new @@ -255,13 +248,6 @@ describe Chef::RunList do end - describe "from couchdb" do - it "should load the role from couchdb" do - Chef::Role.should_receive(:cdb_load).and_return(@role) - @run_list.expand("_default", "couchdb") - end - end - it "should return the list of expanded recipes" do expansion = @run_list.expand("_default") expansion.recipes[0].should == "one" @@ -323,199 +309,4 @@ describe Chef::RunList do end - describe "constrain" do - - pending "=> can't find 'dep_selector' gem...skipping Chef::CookbookVersionSelector related tests" do - - @fake_db = Object.new - - def cookbook_maker(name, version, deps) - book = Chef::CookbookVersion.new(name, @fake_db) - book.version = version - deps.each { |dep_name, vc| book.metadata.depends(dep_name, vc) } - book - end - - def vc_maker(cookbook_name, version_constraint) - vc = Chef::VersionConstraint.new(version_constraint) - { :name => cookbook_name, :version_constraint => vc } - end - - def assert_failure_unsatisfiable_item(run_list, all_cookbooks, constraints, expected_message) - begin - Chef::CookbookVersionSelector.constrain(all_cookbooks, constraints) - fail "Should have raised a Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem exception" - rescue Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem => urli - urli.message.should include(expected_message) - end - end - - def assert_failure_invalid_items(run_list, all_cookbooks, constraints, expected_message) - begin - Chef::CookbookVersionSelector.constrain(all_cookbooks, constraints) - fail "Should have raised a Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems exception" - rescue Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems => irli - irli.message.should include(expected_message) - end - end - - before(:each) do - a1 = cookbook_maker("a", "1.0", [["c", "< 4.0"]]) - b1 = cookbook_maker("b", "1.0", [["c", "< 3.0"]]) - - c2 = cookbook_maker("c", "2.0", [["d", "> 1.0"], ["f", nil]]) - c3 = cookbook_maker("c", "3.0", [["d", "> 2.0"], ["e", nil]]) - - d1_1 = cookbook_maker("d", "1.1", []) - d2_1 = cookbook_maker("d", "2.1", []) - e1 = cookbook_maker("e", "1.0", []) - f1 = cookbook_maker("f", "1.0", []) - g1 = cookbook_maker("g", "1.0", [["d", "> 5.0"]]) - - n1_1 = cookbook_maker("n", "1.1", []) - n1_2 = cookbook_maker("n", "1.2", []) - n1_10 = cookbook_maker("n", "1.10", []) - - depends_on_nosuch = cookbook_maker("depends_on_nosuch", "1.0", [["nosuch", nil]]) - - @all_cookbooks = { - "a" => [a1], - "b" => [b1], - "c" => [c2, c3], - "d" => [d1_1, d2_1], - "e" => [e1], - "f" => [f1], - "g" => [g1], - "n" => [n1_1, n1_2, n1_10], - "depends_on_nosuch" => [depends_on_nosuch] - } - - $stderr.reopen DEV_NULL - end - - after do - $stderr.reopen STDERR - end - - it "pulls in transitive dependencies" do - constraints = [vc_maker("a", "~> 1.0")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - %w(a c d e).each { |k| cookbooks.should have_key k } - cookbooks.size.should == 4 - cookbooks["c"].version.should == "3.0.0" - cookbooks["d"].version.should == "2.1.0" - end - - it "should satisfy recipe-specific dependencies" do - depends_on_recipe = cookbook_maker("depends_on_recipe", "1.0", [["f::recipe", "1.0"]]) - @all_cookbooks["depends_on_recipe"] = [depends_on_recipe] - constraints = [vc_maker("depends_on_recipe", "= 1.0")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks["f"].version.should == "1.0.0" - end - - it "properly sorts version triples, treating each term numerically" do - constraints = [vc_maker("n", "> 1.2")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 1 - cookbooks["n"].version.should == "1.10.0" - end - - it "should fail to find a solution when a run list item is constrained to a range that includes no cookbooks" do - constraints = [vc_maker("d", "> 5.0")] - assert_failure_invalid_items(@run_list, @all_cookbooks, constraints, "Run list contains invalid items: no versions match the constraints on cookbook d.") - end - - it "should fail to find a solution when a run list item's dependency is constrained to a range that includes no cookbooks" do - constraints = [vc_maker("g", nil)] - assert_failure_unsatisfiable_item(@run_list, @all_cookbooks, constraints, "Unable to satisfy constraints on cookbook d due to run list item (g >= 0.0.0)") - end - - it "selects 'd 2.1.0' given constraint 'd > 1.2.3'" do - constraints = [vc_maker("d", "> 1.2.3")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 1 - cookbooks["d"].version.should == "2.1.0" - end - - it "selects largest version when constraint allows multiple" do - constraints = [vc_maker("d", "> 1.0")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 1 - cookbooks["d"].version.should == "2.1.0" - end - - it "selects 'd 1.1.0' given constraint 'd ~> 1.0'" do - constraints = [vc_maker("d", "~> 1.0")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 1 - cookbooks["d"].version.should == "1.1.0" - end - - it "raises InvalidRunListItems for an unknown cookbook in the run list" do - constraints = [vc_maker("nosuch", "1.0.0")] - assert_failure_invalid_items(@run_list, @all_cookbooks, constraints, "Run list contains invalid items: no such cookbook nosuch.") - end - - it "raises CookbookVersionConflict for an unknown cookbook in a cookbook's dependencies" do - constraints = [vc_maker("depends_on_nosuch", "1.0.0")] - assert_failure_unsatisfiable_item(@run_list, @all_cookbooks, constraints, "Unable to satisfy constraints on cookbook nosuch, which does not exist, due to run list item (depends_on_nosuch = 1.0.0). Run list items that may result in a constraint on nosuch: [(depends_on_nosuch = 1.0.0) -> (nosuch >= 0.0.0)]") - end - - it "raises UnsatisfiableRunListItem for direct conflict" do - constraints = [vc_maker("d", "= 1.1.0"), vc_maker("d", ">= 2.0")] - assert_failure_unsatisfiable_item(@run_list, @all_cookbooks, constraints, "Unable to satisfy constraints on cookbook d due to run list item (d >= 2.0.0)") - end - - describe "should solve regardless of constraint order" do - - it "raises CookbookVersionConflict a then b" do - # Cookbooks a and b both have a dependency on c, but with - # differing constraints. - constraints = [vc_maker("a", "1.0"), vc_maker("b", "1.0")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 5 - %w(a b c d f).each { |k| cookbooks.should have_key k } - cookbooks["a"].version.should == "1.0.0" - cookbooks["b"].version.should == "1.0.0" - cookbooks["c"].version.should == "2.0.0" - cookbooks["d"].version.should == "2.1.0" - end - - it "resolves b then a" do - # See above comment for a then b. When b is pulled in first, - # we should get a version of c that satifies the constraints - # on the c dependency for both b and a. - constraints = [vc_maker("b", "1.0"), vc_maker("a", "1.0")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 5 - %w(a b c d f).each { |k| cookbooks.should have_key k } - cookbooks["a"].version.should == "1.0.0" - cookbooks["b"].version.should == "1.0.0" - cookbooks["c"].version.should == "2.0.0" - cookbooks["d"].version.should == "2.1.0" - end - - it "resolves a then d" do - constraints = [vc_maker("a", "1.0"), vc_maker("d", "1.1")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 4 - %w(a c d f).each { |k| cookbooks.should have_key k } - cookbooks["a"].version.should == "1.0.0" - cookbooks["c"].version.should == "2.0.0" - cookbooks["d"].version.should == "1.1.0" - end - - it "resolves d then a" do - constraints = [vc_maker("d", "1.1"), vc_maker("a", "1.0")] - cookbooks = Chef::CookbookVersionSelector.constrain(@all_cookbooks, constraints) - cookbooks.size.should == 4 - %w(a c d f).each { |k| cookbooks.should have_key k } - cookbooks["a"].version.should == "1.0.0" - cookbooks["c"].version.should == "2.0.0" - cookbooks["d"].version.should == "1.1.0" - end - end - end - end end diff --git a/chef/spec/unit/solr_query/query_transform_spec.rb b/chef/spec/unit/solr_query/query_transform_spec.rb deleted file mode 100644 index f3fc746746..0000000000 --- a/chef/spec/unit/solr_query/query_transform_spec.rb +++ /dev/null @@ -1,454 +0,0 @@ -# -# Author:: Seth Falcon (<seth@opscode.com>) -# Copyright:: Copyright (c) 2010-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. -# - -require 'spec_helper' -require 'chef/solr_query/query_transform' - -describe "Chef::SolrQuery::QueryTransform" do - before(:each) do - @parser = Chef::SolrQuery::QueryTransform - @parseError = Chef::Exceptions::QueryParseError - end - - describe "single term queries" do - basic_terms = %w(a ab 123 a1 2b foo_bar baz-baz) - basic_terms << " leading" - basic_terms << "trailing " - basic_terms += %w(XAND ANDX XOR ORX XNOT NOTX) - basic_terms.each do |term| - expect = "T:#{term.strip}" - it "'#{term}' => #{expect}" do - @parser.parse(term).should == expect - end - end - describe "invalid" do - %w(AND OR NOT :).each do |t| - it "'#{t}' => ParseError" do - lambda { @parser.parse(t) }.should raise_error(@parseError) - end - end - end - - describe "wildcards in terms" do - it "allows * as a wildcard" do - @parser.parse("foo*bar").should == "T:foo*bar" - end - - it "allows a single ? as a wildcard" do - @parser.parse("foo?bar").should == "T:foo?bar" - end - - it "allows multiple ? as fixed length wildcards" do - @parser.parse("foo???bar").should == "T:foo???bar" - end - - it "allows a leading wildcard with *" do - # NOTE: This is not valid lucene query syntax. However, our - # index format and query transformation can allow it because - # the transformed query ends up with the '*' not in leading - # position. We decided that allowing it makes sense because - # queries like ec2:* are useful and many users expect this - # behavior to work. - @parser.parse("*foobar").should == "T:*foobar" - end - - it "does not allow a leading wildcard with ?" do - lambda { @parser.parse("?foobar") }.should raise_error(@parseError) - end - - it "does not allow a leading wildcard with ?" do - lambda { @parser.parse("afield:?foobar") }.should raise_error(@parseError) - end - - end - - describe "escaped special characters in terms" do - special_chars = ["!", "(", ")", "{", "}", "[", "]", "^", "\"", - "~", "*", "?", ":", "\\", "&", "|", "+", "-"] - example_fmts = ['foo%sbar', '%sb', 'a%s'] - special_chars.each do |char| - example_fmts.each do |fmt| - input = fmt % ("\\" + char) - expect = "T:#{input}" - it "'#{input}' => #{expect}" do - @parser.parse(input).should == expect - end - end - end - end - - describe "special characters in terms are not allowed" do - # NOTE: '*' is not a valid start letter for a lucene search - # term, however, we can support it because of our index - # structure and query transformation. We decided to keep this - # flexibility because queries like ec2:* are common and useful. - prefix_ok = ["!", "+", "-", "*"] - suffix_ok = ["*", "?", "~", "-"] - # FIXME: ideally, '!' would not be allowed in the middle of a - # term. Currently we parse foo!bar the same as foo !bar. - # Also '+' might be nice to disallow - embed_ok = ["*", "?", ":", "-", "!", "+"] - special_chars = ["!", "(", ")", "{", "}", "[", "]", "^", "\"", - "~", "*", "?", ":", "\\", "&", "|", "+", "-"] - example_fmts = { - :prefix => '%sb', - :middle => 'foo%sbar', - :suffix => 'a%s' - } - special_chars.each do |char| - example_fmts.keys.each do |key| - fmt = example_fmts[key] - if key == :prefix && prefix_ok.include?(char) - :pass - elsif key == :middle && embed_ok.include?(char) - :pass - elsif key == :suffix && suffix_ok.include?(char) - :pass - else - input = fmt % char - it "disallows: '#{input}'" do - lambda { @parser.parse(input) }.should raise_error(@parseError) - end - end - end - end - end - - end - - describe "multiple terms" do - it "should allow multiple terms" do - @parser.parse("a b cdefg").should == "T:a T:b T:cdefg" - end - end - - describe "boolean queries" do - describe "two term basic and/or" do - binary_operators = [['AND', 'AND'], ['&&', 'AND'], ['OR', 'OR'], ['||', 'OR']] - binary_operators.each do |op, op_name| - expect = "(OP:#{op_name} T:t1 T:t2)" - it "should parse 't1 #{op} t2' => #{expect}" do - @parser.parse("t1 #{op} t2").should == expect - end - end - end - - it "should allow a string of terms with ands and ors" do - expect = "(OP:AND T:t1 (OP:OR T:t2 (OP:AND T:t3 T:t4)))" - @parser.parse("t1 AND t2 OR t3 AND t4").should == expect - end - end - - describe "grouping with parens" do - it "should create a single group for (aterm)" do - @parser.parse("(aterm)").should == "(T:aterm)" - end - - describe "and booleans" do - - %w(AND &&).each do |op| - expect = "((OP:AND T:a T:b))" - input = "(a #{op} b)" - it "parses #{input} => #{expect}" do - @parser.parse(input).should == expect - end - end - - %w(OR ||).each do |op| - expect = "((OP:OR T:a T:b))" - input = "(a #{op} b)" - it "parses #{input} => #{expect}" do - @parser.parse(input).should == expect - end - end - - it "should handle a LHS group" do - expect = "(OP:OR ((OP:AND T:a T:b)) T:c)" - @parser.parse("(a && b) OR c").should == expect - @parser.parse("(a && b) || c").should == expect - end - - it "should handle a RHS group" do - expect = "(OP:OR T:c ((OP:AND T:a T:b)))" - @parser.parse("c OR (a && b)").should == expect - @parser.parse("c OR (a AND b)").should == expect - end - - it "should handle both sides as groups" do - expect = "(OP:OR ((OP:AND T:c T:d)) ((OP:AND T:a T:b)))" - @parser.parse("(c AND d) OR (a && b)").should == expect - end - end - end - - describe "NOT queries" do - # input, output - [ - ["a NOT b", "T:a (OP:NOT T:b)"], - ["a ! b", "T:a (OP:NOT T:b)"], - ["a !b", "T:a (OP:NOT T:b)"], - ["a NOT (b || c)", "T:a (OP:NOT ((OP:OR T:b T:c)))"], - ["a ! (b || c)", "T:a (OP:NOT ((OP:OR T:b T:c)))"], - ["a !(b || c)", "T:a (OP:NOT ((OP:OR T:b T:c)))"] - ].each do |input, expected| - it "should parse '#{input}' => #{expected.inspect}" do - @parser.parse(input).should == expected - end - end - - ["NOT", "a NOT", "(NOT)"].each do |d| - it "should raise a ParseError on '#{d}'" do - lambda { @parser.parse(d) }.should raise_error(@parseError) - end - end - end - - describe 'required and prohibited prefixes (+/-)' do - ["+", "-"].each do |kind| - [ - ["#{kind}foo", "(OP:#{kind} T:foo)"], - ["bar #{kind}foo", "T:bar (OP:#{kind} T:foo)"], - ["(#{kind}oneA twoA) b", "((OP:#{kind} T:oneA) T:twoA) T:b"] - ].each do |input, expect| - it "should parse '#{input} => #{expect.inspect}" do - @parser.parse(input).should == expect - end - end - end - - # it 'ignores + embedded in a term' do - # @parser.parse("one+two").should == "T:one+two" - # end - - it 'ignores - embedded in a term' do - @parser.parse("one-two").should == "T:one-two" - end - - it "allows a trailing dash" do - @parser.parse("one-").should == "T:one-" - end - - end - - describe "phrases (strings)" do - phrases = [['"single"', 'STR:"single"'], - ['"two term"', 'STR:"two term"'], - ['"has \"escaped\" quote\"s"', 'STR:"has \"escaped\" quote\"s"'] - ] - phrases.each do |phrase, expect| - it "'#{phrase}' => #{expect}" do - @parser.parse(phrase).should == expect - end - end - - describe "invalid" do - bad = ['""', '":not:a:term"', '"a :bad:'] - bad.each do |t| - it "'#{t}' => ParseError" do - lambda { @parser.parse(t) }.should raise_error(@parseError) - end - end - end - - it "allows phrases to be required with '+'" do - @parser.parse('+"a b c"').should == '(OP:+ STR:"a b c")' - end - - it "allows phrases to be prohibited with '-'" do - @parser.parse('-"a b c"').should == '(OP:- STR:"a b c")' - end - - it "allows phrases to be excluded with NOT" do - @parser.parse('a NOT "b c"').should == 'T:a (OP:NOT STR:"b c")' - end - - end - - describe "fields" do - it "parses a term annotated with a field" do - @parser.parse("afield:aterm").should == "(F:afield T:aterm)" - end - - it "allows underscore in a field name" do - @parser.parse("a_field:aterm").should == "(F:a_field T:aterm)" - end - - it "parses a group annotated with a field" do - @parser.parse("afield:(a b c)").should == "(F:afield (T:a T:b T:c))" - end - - it "parses a phrase annotated with a field" do - @parser.parse('afield:"a b c"').should == '(F:afield STR:"a b c")' - end - - it "allows @ in a term" do - @parser.parse('afield:foo@acme.org').should == '(F:afield T:foo@acme.org)' - end - - describe "and binary operators" do - examples = [ - ['term1 AND afield:term2', "(OP:AND T:term1 (F:afield T:term2))"], - ['afield:term1 AND term2', "(OP:AND (F:afield T:term1) T:term2)"], - ['afield:term1 AND bfield:term2', - "(OP:AND (F:afield T:term1) (F:bfield T:term2))"]] - examples.each do |input, want| - it "'#{input}' => '#{want}'" do - @parser.parse(input).should == want - end - end - end - - describe "and unary operators" do - examples = [ - ['term1 AND NOT afield:term2', - "(OP:AND T:term1 (OP:NOT (F:afield T:term2)))"], - ['term1 AND ! afield:term2', - "(OP:AND T:term1 (OP:NOT (F:afield T:term2)))"], - ['term1 AND !afield:term2', - "(OP:AND T:term1 (OP:NOT (F:afield T:term2)))"], - ['term1 AND -afield:term2', - "(OP:AND T:term1 (OP:- (F:afield T:term2)))"], - ['-afield:[* TO *]', - "(OP:- (FR:afield [*] [*]))"] - ] - examples.each do |input, want| - it "#{input} => #{want}" do - @parser.parse(input).should == want - end - end - end - end - - describe "range queries" do - before(:each) do - @kinds = { - "inclusive" => {:left => "[", :right => "]"}, - "exclusive" => {:left => "{", :right => "}"} - } - end - - def make_expect(kind, field, s, e) - expect_fmt = "(FR:%s %s%s%s %s%s%s)" - left = @kinds[kind][:left] - right = @kinds[kind][:right] - expect_fmt % [field, left, s, right, left, e, right] - end - - def make_query(kind, field, s, e) - query_fmt = "%s:%s%s TO %s%s" - left = @kinds[kind][:left] - right = @kinds[kind][:right] - query_fmt % [field, left, s, e, right] - end - - ["inclusive", "exclusive"].each do |kind| - tests = [["afield", "start", "end"], - ["afield", "start", "*"], - ["afield", "*", "end"], - ["afield", "*", "*"] - ] - tests.each do |field, s, e| - it "parses an #{kind} range query #{s} TO #{e}" do - expect = make_expect(kind, field, s, e) - query = make_query(kind, field, s, e) - @parser.parse(query).should == expect - end - end - end - - describe "and binary operators" do - [["afield:[start TO end] AND term", - "(OP:AND (FR:afield [start] [end]) T:term)"], - ["term OR afield:[start TO end]", - "(OP:OR T:term (FR:afield [start] [end]))"], - ["f1:[s1 TO e1] OR f2:[s2 TO e2]", - "(OP:OR (FR:f1 [s1] [e1]) (FR:f2 [s2] [e2]))"] - ].each do |q, want| - it "parses '#{q}'" do - @parser.parse(q).should == want - end - end - end - - describe "and unary operators" do - [["t1 NOT afield:[start TO end]", - "T:t1 (OP:NOT (FR:afield [start] [end]))"] - ].each do |input, want| - it "#{input} => #{want}" do - @parser.parse(input).should == want - end - end - end - end - - describe "proximity query" do - [ - ['"one two"~10', '(OP:~ STR:"one two" 10)'], - ['word~', '(OP:~ T:word)'], - ['word~0.5', '(OP:~ T:word 0.5)'] - ].each do |input, expect| - it "'#{input}' => #{expect}" do - @parser.parse(input).should == expect - end - end - end - - describe "term boosting" do - [ - ['"one two"^10', '(OP:^ STR:"one two" 10)'], - ['word^0.5', '(OP:^ T:word 0.5)'] - ].each do |input, expect| - it "'#{input}' => #{expect}" do - @parser.parse(input).should == expect - end - end - - it "should fail to parse if no boosting argument is given" do - lambda { @parser.parse("foo^")}.should raise_error(@parseError) - end - end - - describe "examples" do - examples = [['tags:apples*.for.eating.com', "(F:tags T:apples*.for.eating.com)"], - ['ohai_time:[1234.567 TO *]', "(FR:ohai_time [1234.567] [*])"], - ['ohai_time:[* TO 1234.567]', "(FR:ohai_time [*] [1234.567])"], - ['ohai_time:[* TO *]', "(FR:ohai_time [*] [*])"]] - # ['aterm AND afield:aterm', "((OP:AND T:aterm ((F:afield T:aterm))))"], - # ['role:prod AND aterm', "blah"], - # ['role:prod AND xy:true', "blah"]] - examples.each do |input, want| - it "'#{input}' => '#{want}'" do - @parser.parse(input).should == want - end - end - end - - describe "transform queries for solr schema" do - testcase_file = "#{CHEF_SPEC_DATA}/search_queries_to_transform.txt" - lines = File.readlines(testcase_file).map { |line| line.strip } - lines = lines.select { |line| !line.empty? } - testcases = Hash[*(lines)] - testcases.keys.sort.each do |input| - expected = testcases[input] - it "from> #{input}\n to> #{expected}\n" do - @parser.transform(input).should == expected - end - end - end - -end diff --git a/chef/spec/unit/solr_query/solr_http_request_spec.rb b/chef/spec/unit/solr_query/solr_http_request_spec.rb deleted file mode 100644 index c70c347a14..0000000000 --- a/chef/spec/unit/solr_query/solr_http_request_spec.rb +++ /dev/null @@ -1,244 +0,0 @@ -# Author:: Daniel DeLeo (<dan@opscode.com>) -# 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. -# - -require 'spec_helper' - -require 'chef/solr_query' -require 'net/http' - -describe Chef::SolrQuery::SolrHTTPRequest do - before do - Chef::Config[:solr_url] = "http://example.com:8983" - Chef::SolrQuery::SolrHTTPRequest.instance_variable_set(:@solr_url, nil) - Chef::SolrQuery::SolrHTTPRequest.instance_variable_set(:@url_prefix, nil) - - @request = Chef::SolrQuery::SolrHTTPRequest.new(:GET, '/solr/select') - end - - it "defaults to using the configured solr_url" do - Chef::SolrQuery::SolrHTTPRequest.solr_url.should == "http://example.com:8983" - end - - it "supports solr_url with a path" do - Chef::Config[:solr_url] = "http://example.com:8983/test" - Chef::SolrQuery::SolrHTTPRequest.instance_variable_set(:@solr_url, nil) - - Chef::SolrQuery::SolrHTTPRequest.solr_url.should == "http://example.com:8983/test" - end - - it "updates the Solr URL as you like" do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://chunkybacon.org:1234" - Chef::SolrQuery::SolrHTTPRequest.solr_url.should == "http://chunkybacon.org:1234" - end - - it "updates the URL prefix with a path" do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://chunkybacon.org:1234/something" - Chef::SolrQuery::SolrHTTPRequest.url_prefix.should == "/something" - end - - it "removes extra / at the end of solr_url" do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://chunkybacon.org:1234/extra/" - Chef::SolrQuery::SolrHTTPRequest.url_prefix.should == "/extra" - end - - it "creates a Net::HTTP client for the base Solr URL" do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://chunkybacon.org:1234" - http_client = Chef::SolrQuery::SolrHTTPRequest.http_client - http_client.address.should == "chunkybacon.org" - http_client.port.should == 1234 - end - - it "creates a Net::HTTP client for the base Solr URL ignoring the path" do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://chunkybacon.org:1234/test" - http_client = Chef::SolrQuery::SolrHTTPRequest.http_client - http_client.address.should == "chunkybacon.org" - http_client.port.should == 1234 - end - - it "defaults url_prefix to /solr if the configured solr_url has no path" do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://chunkybacon.org:1234" - Chef::SolrQuery::SolrHTTPRequest.url_prefix.should == "/solr" - end - - it "defaults url_prefix to the path from the configured solr_url" do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://chunkybacon.org:1234/test" - Chef::SolrQuery::SolrHTTPRequest.url_prefix.should == "/test" - end - - describe "when configured with the Solr URL" do - before do - @http_response = mock( - "Net::HTTP::Response", - :kind_of? => Net::HTTPSuccess, - :body => "{ :some => :hash }" - ) - @http_request = mock( - "Net::HTTP::Request", - :body= => true - ) - @http = mock("Net::HTTP", :request => @http_response) - Chef::SolrQuery::SolrHTTPRequest.stub!(:http_client).and_return(@http) - end - - describe "when executing a select query" do - before(:each) do - @http_response = mock( - "Net::HTTP::Response", - :kind_of? => Net::HTTPSuccess, - :body => '{"some": "hash" }' - ) - @solr = Chef::SolrQuery.from_params(:type => 'node', - :q => "hostname:latte") - @params = @solr.to_hash - @http = mock("Net::HTTP", :request => @http_response) - Chef::SolrQuery::SolrHTTPRequest.stub!(:http_client).and_return(@http) - end - - describe "when the HTTP call is successful" do - it "should call get to /solr/select with the escaped query" do - txfm_query = "q=content%3Ahostname__%3D__latte" - Net::HTTP::Get.should_receive(:new).with(%r(/solr/select?.+#{txfm_query})) - Chef::SolrQuery::SolrHTTPRequest.select(@params) - end - - it "uses Solr's JSON response format" do - Net::HTTP::Get.should_receive(:new).with(%r(wt=json)) - Chef::SolrQuery::SolrHTTPRequest.select(@params) - end - - it "uses indent=off to get a compact response" do - Net::HTTP::Get.should_receive(:new).with(%r(indent=off)) - Chef::SolrQuery::SolrHTTPRequest.select(@params) - end - - it "uses the filter query to restrict the result set" do - filter_query =@solr.filter_query.gsub('+', '%2B').gsub(':', "%3A").gsub(' ', '+') - Net::HTTP::Get.should_receive(:new).with(/fq=#{Regexp.escape(filter_query)}/) - Chef::SolrQuery::SolrHTTPRequest.select(@params) - end - - it "returns the evaluated response body" do - res = Chef::SolrQuery::SolrHTTPRequest.select(@params) - res.should == {"some" => "hash" } - end - end - end - - describe "when updating" do - before do - Net::HTTP::Post.stub!(:new).and_return(@http_request) - end - - it "should post to /solr/update" do - @doc = "<xml is the old tldr>" - Net::HTTP::Post.should_receive(:new).with("/solr/update", "Content-Type" => "text/xml").and_return(@http_request) - Chef::SolrQuery::SolrHTTPRequest.update(@doc) - end - - it "should set the body of the request to the stringified doc" do - @http_request.should_receive(:body=).with("foo") - Chef::SolrQuery::SolrHTTPRequest.update(:foo) - end - - it "should send the request to solr" do - @http.should_receive(:request).with(@http_request).and_return(@http_response) - Chef::SolrQuery::SolrHTTPRequest.update(:foo) - end - - end - - describe "when the HTTP call is unsuccessful" do - [Timeout::Error, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EINVAL].each do |exception| - it "should rescue, log an error message, and raise a SolrConnectionError encountering exception #{exception}" do - response = mock("Net:HTTPResponse test double", :code => 500, :message => "oops", :class => exception) - @http.should_receive(:request).with(instance_of(Net::HTTP::Get)).and_return(response) - response.should_receive(:error!).and_raise(exception) - Chef::Log.should_receive(:fatal).with("Search Query to Solr failed (#{exception} 500 oops)") - - lambda {@request.run('Search Query to Solr')}.should raise_error(Chef::Exceptions::SolrConnectionError) - end - end - - it "should rescue, log an error message, and raise a SolrConnectionError when encountering exception NoMethodError and net/http closed? bug" do - @no_method_error = NoMethodError.new("undefined method 'closed\?' for nil:NilClass") - @http.should_receive(:request).with(instance_of(Net::HTTP::Get)).and_raise(@no_method_error) - Chef::Log.should_receive(:fatal).with("HTTP Request to Solr failed. Chef::Exceptions::SolrConnectionError exception: Errno::ECONNREFUSED (net/http undefined method closed?) attempting to contact http://example.com:8983") - lambda { - @request.run - }.should raise_error(Chef::Exceptions::SolrConnectionError) - end - end - - end - - describe "when configured with the Solr URL with a path" do - before do - Chef::Config[:solr_url] = "http://example.com:8983/test" - Chef::SolrQuery::SolrHTTPRequest.instance_variable_set(:@solr_url, nil) - Chef::SolrQuery::SolrHTTPRequest.instance_variable_set(:@url_prefix, nil) - - @request = Chef::SolrQuery::SolrHTTPRequest.new(:GET, '/solr/select') - - @http_response = mock( - "Net::HTTP::Response", - :kind_of? => Net::HTTPSuccess, - :body => "{ :some => :hash }" - ) - @http_request = mock( - "Net::HTTP::Request", - :body= => true - ) - @http = mock("Net::HTTP", :request => @http_response) - Chef::SolrQuery::SolrHTTPRequest.stub!(:http_client).and_return(@http) - end - - describe "when executing a select query" do - before(:each) do - @http_response = mock( - "Net::HTTP::Response", - :kind_of? => Net::HTTPSuccess, - :body => '{"some": "hash" }' - ) - @solr = Chef::SolrQuery.from_params(:type => 'node', - :q => "hostname:latte") - @params = @solr.to_hash - @http = mock("Net::HTTP", :request => @http_response) - Chef::SolrQuery::SolrHTTPRequest.stub!(:http_client).and_return(@http) - end - - describe "when the HTTP call is successful" do - it "should call get to /test/select with the escaped query" do - txfm_query = "q=content%3Ahostname__%3D__latte" - Net::HTTP::Get.should_receive(:new).with(%r(/test/select?.+#{txfm_query})) - Chef::SolrQuery::SolrHTTPRequest.select(@params) - end - end - end - - describe "when updating" do - before do - Net::HTTP::Post.stub!(:new).and_return(@http_request) - end - - it "should post to /test/update" do - @doc = "<xml is the old tldr>" - Net::HTTP::Post.should_receive(:new).with("/test/update", "Content-Type" => "text/xml").and_return(@http_request) - Chef::SolrQuery::SolrHTTPRequest.update(@doc) - end - end - end -end diff --git a/chef/spec/unit/solr_query_spec.rb b/chef/spec/unit/solr_query_spec.rb deleted file mode 100644 index 8b48011713..0000000000 --- a/chef/spec/unit/solr_query_spec.rb +++ /dev/null @@ -1,203 +0,0 @@ -# Author:: Daniel DeLeo (<dan@opscode.com>) -# Copyright:: Copyright (c) 2010, 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. -# - -require 'spec_helper' - -require 'chef/solr_query' -require 'net/http' - -#require 'rspec/mocks' - -describe Chef::SolrQuery do - before do - Chef::SolrQuery::SolrHTTPRequest.solr_url = "http://example.com:8983" - - @http_response = mock( - "Net::HTTP::Response", - :kind_of? => Net::HTTPSuccess, - :body => "{ :some => :hash }" - ) - @http_request = mock( - "Net::HTTP::Request", - :body= => true - ) - @http = mock("Net::HTTP", :request => @http_response) - Chef::SolrQuery::SolrHTTPRequest.stub!(:http_client).and_return(@http) - Net::HTTP::Post.stub!(:new).and_return(@http_request) - Net::HTTP::Get.stub!(:new).and_return(@http_request) - @doc = { "foo" => "bar" } - end - - before(:each) do - @solr = Chef::SolrQuery.new - end - - it "sets filter query params" do - @solr.filter_by(:database => 'chef') - @solr.filter_query.should == "+X_CHEF_database_CHEF_X:chef" - end - - it "filters by type when querying for a builtin type" do - @solr.filter_by_type("node") - @solr.filter_query.should == "+X_CHEF_type_CHEF_X:node" - end - - it "filters by type for data bag items" do - @solr.filter_by_type("users") - @solr.filter_query.split(" ").sort.should == ['+X_CHEF_type_CHEF_X:data_bag_item', '+data_bag:users'] - end - - it "stores the main query" do - @solr.query = "role:prod AND tags:chef-server" - @solr.query.should == "role:prod AND tags:chef-server" - end - - describe "when generating query params for select" do - before(:each) do - @solr = Chef::SolrQuery.from_params(:type => 'node', :q => "hostname:latte") - @params = @solr.to_hash - end - - it "includes the query as q" do - @params[:q].should == "content:hostname__=__latte" - end - - it "sets the response format to json" do - @params[:wt].should == "json" - end - - it "uses indent=off to get a compact response" do - @params[:indent].should == "off" - end - - it "includes the filter query to restrict the result set" do - @params[:fq].should == @solr.filter_query - end - - it "defaults to returning 1000 rows" do - @params[:rows].should == 1000 - end - - it "returns the number of rows requested" do - @solr.params[:rows] = 500 - @solr.to_hash[:rows].should == 500 - end - - it "offsets the row selection if requested" do - @solr.params[:start] = 500 - @solr.to_hash[:start].should == 500 - end - - end - - describe "when querying solr" do - before do - @couchdb = mock("CouchDB Test Double", :couchdb_database => "chunky_bacon") - @couchdb.stub!(:kind_of?).with(Chef::CouchDB).and_return(true) #ugh. - @solr = Chef::SolrQuery.from_params({:type => 'node', :q => "hostname:latte", :start => 10, :rows => 5}, @couchdb) - @docs = [1,2,3,4,5].map { |doc_id| {'X_CHEF_id_CHEF_X' => doc_id} } - @solr_response = {"response" => {"docs" => @docs, "start" => 10, "results" => 123}} - Chef::SolrQuery::SolrHTTPRequest.should_receive(:select).with(@solr.to_hash).and_return(@solr_response) - end - - it "it collects the document ids from the response" do - @solr.object_ids.should == [1,2,3,4,5] - end - - it "does a bulk get of the objects from CouchDB" do - @couchdb.should_receive(:bulk_get).with([1,2,3,4,5]).and_return(%w{obj1 obj2 obj3 obj4 obj5}) - @solr.objects.should == %w{obj1 obj2 obj3 obj4 obj5} - end - - end - - describe "when forcing a Solr commit" do - it "sends valid commit xml to solr" do - Chef::SolrQuery::SolrHTTPRequest.should_receive(:update).with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<commit/>\n") - @solr.commit - end - end - - describe "when deleting a database from Solr" do - it "sends a valid delete query to solr and forces a commit" do - Chef::SolrQuery::SolrHTTPRequest.should_receive(:update).with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<delete><query>X_CHEF_database_CHEF_X:chef</query></delete>\n") - @solr.should_receive(:commit) - @solr.delete_database("chef") - end - end - - describe "rebuilding the index" do - before do - Chef::Config[:couchdb_database] = "chunky_bacon" - end - - it "deletes the index and commits" do - @solr.should_receive(:delete_database).with("chunky_bacon") - @solr.stub!(:reindex_all) - Chef::DataBag.stub!(:cdb_list).and_return([]) - @solr.rebuild_index - end - - it "reindexes Chef::ApiClient, Chef::Node, and Chef::Role objects, reporting the results as a hash" do - @solr.should_receive(:delete_database).with("chunky_bacon") - @solr.should_receive(:reindex_all).with(Chef::ApiClient).and_return(true) - @solr.should_receive(:reindex_all).with(Chef::Environment).and_return(true) - @solr.should_receive(:reindex_all).with(Chef::Node).and_return(true) - @solr.should_receive(:reindex_all).with(Chef::Role).and_return(true) - Chef::DataBag.stub!(:cdb_list).and_return([]) - - result = @solr.rebuild_index - result["Chef::ApiClient"].should == "success" - result["Chef::Node"].should == "success" - result["Chef::Role"].should == "success" - end - - it "does not reindex Chef::OpenIDRegistration or Chef::WebUIUser objects" do - # hi there. the reason we're specifying this behavior is because these objects - # are not properly indexed in the first place and trying to reindex them - # tickles a bug in our CamelCase to snake_case code. See CHEF-1009. - @solr.should_receive(:delete_database).with("chunky_bacon") - @solr.stub!(:reindex_all).with(Chef::ApiClient) - @solr.stub!(:reindex_all).with(Chef::Node) - @solr.stub!(:reindex_all).with(Chef::Role) - @solr.should_not_receive(:reindex_all).with(Chef::OpenIDRegistration) - @solr.should_not_receive(:reindex_all).with(Chef::WebUIUser) - Chef::DataBag.stub!(:cdb_list).and_return([]) - - @solr.rebuild_index - end - - it "reindexes databags" do - one_data_item = Chef::DataBagItem.new - one_data_item.raw_data = {"maybe"=>"snakes actually are evil", "id" => "just_sayin"} - two_data_item = Chef::DataBagItem.new - two_data_item.raw_data = {"tone_depth"=>"rumble_fish", "id" => "eff_yes"} - data_bag = Chef::DataBag.new - data_bag.stub!(:list).and_return([one_data_item, two_data_item]) - - @solr.should_receive(:delete_database).with("chunky_bacon") - @solr.stub!(:reindex_all) - Chef::DataBag.stub!(:cdb_list).and_return([data_bag]) - - data_bag.should_receive(:add_to_index) - one_data_item.should_receive(:add_to_index) - two_data_item.should_receive(:add_to_index) - - @solr.rebuild_index["Chef::DataBag"].should == "success" - end - end -end diff --git a/cucumber.yml b/cucumber.yml deleted file mode 100644 index caa038409b..0000000000 --- a/cucumber.yml +++ /dev/null @@ -1,70 +0,0 @@ -default: -f pretty features -r features/steps -r features/support -api: --tags @api --format pretty -r features/steps -r features/support features -api_cookbooks: --tags @api --tags @cookbooks --format pretty -r features/steps -r features/support features -api_cookbooks_list: --tags @api_cookbooks_list --format pretty -r features/steps -r features/support features -api_cookbooks_show: --tags @api_cookbooks_show --format pretty -r features/steps -r features/support features -api_cookbooks_upload: --tags @api_cookbooks_upload --format pretty -r features/steps -r features/support features -api_cookbooks_download: --tags @api_cookbooks_download --format pretty -r features/steps -r features/support features -api_cookbooks_delete: --tags @api_cookbooks_delete --format pretty -r features/steps -r features/support features -api_cookbooks_tarballs: --tags @api --tags @cookbooks --tags @tarballs --format pretty -r features/steps -r features/support features -api_clients: --tags @api_clients --format pretty -r features/steps -r features/support features -api_clients_create: --tags @clients_create --format pretty -r features/steps -r features/support features -api_clients_delete: --tags @clients_delete --format pretty -r features/steps -r features/support features -api_clients_list: --tags @clients_list --format pretty -r features/steps -r features/support features -api_clients_show: --tags @clients_show --format pretty -r features/steps -r features/support features -api_clients_update: --tags @clients_update --format pretty -r features/steps -r features/support features -api_roles: --tags @api_roles --format pretty -r features/steps -r features/support features -api_roles_create: --tags @roles_create --format pretty -r features/steps -r features/support features -api_roles_delete: --tags @roles_delete --format pretty -r features/steps -r features/support features -api_roles_list: --tags @roles_list --format pretty -r features/steps -r features/support features -api_roles_show: --tags @roles_show --format pretty -r features/steps -r features/support features -api_roles_update: --tags @roles_update --format pretty -r features/steps -r features/support features -api_environments: --tags @api_environments --format pretty -r features/steps -r features/support features -api_environments_create: --tags @environments_create --format pretty -r features/steps -r features/support features -api_environments_delete: --tags @environments_delete --format pretty -r features/steps -r features/support features -api_environments_list: --tags @environments_list --format pretty -r features/steps -r features/support features -api_environments_show: --tags @environments_show --format pretty -r features/steps -r features/support features -api_environments_update: --tags @environments_update --format pretty -r features/steps -r features/support features -api_environments_cookbook_list: --tags @environments_cookbook_list --format pretty -r features/steps -r features/support features -api_environments_node_list: --tags @environments_node_list --format pretty -r features/steps -r features/support features -api_nodes: --tags @api_nodes --format pretty -r features/steps -r features/support features -api_nodes_sync: --tags @cookbook_sync --format pretty -r features/steps -r features/support features -api_nodes_create: --tags @nodes_create --format pretty -r features/steps -r features/support features -api_nodes_delete: --tags @nodes_delete --format pretty -r features/steps -r features/support features -api_nodes_list: --tags @nodes_list --format pretty -r features/steps -r features/support features -api_nodes_show: --tags @nodes_show --format pretty -r features/steps -r features/support features -api_nodes_update: --tags @nodes_update --format pretty -r features/steps -r features/support features -api_data: --tags @api_data --format pretty -r features/steps -r features/support features -api_data_delete: --tags @api_data_delete --format pretty -r features/steps -r features/support features -api_data_item: --tags @api_data_item --format pretty -r features/steps -r features/support features -api_search: --tags @api_search --format pretty -r features/steps -r features/support features -api_search_list: --tags @api_search_list --format pretty -r features/steps -r features/support features -api_search_show: --tags @api_search_show --format pretty -r features/steps -r features/support features -api_search_reindex: --tags @api_search_reindex --format pretty -r features/steps -r features/support features -client: --tags @client --format pretty -r features/steps -r features/support features -client_roles: --tags @client_roles --format pretty -r features/steps -r features/support features -client_cookbook_sync: --tags @client-cookbook-sync --format pretty -r features/steps -r features/support features -search: --tags @search --format pretty -r features/steps -r features/support features -provider: --tags @provider --format pretty -r features/steps -r features/support features -provider_directory: --tags @provider_directory --format pretty -r features/steps -r features/support features -provider_deploy: --tags @provider_deploy --format pretty -r features/steps -r features/support features -provider_execute: --tags @provider_execute --format pretty -r features/steps -r features/support features -provider_file: --tags @provider_file --format pretty -r features/steps -r features/support features -provider_template: --tags @template --format pretty -r features/steps -r features/support features -provider_remote_file: --tags @remote_file --format pretty -r features/steps -r features/support features -provider_package_macports: --tags @macports --format pretty -r features/steps -r features/support features -language: --tags @language --format pretty -r features/steps -r features/support features -client_run_interval: --tags @client_run_interval --format pretty -r features/steps -r features/support features -recipe_inclusion: --tags @recipe_inclusion --format pretty -r features/steps -r features/support features -attribute_inclusion: --tags @attribute_inclusion --format pretty -r features/steps -r features/support features -cookbooks: --tags @cookbooks --format pretty -r features/steps -r features/support features -cookbook_metadata: --tags @cookbook_metadata --format pretty -r features/steps -r features/support features -provider_remote_directory: --tags @remote_directory --format pretty -r features/steps -r features/support features -provider_git: --tags @provider --tags @git --format pretty -r features/steps -r features/support features -provider_template: --tags @template --format pretty -r features/steps -r features/support features -provider_package_macports: --tags @macports --format pretty -r features/steps -r features/support features -provider_package_rubygems: --tags @rubygems --format pretty -r features/steps -r features/support features -lwrp: --tags @lwrp --format pretty -r features/steps -r features/support features -attribute_settings: --tags @attribute_settings --format pretty -r features/steps -r features/support features -knife: --tags @knife --format pretty -r features/steps -r features/support features -knife_cookbook_upload: --tags @knife_cookbook_upload --format pretty -r features/steps -r features/support features diff --git a/features/api/clients/create_client_api.feature b/features/api/clients/create_client_api.feature deleted file mode 100644 index 3aab5459ed..0000000000 --- a/features/api/clients/create_client_api.feature +++ /dev/null @@ -1,39 +0,0 @@ -@api @api_clients @clients_create -Feature: Create a client via the REST API - In order to create clients programatically - As a Devleoper - I want to create clients via the REST API - - Scenario: Create a new client - Given I am an administrator - And a 'client' named 'isis' - When I create the client - And the inflated responses key 'uri' should match '^http://.+/clients/isis$' - - @oss_only - Scenario: Create a new client as an admin - Given I am an administrator - And a 'client' named 'adminmonkey' - When I create the client - When I 'GET' the path '/clients/adminmonkey' - Then the inflated response should respond to 'admin' with 'true' - - Scenario: Create a client that already exists - Given I am an administrator - And an 'client' named 'isis' - When I create the client - And I create the client - Then I should get a '409 "Conflict"' exception - - Scenario: Create a new client with a wrong private key - Given I am an administrator - And a 'client' named 'isis' - When I 'POST' the 'client' to the path '/clients' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Create a new client when you are not an admin - Given I am a non-admin - And a 'client' named 'isis' - When I create the client - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/clients/delete_client_api.feature b/features/api/clients/delete_client_api.feature deleted file mode 100644 index 62f4b2373b..0000000000 --- a/features/api/clients/delete_client_api.feature +++ /dev/null @@ -1,31 +0,0 @@ -@api @api_clients @clients_delete -Feature: Delete a client via the REST API - In order to remove a client - As a Developer - I want to delete a client via the REST API - - Scenario: Delete a client - Given I am an administrator - And a 'client' named 'isis' exists - When I 'DELETE' the path '/clients/isis' - Then the inflated responses key 'name' should match '^isis$' - - Scenario: Delete a client that does not exist - Given I am an administrator - And there are no clients - When I 'DELETE' the path '/clients/isis' - Then I should get a '404 "Not Found"' exception - - Scenario: Delete a client with a wrong private key - Given I am an administrator - And a 'client' named 'isis' exists - When I 'DELETE' the path '/clients/isis' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Delete a client when you are not an admin - Given I am a non-admin - And a 'client' named 'isis' exists - When I 'DELETE' the path '/clients/isis' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/clients/list_clients_api.feature b/features/api/clients/list_clients_api.feature deleted file mode 100644 index ba8f224990..0000000000 --- a/features/api/clients/list_clients_api.feature +++ /dev/null @@ -1,33 +0,0 @@ -@api @api_clients @clients_list -Feature: List clients via the REST API - In order to know what clients exists programatically - As a Developer - I want to list all the clients - - Scenario: List clients when one has been created - Given I am an administrator - Given a 'client' named 'isis' exists - When I 'GET' the path '/clients' - Then the inflated responses key 'isis' should match '^http://.+/clients/isis$' - - Scenario: List clients when two have been created - Given I am an administrator - And a 'client' named 'isis' exists - And a 'client' named 'neurosis' exists - When I 'GET' the path '/clients' - Then the inflated responses key 'isis' should match '^http://.+/clients/isis$' - And the inflated responses key 'neurosis' should match '^http://.+/clients/neurosis$' - - Scenario: List clients when none have been created with a wrong private key - Given I am an administrator - And there are no clients - When I 'GET' the path '/clients' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: List clients when one has been created and you are not an admin - Given I am a non-admin - Given a 'client' named 'isis' exists - When I 'GET' the path '/clients' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/clients/show_client_api.feature b/features/api/clients/show_client_api.feature deleted file mode 100644 index 360284141c..0000000000 --- a/features/api/clients/show_client_api.feature +++ /dev/null @@ -1,33 +0,0 @@ -@api @api_clients @clients_show -Feature: Show a client via the REST API - In order to know what the details are for a client - As a Developer - I want to show the details for a specific client - - @oss_only - Scenario: Show a client - Given I am an administrator - And a 'client' named 'isis' exists - When I 'GET' the path '/clients/isis' - Then the inflated response should respond to 'name' with 'isis' - And the inflated response should respond to 'admin' with 'false' - - Scenario: Show a missing client - Given I am an administrator - And there are no clients - When I 'GET' the path '/clients/frankenstein' - Then I should get a '404 "Not Found"' exception - - Scenario: Show a client with a wrong private key - Given I am an administrator - And a 'client' named 'isis' exists - When I 'GET' the path '/clients/isis' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Show a client when you are not an admin - Given I am a non-admin - And a 'client' named 'isis' exists - When I 'GET' the path '/clients/isis' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/clients/update_client_api.feature b/features/api/clients/update_client_api.feature deleted file mode 100644 index 5f2b5ca5a7..0000000000 --- a/features/api/clients/update_client_api.feature +++ /dev/null @@ -1,39 +0,0 @@ -@api @api_clients @clients_update -Feature: Update a client - In order to keep my client data up-to-date - As a Developer - I want to update my client via the API - - Scenario: Update a client - Given I am an administrator - And a 'client' named 'isis' exists - And a 'client' named 'isis_update' - When I 'PUT' the 'client' to the path '/clients/isis' - Then the inflated responses key 'name' should match '^isis$' - And the inflated responses key 'private_key' should match 'BEGIN RSA PRIVATE KEY' - - Scenario: Update a client with a wrong private key - Given I am an administrator - And a 'client' named 'isis' exists - And a 'client' named 'isis_update' - When I 'PUT' the 'client' to the path '/clients/isis' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Update a client when you are not an admin - Given I am a non-admin - And a 'client' named 'isis' exists - And a 'client' named 'isis_update' - When I 'PUT' the 'client' to the path '/clients/isis' - Then I should get a '403 "Forbidden"' exception - - @privilege_escalation @oss_only - Scenario: Non-admin clients cannot update themselves - Given I am a non-admin - When I edit the 'not_admin' client - And I set 'admin' to true - And I save the client - Then I should get a '403 "Forbidden"' exception - - - - diff --git a/features/api/cookbooks/delete_cookbooks.feature b/features/api/cookbooks/delete_cookbooks.feature deleted file mode 100644 index 951543193f..0000000000 --- a/features/api/cookbooks/delete_cookbooks.feature +++ /dev/null @@ -1,61 +0,0 @@ -@api @cookbooks @api_cookbooks_delete -@manage_cookbook - -Feature: CRUD cookbooks - In order to manage cookbook data - As a Developer - I want to delete cookbook versions - - @delete_cookbook_positive @delete_cookbook_version_positive - Scenario: After uploading two versions of a cookbook, then deleting the second, I should not be able to interact with the second but should be able to interact with the first - Given I am an administrator - When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0' - When I 'GET' to the path '/cookbooks/testcookbook_valid/0.2.0' - Then I should not get an exception - When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.2.0' - When I 'GET' to the path '/cookbooks/testcookbook_valid' - Then the inflated responses key 'testcookbook_valid' should exist - Then the inflated responses key 'testcookbook_valid' sub-key 'versions' should be '1' items long - Then the inflated responses key 'testcookbook_valid' sub-key 'versions' item '0' sub-key 'version' should equal '0.1.0' - When I 'GET' to the path '/cookbooks/testcookbook_valid/0.2.0' - Then I should get a '404 "Not Found"' exception - When I download the cookbook manifest for 'testcookbook_valid' version '0.1.0' - Then I should not get an exception - When I download the file 'recipes/default.rb' from the downloaded cookbook manifest - Then the downloaded cookbook file contents should match the pattern '.*0.1.0.*' - - @delete_cookbook_negative @delete_cookbook_version_negative - Scenario: I should not be able to delete a cookbook version that does not exist - Given I am an administrator - When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0' - When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.3.0' - Then I should get a '404 "Not Found"' exception - - # Currently you cannot delete a cookbook by, e.g., DELETE /cookbooks/foo. - # You delete all of its versions and then it disappears. - @delete_cookbook_positive - Scenario: I should be able to delete a cookbook by deleting all of its versions - Given I am an administrator - When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.1.0' - Then I should not get an exception - When I 'GET' the path '/cookbooks' - Then the inflated responses key 'testcookbook_valid' should not exist - When I 'GET' the path '/cookbooks/testcookbook_valid' - Then I should get a '404 "Not Found"' exception - - @delete_cookbook_negative - Scenario: I should not be able to delete a cookbook that doesn't exist' - Given I am an administrator - When I 'DELETE' to the path '/cookbooks/testcookbook_nonexistent/1.2.3' - Then I should get a '404 "Not Found"' exception - - @delete_cookbook_negative @cookbook_non_admin - Scenario: I should not be able to delete cookbook if I am not an admin - Given I am an administrator - When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - Given I am a non-admin - When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.1.0' - Then I should get a '403 "Forbidden"' exception diff --git a/features/api/cookbooks/download_cookbooks.feature b/features/api/cookbooks/download_cookbooks.feature deleted file mode 100644 index cc3d2d8759..0000000000 --- a/features/api/cookbooks/download_cookbooks.feature +++ /dev/null @@ -1,47 +0,0 @@ -@api @cookbooks @api_cookbooks_download -@manage_cookbook - -Feature: CRUD cookbooks - In order to manage cookbook data - As a Developer - I want to download cookbook files and manifests - - # Downloading a cookbook -- positive - @download_cookbook_positive - Scenario: After a cookbook is uploaded, it should be downloadable - Given I am an administrator - Then I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - When I download the cookbook manifest for 'testcookbook_valid' version '0.1.0' - Then the downloaded cookbook manifest contents should match 'testcookbook_valid' - - Scenario: After a cookbook is uploaded, its contents should be downloadable - Given I am an administrator - Then I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - When I download the cookbook manifest for 'testcookbook_valid' version '0.1.0' - When I download the file 'metadata.json' from the downloaded cookbook manifest - Then I should not get an exception - When I download the file 'recipes/default.rb' from the downloaded cookbook manifest - Then I should not get an exception - - @download_cookbook_positive - Scenario: After uploading two versions of a cookbook, I should be able to retrieve files from either version - Given I am an administrator - When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0' - When I download the cookbook manifest for 'testcookbook_valid' version '0.1.0' - Then I should not get an exception - When I download the file 'recipes/default.rb' from the downloaded cookbook manifest - Then the downloaded cookbook file contents should match the pattern '.*0.1.0.*' - When I download the cookbook manifest for 'testcookbook_valid' version '0.2.0' - Then I should not get an exception - When I download the file 'recipes/default.rb' from the downloaded cookbook manifest - Then the downloaded cookbook file contents should match the pattern '.*0.2.0.*' - - @download_cookbook_negative - Scenario: Retrieving a non-existent version for an existing cookbook should fail - Given I am an administrator - Then I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - When I download the cookbook manifest for 'testcookbook_valid' version '9.9.9' - Then I should get a '404 "Not Found"' exception - - diff --git a/features/api/cookbooks/list_cookbooks.feature b/features/api/cookbooks/list_cookbooks.feature deleted file mode 100644 index df9188b68f..0000000000 --- a/features/api/cookbooks/list_cookbooks.feature +++ /dev/null @@ -1,43 +0,0 @@ -@api @cookbooks @api_cookbooks_list - -Feature: List cookbooks via the REST API - In order to know what cookbooks are available - As a developer - I want to be able to list all cookbooks via the REST API - - Scenario Outline: List all cookbooks - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook - And I am <user_type> - When I 'GET' the path '/cookbooks' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.2.0' - And the inflated responses key 'version_test' sub-key 'versions' should be '1' items long - When I 'GET' the path '/cookbooks?num_versions=2' - Then the inflated responses key 'version_test' sub-key 'versions' should be '2' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.2.0' - When I 'GET' the path '/cookbooks?num_versions=-1' - Then I should get a '400 "Bad Request"' exception - When I 'GET' the path '/cookbooks?num_versions=invalid-input' - Then I should get a '400 "Bad Request"' exception - When I 'GET' the path '/cookbooks?num_versions=all' - Then the inflated responses key 'version_test' sub-key 'versions' should be '3' items long - - Examples: - | user_type | - | an administrator | - | a non-admin | - - @CHEF-1607 - Scenario: List all cookbooks with the lastest version, when they cannot be lexically sorted - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - When I 'GET' the path '/cookbooks?num_versions=all' - Then the inflated responses key 'version_test' sub-key 'versions' should be '3' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - - Scenario: List cookbooks with a wrong private key - Given I am an administrator - When I 'GET' the path '/cookbooks' using a wrong private key - Then I should get a '401 "Unauthorized"' exception diff --git a/features/api/cookbooks/show_cookbooks.feature b/features/api/cookbooks/show_cookbooks.feature deleted file mode 100644 index 48286fdfcd..0000000000 --- a/features/api/cookbooks/show_cookbooks.feature +++ /dev/null @@ -1,71 +0,0 @@ -@api @cookbooks @api_cookbooks_show -Feature: Show a cookbook via the REST API - In order to know what the details are for a cookbook - As a Developer - I want to show the details for a specific cookbook - - @show_cookbook - Scenario: Show a cookbook - Given I am an administrator - When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - Then I 'GET' the path '/cookbooks/testcookbook_valid/0.1.0' - Then the inflated response should respond to 'cookbook_name' and match 'testcookbook_valid' - Then the inflated response should respond to 'name' and match 'testcookbook_valid-0.1.0' - Then the inflated response should respond to 'files' and match '^\[\]$' as json - Then the inflated response should respond to 'root_files' and match '^\[.+\]$' as json - Then the inflated response should respond to 'recipes' and match '^\[.+\]$' as json - Then the inflated response should respond to 'metadata' and match '^\{.+\}$' as json - Then the inflated response should respond to 'attributes' and match '^\[.+\]$' as json - Then the inflated response should respond to 'libraries' and match '^\[\]$' as json - Then the inflated response should respond to 'definitions' and match '^\[\]$' as json - Then the inflated response should respond to 'templates' and match '^\[\]$' as json - Then the inflated response should respond to 'resources' and match '^\[\]$' as json - - @CHEF-1607 - Scenario: Show the latest version of a cookbook - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - When I 'GET' the path '/cookbooks/version_test/_latest' - Then the inflated response should respond to 'version' and match '0.10.0' - - @show_cookbook_negative - Scenario: Show a cookbook with a wrong private key - Given I am an administrator - When I 'GET' the path '/cookbooks/show_cookbook' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @show_cookbook_negative - Scenario: Listing versions for a non-existent cookbook should fail - Given I am an administrator - When I 'GET' the path '/cookbooks/non_existent' - Then I should get a '404 "Not Found"' exception - - Scenario: Show all the available versions for a cookbook, sorted - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - When I 'GET' the path '/cookbooks/version_test' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' should be '3' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - And the inflated responses key 'version_test' sub-key 'versions' item '1' sub-key 'version' should equal '0.9.7' - And the inflated responses key 'version_test' sub-key 'versions' item '2' sub-key 'version' should equal '0.9.0' - - Scenario: Show the latest available version for a cookbook - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - When I 'GET' the path '/cookbooks/version_test?num_versions=1' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' should be '1' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - - Scenario: Show a given number available version for a cookbook, sorted by latest date - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - When I 'GET' the path '/cookbooks/version_test?num_versions=2' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' should be '2' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - And the inflated responses key 'version_test' sub-key 'versions' item '1' sub-key 'version' should equal '0.9.7' diff --git a/features/api/cookbooks/upload_cookbooks.feature b/features/api/cookbooks/upload_cookbooks.feature deleted file mode 100644 index 0626695591..0000000000 --- a/features/api/cookbooks/upload_cookbooks.feature +++ /dev/null @@ -1,176 +0,0 @@ -@api @cookbooks @api_cookbooks_upload -@manage_cookbook - -Feature: CRUD cookbooks - In order to manage cookbook data - As a Developer - I want to create and upload cookbook files and manifests - - @create_cookbook_negative - - Scenario: Should not be able to create a cookbook with the wrong name - Given I am an administrator - When I create a versioned cookbook named 'foo' versioned '1.0.0' with 'testcookbook_valid' - Then I should get a '400 "Bad Request"' exception - - Scenario: Should not be able to create a cookbook with the wrong version - Given I am an administrator - When I create a versioned cookbook named 'testcookbook_valid' versioned '9.9.9' with 'testcookbook_valid' - Then I should get a '400 "Bad Request"' exception - - Scenario: Should not be able to create a cookbook with missing name - Given I am an administrator - When I create a versioned cookbook named '' versioned '9.9.9' with 'testcookbook_valid' - Then I should get a '404 "Not Found"' exception - - Scenario: Should not be able to create a cookbook with missing name and version - Given I am an administrator - When I create a versioned cookbook named '' versioned '' with 'testcookbook_valid' - Then I should get a '404 "Not Found"' exception - - Scenario: Should not be able to create a cookbook with non-X.Y.Z version - Given I am an administrator - When I create a versioned cookbook named 'testcookbook_valid' versioned '1.0.1.2' with 'testcookbook_valid' - Then I should get a '404 "Not Found"' exception - - Scenario: Should not be able to create a cookbook if none of its contained files have been uploaded - Given I am an administrator - When I create a versioned cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - Then I should get a '400 "Bad Request"' exception - - @create_cookbook_positive - Scenario: Should be able to create a cookbook if its files have been uploaded - Given I am an administrator - When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_valid' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'metadata.json' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'metadata.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'attributes/attributes.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'recipes/default.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - When I create a versioned cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - Then I should not get an exception - - @create_cookbook_positive - Scenario: Cookbook successfully uploaded via sandbox should later be visible via /cookbooks, including its versions and metadata - Given I am an administrator - When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - When I 'GET' the path '/cookbooks' - Then the inflated responses key 'testcookbook_valid' should exist - When I 'GET' the path '/cookbooks/testcookbook_valid' - Then the inflated responses key 'testcookbook_valid' should exist - Then the inflated responses key 'testcookbook_valid' sub-key 'versions' item '0' sub-key 'version' should equal '0.1.0' - When I 'GET' the path '/cookbooks/testcookbook_valid/0.1.0' - Then the inflated response should match '.*default.rb.*' as json - - @create_multiple_cookbook_versions_positive - Scenario: Multiple cookbook versions successfully uploaded are visible - Given I am an administrator - And I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0' - When I 'GET' the path '/cookbooks' - Then the inflated responses key 'testcookbook_valid' should exist - When I 'GET' the path '/cookbooks/testcookbook_valid' - Then the inflated responses key 'testcookbook_valid' should exist - And the inflated responses key 'testcookbook_valid' sub-key 'versions' should be '2' items long - And the inflated responses key 'testcookbook_valid' sub-key 'versions' item '0' sub-key 'version' should equal '0.2.0' - And the inflated responses key 'testcookbook_valid' sub-key 'versions' item '1' sub-key 'version' should equal '0.1.0' - - @update_cookbook_version_metadata_positive - Scenario: A successful cookbook version upload that changes the metadata is properly reflected - Given I am an administrator - And I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - When I 'GET' the path '/cookbooks/testcookbook_valid/0.1.0' - Then the inflated response should be a kind of 'Chef::CookbookVersion' - And the dependencies in its metadata should be an empty hash - When I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid_v0.1.0_with_different_dependencies' - Then the inflated response should be a kind of 'Chef::CookbookVersion' - And the metadata should include a dependency on 'aws' - - # The sandbox is created missing 'metadata.json'. However, the cookbook's - # manifest includes that file. We don't upload the file to the sandbox, but - # the sandbox commits ok cuz it wasn't expecting that file. However, when we - # try to create the cookbook, it should complain as its manifest wants that - # file. - @create_cookbook_negative - Scenario: Should not be able to create a cookbook if it is missing one file - Given I am an administrator - When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_valid' minus files 'metadata.rb' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'metadata.json' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'attributes/attributes.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'recipes/default.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - When I create a versioned cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - Then I should get a '400 "Bad Request"' exception - - @create_cookbook_negative - Scenario: Should not be able to create a cookbook if it has no metadata file - Given I am an administrator - When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_invalid_nometadata' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'attributes/attributes.rb' from cookbook 'testcookbook_invalid_nometadata' to the sandbox - Then the response code should be '200' - Then I upload a file named 'recipes/default.rb' from cookbook 'testcookbook_invalid_nometadata' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - When I create a versioned cookbook named 'testcookbook_invalid_nometadata' versioned '0.1.0' with 'testcookbook_invalid_nometadata' - Then I should get a '400 "Bad Request"' exception - - # update a cookbook with no files should fail - @create_cookbook_negative - Scenario: Should not be able to create a cookbook if it has no files and just metadata - Given I am an administrator - When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_invalid_empty_except_metadata' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'metadata.json' from cookbook 'testcookbook_invalid_empty_except_metadata' to the sandbox - Then the response code should be '200' - Then I upload a file named 'metadata.rb' from cookbook 'testcookbook_invalid_empty_except_metadata' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - When I create a cookbook named 'testcookbook_invalid_empty_except_metadata' with only the metadata file - Then I should get a '400 "Bad Request"' exception - - @freeze_cookbook_version - Scenario: Create a frozen Cookbook Version - Given I am an administrator - And I have uploaded a frozen cookbook named 'testcookbook_valid' at version '0.1.0' - When I 'GET' the path '/cookbooks/testcookbook_valid/0.1.0' - Then the cookbook version document should be frozen - - @freeze_cookbook_version @overwrite_frozen_version - Scenario: Cannot overwrite a frozen Cookbook Version - Given I am an administrator - And I have uploaded a frozen cookbook named 'testcookbook_valid' at version '0.1.0' - When I upload a cookbook named 'testcookbook_valid' at version '0.1.0' - Then I should get a '409 "Conflict"' exception - - @create_cookbook_negative @cookbook_non_admin - Scenario: Should not be able to create a cookbook if I am not an admin - Given I am an administrator - When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_valid' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'metadata.json' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'metadata.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'attributes/attributes.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - Then I upload a file named 'recipes/default.rb' from cookbook 'testcookbook_valid' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - Given I am a non-admin - When I create a versioned cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid' - Then I should get a '403 "Forbidden"' exception diff --git a/features/api/data/create_data_bag_api.feature b/features/api/data/create_data_bag_api.feature deleted file mode 100644 index fb21d1e438..0000000000 --- a/features/api/data/create_data_bag_api.feature +++ /dev/null @@ -1,33 +0,0 @@ -@api @data @api_data -Feature: Create a data bag via the REST API - In order to create data bags programatically - As a Devleoper - I want to create data bags via the REST API - - Scenario: Create a new data bag - Given I am an administrator - And a 'data_bag' named 'users' - When I authenticate as 'bobo' - And I 'POST' the 'data_bag' to the path '/data' - And the inflated responses key 'uri' should match '^http://.+/data/users$' - - Scenario: Create a data bag that already exists - Given I am an administrator - And a 'data_bag' named 'users' - When I authenticate as 'bobo' - And I 'POST' the 'data_bag' to the path '/data' - And I 'POST' the 'data_bag' to the path '/data' - Then I should get a '409 "Conflict"' exception - - Scenario: Create a new data bag without authenticating - Given a 'data_bag' named 'webserver' - When I 'POST' the 'data_bag' to the path '/data' - Then I should get a '400 "Bad Request"' exception - - @oss_only - Scenario: Create a new data bag as a non-admin - Given I am a non-admin - And a 'data_bag' named 'users' - When I 'POST' the 'data_bag' to the path '/data' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/data/create_data_bag_item_api.feature b/features/api/data/create_data_bag_item_api.feature deleted file mode 100644 index 32024a9601..0000000000 --- a/features/api/data/create_data_bag_item_api.feature +++ /dev/null @@ -1,45 +0,0 @@ -@api @data @api_data @api_data_item -Feature: Create a data bag item via the REST API - In order to store an item in a data bag programatically - As a Devleoper - I want to store data bag items via the REST API - - Scenario: Create a new data bag item - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' - When I authenticate as 'bobo' - And I 'POST' the 'data_bag_item' to the path '/data/users' - Then the inflated responses key 'id' should match '^francis$' - - Scenario: Update a data bag item that already exists - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'francis_extra' - When I authenticate as 'bobo' - And I 'PUT' the 'data_bag_item' to the path '/data/users/francis' - Then the inflated responses key 'id' should match '^francis$' - And the inflated responses key 'extra' should match '^majority$' - - Scenario: Create a new data bag without authenticating - Given a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' - When I 'PUT' the 'data_bag_item' to the path '/data/users/francis' - Then I should get a '400 "Bad Request"' exception - - Scenario: Create a new data bag item with a wrong private key - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' - When I 'PUT' the 'data_bag_item' to the path '/data/users/francis' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Create a new data bag item as a non-admin - Given I am a non-admin - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' - When I 'PUT' the 'data_bag_item' to the path '/data/users/francis' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/data/delete_data_bag_api.feature b/features/api/data/delete_data_bag_api.feature deleted file mode 100644 index 39d78bd6be..0000000000 --- a/features/api/data/delete_data_bag_api.feature +++ /dev/null @@ -1,47 +0,0 @@ -@api @data @api_data @api_data_delete -Feature: Delete a Data Bag via the REST API - In order to remove a Data Bag - As a Developer - I want to delete a Data Bag via the REST API - - Scenario: Delete a Data Bag - Given I am an administrator - And a 'data_bag' named 'users' exists - When I authenticate as 'bobo' - And I 'DELETE' the path '/data/users' - Then the inflated response should respond to 'name' with 'users' - - Scenario: Delete a Data Bag that does not exist - Given I am an administrator - And there are no Data Bags - When I authenticate as 'bobo' - When I 'DELETE' the path '/data/users' - Then I should get a '404 "Not Found"' exception - - Scenario: Delete a Data Bag that has items in it - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - When I authenticate as 'bobo' - And I 'DELETE' the path '/data/users' - Then the inflated response should respond to 'name' with 'users' - And the data_bag named 'users' should not have an item named 'francis' - - Scenario: Delete a Data Bag without authenticating - Given a 'data_bag' named 'users' exists - When I 'DELETE' the path '/data/users' - Then I should get a '400 "Bad Request"' exception - - Scenario: Delete a data bag with a wrong private key - Given a 'registration' named 'bobo' exists - And a 'data_bag' named 'users' exists - When I 'DELETE' the path '/data/users' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Delete a Data Bag as a non-admin - Given I am a non-admin - And a 'data_bag' named 'users' exists - When I 'DELETE' the path '/data/users' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/data/delete_data_bag_item.feature b/features/api/data/delete_data_bag_item.feature deleted file mode 100644 index fea2d97151..0000000000 --- a/features/api/data/delete_data_bag_item.feature +++ /dev/null @@ -1,35 +0,0 @@ -@api @data @api_data @api_data_item -Feature: Delete a Data Bag Item via the REST API - In order to remove a Data Bag Item - As a Developer - I want to delete a Data Bag Item via the REST API - - Scenario: Delete a Data Bag Item - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - When I authenticate as 'bobo' - And I 'DELETE' the path '/data/users/francis' - Then the inflated responses key 'id' should match '^francis$' - - Scenario: Delete a Data Bag Item that does not exist - Given I am an administrator - And a 'data_bag' named 'users' exists - When I authenticate as 'bobo' - When I 'DELETE' the path '/data/users/francis' - Then I should get a '404 "Not Found"' exception - - Scenario: Delete a Data Bag Item without authenticating - Given a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - When I 'DELETE' the path '/data/users/francis' - Then I should get a '400 "Bad Request"' exception - - @oss_only - Scenario: Delete a Data Bag Item as a non-admin - Given I am a non-admin - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - When I 'DELETE' the path '/data/users/francis' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/data/list_data_bags.feature b/features/api/data/list_data_bags.feature deleted file mode 100644 index 73c4650fb3..0000000000 --- a/features/api/data/list_data_bags.feature +++ /dev/null @@ -1,40 +0,0 @@ -@api @data @api_data -Feature: List data bags via the REST API - In order to know what data bags exists programatically - As a Developer - I want to list all the data bags - - Scenario: List data bags when none have been created - Given I am an administrator - And there are no data bags - When I authenticate as 'bobo' - And I 'GET' the path '/data' - Then the inflated response should be an empty hash - - Scenario: List data bags when one has been created - Given I am an administrator - And a 'data_bag' named 'users' exists - When I authenticate as 'bobo' - And I 'GET' the path '/data' - Then the inflated responses key 'users' should match '^http://.+/data/users$' - - Scenario: List data bags when two have been created - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag' named 'rubies' exists - When I authenticate as 'bobo' - And I 'GET' the path '/data' - Then the inflated response should be '2' items long - And the inflated responses key 'users' should match '^http://.+/data/users$' - And the inflated responses key 'rubies' should match '^http://.+/data/rubies$' - - Scenario: List data bags when you are not authenticated - When I 'GET' the path '/data' - Then I should get a '400 "Bad Request"' exception - - Scenario: List data bags with the wrong key - Given a 'registration' named 'bobo' exists - When I 'GET' the path '/data' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - diff --git a/features/api/data/show_data_bag_api.feature b/features/api/data/show_data_bag_api.feature deleted file mode 100644 index 5e3b64d18e..0000000000 --- a/features/api/data/show_data_bag_api.feature +++ /dev/null @@ -1,48 +0,0 @@ -@api @data @api_data -Feature: Show a data_bag via the REST API - In order to know what the details are for a data_bag - As a Developer - I want to show the details for a specific data_bag - - Scenario: Show a data_bag with no entries in it - Given I am an administrator - And a 'data_bag' named 'users' exists - When I authenticate as 'bobo' - And I 'GET' the path '/data/users' - Then the inflated response should be an empty hash - - Scenario: Show a data_bag with one entry in it - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - When I authenticate as 'bobo' - And I 'GET' the path '/data/users' - Then the inflated responses key 'francis' should match '/data/users/francis' - - Scenario: Show a data_bag with two entries in it - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - When I authenticate as 'bobo' - And I 'GET' the path '/data/users' - Then the inflated responses key 'francis' should match '/data/users/francis' - And the inflated responses key 'axl_rose' should match '/data/users/axl_rose' - - Scenario: Show a missing data_bag - Given I am an administrator - And there are no data_bags - When I authenticate as 'bobo' - And I 'GET' the path '/data/users' - Then I should get a '404 "Not Found"' exception - - Scenario: Show a data_bag without authenticating - Given a 'data_bag' named 'users' exists - And I 'GET' the path '/data/users' - Then I should get a '400 "Bad Request"' exception - - Scenario: Show a data_bag with a wrong private key - Given a 'registration' named 'bobo' exists - And a 'data_bag' named 'users' exists - And I 'GET' the path '/data/users' using a wrong private key - Then I should get a '401 "Unauthorized"' exception diff --git a/features/api/data/show_data_bag_item_api.feature b/features/api/data/show_data_bag_item_api.feature deleted file mode 100644 index 4f2c437acd..0000000000 --- a/features/api/data/show_data_bag_item_api.feature +++ /dev/null @@ -1,35 +0,0 @@ -@api @data @api_data @api_data_item -Feature: Show a data_bag item via the REST API - In order to know what the data is for an item in a data_bag - As a Developer - I want to retrieve an item from a data_bag - - Scenario: Show a data_bag item - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - When I authenticate as 'bobo' - And I 'GET' the path '/data/users/francis' - Then the inflated responses key 'id' should match '^francis$' - - Scenario: Show a missing data_bag item - Given I am an administrator - And a 'data_bag' named 'users' exists - When I authenticate as 'bobo' - And I 'GET' the path '/data/users/francis' - Then I should get a '404 "Not Found"' exception - - Scenario: Show a data_bag item without authenticating - Given a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And I 'GET' the path '/data/users/francis' - Then I should get a '400 "Bad Request"' exception - - Scenario: Show a data_bag item with a wrong private key - Given a 'registration' named 'bobo' exists - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - When I 'GET' the path '/data/users/francis' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - diff --git a/features/api/environments/create_environment_api.feature b/features/api/environments/create_environment_api.feature deleted file mode 100644 index 4b066088c4..0000000000 --- a/features/api/environments/create_environment_api.feature +++ /dev/null @@ -1,30 +0,0 @@ -@api @api_environments @environments_create -Feature: Create an Environment via the REST API - In order to create environments programatically - As a developer - I want to create environments via the REST API - - Scenario: Create a new environment - Given I am an administrator - And an 'environment' named 'cucumber' - When I 'POST' the 'environment' to the path '/environments' - Then the inflated responses key 'uri' should match 'http://.+/environments/cucumber' - - Scenario: Create an environment that already exists - Given I am an administrator - And an 'environment' named 'cucumber' - When I 'POST' the 'environment' to the path '/environments' - And I 'POST' the 'environment' to the path '/environments' - Then I should get a '409 "Conflict"' exception - - Scenario: Create an environment with the wrong private key - Given I am an administrator - And an 'environment' named 'cucumber' - When I 'POST' the 'environment' to the path '/environments' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Create an environment as a non-admin - Given I am a non-admin - And an 'environment' named 'cucumber' - When I 'POST' the 'environment' to the path '/environments' - Then I should get a '403 "Forbidden"' exception diff --git a/features/api/environments/delete_environment_api.feature b/features/api/environments/delete_environment_api.feature deleted file mode 100644 index fa4eda36d9..0000000000 --- a/features/api/environments/delete_environment_api.feature +++ /dev/null @@ -1,38 +0,0 @@ -@api @api_environments @environments_delete -Feature: Delete environments via the REST API - In order to remove an environment - As a developer - I want to delete an environment via the REST API - - Scenario: Delete an environment - Given I am an administrator - And an 'environment' named 'cucumber' exists - When I 'DELETE' the path '/environments/cucumber' - Then the inflated response should respond to 'name' with 'cucumber' - - Scenario: Delete an environment that does not exist - Given I am an administrator - When I 'DELETE' the path '/environments/graveyard' - Then I should get a '404 "Not Found"' exception - - Scenario: Delete an environment with the wrong private key - Given I am an administrator - And an 'environment' named 'cucumber' exists - When I 'DELETE' the path '/environments/cucumber' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Delete an environment as a non-admin - Given I am a non-admin - And an 'environment' named 'cucumber' exists - When I 'DELETE' the path '/environments/cucumber' - Then I should get a '403 "Forbidden"' exception - - Scenario Outline: Delete the '_default' environment - Given I am <user_type> - When I 'DELETE' the path '/environments/_default' - Then I should get a '<exception_type>' exception - - Examples: - | user_type | exception_type | - | an administrator | 405 "Method Not Allowed" | - | a non-admin | 403 "Forbidden" | diff --git a/features/api/environments/list_environment_cookbooks_api.feature b/features/api/environments/list_environment_cookbooks_api.feature deleted file mode 100644 index 87963aa9c7..0000000000 --- a/features/api/environments/list_environment_cookbooks_api.feature +++ /dev/null @@ -1,106 +0,0 @@ -@api @api_environments @environments_cookbook_list -Feature: List cookbook versions for an environment via the REST API - In order to know what cookbooks are available in a given environment - As a developer - I was to list all cookbooks versions for a given environment via the REST API - - Scenario Outline: List cookbook versions for an environment - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook - And an 'environment' named 'skynet' exists - And I am <user_type> - When I 'GET' the path '/environments/skynet/cookbooks' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.2.0' - And the inflated responses key 'version_test' sub-key 'versions' should be '1' items long - When I 'GET' the path '/environments/skynet/cookbooks?num_versions=2' - Then the inflated responses key 'version_test' sub-key 'versions' should be '2' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.2.0' - When I 'GET' the path '/environments/skynet/cookbooks?num_versions=-1' - Then I should get a '400 "Bad Request"' exception - When I 'GET' the path '/environments/skynet/cookbooks?num_versions=invalid-input' - Then I should get a '400 "Bad Request"' exception - When I 'GET' the path '/environments/skynet/cookbooks?num_versions=all' - Then the inflated responses key 'version_test' sub-key 'versions' should be '2' items long - - Examples: - | user_type | - | an administrator | - | a non-admin | - - @CHEF-1607 - Scenario: List all cookbooks with the lastest version, when they cannot be lexically sorted - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - And an 'environment' named 'chef-1607' exists - When I 'GET' the path '/environments/chef-1607/cookbooks?num_versions=all' - Then the inflated responses key 'version_test' sub-key 'versions' should be '3' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - - Scenario Outline: List cookbook versions for an environment should restrict only the specified cookbooks - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook - And an 'environment' named '<env_name>' exists - When I 'GET' the path '/environments/cookbooks_test/cookbooks' - And the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/<version_regexp>' - - Examples: - | env_name | version_regexp | - | cookbooks-0.1.0 | 0.1.0 | - | cookbooks-0.1.1 | 0.1.1 | - | cookbooks-0.2.0 | 0.2.0 | - - Scenario: List cookbook versions for an environment with a wrong private key - Given I am an administrator - And an 'environment' named 'cookbooks-0.1.0' exists - When I 'GET' the path '/environments/cookbooks_test/cookbooks' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Show all the available versions for a cookbook, sorted - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - And an 'environment' named 'skynet' exists - When I 'GET' the path '/environments/skynet/cookbooks/version_test' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' should be '3' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - And the inflated responses key 'version_test' sub-key 'versions' item '1' sub-key 'version' should equal '0.9.7' - And the inflated responses key 'version_test' sub-key 'versions' item '2' sub-key 'version' should equal '0.9.0' - - Scenario: Show the latest available version for a cookbook - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - And an 'environment' named 'skynet' exists - When I 'GET' the path '/environments/skynet/cookbooks/version_test?num_versions=1' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' should be '1' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - - Scenario: Show a given number available versions for a cookbook, sorted by latest version - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - And an 'environment' named 'skynet' exists - When I 'GET' the path '/environments/skynet/cookbooks/version_test?num_versions=2' - Then the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/(\d+.\d+.\d+)' - And the inflated responses key 'version_test' sub-key 'versions' should be '2' items long - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'version' should equal '0.10.0' - And the inflated responses key 'version_test' sub-key 'versions' item '1' sub-key 'version' should equal '0.9.7' - - Scenario Outline: List cookbook versions for a single cookbook in an environment that is restricted - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook - And an 'environment' named '<env_name>' exists - When I 'GET' the path '/environments/cookbooks_test/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'url' should match 'http://.+/cookbooks/version_test' - And the inflated responses key 'version_test' sub-key 'versions' item '0' sub-key 'url' should match 'http://.+/cookbooks/version_test/<version_regexp>' - - Examples: - | env_name | version_regexp | - | cookbooks-0.1.0 | 0.1.0 | - | cookbooks-0.1.1 | 0.1.1 | - | cookbooks-0.2.0 | 0.2.0 | diff --git a/features/api/environments/list_environment_nodes_api.feature b/features/api/environments/list_environment_nodes_api.feature deleted file mode 100644 index 7dc31990f2..0000000000 --- a/features/api/environments/list_environment_nodes_api.feature +++ /dev/null @@ -1,18 +0,0 @@ -@api @api_environments @environments_node_list -Feature: List nodes by environments via the REST API - In order to know what nodes are in an environment programmatically - As a developer - I want to list all the nodes in an environment via the REST API - - Scenario Outline: List nodes in an environment - Given I am <user_type> - And an 'environment' named 'production' exists - And a 'node' named 'opsmaster' exists - When I 'GET' the path '/environments/production/nodes' - Then the inflated response should be '1' items long - And the inflated responses key 'opsmaster' should match '^http://.+/nodes/opsmaster$' - - Examples: - | user_type | - | an administrator | - | a non-admin |
\ No newline at end of file diff --git a/features/api/environments/list_environments_api.feature b/features/api/environments/list_environments_api.feature deleted file mode 100644 index 03fd67a753..0000000000 --- a/features/api/environments/list_environments_api.feature +++ /dev/null @@ -1,52 +0,0 @@ -@api @api_environments @environments_list -Feature: List environments via the REST API - In order to know what environments exist programatically - As a developer - I want to list all the environments via the REST API - - Scenario Outline: List environments when none have been created - Given I am <user_type> - And there are no environments - When I 'GET' the path '/environments' - Then the inflated response should be '1' items long - Then the inflated responses key '_default' should match 'http://.+/environments/_default' - - Examples: - | user_type | - | an administrator | - | a non-admin | - - Scenario Outline: List the environments when one has been created - Given I am <user_type> - And an 'environment' named 'cucumber' exists - When I 'GET' the path '/environments' - Then the inflated responses key 'cucumber' should match 'http://.+/environments/cucumber' - - Examples: - | user_type | - | an administrator | - | a non-admin | - - Scenario Outline: List the environments when two have been created - Given I am <user_type> - And an 'environment' named 'cucumber' exists - And an 'environment' named 'production' exists - When I 'GET' the path '/environments' - Then the inflated response should be '3' items long - And the inflated responses key 'cucumber' should match 'http://.+/environments/cucumber' - And the inflated responses key 'production' should match 'http://.+/environments/production' - - Examples: - | user_type | - | an administrator | - | a non-admin | - - Scenario Outline: List environments with a wrong private key - Given I am <user_type> - When I 'GET' the path '/environments' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Examples: - | user_type | - | an administrator | - | a non-admin | diff --git a/features/api/environments/show_environment_api.feature b/features/api/environments/show_environment_api.feature deleted file mode 100644 index 6c7a8e1f00..0000000000 --- a/features/api/environments/show_environment_api.feature +++ /dev/null @@ -1,34 +0,0 @@ -@api @api_environments @environments_show -Feature: Show an environment via the REST API - In order to know what the details for an environment are - As a developer - I want to show the details for a specific environment via the REST API - - Scenario Outline: Show an environment - Given I am <user_type> - And an 'environment' named 'cucumber' exists - When I 'GET' the path '/environments/cucumber' - Then the inflated response should respond to 'name' with 'cucumber' - And the inflated response should respond to 'description' with 'I like to run tests' - - Examples: - | user_type | - | an administrator | - | a non-admin | - - Scenario Outline: Show an environment that does not exist - Given I am <user_type> - And there are no environments - When I 'GET' the path '/environments/cucumber' - Then I should get a '404 "Not Found"' exception - - Examples: - | user_type | - | an administrator | - | a non-admin | - - Scenario: Show an environment using the wrong private key - Given I am an administrator - And an 'environment' named 'cucumber' exists - And I 'GET' the path '/environments/cucumber' using a wrong private key - Then I should get a '401 "Unauthorized"' exception diff --git a/features/api/environments/show_role_in_environment.feature b/features/api/environments/show_role_in_environment.feature deleted file mode 100644 index 59e76c3aed..0000000000 --- a/features/api/environments/show_role_in_environment.feature +++ /dev/null @@ -1,12 +0,0 @@ -@api @api_environments @show_roles -Feature: Show a role in an environment via the REST API - In order to know what the run list is for a Role in a specific environment - As a Developer - I want to show the run list for a specific Role in a specific environment - - Scenario: Show an environment specific run list and attribuets in a role - Given I am an administrator - And an 'environment' named 'cucumber' exists - And a 'role' named 'webserver' exists - When I 'GET' the path '/environments/cucumber/roles/webserver' - Then the inflated response should respond to 'run_list' with '["role[db]"]' diff --git a/features/api/environments/update_environment_api.feature b/features/api/environments/update_environment_api.feature deleted file mode 100644 index 016f2469bc..0000000000 --- a/features/api/environments/update_environment_api.feature +++ /dev/null @@ -1,51 +0,0 @@ -@api @api_environments @environments_update -Feature: Update an environment via the REST API - In order to keep my environment data up-to-date - As a developer - I want to update my environment via the REST API - - Scenario Outline: Update an environment - Given I am an administrator - And an 'environment' named 'cucumber' exists - And sending the method '<method>' to the 'environment' with '<updated_value>' - When I 'PUT' the 'environment' to the path '/environments/cucumber' - Then the inflated response should respond to '<method>' with '<updated_value>' - When I 'GET' the path '/environments/cucumber' - Then the inflated response should respond to '<method>' with '<updated_value>' - - Examples: - | method | updated_value | - | description | I am a pickle | - | cookbook_versions | {"apt": "1.2.3"} | - - Scenario: Update an environment that does not exist - Given I am an administrator - And an 'environment' named 'cucumber' - And sending the method 'description' to the 'environment' with 'This will not work' - When I 'PUT' the 'environment' to the path '/environments/cucumber' - Then I should get a '404 "Not Found"' exception - - Scenario: Update an environment with the wrong private key - Given I am an administrator - And an 'environment' named 'cucumber' exists - And sending the method 'description' to the 'environment' with 'This will not work' - When I 'PUT' the 'environment' to the path '/environments/cucumber' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Update an environment as a non-admin user - Given I am a non-admin - And an 'environment' named 'cucumber' exists - And sending the method 'description' to the 'environment' with 'This will not work' - When I 'PUT' the 'environment' to the path '/environments/cucumber' - Then I should get a '403 "Forbidden"' exception - - Scenario Outline: Update the '_default' environment - Given I am <user_type> - And an 'environment' named 'cucumber' - When I 'PUT' the 'environment' to the path '/environments/_default' - Then I should get a '<exception_type>' exception - - Examples: - | user_type | exception_type | - | an administrator | 405 "Method Not Allowed" | - | a non-admin | 403 "Forbidden" | diff --git a/features/api/nodes/cookbook_sync_api.feature b/features/api/nodes/cookbook_sync_api.feature deleted file mode 100644 index 1a833ae8b1..0000000000 --- a/features/api/nodes/cookbook_sync_api.feature +++ /dev/null @@ -1,94 +0,0 @@ -@api @nodes @cookbook_sync @api_nodes -Feature: Synchronize cookbooks to the edge - In order to configure my nodes centrally - As a Developer - I want to synchronize the cookbooks from the server to the edge nodes - - Scenario: Retrieve the list of cookbook files to synchronize - Given I am an administrator - And a 'node' named 'sync' exists - When I 'GET' the path '/nodes/sync/cookbooks' - And the inflated responses key 'node_cookbook_sync' should exist - And the inflated responses key 'node_cookbook_sync' should match '"recipes":' as json - And the inflated responses key 'node_cookbook_sync' should match 'default.rb' as json - And the inflated responses key 'node_cookbook_sync' should match '"definitions":' as json - And the inflated responses key 'node_cookbook_sync' should match 'def_file.rb' as json - And the inflated responses key 'node_cookbook_sync' should match '"libraries":' as json - And the inflated responses key 'node_cookbook_sync' should match 'lib_file.rb' as json - And the inflated responses key 'node_cookbook_sync' should match '"attributes":' as json - And the inflated responses key 'node_cookbook_sync' should match 'attr_file.rb' as json - - @CHEF-1607 - Scenario: Retrieve the correct versions of cookbook files to sync, especially when they do not lexically sort - Given I am an administrator - And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly - And a 'node' named 'paradise' exists - When I 'GET' the path '/nodes/paradise/cookbooks' - And the inflated responses key 'version_test' should exist - And the inflated responses key 'version_test' should match '"version":"0.10.0"' as json - - Scenario: Retrieve the list of cookbook files to syncronize when the node has a chef_environment - Given I am an administrator - And an 'environment' named 'cookbooks-0.1.0' exists - And a 'node' named 'has_environment' exists - And I upload multiple versions of the 'version_test' cookbook - When I 'GET' the path '/nodes/has_environment/cookbooks' - Then the inflated responses key 'version_test' should exist - And the inflated responses key 'version_test' should match '"version":"0.1.0"' as json - Given an 'environment' named 'cookbooks-0.1.1' - When I 'PUT' the 'environment' to the path '/environments/cookbooks_test' - And I 'GET' the path '/nodes/has_environment/cookbooks' - Then the inflated responses key 'version_test' should exist - And the inflated responses key 'version_test' should match '"version":"0.1.1"' as json - Given an 'environment' named 'cookbooks-0.2.0' - When I 'PUT' the 'environment' to the path '/environments/cookbooks_test' - And I 'GET' the path '/nodes/has_environment/cookbooks' - Then the inflated responses key 'version_test' should exist - And the inflated responses key 'version_test' should match '"version":"0.2.0"' as json - - Scenario: Retrieve the list of cookbook files to synchronize with a wrong private key - Given I am an administrator - And a 'node' named 'sync' exists - When I 'GET' the path '/nodes/sync/cookbooks' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Retrieve the list of cookbook files to synchronize as a non-admin - Given I am a non-admin - And a 'node' named 'sync' exists - When I 'GET' the path '/nodes/sync/cookbooks' - Then I should get a '403 "Forbidden"' exception - - @cookbook_dependencies @positive - Scenario: Retrieve the list of cookbooks when dependencies are resolvable - Given I am an administrator - And I upload the set of 'dep_test_*' cookbooks - And a 'node' named 'empty' exists - And changing the 'node' field 'run_list' to 'recipe[dep_test_a@1.0.0]' - When I 'PUT' the 'node' to the path 'nodes/empty' - And I 'GET' the path 'nodes/empty/cookbooks' - Then cookbook 'dep_test_a' should have version '1.0.0' - Then cookbook 'dep_test_b' should have version '1.0.0' - Then cookbook 'dep_test_c' should have version '1.0.0' - - @cookbook_dependencies - Scenario: Retrieve the list of cookbooks when there is a conflict in the dependencies - Given I am an administrator - And I upload the set of 'dep_test_*' cookbooks - And a 'node' named 'empty' exists - And changing the 'node' field 'run_list' to 'recipe[dep_test_b@2.0.0]' - When I 'PUT' the 'node' to the path 'nodes/empty' - And I 'GET' the path 'nodes/empty/cookbooks' - Then I should get a '412 "Precondition Failed"' exception - And the response exception body should match 'Unable to satisfy constraints on cookbook dep_test_a due to run list item \(dep_test_b = 2.0.0\)' - - @cookbook_dependencies - Scenario: Retrieve the list of cookbooks when a cookbook is unavailable - Given I am an administrator - And I upload the set of 'dep_test_*' cookbooks - And a 'node' named 'empty' exists - And changing the 'node' field 'run_list' to 'recipe[dep_test_a@3.0.0]' - When I 'PUT' the 'node' to the path 'nodes/empty' - And I 'GET' the path 'nodes/empty/cookbooks' - Then I should get a '412 "Precondition Failed"' exception - And the response exception body should match 'Unable to satisfy constraints on cookbook dep_test_c due to run list item \(dep_test_a = 3.0.0\)' diff --git a/features/api/nodes/create_node_api.feature b/features/api/nodes/create_node_api.feature deleted file mode 100644 index 61474f69e8..0000000000 --- a/features/api/nodes/create_node_api.feature +++ /dev/null @@ -1,33 +0,0 @@ -@api @api_nodes @nodes_create -Feature: Create a node via the REST API - In order to create nodes programatically - As a Devleoper - I want to create nodes via the REST API - - Scenario: Create a new node - Given I am an administrator - And a 'node' named 'webserver' - When I 'POST' the 'node' to the path '/nodes' - And the inflated responses key 'uri' should match '^http://.+/nodes/webserver$' - - Scenario: Create a node that already exists - Given I am an administrator - And an 'node' named 'webserver' - When I 'POST' the 'node' to the path '/nodes' - And I 'POST' the 'node' to the path '/nodes' - Then I should get a '409 "Conflict"' exception - - Scenario: Create a node with a wrong private key - Given I am an administrator - And an 'node' named 'webserver' - When I 'POST' the 'node' to the path '/nodes' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Create a node with a role that does not exist - Given I am an administrator - And an 'node' named 'role_not_exist' - When I 'POST' the 'node' to the path '/nodes' - Then the inflated responses key 'uri' should match '^http://.+/nodes/role_not_exist$' - When I 'GET' the path '/nodes/role_not_exist' - Then the stringified response should be the stringified 'node' - diff --git a/features/api/nodes/deep_node_show_save.feature b/features/api/nodes/deep_node_show_save.feature deleted file mode 100644 index 71290434b8..0000000000 --- a/features/api/nodes/deep_node_show_save.feature +++ /dev/null @@ -1,14 +0,0 @@ -@api @api_nodes @nodes_show @json_recusion @pl_538 @chef_1292 -Feature: Save and show a node with deep structure via the API - In order to verify that I can save and show very deep structure in a node object - As a Developer - I want to show the details for a specific node - - Scenario: Show a deeply nested node - Given I am an administrator - And a 'node' named 'really_deep_node' exists - When I 'GET' the path '/nodes/really_deep_node' - Then I should not get an exception - And the inflated response should respond to 'name' with 'really_deep_node' - And the 'deep_array' component has depth of '50' levels - And the 'deep_hash' component has depth of '50' levels diff --git a/features/api/nodes/delete_node_api.feature b/features/api/nodes/delete_node_api.feature deleted file mode 100644 index b7d585de51..0000000000 --- a/features/api/nodes/delete_node_api.feature +++ /dev/null @@ -1,31 +0,0 @@ -@api @api_nodes @nodes_delete -Feature: Delete a node via the REST API - In order to remove a node - As a Developer - I want to delete a node via the REST API - - Scenario: Delete a node - Given I am an administrator - And a 'node' named 'webserver' exists - When I 'DELETE' the path '/nodes/webserver' - Then the inflated response should respond to 'name' with 'webserver' - - Scenario: Delete a node that does not exist - Given I am an administrator - And there are no nodes - When I 'DELETE' the path '/nodes/webserver' - Then I should get a '404 "Not Found"' exception - - Scenario: Delete a node with a wrong private key - Given I am an administrator - And a 'node' named 'webserver' exists - When I 'DELETE' the path '/nodes/webserver' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Delete a node as a when I am not an admin - Given I am a non-admin - And a 'node' named 'webserver' exists - When I 'DELETE' the path '/nodes/webserver' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/nodes/list_nodes_api.feature b/features/api/nodes/list_nodes_api.feature deleted file mode 100644 index cca9d508a3..0000000000 --- a/features/api/nodes/list_nodes_api.feature +++ /dev/null @@ -1,32 +0,0 @@ -@api @api_nodes @nodes_list -Feature: List nodes via the REST API - In order to know what nodes exists programatically - As a Developer - I want to list all the nodes - - Scenario: List nodes when none have been created - Given I am an administrator - And there are no nodes - When I 'GET' the path '/nodes' - Then the inflated response should be an empty hash - - Scenario: List nodes when one has been created - Given I am an administrator - Given a 'node' named 'webserver' exists - When I 'GET' the path '/nodes' - Then the inflated responses key 'webserver' should match '^http://.+/nodes/webserver$' - - Scenario: List nodes when two have been created - Given I am an administrator - And a 'node' named 'webserver' exists - And a 'node' named 'dbserver' exists - When I 'GET' the path '/nodes' - Then the inflated response should be '2' items long - Then the inflated responses key 'webserver' should match '^http://.+/nodes/webserver$' - Then the inflated responses key 'dbserver' should match '^http://.+/nodes/dbserver$' - - Scenario: List nodes none have been created with a wrong private key - Given I am an administrator - And there are no cookbooks - When I 'GET' the path '/nodes' using a wrong private key - Then I should get a '401 "Unauthorized"' exception diff --git a/features/api/nodes/show_node_api.feature b/features/api/nodes/show_node_api.feature deleted file mode 100644 index a169b10569..0000000000 --- a/features/api/nodes/show_node_api.feature +++ /dev/null @@ -1,24 +0,0 @@ -@api @api_nodes @nodes_show -Feature: Show a node via the REST API - In order to know what the details are for a node - As a Developer - I want to show the details for a specific node - - Scenario: Show a node - Given I am an administrator - And a 'node' named 'webserver' exists - When I 'GET' the path '/nodes/webserver' - Then the inflated response should respond to 'name' with 'webserver' - - Scenario: Show a missing node - Given I am an administrator - And there are no nodes - When I 'GET' the path '/nodes/bobo' - Then I should get a '404 "Not Found"' exception - - Scenario: Show a node with a wrong private key - Given I am an administrator - And a 'node' named 'webserver' exists - When I 'GET' the path '/nodes/webserver' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - diff --git a/features/api/nodes/update_node_api.feature b/features/api/nodes/update_node_api.feature deleted file mode 100644 index 0acf6a7f47..0000000000 --- a/features/api/nodes/update_node_api.feature +++ /dev/null @@ -1,55 +0,0 @@ -@api @api_nodes @nodes_update -Feature: Update a node - In order to keep my node data up-to-date - As a Developer - I want to update my node via the API - - Scenario Outline: Update a node - Given I am an administrator - And a 'node' named 'webserver' exists - And sending the method '<method>' to the 'node' with '<updated_value>' - When I 'PUT' the 'node' to the path '/nodes/webserver' - Then the inflated response should respond to '<method>' with '<updated_value>' - When I 'GET' the path '/nodes/webserver' - Then the inflated response should respond to '<method>' with '<updated_value>' - - Examples: - | method | updated_value | - | run_list | [ "recipe[one]", "recipe[two]" ] | - | snakes | really arent so bad | - | chef_environment | prod | - - @PL-493 - Scenario: Update a node to include a role which includes another role - Given I am an administrator - And a 'node' named 'webserver' exists - And sending the method 'run_list' to the 'node' with '[ "role[role1_includes_role2]" ]' - When I 'PUT' the 'node' to the path '/nodes/webserver' - Then the inflated response should respond to 'run_list' with '[ "role[role1_includes_role2]" ]' - When I 'GET' the path '/nodes/webserver' - Then the inflated response should respond to 'run_list' with '[ "role[role1_includes_role2]" ]' - - Scenario: Update a node with a wrong private key - Given I am an administrator - And a 'node' named 'webserver' exists - And sending the method 'run_list' to the 'node' with '[ "recipe[one]", "recipe[two]" ]' - When I 'PUT' the 'node' to the path '/nodes/webserver' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Update a node when I am not an admin - Given I am a non-admin - And a 'node' named 'webserver' exists - And sending the method 'run_list' to the 'node' with '[ "recipe[one]", "recipe[two]" ]' - When I 'PUT' the 'node' to the path '/nodes/webserver' - Then I should get a '403 "Forbidden"' exception - - Scenario: Update a node with a role that does not exist - Given I am an administrator - And a 'node' named 'webserver' exists - And sending the method 'run_list' to the 'node' with '["role[not_exist]"]' - When I 'PUT' the 'node' to the path '/nodes/webserver' - Then the inflated response should respond to 'run_list' with '["role[not_exist]"]' - When I 'GET' the path '/nodes/webserver' - Then the inflated response should respond to 'run_list' with '["role[not_exist]"]' - diff --git a/features/api/nodes/versioned_run_list.feature b/features/api/nodes/versioned_run_list.feature deleted file mode 100644 index d7e4aca07a..0000000000 --- a/features/api/nodes/versioned_run_list.feature +++ /dev/null @@ -1,38 +0,0 @@ -@api @nodes @api_nodes - -Feature: Versioned Run List - In order to maintain multiple versions of a cookbook - As a DevOps - I want to create and use multiple versions of a cookbook - - @cookbook_dependencies - Scenario: Unversioned run_list entries should automatically get the latest version - Given I am an administrator - And a validated node - And it includes the recipe 'versions' - When I run the chef-client - Then the run should exit '0' - And a file named 'thundercats_are_go.txt' should contain '1' - - @cookbook_dependencies - Scenario: Uploading a newer version of a cookbook should cause it to be used - Given I am an administrator - And a validated node - And it includes the recipe 'versions' - When I fully upload a sandboxed cookbook named 'versions' versioned '0.2.0' with 'versions' - When I run the chef-client - Then the run should exit '0' - And a file named 'thundercats_are_go.txt' should contain '2' - - @cookbook_dependencies - Scenario: Providing a version number should cause that version of a cookbook to be used - Given I am an administrator - And a validated node - And it includes the recipe 'versions' at version '0.1.0' - When I fully upload a sandboxed cookbook named 'versions' versioned '0.2.0' with 'versions' - When I run the chef-client - Then the run should exit '0' - And a file named 'thundercats_are_go.txt' should contain '1' - - - diff --git a/features/api/roles/create_role_api.feature b/features/api/roles/create_role_api.feature deleted file mode 100644 index d364a9136c..0000000000 --- a/features/api/roles/create_role_api.feature +++ /dev/null @@ -1,39 +0,0 @@ -@api @api_roles @roles_create -Feature: Create a role via the REST API - In order to create roles programatically - As a Devleoper - I want to create roles via the REST API - - Scenario: Create a new role - Given I am an administrator - And a 'role' named 'webserver' - When I 'POST' the 'role' to the path '/roles' - And the inflated responses key 'uri' should match '^http://.+/roles/webserver$' - - Scenario: Create a role that already exists - Given I am an administrator - And an 'role' named 'webserver' - When I 'POST' the 'role' to the path '/roles' - And I 'POST' the 'role' to the path '/roles' - Then I should get a '409 "Conflict"' exception - - Scenario: Create a new role with a wrong private key - Given I am an administrator - And a 'role' named 'webserver' - When I 'POST' the 'role' to the path '/roles' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Create a new role as a non-admin - Given I am a non-admin - And a 'role' named 'webserver' - When I 'POST' the 'role' to the path '/roles' - Then I should get a '403 "Forbidden"' exception - - Scenario: Create a role with a role that does not exist - Given I am an administrator - And an 'role' named 'role_not_exist' - When I 'POST' the 'role' to the path '/roles' - Then the inflated responses key 'uri' should match '^http://.+/roles/role_not_exist$' - When I 'GET' the path '/roles/role_not_exist' - Then the stringified response should be the stringified 'role' diff --git a/features/api/roles/delete_role_api.feature b/features/api/roles/delete_role_api.feature deleted file mode 100644 index d1e28c15f0..0000000000 --- a/features/api/roles/delete_role_api.feature +++ /dev/null @@ -1,31 +0,0 @@ -@api @api_roles @roles_delete -Feature: Delete a Role via the REST API - In order to remove a role - As a Developer - I want to delete a role via the REST API - - Scenario: Delete a Role - Given I am an administrator - And a 'role' named 'webserver' exists - When I 'DELETE' the path '/roles/webserver' - Then the inflated response should respond to 'name' with 'webserver' - - Scenario: Delete a Role that does not exist - Given I am an administrator - And there are no roles - When I 'DELETE' the path '/roles/webserver' - Then I should get a '404 "Not Found"' exception - - Scenario: Delete a Role with a wrong private key - Given I am an administrator - And a 'role' named 'webserver' exists - When I 'DELETE' the path '/roles/webserver' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - @oss_only - Scenario: Delete a Role as a non-admin - Given I am a non-admin - And a 'role' named 'webserver' exists - When I 'DELETE' the path '/roles/webserver' - Then I should get a '403 "Forbidden"' exception - diff --git a/features/api/roles/list_roles_api.feature b/features/api/roles/list_roles_api.feature deleted file mode 100644 index b428eec34c..0000000000 --- a/features/api/roles/list_roles_api.feature +++ /dev/null @@ -1,33 +0,0 @@ -@api @api_roles @roles_list -Feature: List roles via the REST API - In order to know what roles exists programatically - As a Developer - I want to list all the roles - - Scenario: List roles when none have been created - Given I am an administrator - And there are no roles - When I 'GET' the path '/roles' - Then the inflated response should be '0' items long - - Scenario: List roles when one has been created - Given I am an administrator - Given a 'role' named 'webserver' exists - When I 'GET' the path '/roles' - Then the inflated responses key 'webserver' should match '^http://.+/roles/webserver$' - - Scenario: List roles when two have been created - Given I am an administrator - And a 'role' named 'webserver' exists - And a 'role' named 'db' exists - When I 'GET' the path '/roles' -# Then the inflated responses key 'role_test' should match '^http://.+/roles/role_test$' - Then the inflated responses key 'webserver' should match '^http://.+/roles/webserver$' - And the inflated responses key 'db' should match '^http://.+/roles/db$' - - Scenario: List roles when none have been created with a wrong private key - Given I am an administrator - And there are no roles - When I 'GET' the path '/roles' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - diff --git a/features/api/roles/show_roles_api.feature b/features/api/roles/show_roles_api.feature deleted file mode 100644 index 6c66f4ac92..0000000000 --- a/features/api/roles/show_roles_api.feature +++ /dev/null @@ -1,36 +0,0 @@ -@api @api_roles @roles_show -Feature: Show a role via the REST API - In order to know what the details are for a Role - As a Developer - I want to show the details for a specific Role - - Scenario: Show a role - Given I am an administrator - And a 'role' named 'webserver' exists - When I 'GET' the path '/roles/webserver' - Then the inflated response should respond to 'name' with 'webserver' - - Scenario: Show a missing role - Given I am an administrator - And there are no roles - When I 'GET' the path '/roles/bobo' - Then I should get a '404 "Not Found"' exception - - Scenario: Show a role with a wrong private key - Given I am an administrator - And a 'role' named 'webserver' exists - When I 'GET' the path '/roles/webserver' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Show an environment specific run list and attribuets in a role - Given I am an administrator - And an 'environment' named 'cucumber' exists - And a 'role' named 'webserver' exists - When I 'GET' the path '/roles/webserver/environments/cucumber' - Then the inflated response should respond to 'run_list' with '["role[db]"]' - - Scenario: List environments in the role - Given I am an administrator - And a 'role' named 'webserver' exists - When I 'GET' the path '/roles/webserver/environments' - Then the inflated response should include 'cucumber'
\ No newline at end of file diff --git a/features/api/roles/update_roles_api.feature b/features/api/roles/update_roles_api.feature deleted file mode 100644 index 21376a3618..0000000000 --- a/features/api/roles/update_roles_api.feature +++ /dev/null @@ -1,44 +0,0 @@ -@api @api_roles @roles_update -Feature: Update a role - In order to keep my role data up-to-date - As a Developer - I want to update my role via the API - - Scenario Outline: Update a role - Given I am an administrator - And a 'role' named 'webserver' exists - And sending the method '<method>' to the 'role' with '<updated_value>' - When I 'PUT' the 'role' to the path '/roles/webserver' - Then the inflated response should respond to '<method>' with '<updated_value>' - When I 'GET' the path '/roles/webserver' - Then the inflated response should respond to '<method>' with '<updated_value>' - - Examples: - | method | updated_value | - | description | gorilla | - | run_list | [ "recipe[one]", "recipe[two]", "role[a]" ] | - | default_attributes | { "a": "d" } | - | override_attributes | { "c": "e" } | - - Scenario: Update a role with a wrong private key - Given I am an administrator - And a 'role' named 'webserver' exists - And sending the method 'description' to the 'role' with 'gorilla' - When I 'PUT' the 'role' to the path '/roles/webserver' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Update a role as a non-admin user - Given I am a non-admin - And a 'role' named 'webserver' exists - And sending the method 'description' to the 'role' with 'gorilla' - When I 'PUT' the 'role' to the path '/roles/webserver' using a wrong private key - Then I should get a '401 "Unauthorized"' exception - - Scenario: Update a node with a role that does not exist - Given I am an administrator - And a 'role' named 'webserver' exists - And sending the method 'run_list' to the 'role' with '["role[not_exist]"]' - When I 'PUT' the 'role' to the path '/roles/webserver' - Then the inflated response should respond to 'run_list' with '["role[not_exist]"]' - When I 'GET' the path '/roles/webserver' - Then the inflated response should respond to 'run_list' with '["role[not_exist]"]' diff --git a/features/api/sandboxes/sandboxes_api.feature b/features/api/sandboxes/sandboxes_api.feature deleted file mode 100644 index 56675ab47e..0000000000 --- a/features/api/sandboxes/sandboxes_api.feature +++ /dev/null @@ -1,112 +0,0 @@ -@api @sandboxes @sandbox @create_sandbox -Feature: Create a sandbox via the REST API - In order to have files available to be included in a cookbook - As a Developer - I want to upload files into a sandbox and commit the sandbox - - @positive - Scenario: Create a one-file sandbox - Given I am an administrator - When I create a sandbox named 'sandbox1' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - - @negative - Scenario: Create a one-file sandbox, but commit without uploading any files - Given I am an administrator - When I create a sandbox named 'sandbox1' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - When I commit the sandbox - Then I should get a '400 "Bad Request"' exception - - @positive - Scenario: Create a one-file sandbox, upload a file with an expected checksum, then commit - Given I am an administrator - When I create a sandbox named 'sandbox1' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'sandbox1_file1' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - - @negative - Scenario: Create a one-file sandbox, upload a file with an unexpected checksum, then commit - Given I am an administrator - When I create a sandbox named 'sandbox1' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'sandbox2_file1' to the sandbox - Then I should get a '404 Resource Not Found' exception - When I commit the sandbox - Then I should get a '400 "Bad Request"' exception - - @negative - Scenario: Create a one-file sandbox, upload a file with an expected checksum and one with an unexpected checksum, then commit - Given I am an administrator - When I create a sandbox named 'sandbox1' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'sandbox1_file1' to the sandbox - Then the response code should be '200' - Then I upload a file named 'sandbox2_file1' to the sandbox - Then I should get a '404 Resource Not Found' exception - When I commit the sandbox - # commit works as we did upload the only correct file. - Then I should not get an exception - - @negative @die - Scenario: Create a one-file sandbox, upload a file to an expected checksum URL whose contents do not match that checksum, then commit - Given I am an administrator - When I create a sandbox named 'sandbox1' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'sandbox2_file1' using the checksum of 'sandbox1_file1' to the sandbox - Then the response code should be '400' - When I commit the sandbox - Then I should get a '400 "Bad Request"' exception - -# multiple file sandbox positive and 1/2 negative - @positive - Scenario: Create a two-file sandbox, upload two expected checksums, and commit - Given I am an administrator - When I create a sandbox named 'sandbox2' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'sandbox2_file1' to the sandbox - Then the response code should be '200' - Then I upload a file named 'sandbox2_file2' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - - @negative - Scenario: Create a two-file sandbox, upload one of the expected checksums, then commit - Given I am an administrator - When I create a sandbox named 'sandbox2' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then I upload a file named 'sandbox2_file1' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should get a '400 "Bad Request"' exception - - @positive - Scenario: Create a two-file sandbox, and check the needs_upload field is set for both checksums - Given I am an administrator - When I create a sandbox named 'sandbox2' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then the sandbox file 'sandbox2_file1' should need upload - Then the sandbox file 'sandbox2_file2' should need upload - - @positive - Scenario: Create a two-file sandbox, upload the files, then commit. Create the same sandbox again, and neither file should need_upload. - Given I am an administrator - When I create a sandbox named 'sandbox2' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then the sandbox file 'sandbox2_file1' should need upload - Then the sandbox file 'sandbox2_file2' should need upload - Then I upload a file named 'sandbox2_file1' to the sandbox - Then the response code should be '200' - Then I upload a file named 'sandbox2_file2' to the sandbox - Then the response code should be '200' - When I commit the sandbox - Then I should not get an exception - # create again. - When I create a sandbox named 'sandbox2' - Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$' - Then the sandbox file 'sandbox2_file1' should not need upload - Then the sandbox file 'sandbox2_file2' should not need upload diff --git a/features/api/search/list_search.feature b/features/api/search/list_search.feature deleted file mode 100644 index 4341cd0bd1..0000000000 --- a/features/api/search/list_search.feature +++ /dev/null @@ -1,33 +0,0 @@ -@api @data @api_search @api_search_list -Feature: List search endpoints via the REST API - In order to know what search endpoints exist programatically - As a Developer - I want to list all the search indexes - - Scenario: List search indexes when no data bags have been created - Given I am an administrator - And there are no data bags - When I authenticate as 'bobo' - And I 'GET' the path '/search' - Then the inflated responses key 'node' should match '^http://(.+)/search/node$' - And the inflated responses key 'role' should match '^http://(.+)/search/role$' - And the inflated responses key 'client' should match '^http://(.+)/search/client$' - And the inflated responses key 'environment' should match '^http://(.+)/search/environment' - And the inflated response should be '4' items long - - Scenario: List search indexes when a data bag has been created - Given I am an administrator - And a 'data_bag' named 'users' exists - When I authenticate as 'bobo' - And I 'GET' the path '/search' - Then the inflated responses key 'node' should match '^http://(.+)/search/node$' - And the inflated responses key 'role' should match '^http://(.+)/search/role$' - And the inflated responses key 'client' should match '^http://(.+)/search/client$' - And the inflated responses key 'users' should match '^http://(.+)/search/users$' - And the inflated responses key 'environment' should match '^http://(.+)/search/environment' - And the inflated response should be '5' items long - - Scenario: List search indexes when you are not authenticated - When I 'GET' the path '/search' - Then I should get a '400 "Bad Request"' exception - diff --git a/features/api/search/reindex.feature b/features/api/search/reindex.feature deleted file mode 100644 index da67d8fefb..0000000000 --- a/features/api/search/reindex.feature +++ /dev/null @@ -1,18 +0,0 @@ -@api @data @api_search @api_search_reindex -Feature: Trigger a reindex via the REST API - In order to have a consistent index when all else fails - As an OpsDev - I want to rebuild the search index via the api - - Scenario: Ensure objects are inserted back into the index - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And I wait for '15' seconds - When I 'POST' the 'data_bag' to the path '/search/reindex' - And I wait for '15' seconds - And I 'GET' the path '/search/users?sort=id+desc' - Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem' - And the inflated responses key 'rows' item '0' key 'id' should be 'francis' - -
\ No newline at end of file diff --git a/features/api/search/show_search.feature b/features/api/search/show_search.feature deleted file mode 100644 index 656b63e8b2..0000000000 --- a/features/api/search/show_search.feature +++ /dev/null @@ -1,142 +0,0 @@ -@api @data @api_search @api_search_show -Feature: Search data via the REST API - In order to know about objects in the system - As a Developer - I want to search the objects - - Scenario: Search for objects when none have been created - Given I am an administrator - And a 'data_bag' named 'users' exists - When I authenticate as 'bobo' - And I 'GET' the path '/search/users' - Then the inflated responses key 'rows' should be '0' items long - And the inflated responses key 'start' should be the integer '0' - And the inflated responses key 'total' should be the integer '0' - - Scenario: Search for objects when one has been created - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/users' - Then a 'Chef::DataBagItem' with id 'francis' should be in the search result - And there should be '1' total search results - - Scenario: Search for objects when two have been created - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/users' - Then a 'Chef::DataBagItem' with id 'francis' should be in the search result - And a 'Chef::DataBagItem' with id 'axl_rose' should be in the search result - And there should be '2' total search results - - @oss_only - Scenario: Search for objects with a manual ascending sort order - Given PL-540 is resolved in favor of not removing this feature - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/users?sort=id+asc' - Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem' - And the inflated responses key 'rows' item '0' key 'id' should be 'axl_rose' - And the inflated responses key 'rows' item '1' should be a kind of 'Chef::DataBagItem' - And the inflated responses key 'rows' item '1' key 'id' should be 'francis' - And the inflated responses key 'start' should be the integer '0' - And the inflated responses key 'total' should be the integer '2' - - @oss_only - Scenario: Search for objects with a manual descending sort order - Given PL-540 is resolved in favor of not removing this feature - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/users?sort=id+desc' - Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem' - And the inflated responses key 'rows' item '0' key 'id' should be 'francis' - And the inflated responses key 'rows' item '1' should be a kind of 'Chef::DataBagItem' - And the inflated responses key 'rows' item '1' key 'id' should be 'axl_rose' - And the inflated responses key 'start' should be the integer '0' - And the inflated responses key 'total' should be the integer '2' - - @oss_only - Scenario: Search for objects and page through the results - Given PL-540 is resolved in favor of not removing this feature - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/users?rows=1&sort=id+asc' - Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem' - And the inflated responses key 'rows' item '0' key 'id' should be 'axl_rose' - And the inflated responses key 'rows' should be '1' items long - And the inflated responses key 'start' should be the integer '0' - And the inflated responses key 'total' should be the integer '2' - When I 'GET' the path '/search/users?rows=1&start=1&sort=id+asc' - Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem' - And the inflated responses key 'rows' item '0' key 'id' should be 'francis' - And the inflated responses key 'rows' should be '1' items long - And the inflated responses key 'start' should be the integer '1' - And the inflated responses key 'total' should be the integer '2' - - Scenario: Search for a subset of objects - Given I am an administrator - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/users?q=id:axl_rose' - Then a 'Chef::DataBagItem' with id 'axl_rose' should be in the search result - And there should be '1' total search results - - Scenario: Search for a node - Given I am an administrator - And a 'node' named 'searchman' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/node?q=recipe:oracle' - Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::Node' - And the inflated responses key 'rows' item '0' key 'one' should be 'five' - And the inflated responses key 'rows' item '0' key 'three' should be 'four' - And the inflated responses key 'rows' item '0' key 'walking' should be 'tall' - - Scenario: Search for an environment - Given I am an administrator - And a 'environment' named 'cucumber' exists - And I wait for '15' seconds - When I authenticate as 'bobo' - And I 'GET' the path '/search/environment?q=name:cucumber' - Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::Environment' - And the inflated responses key 'rows' item '0' should respond to 'name' with 'cucumber' - - Scenario: Search for a client - Given I am an administrator - And a 'client' named 'isis' exists - And the search index has been committed - When I authenticate as 'bobo' - And I 'GET' the path '/search/client?q=*:*' - Then a 'Chef::ApiClient' with item name 'isis' should be in the search result - - Scenario: Search for a type of object that does not exist - Given I am an administrator - When I authenticate as 'bobo' - And I 'GET' the path '/search/funkensteins' - Then I should get a '404 "Not Found"' exception - - Scenario: Search for objects when you are not authenticated - When I 'GET' the path '/search/users' - Then I should get a '400 "Bad Request"' exception - diff --git a/features/chef-client/attribute_settings.feature b/features/chef-client/attribute_settings.feature deleted file mode 100644 index f0ab6a9705..0000000000 --- a/features/chef-client/attribute_settings.feature +++ /dev/null @@ -1,192 +0,0 @@ -@client @attribute_settings - -Feature: Set default, normal, and override attributes - In order to easily configure similar systems - As an Administrator - I want to use different kinds of attributes - - Scenario: Set a default attribute in a cookbook attribute file - Given I am an administrator - And a validated node - And it includes the recipe 'attribute_settings' - When I run the chef-client - Then the run should exit '0' - Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings\] attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings\] attributes' - - Scenario: Set the default attribute in a environment - Given I am an administrator - And an 'environment' named 'default_attr_test' exists - And a validated node in the 'default_attr_test' environment - And it includes the recipe 'attribute_settings' - When I run the chef-client with '-l debug' - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'came from environment default_attr_test default attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from environment default_attr_test default attributes' - - Scenario: Set the default attribute in a role - Given I am an administrator - And an 'environment' named 'default_attr_test' exists - And a 'role' named 'attribute_settings_default' exists - And a validated node in the 'default_attr_test' environment - And it includes the role 'attribute_settings_default' - When I run the chef-client - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'came from role\[attribute_settings_default\] default attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from role\[attribute_settings_default\] default attributes' - - Scenario: Set the default attribute in a recipe - Given I am an administrator - And an 'environment' named 'default_attr_test' exists - And a 'role' named 'attribute_settings_default' exists - And a validated node in the 'default_attr_test' environment - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - When I run the chef-client - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings::default_in_recipe\]' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings::default_in_recipe\]' - - Scenario: Set a normal attribute in a cookbook attribute file - Given I am an administrator - And an 'environment' named 'default_attr_test' exists - And a validated node in the 'default_attr_test' environment - And a 'role' named 'attribute_settings_default' exists - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - And it includes the recipe 'attribute_settings_normal' - When I run the chef-client - Then the run should exit '0' - Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_normal\] attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_normal\] attributes' - - Scenario: Set a normal attribute in a cookbook recipe - Given I am an administrator - And an 'environment' named 'default_attr_test' exists - And a validated node in the 'default_attr_test' environment - And a 'role' named 'attribute_settings_default' exists - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - And it includes the recipe 'attribute_settings_normal::normal_in_recipe' - When I run the chef-client - Then the run should exit '0' - Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_normal::normal_in_recipe\]' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_normal::normal_in_recipe\]' - - Scenario: Set an override attribute in a cookbook attribute file - Given I am an administrator - And an 'environment' named 'default_attr_test' exists - And a validated node in the 'default_attr_test' environment - And a 'role' named 'attribute_settings_default' exists - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - And it includes the recipe 'attribute_settings_normal::normal_in_recipe' - And it includes the recipe 'attribute_settings_override' - When I run the chef-client - Then the run should exit '0' - Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_override\] override attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_override\] override attributes' - - Scenario: Set the override attribute in a role - Given I am an administrator - And a 'role' named 'attribute_settings_default' exists - And a 'role' named 'attribute_settings_override' exists - And an 'environment' named 'default_attr_test' exists - And a validated node in the 'default_attr_test' environment - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - And it includes the recipe 'attribute_settings_normal::normal_in_recipe' - And it includes the recipe 'attribute_settings_override' - And it includes the role 'attribute_settings_override' - When I run the chef-client - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'came from role\[attribute_settings_override\] override attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from role\[attribute_settings_override\] override attributes' - - Scenario: Set the override attribute in a environment - Given I am an administrator - And an 'environment' named 'cucumber' exists - And a 'role' named 'attribute_settings_default' exists - And a 'role' named 'attribute_settings_override' exists - And a validated node in the 'cucumber' environment - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - And it includes the recipe 'attribute_settings_normal::normal_in_recipe' - And it includes the recipe 'attribute_settings_override' - And it includes the role 'attribute_settings_override' - When I run the chef-client with '-l debug' - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'came from environment cucumber override attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from environment cucumber override attributes' - - Scenario: Set the override attribute in a recipe - Given I am an administrator - And an 'environment' named 'cucumber' exists - And a 'role' named 'attribute_settings_default' exists - And a 'role' named 'attribute_settings_override' exists - And a validated node in the 'cucumber' environment - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - And it includes the recipe 'attribute_settings_normal::normal_in_recipe' - And it includes the recipe 'attribute_settings_override' - And it includes the role 'attribute_settings_override' - And it includes the recipe 'attribute_settings_override::override_in_recipe' - When I run the chef-client - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_override::override_in_recipe\]' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_override::override_in_recipe\]' - - Scenario: Data is removed from override attribute in a recipe - Given I am an administrator - And an 'environment' named 'cucumber' exists - And a 'role' named 'attribute_settings_override' exists - And a validated node in the 'cucumber' environment - And it includes the role 'attribute_settings_override' - When I run the chef-client - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'came from environment cucumber override attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from environment cucumber override attributes' - Given it includes no recipes - And it includes the recipe 'integration_setup' - And it includes the recipe 'no_attributes' - When I run the chef-client - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'snakes' - - - # Test that attributes from JSON are applied before attribute files are applied. - @chef1286 - Scenario: Attributes from JSON files are normal attributes applied before attribute files - Given I am an administrator - And a validated node - And it includes the recipe 'attribute_settings_normal' - When I run the chef-client with json attributes - Then the run should exit '0' - Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_normal\] attributes' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_normal\] attributes' - - @chef1286 - Scenario: Attributes from JSON files have higher precedence than defaults - Given a 'role' named 'attribute_settings_default' exists - And a 'role' named 'attribute_settings_override' exists - And a validated node - And it includes the role 'attribute_settings_default' - And it includes the recipe 'attribute_settings::default_in_recipe' - When I run the chef-client with json attributes - Then the run should exit '0' - Then a file named 'attribute_setting.txt' should contain 'from_json_file' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'from_json_file' - diff --git a/features/chef-client/cleanup_checksum_cache.feature b/features/chef-client/cleanup_checksum_cache.feature deleted file mode 100644 index 951d752d6d..0000000000 --- a/features/chef-client/cleanup_checksum_cache.feature +++ /dev/null @@ -1,19 +0,0 @@ -@client @checksum_cache @checksum_cache_cleanup @chef_1397 -Feature: Cleanup checksum cache - In order to not use all of the available inodes on the filesystem with unneeded files - As a sysadmin - I want Chef to remove unused checksum cache files - - Scenario: Remove cached file checksums that are no longer needed - Given a validated node - And it includes the recipe 'template' - When I run the chef-client with '-l info' and the 'client_with_checksum_caching' config - Then the run should exit '0' - Given it includes no recipes - When I run the chef-client with '-l debug' and the 'client_with_checksum_caching' config - Then the run should exit '0' - And 'stdout' should have 'Removing unused checksum cache file .*chef\-file\-\-.*\-chef\-rendered\-template.*' - - -# for example: -# DEBUG: removing unused checksum cache file /Users/ddeleo/opscode/chef/features/data/tmp/checksum_cache/chef-file--var-folders-Ui-UiODstTvGJm3edk+EIMyf++++TI--Tmp--chef-rendered-template20100929-40338-1rjvhyc-0
\ No newline at end of file diff --git a/features/chef-client/cookbook_sync.feature b/features/chef-client/cookbook_sync.feature deleted file mode 100644 index eafcff63b0..0000000000 --- a/features/chef-client/cookbook_sync.feature +++ /dev/null @@ -1,62 +0,0 @@ -@client @client-cookbook-sync -Feature: Synchronize cookbooks from the server - In order to configure a system according to a centralized repository - As an Administrator - I want to synchronize cookbooks to the edge nodes - - Scenario: Synchronize specific cookbooks - Given a validated node - And it includes the recipe 'synchronize' - When I run the chef-client with '-l info' - Then the run should exit '0' - And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize/recipes/default.rb in the cache.' - - Scenario: Synchronize dependent cookbooks - Given a validated node - And it includes the recipe 'synchronize_deps' - When I run the chef-client with '-l info' - Then the run should exit '0' - And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize/recipes/default.rb in the cache.' - And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize_deps/recipes/default.rb in the cache.' - - Scenario: Removes files from the cache that are no longer needed - Given a validated node - And it includes the recipe 'synchronize_deps' - When I run the chef-client with '-l info' - Then the run should exit '0' - And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize_deps/recipes/default.rb in the cache.' - Given we have an empty file named 'cookbooks/synchronize_deps/recipes/woot.rb' in the client cache - When I run the chef-client with '-l info' - Then the run should exit '0' - And 'stdout' should have 'INFO: Removing cookbooks/synchronize_deps/recipes/woot.rb from the cache' - - Scenario: Remove cookbooks that are no longer needed - Given a validated node - And it includes the recipe 'synchronize_deps' - When I run the chef-client with '-l info' - Then the run should exit '0' - And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize_deps/recipes/default.rb in the cache.' - Given it includes no recipes - When I run the chef-client with '-l info' - Then the run should exit '0' - And 'stdout' should have 'INFO: Removing cookbooks/synchronize_deps/recipes/default.rb from the cache; its cookbook is no longer needed on this client.' - - @cookbook_dependencies - Scenario: Try to download a cookbook that depends on a non-existent cookbook - Given I am an administrator - And I fully upload a sandboxed cookbook named 'testcookbook_wrong_metadata' versioned '0.1.0' with 'testcookbook_wrong_metadata' - And a validated node - And it includes the recipe 'testcookbook_wrong_metadata' - When I run the chef-client with '-l debug' - Then the run should exit '1' - And 'stdout' should have '412 Precondition Failed.*Unable to satisfy constraints on cookbook no_such_cookbook, which does not exist, due to run list item \(testcookbook_wrong_metadata >= 0.0.0\)' - - Scenario: Utilise versioned dependencies - Given I am an administrator - And I fully upload a sandboxed cookbook named 'versions' versioned '0.2.0' with 'versions' - And a validated node - And it includes the recipe 'version_deps' - When I run the chef-client - Then the run should exit '0' - And a file named 'thundercats_are_go.txt' should contain '1' - diff --git a/features/chef-client/roles.feature b/features/chef-client/roles.feature deleted file mode 100644 index 26d8cf885f..0000000000 --- a/features/chef-client/roles.feature +++ /dev/null @@ -1,30 +0,0 @@ -@client @roles @client_roles -Feature: Configure nodes based on their role - In order to easily configure similar systems - As an Administrator - I want to define and utilize roles - - Scenario: Apply a role to a node - Given I am an administrator - And a validated node - And it includes the role 'role_test' - And a 'role' named 'role_test' exists - When I run the chef-client with '-l debug' - Then the run should exit '0' - And 'stdout' should have 'DEBUG: Loading Recipe roles' - And a file named 'role_test_reason.txt' should contain 'unbalancing' - And a file named 'role_test_ossining.txt' should contain 'whatever' - And a file named 'role_test_ruby_version.txt' should contain '1.\d+.\d+' - - Scenario: Apply a role with multiple environment specific run_lists to a node - Given I am an administrator - And an 'environment' named 'cucumber' exists - And a validated node in the 'cucumber' environment - And it includes the role 'role_env_test' - And a 'role' named 'role_env_test' exists - When I run the chef-client with '-l debug' - Then the run should exit '0' - And 'stdout' should have 'DEBUG: Loading Recipe roles' - And a file named 'role_env_test_reason.txt' should contain 'unbalancing' - And a file named 'role_env_test_ossining.txt' should contain 'whatever' - And a file named 'role_env_test_ruby_version.txt' should contain '1.\d+.\d+' diff --git a/features/chef-client/run_client.feature b/features/chef-client/run_client.feature deleted file mode 100644 index 31ab321604..0000000000 --- a/features/chef-client/run_client.feature +++ /dev/null @@ -1,21 +0,0 @@ -@client -Feature: Run chef-client - In order to ensure a system is always correctly configured - As an Administrator - I want to run the chef-client - - @empty_run_list - Scenario: Run chef-client with an empty runlist should get a log warning the node has an empty run list - Given a validated node with an empty runlist - When I run the chef-client with '-l debug' - Then the run should exit '0' - And 'stdout' should have 'has an empty run list.' - - @json_run_list - Scenario: Run chef client with a run list from command line JSON attributes - Given a validated node with an empty runlist - When I run the chef-client with json attributes 'json_runlist_and_attrs' - Then the run should exit '0' - And a file named 'attribute_setting.txt' should contain 'from_json_file' - When the node is retrieved from the API - Then the inflated responses key 'attribute_priority_was' should match 'from_json_file' diff --git a/features/chef-client/run_interval.feature b/features/chef-client/run_interval.feature deleted file mode 100644 index 54046ceec6..0000000000 --- a/features/chef-client/run_interval.feature +++ /dev/null @@ -1,29 +0,0 @@ -@client @client_run_interval -Feature: Run chef-client at periodic intervals - In order to ensure a system is always correctly configured - As an Administrator - I want to run the chef-client repeatedly at an interval - - Scenario: Run the client at an interval - Given a validated node - And it includes the recipe 'run_interval' - When I run the chef-client with '-l info -i 1' for '12' seconds - Then 'INFO: Starting Chef Run' should appear on 'stdout' '2' times - - Scenario: Run a background client for a few seconds - Given a validated node - And it includes the recipe 'run_interval' - When I run the chef-client in the background with '-l info -i 2' - And I stop the background chef-client after '10' seconds - Then the background chef-client should not be running - And 'INFO: Starting Chef Run' should appear on 'stdout' '2' times - - Scenario: Run a background client with the sync_library cookbook, update sync_library between intervals and ensure updated library is run - Given I have restored the original 'sync_library' cookbook - And a validated node - And it includes the recipe 'sync_library' - When I run the chef-client in the background with '-l info -i 2' - And I update cookbook 'sync_library' from 'sync_library_updated' after the first run - And I stop the background chef-client after '10' seconds - Then 'INFO: First generation library' should appear on 'stdout' '1' times - And 'INFO: Second generation library' should appear on 'stdout' '1' times diff --git a/features/chef-client/run_solo.feature b/features/chef-client/run_solo.feature deleted file mode 100644 index 0073833c94..0000000000 --- a/features/chef-client/run_solo.feature +++ /dev/null @@ -1,11 +0,0 @@ -@client @client_run_solo -Feature: Run chef-solo - In order to ensure a system is always correctly configured without chef-server - As an Administrator - I want to run the chef-solo - - Scenario: Run chef-solo without cookbooks should get error - When I run chef-solo without cookbooks - Then the run should exit '1' - And 'stdout' should have 'FATAL: No cookbook found' - diff --git a/features/cookbooks/cookbook_cache_cleanup.feature b/features/cookbooks/cookbook_cache_cleanup.feature deleted file mode 100644 index 6ac7173a99..0000000000 --- a/features/cookbooks/cookbook_cache_cleanup.feature +++ /dev/null @@ -1,19 +0,0 @@ - -@cookbooks @cookbook_cache_cleanup -Feature: Cookbook file downloads cache cleanup - In order to use the network efficiently and only download files when they've changed - As a Chef User - I want to keep cookbook contents in the cache and only remove they're no longer needed - - Scenario: Include a cookbook which references a file and a template then run chef-client twice -- only the first run should download a file - Given a validated node - And it includes the recipe 'transfer_some_cookbook_files::default' - When I run the chef-client with '-l debug' - Then the run should exit '0' - Then 'stdout' should have 'Storing updated cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt in the cache' - Then 'stdout' should have 'Storing updated cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb in the cache' - When I run the chef-client with '-l debug' - Then the run should exit '0' - Then 'stdout' should not have 'Storing updated cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt in the cache' - Then 'stdout' should not have 'Storing updated cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb in the cache' - diff --git a/features/cookbooks/cookbook_files_lazy_loading.feature b/features/cookbooks/cookbook_files_lazy_loading.feature deleted file mode 100644 index 81b0b04817..0000000000 --- a/features/cookbooks/cookbook_files_lazy_loading.feature +++ /dev/null @@ -1,22 +0,0 @@ - -@cookbooks @cookbook_lazy_loading -Feature: Cookbook lazy loading - In order to use the network efficiently and only download cookbook parts that are appropriate for the given Node - As a Chef User - I want to only download cookbook files and templates that are referred to in evaluated recipes - - Scenario: Include a cookbook containing 2 files, with a recipe that only references one via cookbook_file, and ensure that the second is not downloaded - Given a validated node - And it includes the recipe 'transfer_some_cookbook_files::default' - When I run the chef-client with '-l debug' - Then the run should exit '0' - Then 'stdout' should have 'Storing updated cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt in the cache' - Then 'stdout' should not have 'Storing updated cookbooks/transfer_some_cookbook_files/files/default/should_not_be_transferred.txt in the cache' - - Scenario: Include a cookbook containing 2 templates, with a recipe that only references one, and ensure that the second is not downloaded - Given a validated node - And it includes the recipe 'transfer_some_cookbook_files::default' - When I run the chef-client with '-l debug' - Then the run should exit '0' - Then 'stdout' should have 'Storing updated cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb in the cache' - Then 'stdout' should not have 'Storing updated cookbooks/transfer_some_cookbook_files/templates/default/should_not_be_transferred.erb in the cache' diff --git a/features/cookbooks/cookbook_purge.feature b/features/cookbooks/cookbook_purge.feature deleted file mode 100644 index 386f30c797..0000000000 --- a/features/cookbooks/cookbook_purge.feature +++ /dev/null @@ -1,43 +0,0 @@ -@cookbooks @cookbook_purge @manage_cookbook @checksum_purge -Feature: Purge Cookbook Files - In order to remove files with sensitive information or force the system into a consistent state - As a sysadmin - I want to purge cookbooks and all associated state from the Chef server - - @api @oss_only - Scenario: Purge a cookbook when its files are on disk - Given I am an administrator - And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0' - When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.2.0?purge=true' - Then I should not get an exception - When I 'GET' the path '/cookbooks' - Then the inflated responses key 'testcookbook_valid' should not exist - And the cookbook's files should have been deleted - And the cookbook's checksums should be removed from couchdb - - @knife @oss_only - Scenario: Purge a cookbook using knife when its files are on disk - Given I am an administrator - And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0' - When I run knife 'cookbook delete testcookbook_valid --all --purge --yes' - Then knife should succeed - When I 'GET' the path '/cookbooks' - Then the inflated responses key 'testcookbook_valid' should not exist - And the cookbook's files should have been deleted - And the cookbook's checksums should be removed from couchdb - - @api @oss_only - Scenario: Purge a cookbook when its files are not on disk - Given I am an administrator - And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0' - And I delete the cookbook's on disk checksum files - When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.2.0?purge=true' - Then I should not get an exception - When I 'GET' the path '/cookbooks' - Then the inflated responses key 'testcookbook_valid' should not exist - And the cookbook's files should have been deleted - And the cookbook's checksums should be removed from couchdb - - - - diff --git a/features/cookbooks/lightweight_resources_and_providers.feature b/features/cookbooks/lightweight_resources_and_providers.feature deleted file mode 100644 index 24fc7c5590..0000000000 --- a/features/cookbooks/lightweight_resources_and_providers.feature +++ /dev/null @@ -1,57 +0,0 @@ -@lwrp @cookbooks -Feature: Light-weight resources and providers - - @solo @lwrp_solo - Scenario Outline: Chef solo handles light-weight resources and providers - Given a local cookbook repository - When I run chef-solo with the 'lwrp::<recipe>' recipe - Then the run should exit '0' - And 'stdout' should have '<message>' - - Examples: - | recipe | message | - | default_everything | Default everything | - | non_default_provider | Non-default provider | - | non_default_resource | Non-default resource | - | overridden_resource_initialize | Overridden initialize | - | overridden_provider_load_current_resource | Overridden load_current_resource | - | provider_is_a_string | Provider is a string | - | provider_is_a_symbol | Provider is a symbol | - | provider_is_a_class | Provider is a class | - | provider_is_omitted | P=Chef::Provider::LwrpProviderIsOmitted, R=Chef::Resource::LwrpProviderIsOmitted | - - @solo @lwrp_solo - Scenario: Chef solo properly handles providers that invoke resources in their action definitions - Given a local cookbook repository - When I run chef-solo with the 'lwrp::provider_invokes_resource' recipe - Then the run should exit '0' - And a file named 'lwrp_touch_file.txt' should exist - - @client @lwrp_api - Scenario Outline: Chef-client handles light-weight resources and providers - Given a validated node with an empty runlist - And it includes the recipe 'lwrp::<recipe>' - When I run the chef-client - Then the run should exit '0' - And 'stdout' should have '<message>' - - Examples: - | recipe | message | - | default_everything | Default everything | - | non_default_provider | Non-default provider | - | non_default_resource | Non-default resource | - | overridden_resource_initialize | Overridden initialize | - | overridden_provider_load_current_resource | Overridden load_current_resource | - | provider_is_a_string | Provider is a string | - | provider_is_a_symbol | Provider is a symbol | - | provider_is_a_class | Provider is a class | - | provider_is_omitted | P=Chef::Provider::LwrpProviderIsOmitted, R=Chef::Resource::LwrpProviderIsOmitted | - - @client @lwrp_api - Scenario: Chef-client properly handles providers that invoke resources in their action definitions - Given a validated node - And it includes the recipe 'lwrp::provider_invokes_resource' - When I run the chef-client - Then the run should exit '0' - And a file named 'lwrp_touch_file.txt' should exist - diff --git a/features/cookbooks/metadata.feature b/features/cookbooks/metadata.feature deleted file mode 100644 index 5e32c6d383..0000000000 --- a/features/cookbooks/metadata.feature +++ /dev/null @@ -1,20 +0,0 @@ -@cookbooks @cookbook_metadata -Feature: Cookbook Metadata - In order to understand cookbooks without evaluating them - As an Administrator - I want to automatically generate metadata about cookbooks - - Scenario: Generate metadata for all cookbooks - Given a local cookbook repository - When I run the task to generate cookbook metadata - Then the run should exit '0' - And 'stdout' should have 'Generating metadata' - And a file named 'cookbooks_dir/cookbooks/metadata/metadata.json' should exist - - Scenario: Generate metadata for a specific cookbook - Given a local cookbook repository - When I run the task to generate cookbook metadata for 'metadata' - Then the run should exit '0' - And 'stdout' should have 'Generating metadata' - And a file named 'cookbooks_dir/cookbooks/metadata/metadata.json' should exist - diff --git a/features/data/Rakefile b/features/data/Rakefile deleted file mode 100644 index f615d66235..0000000000 --- a/features/data/Rakefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# Rakefile for Chef Server Repository -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -$: << File.join(File.dirname(__FILE__), "..", "..", "chef", "lib") - -require 'rubygems' -require 'chef' -require 'chef/json_compat' - -# Make sure you have loaded constants first -require File.join(File.dirname(__FILE__), 'config', 'rake') - -# And choosen a VCS -if File.directory?(File.join(TOPDIR, ".svn")) - $vcs = :svn -elsif File.directory?(File.join(TOPDIR, ".git")) - $vcs = :git -end - -load 'chef/tasks/chef_repo.rake' - diff --git a/features/data/apt/chef-integration-test-1.0/debian/changelog b/features/data/apt/chef-integration-test-1.0/debian/changelog deleted file mode 100644 index bb34505e65..0000000000 --- a/features/data/apt/chef-integration-test-1.0/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -chef-integration-test (1.0-1) unstable; urgency=low - - * Initial release (Closes: #CHEF-1718) - - -- Joshua Timberman <joshua@opscode.com> Thu, 30 Sep 2010 09:53:45 -0600 diff --git a/features/data/apt/chef-integration-test-1.0/debian/compat b/features/data/apt/chef-integration-test-1.0/debian/compat deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/features/data/apt/chef-integration-test-1.0/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/features/data/apt/chef-integration-test-1.0/debian/control b/features/data/apt/chef-integration-test-1.0/debian/control deleted file mode 100644 index e77b01b1d2..0000000000 --- a/features/data/apt/chef-integration-test-1.0/debian/control +++ /dev/null @@ -1,13 +0,0 @@ -Source: chef-integration-test -Section: ruby -Priority: extra -Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> -Build-Depends: debhelper (>= 7.0.50~) -Standards-Version: 3.8.4 -Homepage: http://tickets.opscode.com - -Package: chef-integration-test -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Chef integration tests for APT in Cucumber - This package is used for cucumber integration testing in Chef. diff --git a/features/data/apt/chef-integration-test-1.0/debian/copyright b/features/data/apt/chef-integration-test-1.0/debian/copyright deleted file mode 100644 index 72b6c65542..0000000000 --- a/features/data/apt/chef-integration-test-1.0/debian/copyright +++ /dev/null @@ -1,34 +0,0 @@ -This work was packaged by: - - Joshua Timberman <Joshua Timberman <joshua@opscode.com>> on Thu, 30 Sep 2010 09:53:45 -0600 - -Upstream Author(s): - - Opscode, Inc. - -Copyright: - - Copyright (C) 2010 Opscode, Inc - -License: - - 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. - -The Debian packaging is: - - Copyright (C) 2010 Opscode, Inc (<legal@opscode.com>) - - -and is licensed under the Apache 2.0 license. - -See "/usr/share/common-licenses/Apache-2.0" diff --git a/features/data/apt/chef-integration-test-1.0/debian/files b/features/data/apt/chef-integration-test-1.0/debian/files deleted file mode 100644 index 536f4beabc..0000000000 --- a/features/data/apt/chef-integration-test-1.0/debian/files +++ /dev/null @@ -1 +0,0 @@ -chef-integration-test_1.0-1_amd64.deb ruby extra diff --git a/features/data/apt/chef-integration-test-1.0/debian/rules b/features/data/apt/chef-integration-test-1.0/debian/rules deleted file mode 100755 index b760bee7f4..0000000000 --- a/features/data/apt/chef-integration-test-1.0/debian/rules +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ diff --git a/features/data/apt/chef-integration-test-1.0/debian/source/format b/features/data/apt/chef-integration-test-1.0/debian/source/format deleted file mode 100644 index 163aaf8d82..0000000000 --- a/features/data/apt/chef-integration-test-1.0/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/features/data/apt/chef-integration-test-1.1/debian/changelog b/features/data/apt/chef-integration-test-1.1/debian/changelog deleted file mode 100644 index fc693c1ec8..0000000000 --- a/features/data/apt/chef-integration-test-1.1/debian/changelog +++ /dev/null @@ -1,11 +0,0 @@ -chef-integration-test (1.1-1) unstable; urgency=low - - * New upstream release (1.1) - - -- Joshua Timberman <joshua@opscode.com> Thu, 30 Sep 2010 10:09:34 -0600 - -chef-integration-test (1.0-1) unstable; urgency=low - - * Initial release (Closes: #CHEF-1718) - - -- Joshua Timberman <joshua@opscode.com> Thu, 30 Sep 2010 09:53:45 -0600 diff --git a/features/data/apt/chef-integration-test-1.1/debian/compat b/features/data/apt/chef-integration-test-1.1/debian/compat deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/features/data/apt/chef-integration-test-1.1/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/features/data/apt/chef-integration-test-1.1/debian/control b/features/data/apt/chef-integration-test-1.1/debian/control deleted file mode 100644 index e77b01b1d2..0000000000 --- a/features/data/apt/chef-integration-test-1.1/debian/control +++ /dev/null @@ -1,13 +0,0 @@ -Source: chef-integration-test -Section: ruby -Priority: extra -Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> -Build-Depends: debhelper (>= 7.0.50~) -Standards-Version: 3.8.4 -Homepage: http://tickets.opscode.com - -Package: chef-integration-test -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Chef integration tests for APT in Cucumber - This package is used for cucumber integration testing in Chef. diff --git a/features/data/apt/chef-integration-test-1.1/debian/copyright b/features/data/apt/chef-integration-test-1.1/debian/copyright deleted file mode 100644 index 72b6c65542..0000000000 --- a/features/data/apt/chef-integration-test-1.1/debian/copyright +++ /dev/null @@ -1,34 +0,0 @@ -This work was packaged by: - - Joshua Timberman <Joshua Timberman <joshua@opscode.com>> on Thu, 30 Sep 2010 09:53:45 -0600 - -Upstream Author(s): - - Opscode, Inc. - -Copyright: - - Copyright (C) 2010 Opscode, Inc - -License: - - 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. - -The Debian packaging is: - - Copyright (C) 2010 Opscode, Inc (<legal@opscode.com>) - - -and is licensed under the Apache 2.0 license. - -See "/usr/share/common-licenses/Apache-2.0" diff --git a/features/data/apt/chef-integration-test-1.1/debian/files b/features/data/apt/chef-integration-test-1.1/debian/files deleted file mode 100644 index d72553c027..0000000000 --- a/features/data/apt/chef-integration-test-1.1/debian/files +++ /dev/null @@ -1 +0,0 @@ -chef-integration-test_1.1-1_amd64.deb ruby extra diff --git a/features/data/apt/chef-integration-test-1.1/debian/rules b/features/data/apt/chef-integration-test-1.1/debian/rules deleted file mode 100755 index b760bee7f4..0000000000 --- a/features/data/apt/chef-integration-test-1.1/debian/rules +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ diff --git a/features/data/apt/chef-integration-test-1.1/debian/source/format b/features/data/apt/chef-integration-test-1.1/debian/source/format deleted file mode 100644 index 163aaf8d82..0000000000 --- a/features/data/apt/chef-integration-test-1.1/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/features/data/apt/chef-integration-test_1.0-1_amd64.changes b/features/data/apt/chef-integration-test_1.0-1_amd64.changes deleted file mode 100644 index 4746b834e5..0000000000 --- a/features/data/apt/chef-integration-test_1.0-1_amd64.changes +++ /dev/null @@ -1,22 +0,0 @@ -Format: 1.8 -Date: Thu, 30 Sep 2010 09:53:45 -0600 -Source: chef-integration-test -Binary: chef-integration-test -Architecture: amd64 -Version: 1.0-1 -Distribution: unstable -Urgency: low -Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> -Changed-By: Joshua Timberman <joshua@opscode.com> -Description: - chef-integration-test - Chef integration tests for APT in Cucumber -Changes: - chef-integration-test (1.0-1) unstable; urgency=low - . - * Initial release (Closes: #CHEF-1718) -Checksums-Sha1: - b44685ff59626bc94c67e60665f06c4643fe9767 1680 chef-integration-test_1.0-1_amd64.deb -Checksums-Sha256: - da176f4405fa21fd7207d4785680c6996d395a1ca132f2d5565a61c5479b1116 1680 chef-integration-test_1.0-1_amd64.deb -Files: - 713722480408ecc8e7220aea52bdd76e 1680 ruby extra chef-integration-test_1.0-1_amd64.deb diff --git a/features/data/apt/chef-integration-test_1.0-1_amd64.deb b/features/data/apt/chef-integration-test_1.0-1_amd64.deb Binary files differdeleted file mode 100644 index 458dd026ff..0000000000 --- a/features/data/apt/chef-integration-test_1.0-1_amd64.deb +++ /dev/null diff --git a/features/data/apt/chef-integration-test_1.0.orig.tar.gz b/features/data/apt/chef-integration-test_1.0.orig.tar.gz Binary files differdeleted file mode 100644 index 3de028d486..0000000000 --- a/features/data/apt/chef-integration-test_1.0.orig.tar.gz +++ /dev/null diff --git a/features/data/apt/chef-integration-test_1.1-1_amd64.changes b/features/data/apt/chef-integration-test_1.1-1_amd64.changes deleted file mode 100644 index f014de813b..0000000000 --- a/features/data/apt/chef-integration-test_1.1-1_amd64.changes +++ /dev/null @@ -1,22 +0,0 @@ -Format: 1.8 -Date: Thu, 30 Sep 2010 10:09:34 -0600 -Source: chef-integration-test -Binary: chef-integration-test -Architecture: amd64 -Version: 1.1-1 -Distribution: unstable -Urgency: low -Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> -Changed-By: Joshua Timberman <joshua@opscode.com> -Description: - chef-integration-test - Chef integration tests for APT in Cucumber -Changes: - chef-integration-test (1.1-1) unstable; urgency=low - . - * New upstream release (1.1) -Checksums-Sha1: - 43c5653a9a5b9419849173a4ec3a9855cf0327a3 1722 chef-integration-test_1.1-1_amd64.deb -Checksums-Sha256: - 84e2f087f7e11d1b73743007ecfc6b8b34e03f6917c0993b35c0758ee59702c1 1722 chef-integration-test_1.1-1_amd64.deb -Files: - 4b05bace483dbca54efc21f97ee47e1d 1722 ruby extra chef-integration-test_1.1-1_amd64.deb diff --git a/features/data/apt/chef-integration-test_1.1-1_amd64.deb b/features/data/apt/chef-integration-test_1.1-1_amd64.deb Binary files differdeleted file mode 100644 index c4fac10dc1..0000000000 --- a/features/data/apt/chef-integration-test_1.1-1_amd64.deb +++ /dev/null diff --git a/features/data/apt/chef-integration-test_1.1.orig.tar.gz b/features/data/apt/chef-integration-test_1.1.orig.tar.gz Binary files differdeleted file mode 100644 index 5fda119eae..0000000000 --- a/features/data/apt/chef-integration-test_1.1.orig.tar.gz +++ /dev/null diff --git a/features/data/apt/var/www/apt/conf/distributions b/features/data/apt/var/www/apt/conf/distributions deleted file mode 100644 index 285c1a88de..0000000000 --- a/features/data/apt/var/www/apt/conf/distributions +++ /dev/null @@ -1,7 +0,0 @@ -Origin: localhost -Label: apt repository -Codename: sid -Architectures: amd64 -Components: main -Description: Apt repository -Pull: sid diff --git a/features/data/apt/var/www/apt/conf/incoming b/features/data/apt/var/www/apt/conf/incoming deleted file mode 100644 index d44e59c51b..0000000000 --- a/features/data/apt/var/www/apt/conf/incoming +++ /dev/null @@ -1,4 +0,0 @@ -Name: default -IncomingDir: /tmp/incoming -TempDir: /tmp -Allow: sid unstable>sid diff --git a/features/data/apt/var/www/apt/conf/pulls b/features/data/apt/var/www/apt/conf/pulls deleted file mode 100644 index 0fc3358279..0000000000 --- a/features/data/apt/var/www/apt/conf/pulls +++ /dev/null @@ -1,3 +0,0 @@ -Name: sid -From: sid -Components: main diff --git a/features/data/apt/var/www/apt/db/checksums.db b/features/data/apt/var/www/apt/db/checksums.db Binary files differdeleted file mode 100644 index e36ade2079..0000000000 --- a/features/data/apt/var/www/apt/db/checksums.db +++ /dev/null diff --git a/features/data/apt/var/www/apt/db/contents.cache.db b/features/data/apt/var/www/apt/db/contents.cache.db Binary files differdeleted file mode 100644 index 04a0c4aed5..0000000000 --- a/features/data/apt/var/www/apt/db/contents.cache.db +++ /dev/null diff --git a/features/data/apt/var/www/apt/db/packages.db b/features/data/apt/var/www/apt/db/packages.db Binary files differdeleted file mode 100644 index 43c70b0de3..0000000000 --- a/features/data/apt/var/www/apt/db/packages.db +++ /dev/null diff --git a/features/data/apt/var/www/apt/db/references.db b/features/data/apt/var/www/apt/db/references.db Binary files differdeleted file mode 100644 index 47c99fe152..0000000000 --- a/features/data/apt/var/www/apt/db/references.db +++ /dev/null diff --git a/features/data/apt/var/www/apt/db/release.caches.db b/features/data/apt/var/www/apt/db/release.caches.db Binary files differdeleted file mode 100644 index 0e251c5496..0000000000 --- a/features/data/apt/var/www/apt/db/release.caches.db +++ /dev/null diff --git a/features/data/apt/var/www/apt/db/version b/features/data/apt/var/www/apt/db/version deleted file mode 100644 index a6908690d9..0000000000 --- a/features/data/apt/var/www/apt/db/version +++ /dev/null @@ -1,4 +0,0 @@ -4.2.0 -3.3.0 -bdb4.8.30 -bdb4.8.0 diff --git a/features/data/apt/var/www/apt/dists/sid/Release b/features/data/apt/var/www/apt/dists/sid/Release deleted file mode 100644 index 44ccd079bf..0000000000 --- a/features/data/apt/var/www/apt/dists/sid/Release +++ /dev/null @@ -1,19 +0,0 @@ -Origin: localhost -Label: apt repository -Codename: sid -Date: Thu, 30 Sep 2010 16:33:01 UTC -Architectures: amd64 -Components: main -Description: Apt repository -MD5Sum: - 92ed2cc14e37e9ab23466b27857d29ac 596 main/binary-amd64/Packages - c7726773341137b71cc971d44ddec4f5 394 main/binary-amd64/Packages.gz - 46cd71c965ce0813c94ef78c836cc7d3 104 main/binary-amd64/Release -SHA1: - cde25071c5fcee59cee8dcd773ca419dcb40d946 596 main/binary-amd64/Packages - ce04daff75d4b27371d691d645282b198045544a 394 main/binary-amd64/Packages.gz - 91ca9531e3afa7a540cabdc6030c6f75d315fec7 104 main/binary-amd64/Release -SHA256: - af601ce143f33405425746462973adc0fda3aceb381d1c739851b95ee0814ca3 596 main/binary-amd64/Packages - 15e98119705a08018d4583caabc91d36ba12e6f1c8af0f799a3ec8ca5bfaa80d 394 main/binary-amd64/Packages.gz - 098c599ac5b0a98785336afb2bc9c47002570ffa07dd62321c6f70b9fdb74325 104 main/binary-amd64/Release diff --git a/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages b/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages deleted file mode 100644 index 209c23cd42..0000000000 --- a/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages +++ /dev/null @@ -1,16 +0,0 @@ -Package: chef-integration-test -Version: 1.1-1 -Architecture: amd64 -Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> -Installed-Size: 32 -Homepage: http://tickets.opscode.com -Priority: extra -Section: ruby -Filename: pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb -Size: 1722 -SHA256: 84e2f087f7e11d1b73743007ecfc6b8b34e03f6917c0993b35c0758ee59702c1 -SHA1: 43c5653a9a5b9419849173a4ec3a9855cf0327a3 -MD5sum: 4b05bace483dbca54efc21f97ee47e1d -Description: Chef integration tests for APT in Cucumber - This package is used for cucumber integration testing in Chef. - diff --git a/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz b/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz Binary files differdeleted file mode 100644 index 8a2c1e8980..0000000000 --- a/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz +++ /dev/null diff --git a/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release b/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release deleted file mode 100644 index e913d702a1..0000000000 --- a/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release +++ /dev/null @@ -1,5 +0,0 @@ -Component: main -Origin: localhost -Label: apt repository -Architecture: amd64 -Description: Apt repository diff --git a/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb b/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb Binary files differdeleted file mode 100644 index 458dd026ff..0000000000 --- a/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb +++ /dev/null diff --git a/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb b/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb Binary files differdeleted file mode 100644 index c4fac10dc1..0000000000 --- a/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb +++ /dev/null diff --git a/features/data/config/client.rb b/features/data/config/client.rb deleted file mode 100644 index 7f2df8b22c..0000000000 --- a/features/data/config/client.rb +++ /dev/null @@ -1,23 +0,0 @@ -supportdir = File.expand_path(File.join(File.dirname(__FILE__), "..")) -tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp")) - -log_level :error -log_location STDOUT -file_cache_path File.join(tmpdir, "cache") -ssl_verify_mode :verify_none -registration_url "http://127.0.0.1:4000" -template_url "http://127.0.0.1:4000" -remotefile_url "http://127.0.0.1:4000" -search_url "http://127.0.0.1:4000" -role_url "http://127.0.0.1:4000" -client_url "http://127.0.0.1:4000" -chef_server_url "http://127.0.0.1:4000" -validation_client_name "validator" -systmpdir = File.expand_path(File.join(Dir.tmpdir, "chef_integration")) -validation_key File.join(systmpdir, "validation.pem") -client_key File.join(systmpdir, "client.pem") -cache_type "Memory" -cache_options({}) - -Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners' -Ohai::Config[:disabled_plugins ]<< 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java' diff --git a/features/data/config/client_with_checksum_caching.rb b/features/data/config/client_with_checksum_caching.rb deleted file mode 100644 index 581c22d796..0000000000 --- a/features/data/config/client_with_checksum_caching.rb +++ /dev/null @@ -1,23 +0,0 @@ -supportdir = File.expand_path(File.join(File.dirname(__FILE__), "..")) -tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp")) - -log_level :error -log_location STDOUT -file_cache_path File.join(tmpdir, "cache") -ssl_verify_mode :verify_none -registration_url "http://127.0.0.1:4000" -template_url "http://127.0.0.1:4000" -remotefile_url "http://127.0.0.1:4000" -search_url "http://127.0.0.1:4000" -role_url "http://127.0.0.1:4000" -client_url "http://127.0.0.1:4000" -chef_server_url "http://127.0.0.1:4000" -validation_client_name "validator" -systmpdir = File.expand_path(File.join(Dir.tmpdir, "chef_integration")) -validation_key File.join(systmpdir, "validation.pem") -client_key File.join(systmpdir, "client.pem") -cache_type "BasicFile" -cache_options({:path => File.join(tmpdir, "checksum_cache")}) - -Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners' -Ohai::Config[:disabled_plugins ]<< 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java' diff --git a/features/data/config/knife-stephen.rb b/features/data/config/knife-stephen.rb deleted file mode 100644 index c1678104a5..0000000000 --- a/features/data/config/knife-stephen.rb +++ /dev/null @@ -1,12 +0,0 @@ -log_level :debug -log_location STDOUT -# Webui is an admin. -# env.rb gets the client name from Chef::Config[:web_ui_client_name] but we -# cannot use that since it won't be loaded in knife's memory. -systmpdir = File.expand_path(File.join(Dir.tmpdir, "chef_integration")) -node_name 'chef-webui' -client_key File.join(systmpdir, "webui.pem") -validation_client_name 'chef-validator' -validation_key File.join(systmpdir, "validation.pem") -chef_server_url 'http://localhost:4000' -cache_type 'BasicFile' diff --git a/features/data/config/knife.rb b/features/data/config/knife.rb deleted file mode 100644 index 7a1830a9d0..0000000000 --- a/features/data/config/knife.rb +++ /dev/null @@ -1,11 +0,0 @@ -log_level :debug -log_location STDOUT -# Webui is an admin. -# env.rb gets the client name from Chef::Config[:web_ui_client_name] but we -# cannot use that since it won't be loaded in knife's memory. -node_name 'chef-webui' -client_key "#{Dir.tmpdir}/chef_integration/webui.pem" -validation_client_name 'chef-validator' -validation_key "#{Dir.tmpdir}/validation.pem" -chef_server_url 'http://localhost:4000' -cache_type 'BasicFile' diff --git a/features/data/config/rake.rb b/features/data/config/rake.rb deleted file mode 100644 index d79d6e9889..0000000000 --- a/features/data/config/rake.rb +++ /dev/null @@ -1,57 +0,0 @@ -### -# Company and SSL Details -### - -# The company name - used for SSL certificates, and in various other places -COMPANY_NAME = "Opscode" - -# The Country Name to use for SSL Certificates -SSL_COUNTRY_NAME = "US" - -# The State Name to use for SSL Certificates -SSL_STATE_NAME = "Washington" - -# The Locality Name for SSL - typically, the city -SSL_LOCALITY_NAME = "Seattle" - -# What department? -SSL_ORGANIZATIONAL_UNIT_NAME = "Operations" - -# The SSL contact email address -SSL_EMAIL_ADDRESS = "do_not_reply@opscode.com" - -# License for new Cookbooks -# Can be :apachev2 or :none -NEW_COOKBOOK_LICENSE = :apachev2 - -########################## -# Chef Repository Layout # -########################## - -supportdir = File.expand_path(File.join(File.dirname(__FILE__), "..")) -tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp")) - -# Where to find upstream cookbooks -COOKBOOK_PATH = File.join(supportdir, "cookbooks") - -# Where to find site-local modifications to upstream cookbooks -SITE_COOKBOOK_PATH = File.join(supportdir, "site-cookbooks") - -# Chef Config Path -CHEF_CONFIG_PATH = File.join(supportdir, "config") - -# The location of the Chef Server Config file (on the server) -CHEF_SERVER_CONFIG = File.join(CHEF_CONFIG_PATH, "server.rb") - -# The location of the Chef Client Config file (on the client) -CHEF_CLIENT_CONFIG = File.join(CHEF_CONFIG_PATH, "client.rb") - -### -# Useful Extras (which you probably don't need to change) -### - -# The top of the repository checkout -TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), "..")) - -# Where to store certificates generated with ssl_cert -CADIR = File.expand_path(File.join(TOPDIR, "certificates")) diff --git a/features/data/config/server.rb b/features/data/config/server.rb deleted file mode 100644 index 295db68c0f..0000000000 --- a/features/data/config/server.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'tmpdir' - -supportdir = File.expand_path(File.join(File.dirname(__FILE__), "..")) -tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp")) -solr_tmp_dir = '/tmp/chef_solr_for_features' - -log_level :debug -log_location STDOUT -file_cache_path File.join(tmpdir, "cache") -ssl_verify_mode :verify_none -registration_url "http://127.0.0.1:4000" -template_url "http://127.0.0.1:4000" -remotefile_url "http://127.0.0.1:4000" -search_url "http://127.0.0.1:4000" -role_url "http://127.0.0.1:4000" -chef_server_url "http://127.0.0.1:4000" -client_url "http://127.0.0.1:4000" -cookbook_path [File.join(tmpdir, "cookbooks"), File.join(supportdir, "cookbooks")] - - -sandbox_path File.join(tmpdir, "sandboxes") -# checksum_path is where files in sandbox commits (during cookbook upload) are moved -checksum_path File.expand_path(File.join(File.dirname(__FILE__), "..", "repo", "checksums")) -openid_store_path File.join(tmpdir, "openid", "store") -openid_cstore_path File.join(tmpdir, "openid", "cstore") -role_path File.join(supportdir, "roles") -signing_ca_path File.join(tmpdir, "ca") -couchdb_database 'chef_integration' - -systmpdir = File.expand_path(File.join(Dir.tmpdir, "chef_integration")) - -validation_client_name "validator" -validation_key File.join(systmpdir, "validation.pem") -client_key File.join(systmpdir, "client.pem") -web_ui_client_name "chef-webui" -web_ui_key File.join(systmpdir, "webui.pem") - -solr_jetty_path File.join(solr_tmp_dir, "solr-jetty") -solr_data_path File.join(solr_tmp_dir, "solr", "data") -solr_home_path File.join(solr_tmp_dir, "solr") -solr_heap_size "250M" - -amqp_host '0.0.0.0' -amqp_port 5672 -amqp_user 'chef' -amqp_pass 'testing' -amqp_vhost '/chef' -amqp_consumer_id "aaaaaaaa-bbbb-cccc-dddd-eeee-ffffffffffffffff" - -Mixlib::Log::Formatter.show_time = true - -cache_options({ :path => File.join(tmpdir, "server-checksums") }) diff --git a/features/data/cookbook_tarballs/empty_tarball.tar.gz b/features/data/cookbook_tarballs/empty_tarball.tar.gz Binary files differdeleted file mode 100644 index 0834ddfe17..0000000000 --- a/features/data/cookbook_tarballs/empty_tarball.tar.gz +++ /dev/null diff --git a/features/data/cookbook_tarballs/new.tar.gz b/features/data/cookbook_tarballs/new.tar.gz Binary files differdeleted file mode 100644 index 71f27defdd..0000000000 --- a/features/data/cookbook_tarballs/new.tar.gz +++ /dev/null diff --git a/features/data/cookbook_tarballs/not_a_tarball.txt b/features/data/cookbook_tarballs/not_a_tarball.txt deleted file mode 100644 index b8c3637dec..0000000000 --- a/features/data/cookbook_tarballs/not_a_tarball.txt +++ /dev/null @@ -1 +0,0 @@ -I'm not a tarball. diff --git a/features/data/cookbook_tarballs/original.tar.gz b/features/data/cookbook_tarballs/original.tar.gz Binary files differdeleted file mode 100644 index 149fd262b1..0000000000 --- a/features/data/cookbook_tarballs/original.tar.gz +++ /dev/null diff --git a/features/data/cookbooks/attribute_include/README.rdoc b/features/data/cookbooks/attribute_include/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/attribute_include/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/attribute_include/attributes/a.rb b/features/data/cookbooks/attribute_include/attributes/a.rb deleted file mode 100644 index ea03d1a275..0000000000 --- a/features/data/cookbooks/attribute_include/attributes/a.rb +++ /dev/null @@ -1,4 +0,0 @@ -include_attribute 'attribute_include::b' -set[:mars_volta] = mars_volta_name -set[:mars_volta_is] = mars_volta_will_be - diff --git a/features/data/cookbooks/attribute_include/attributes/b.rb b/features/data/cookbooks/attribute_include/attributes/b.rb deleted file mode 100644 index bd5e056c04..0000000000 --- a/features/data/cookbooks/attribute_include/attributes/b.rb +++ /dev/null @@ -1,2 +0,0 @@ -set[:mars_volta_name] = 'mars_volta' -set[:mars_volta_will_be] = 'dope' diff --git a/features/data/cookbooks/attribute_include/metadata.rb b/features/data/cookbooks/attribute_include/metadata.rb deleted file mode 100644 index 07c1801d28..0000000000 --- a/features/data/cookbooks/attribute_include/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures recipe_include" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/attribute_include/recipes/default.rb b/features/data/cookbooks/attribute_include/recipes/default.rb deleted file mode 100644 index a211dc5928..0000000000 --- a/features/data/cookbooks/attribute_include/recipes/default.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Cookbook Name:: recipe_include -# Recipe:: second -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "append to #{node[:tmpdir]}/mars_volta" do - command "echo '#{node.mars_volta} is #{node.mars_volta_is}' >> #{node[:tmpdir]}/mars_volta" -end - diff --git a/features/data/cookbooks/attribute_include_default/README.rdoc b/features/data/cookbooks/attribute_include_default/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/attribute_include_default/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/attribute_include_default/attributes/a.rb b/features/data/cookbooks/attribute_include_default/attributes/a.rb deleted file mode 100644 index 53b60c55de..0000000000 --- a/features/data/cookbooks/attribute_include_default/attributes/a.rb +++ /dev/null @@ -1,5 +0,0 @@ -# should be equivalent to include_attribute 'attribute_include_default::default' -include_attribute 'attribute_include_default' -set[:mars_volta] = mars_volta_name -set[:mars_volta_is] = mars_volta_will_be - diff --git a/features/data/cookbooks/attribute_include_default/attributes/default.rb b/features/data/cookbooks/attribute_include_default/attributes/default.rb deleted file mode 100644 index bd5e056c04..0000000000 --- a/features/data/cookbooks/attribute_include_default/attributes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -set[:mars_volta_name] = 'mars_volta' -set[:mars_volta_will_be] = 'dope' diff --git a/features/data/cookbooks/attribute_include_default/metadata.rb b/features/data/cookbooks/attribute_include_default/metadata.rb deleted file mode 100644 index 07c1801d28..0000000000 --- a/features/data/cookbooks/attribute_include_default/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures recipe_include" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/attribute_include_default/recipes/default.rb b/features/data/cookbooks/attribute_include_default/recipes/default.rb deleted file mode 100644 index a211dc5928..0000000000 --- a/features/data/cookbooks/attribute_include_default/recipes/default.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Cookbook Name:: recipe_include -# Recipe:: second -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "append to #{node[:tmpdir]}/mars_volta" do - command "echo '#{node.mars_volta} is #{node.mars_volta_is}' >> #{node[:tmpdir]}/mars_volta" -end - diff --git a/features/data/cookbooks/attribute_settings/README.rdoc b/features/data/cookbooks/attribute_settings/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/attribute_settings/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/attribute_settings/attributes/default.rb b/features/data/cookbooks/attribute_settings/attributes/default.rb deleted file mode 100644 index 735f7c82bf..0000000000 --- a/features/data/cookbooks/attribute_settings/attributes/default.rb +++ /dev/null @@ -1,3 +0,0 @@ -default[:attribute_priority_was] = "came from recipe[attribute_settings] attributes" - - diff --git a/features/data/cookbooks/attribute_settings/default.rb b/features/data/cookbooks/attribute_settings/default.rb deleted file mode 100644 index 9ad0bdd8c6..0000000000 --- a/features/data/cookbooks/attribute_settings/default.rb +++ /dev/null @@ -1 +0,0 @@ -default[:attribute_priority_was] = 0 diff --git a/features/data/cookbooks/attribute_settings/metadata.rb b/features/data/cookbooks/attribute_settings/metadata.rb deleted file mode 100644 index ed2938fa6d..0000000000 --- a/features/data/cookbooks/attribute_settings/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures attribute_settings" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/attribute_settings/recipes/default.rb b/features/data/cookbooks/attribute_settings/recipes/default.rb deleted file mode 100644 index 23aa2e1c51..0000000000 --- a/features/data/cookbooks/attribute_settings/recipes/default.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "echo #{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - diff --git a/features/data/cookbooks/attribute_settings/recipes/default_in_recipe.rb b/features/data/cookbooks/attribute_settings/recipes/default_in_recipe.rb deleted file mode 100644 index 611f00fab9..0000000000 --- a/features/data/cookbooks/attribute_settings/recipes/default_in_recipe.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -node.default[:attribute_priority_was] = "came from recipe[attribute_settings::default_in_recipe]" - -execute "echo #{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - - - diff --git a/features/data/cookbooks/attribute_settings_normal/README.rdoc b/features/data/cookbooks/attribute_settings_normal/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/attribute_settings_normal/attributes/.default.rb.swo b/features/data/cookbooks/attribute_settings_normal/attributes/.default.rb.swo Binary files differdeleted file mode 100644 index fc5d646009..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/attributes/.default.rb.swo +++ /dev/null diff --git a/features/data/cookbooks/attribute_settings_normal/attributes/default.rb b/features/data/cookbooks/attribute_settings_normal/attributes/default.rb deleted file mode 100644 index 9a9fabd4ff..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/attributes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -normal[:attribute_priority_was] = "came from recipe[attribute_settings_normal] attributes" - diff --git a/features/data/cookbooks/attribute_settings_normal/default.rb b/features/data/cookbooks/attribute_settings_normal/default.rb deleted file mode 100644 index 9ad0bdd8c6..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/default.rb +++ /dev/null @@ -1 +0,0 @@ -default[:attribute_priority_was] = 0 diff --git a/features/data/cookbooks/attribute_settings_normal/metadata.rb b/features/data/cookbooks/attribute_settings_normal/metadata.rb deleted file mode 100644 index ed2938fa6d..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures attribute_settings" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/attribute_settings_normal/recipes/.default.rb.swo b/features/data/cookbooks/attribute_settings_normal/recipes/.default.rb.swo Binary files differdeleted file mode 100644 index 369e8d73ce..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/recipes/.default.rb.swo +++ /dev/null diff --git a/features/data/cookbooks/attribute_settings_normal/recipes/.default_in_recipe.rb.swo b/features/data/cookbooks/attribute_settings_normal/recipes/.default_in_recipe.rb.swo Binary files differdeleted file mode 100644 index 5804d58505..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/recipes/.default_in_recipe.rb.swo +++ /dev/null diff --git a/features/data/cookbooks/attribute_settings_normal/recipes/default.rb b/features/data/cookbooks/attribute_settings_normal/recipes/default.rb deleted file mode 100644 index 23aa2e1c51..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/recipes/default.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "echo #{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - diff --git a/features/data/cookbooks/attribute_settings_normal/recipes/normal_in_recipe.rb b/features/data/cookbooks/attribute_settings_normal/recipes/normal_in_recipe.rb deleted file mode 100644 index 5badb699dc..0000000000 --- a/features/data/cookbooks/attribute_settings_normal/recipes/normal_in_recipe.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -node.normal[:attribute_priority_was] = "came from recipe[attribute_settings_normal::normal_in_recipe]" - -execute "echo #{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - - - diff --git a/features/data/cookbooks/attribute_settings_override/README.rdoc b/features/data/cookbooks/attribute_settings_override/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/attribute_settings_override/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/attribute_settings_override/attributes/default.rb b/features/data/cookbooks/attribute_settings_override/attributes/default.rb deleted file mode 100644 index a0caa1b4b8..0000000000 --- a/features/data/cookbooks/attribute_settings_override/attributes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -override[:attribute_priority_was] = "came from recipe[attribute_settings_override] override attributes" - diff --git a/features/data/cookbooks/attribute_settings_override/default.rb b/features/data/cookbooks/attribute_settings_override/default.rb deleted file mode 100644 index 9ad0bdd8c6..0000000000 --- a/features/data/cookbooks/attribute_settings_override/default.rb +++ /dev/null @@ -1 +0,0 @@ -default[:attribute_priority_was] = 0 diff --git a/features/data/cookbooks/attribute_settings_override/metadata.rb b/features/data/cookbooks/attribute_settings_override/metadata.rb deleted file mode 100644 index ed2938fa6d..0000000000 --- a/features/data/cookbooks/attribute_settings_override/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures attribute_settings" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/attribute_settings_override/recipes/default.rb b/features/data/cookbooks/attribute_settings_override/recipes/default.rb deleted file mode 100644 index 23aa2e1c51..0000000000 --- a/features/data/cookbooks/attribute_settings_override/recipes/default.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "echo #{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - diff --git a/features/data/cookbooks/attribute_settings_override/recipes/normal_in_recipe.rb b/features/data/cookbooks/attribute_settings_override/recipes/normal_in_recipe.rb deleted file mode 100644 index 6e7807f073..0000000000 --- a/features/data/cookbooks/attribute_settings_override/recipes/normal_in_recipe.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -node.override[:attribute_priority_was] = 5 - -execute "echo #{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - - - diff --git a/features/data/cookbooks/attribute_settings_override/recipes/override_in_recipe.rb b/features/data/cookbooks/attribute_settings_override/recipes/override_in_recipe.rb deleted file mode 100644 index 88a28dce0e..0000000000 --- a/features/data/cookbooks/attribute_settings_override/recipes/override_in_recipe.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 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. -# - -node.override[:attribute_priority_was] = "came from recipe[attribute_settings_override::override_in_recipe]" - -execute "echo #{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - - - diff --git a/features/data/cookbooks/delayed_notifications/recipes/bad_syntax_notifies.rb b/features/data/cookbooks/delayed_notifications/recipes/bad_syntax_notifies.rb deleted file mode 100644 index 5136e3aa64..0000000000 --- a/features/data/cookbooks/delayed_notifications/recipes/bad_syntax_notifies.rb +++ /dev/null @@ -1,14 +0,0 @@ - -# Should never be executed, see comment below -execute("echo should-not-execute") - -execute("echo foo") do - # refers to the resource below but the syntax is wrong - # expected behavior is for the reference to be resolved later - # and the notification to work correctly - notifies(:create, /file\[.*notified_file\.txt\]/) #regex isn't a valid argument here -end - -file "#{node[:tmpdir]}/notified_file.txt" do - action :nothing -end diff --git a/features/data/cookbooks/delayed_notifications/recipes/default.rb b/features/data/cookbooks/delayed_notifications/recipes/default.rb deleted file mode 100644 index 70d0071bc5..0000000000 --- a/features/data/cookbooks/delayed_notifications/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: delayed_notifications -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/delayed_notifications/recipes/forward_references.rb b/features/data/cookbooks/delayed_notifications/recipes/forward_references.rb deleted file mode 100644 index 14d82eef0c..0000000000 --- a/features/data/cookbooks/delayed_notifications/recipes/forward_references.rb +++ /dev/null @@ -1,10 +0,0 @@ -execute("echo foo") do - # refers to the resource below, which isn't defined yet. - # expected behavior is for the reference to be resolved later - # and the notification to work correctly - notifies(:create, "file[#{node[:tmpdir]}/notified_file.txt]") -end - -file "#{node[:tmpdir]}/notified_file.txt" do - action :nothing -end diff --git a/features/data/cookbooks/delayed_notifications/recipes/invalid_forward_reference.rb b/features/data/cookbooks/delayed_notifications/recipes/invalid_forward_reference.rb deleted file mode 100644 index d636611dc0..0000000000 --- a/features/data/cookbooks/delayed_notifications/recipes/invalid_forward_reference.rb +++ /dev/null @@ -1,16 +0,0 @@ - -# Should never be executed, see comment below -execute("echo should-not-execute") - -execute("echo foo") do - # refers to the resource below, but there is an intentional typo - # expected behavior is for the reference to be resolved *before* - # Chef starts converging resources, so that the above execute - # resource is never called. - # Also, the error message should be helpful. - notifies(:create, "file[#{node[:tmpdir]}/notified_file.txt]") -end - -file "#{node[:tmpdir]}/not-notified_file.txt" do - action :nothing -end diff --git a/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_a_single_source.rb b/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_a_single_source.rb deleted file mode 100644 index 9ab2a9a6fe..0000000000 --- a/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_a_single_source.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: delayed_notifications -# Recipe:: notify_a_resource_from_a_single_source -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/notified_file.txt" do - action :nothing -end - -execute "echo foo" do - notifies :create, resources("file[#{node[:tmpdir]}/notified_file.txt]"), :delayed -end diff --git a/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_multiple_sources.rb b/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_multiple_sources.rb deleted file mode 100644 index 74fc68a0f3..0000000000 --- a/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_multiple_sources.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Cookbook Name:: delayed_notifications -# Recipe:: notify_a_resource_from_multiple_sources -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "bob dylan" do - command "echo 'bob dylan' >> #{node[:tmpdir]}/notified_file.txt" - action :nothing -end - -execute "echo foo" do - notifies :run, resources("execute[bob dylan]"), :delayed -end - -execute "echo bar" do - notifies :run, resources("execute[bob dylan]"), :delayed -end diff --git a/features/data/cookbooks/delayed_notifications/recipes/notify_different_resources_for_different_actions.rb b/features/data/cookbooks/delayed_notifications/recipes/notify_different_resources_for_different_actions.rb deleted file mode 100644 index 3180bbe4c2..0000000000 --- a/features/data/cookbooks/delayed_notifications/recipes/notify_different_resources_for_different_actions.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Cookbook Name:: delayed_notifications -# Recipe:: notify_different_resources_for_different_actions -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/notified_file_2.txt" do - action :nothing -end - -file "#{node[:tmpdir]}/notified_file_3.txt" do - action :nothing -end - -execute "echo foo" do - notifies([{resources("file[#{node[:tmpdir]}/notified_file_2.txt]") => [:create, :delayed]}, - {resources("file[#{node[:tmpdir]}/notified_file_3.txt]") => [:create, :delayed]}]) -end diff --git a/features/data/cookbooks/deploy/recipes/callbacks.rb b/features/data/cookbooks/deploy/recipes/callbacks.rb deleted file mode 100644 index 7d19c90446..0000000000 --- a/features/data/cookbooks/deploy/recipes/callbacks.rb +++ /dev/null @@ -1,78 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -%w{ log pids system config sqlite deploy}.each do |dir| - directory "#{node[:tmpdir]}/deploy/shared/#{dir}" do - recursive true - mode "0775" - end -end - - -template "#{node[:tmpdir]}/deploy/shared/config/database.yml" do - source "database.yml.erb" - mode "0664" -end - -template "#{node[:tmpdir]}/deploy/shared/config/app_config.yml" do - source "app_config.yml.erb" - mode "0664" -end - -template "#{node[:tmpdir]}/deploy/shared/deploy/before_migrate.rb" do - source "sneaky_before_migrate_hook.rb.erb" - mode "0644" -end - -template "#{node[:tmpdir]}/deploy/shared/deploy/before_symlink.rb" do - source "sneaky_before_symlink_hook.rb.erb" - mode "0644" -end - -template "#{node[:tmpdir]}/deploy/shared/deploy/before_restart.rb" do - source "sneaky_before_restart_hook.rb.erb" - mode "0644" -end - -template "#{node[:tmpdir]}/deploy/shared/deploy/after_restart.rb" do - source "sneaky_after_restart_hook.rb.erb" - mode "0644" -end - -file "#{node[:tmpdir]}/deploy/shared/sqlite/production.sqlite3" do - mode "0664" -end - -deploy "#{node[:tmpdir]}/deploy" do - repo "#{node[:tmpdir]}/gitrepo/myapp/" - environment "RAILS_ENV" => "production" - revision "HEAD" - action :deploy - migration_command "rake db:migrate --trace" - migrate true - restart_command "touch tmp/restart.txt" - create_dirs_before_symlink %w{tmp public config deploy} - symlink_before_migrate "config/database.yml" => "config/database.yml" - - symlinks "system" => "public/system", "pids" => "tmp/pids", "log" => "log", - "deploy/before_migrate.rb" => "deploy/before_migrate.rb", - "deploy/before_symlink.rb" => "deploy/before_symlink.rb", - "deploy/before_restart.rb" => "deploy/before_restart.rb", - "deploy/after_restart.rb" => "deploy/after_restart.rb" -end diff --git a/features/data/cookbooks/deploy/recipes/default.rb b/features/data/cookbooks/deploy/recipes/default.rb deleted file mode 100644 index 39ff3fd040..0000000000 --- a/features/data/cookbooks/deploy/recipes/default.rb +++ /dev/null @@ -1,51 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -%w{ log pids system config sqlite}.each do |dir| - directory "#{node[:tmpdir]}/deploy/shared/#{dir}" do - recursive true - mode "0775" - end -end - - -template "#{node[:tmpdir]}/deploy/shared/config/database.yml" do - source "database.yml.erb" - mode "0664" -end - -template "#{node[:tmpdir]}/deploy/shared/config/app_config.yml" do - source "app_config.yml.erb" - mode "0664" -end - -file "#{node[:tmpdir]}/deploy/shared/sqlite/production.sqlite3" do - mode "0664" -end - -deploy "#{node[:tmpdir]}/deploy" do - repo "#{node[:tmpdir]}/gitrepo/myapp/" - environment "RAILS_ENV" => "production" - revision "HEAD" - action :deploy - migration_command "rake db:migrate --trace" - migrate true - restart_command "touch tmp/restart.txt" -end - diff --git a/features/data/cookbooks/deploy/recipes/deploy_commit1.rb b/features/data/cookbooks/deploy/recipes/deploy_commit1.rb deleted file mode 100644 index f2b28a8874..0000000000 --- a/features/data/cookbooks/deploy/recipes/deploy_commit1.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: deploy_commit1 -# -# Copyright 2010, Opscode -# -# 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. -# - -deploy "deploy" do - deploy_to "#{node[:tmpdir]}/deploy" - repo "#{node[:tmpdir]}/test_git_repo" - revision "commit1" - action :deploy -end diff --git a/features/data/cookbooks/deploy/recipes/deploy_commit2.rb b/features/data/cookbooks/deploy/recipes/deploy_commit2.rb deleted file mode 100644 index 87231bb272..0000000000 --- a/features/data/cookbooks/deploy/recipes/deploy_commit2.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: deploy_commit2 -# -# Copyright 2010, Opscode -# -# 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. -# - -deploy "deploy" do - deploy_to "#{node[:tmpdir]}/deploy" - repo "#{node[:tmpdir]}/test_git_repo" - revision "commit2" - action :deploy -end diff --git a/features/data/cookbooks/deploy/recipes/embedded_recipe_callbacks.rb b/features/data/cookbooks/deploy/recipes/embedded_recipe_callbacks.rb deleted file mode 100644 index 56804eaf50..0000000000 --- a/features/data/cookbooks/deploy/recipes/embedded_recipe_callbacks.rb +++ /dev/null @@ -1,70 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: embedded_recipe_callbacks -# -# Copyright 2009, Daniel DeLeo -# -# 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. -# - -%w{ log pids system config sqlite deploy}.each do |dir| - directory "#{node[:tmpdir]}/deploy/shared/#{dir}" do - recursive true - mode "0775" - end -end - - -template "#{node[:tmpdir]}/deploy/shared/config/database.yml" do - source "database.yml.erb" - mode "0664" -end - -file "#{node[:tmpdir]}/deploy/shared/sqlite/production.sqlite3" do - mode "0664" -end - -timestamped_deploy "#{node[:tmpdir]}/deploy" do - repo "#{node[:tmpdir]}/gitrepo/myapp/" - environment "RAILS_ENV" => "production" - revision "HEAD" - action :deploy - migration_command "rake db:migrate --trace" - migrate true - - # Callback awesomeness: - before_migrate do - current_release = release_path - - directory "#{current_release}/deploy" do - mode "0755" - end - - # creates a callback for before_symlink - template "#{current_release}/deploy/before_symlink_callback.rb" do - source "embedded_recipe_before_symlink.rb.erb" - mode "0644" - end - - end - - before_symlink "deploy/before_symlink_callback.rb" - - restart do - current_release = release_path - file "#{release_path}/tmp/restart.txt" do - mode "0644" - end - end - -end diff --git a/features/data/cookbooks/deploy/recipes/revision_deploy.rb b/features/data/cookbooks/deploy/recipes/revision_deploy.rb deleted file mode 100644 index 666d70df2f..0000000000 --- a/features/data/cookbooks/deploy/recipes/revision_deploy.rb +++ /dev/null @@ -1,51 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -%w{ log pids system config sqlite}.each do |dir| - directory "#{node[:tmpdir]}/deploy/shared/#{dir}" do - recursive true - mode "0775" - end -end - - -template "#{node[:tmpdir]}/deploy/shared/config/database.yml" do - source "database.yml.erb" - mode "0664" -end - -template "#{node[:tmpdir]}/deploy/shared/config/app_config.yml" do - source "app_config.yml.erb" - mode "0664" -end - -file "#{node[:tmpdir]}/deploy/shared/sqlite/production.sqlite3" do - mode "0664" -end - -deploy_revision "#{node[:tmpdir]}/deploy" do - repo "#{node[:tmpdir]}/gitrepo/myapp/" - environment "RAILS_ENV" => "production" - revision "HEAD" - action :deploy - migration_command "rake db:migrate --trace" - migrate true - restart_command "touch tmp/restart.txt" -end - diff --git a/features/data/cookbooks/deploy/recipes/revision_rollback.rb b/features/data/cookbooks/deploy/recipes/revision_rollback.rb deleted file mode 100644 index faa39c2f42..0000000000 --- a/features/data/cookbooks/deploy/recipes/revision_rollback.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -deploy_revision "#{node[:tmpdir]}/deploy" do - repo "#{node[:tmpdir]}/gitrepo/myapp/" - environment "RAILS_ENV" => "production" - revision "HEAD" - action :rollback - migration_command "rake db:migrate --trace" - migrate true - restart_command "touch tmp/restart.txt" -end diff --git a/features/data/cookbooks/deploy/recipes/rollback_commit2.rb b/features/data/cookbooks/deploy/recipes/rollback_commit2.rb deleted file mode 100644 index 08720964b8..0000000000 --- a/features/data/cookbooks/deploy/recipes/rollback_commit2.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# Cookbook Name:: deploy -# Recipe:: rollback_commit2 -# -# Copyright 2010, Opscode -# -# 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. -# - -deploy "deploy" do - deploy_to "#{node[:tmpdir]}/deploy" - repo "#{node[:tmpdir]}/test_git_repo" - action :rollback -end diff --git a/features/data/cookbooks/deploy/templates/default/app_config.yml.erb b/features/data/cookbooks/deploy/templates/default/app_config.yml.erb deleted file mode 100644 index 40bb98ee93..0000000000 --- a/features/data/cookbooks/deploy/templates/default/app_config.yml.erb +++ /dev/null @@ -1,23 +0,0 @@ ---- -default: &default - name: masquerade - host: localhost:3000 - use_ssl: false - time_zone: Berlin - email: info@your.domain.com - session: - session_key: openidserver_session_id - secret: replacethiswithyourowntopsecretsessionsecretsothatnoonewillknowit - mailer: - address: localhost - domain: your.domain.com - from: info@your.domain.com - -development: - <<: *default - -test: - <<: *default - -production: - <<: *default diff --git a/features/data/cookbooks/deploy/templates/default/database.yml.erb b/features/data/cookbooks/deploy/templates/default/database.yml.erb deleted file mode 100644 index 1793d95f55..0000000000 --- a/features/data/cookbooks/deploy/templates/default/database.yml.erb +++ /dev/null @@ -1,18 +0,0 @@ -development: - adapter: sqlite3 - database: dev.sqlite3 - encoding: utf8 - -test: - adapter: sqlite3 - host: localhost - database: masquerade_test - username: masquerade - password: - encoding: utf8 - -production: - adapter: sqlite3 - host: localhost - database: db/production.sqlite3 - encoding: utf8
\ No newline at end of file diff --git a/features/data/cookbooks/deploy/templates/default/embedded_recipe_before_symlink.rb.erb b/features/data/cookbooks/deploy/templates/default/embedded_recipe_before_symlink.rb.erb deleted file mode 100644 index 8b489f15ac..0000000000 --- a/features/data/cookbooks/deploy/templates/default/embedded_recipe_before_symlink.rb.erb +++ /dev/null @@ -1,4 +0,0 @@ -current_release = release_path -file "#{current_release}/app/before_symlink_was_here.txt" do - mode "0644" -end
\ No newline at end of file diff --git a/features/data/cookbooks/deploy/templates/default/sneaky_after_restart_hook.rb.erb b/features/data/cookbooks/deploy/templates/default/sneaky_after_restart_hook.rb.erb deleted file mode 100644 index 90f93f4183..0000000000 --- a/features/data/cookbooks/deploy/templates/default/sneaky_after_restart_hook.rb.erb +++ /dev/null @@ -1,4 +0,0 @@ -hook_name = "after_restart" -::File.open(@release_path + "/app/#{hook_name}", "a+") do |fd| - fd.puts( {:hook_name => hook_name, :env => @configuration[:environment]}.to_json ) -end
\ No newline at end of file diff --git a/features/data/cookbooks/deploy/templates/default/sneaky_before_migrate_hook.rb.erb b/features/data/cookbooks/deploy/templates/default/sneaky_before_migrate_hook.rb.erb deleted file mode 100644 index 59a251e48d..0000000000 --- a/features/data/cookbooks/deploy/templates/default/sneaky_before_migrate_hook.rb.erb +++ /dev/null @@ -1,2 +0,0 @@ -# NOOP -# This file isn't symlinked in yet when its callback would be run.
\ No newline at end of file diff --git a/features/data/cookbooks/deploy/templates/default/sneaky_before_restart_hook.rb.erb b/features/data/cookbooks/deploy/templates/default/sneaky_before_restart_hook.rb.erb deleted file mode 100644 index d514674d4e..0000000000 --- a/features/data/cookbooks/deploy/templates/default/sneaky_before_restart_hook.rb.erb +++ /dev/null @@ -1,4 +0,0 @@ -hook_name = "before_restart" -::File.open(@release_path + "/app/#{hook_name}", "a+") do |fd| - fd.puts( {:hook_name => hook_name, :env => @configuration[:environment]}.to_json ) -end
\ No newline at end of file diff --git a/features/data/cookbooks/deploy/templates/default/sneaky_before_symlink_hook.rb.erb b/features/data/cookbooks/deploy/templates/default/sneaky_before_symlink_hook.rb.erb deleted file mode 100644 index de5fd98645..0000000000 --- a/features/data/cookbooks/deploy/templates/default/sneaky_before_symlink_hook.rb.erb +++ /dev/null @@ -1,2 +0,0 @@ -# NOOP -# This file isn't symlinked to the correct path when its callback fires
\ No newline at end of file diff --git a/features/data/cookbooks/directory_provider/recipes/create.rb b/features/data/cookbooks/directory_provider/recipes/create.rb deleted file mode 100644 index 7cc7f4ce84..0000000000 --- a/features/data/cookbooks/directory_provider/recipes/create.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: directory_provider -# Recipe:: create -# -# Copyright 2009, Opscode -# -# 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. -# - -directory "#{node[:tmpdir]}/isis" do - mode "755" - owner "nobody" - action :create -end - diff --git a/features/data/cookbooks/directory_provider/recipes/default.rb b/features/data/cookbooks/directory_provider/recipes/default.rb deleted file mode 100644 index 41f6776dfc..0000000000 --- a/features/data/cookbooks/directory_provider/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: directory_provider -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/directory_provider/recipes/delete.rb b/features/data/cookbooks/directory_provider/recipes/delete.rb deleted file mode 100644 index f9a81e8e2c..0000000000 --- a/features/data/cookbooks/directory_provider/recipes/delete.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Cookbook Name:: directory_provider -# Recipe:: delete -# -# Copyright 2009, Opscode -# -# 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. -# - -r = directory "#{node[:tmpdir]}/particles" do - action :nothing -end -r.run_action(:create) - -directory "#{node[:tmpdir]}/particles" do - action :delete -end - - diff --git a/features/data/cookbooks/directory_provider/recipes/delete_nonexistent.rb b/features/data/cookbooks/directory_provider/recipes/delete_nonexistent.rb deleted file mode 100644 index ed89bfe3d0..0000000000 --- a/features/data/cookbooks/directory_provider/recipes/delete_nonexistent.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Cookbook Name:: directory_ -# Recipe:: delete_nonexistent -# -# Copyright 2009, Opscode -# -# 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. -# - -directory "#{node[:tmpdir]}/particles" do - action :delete -end - diff --git a/features/data/cookbooks/directory_provider/recipes/owner_update.rb b/features/data/cookbooks/directory_provider/recipes/owner_update.rb deleted file mode 100644 index 7cfb0618f5..0000000000 --- a/features/data/cookbooks/directory_provider/recipes/owner_update.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Cookbook Name:: directory_provider -# Recipe:: create -# -# Copyright 2009, Opscode -# -# 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. -# - -directory "#{node[:tmpdir]}/isis" do - mode "755" - owner "nobody" - action :create -end - -directory "#{node[:tmpdir]}/isis" do - mode "755" - owner "root" - action :create -end - diff --git a/features/data/cookbooks/directory_provider/recipes/set_the_accessibility_of_a_created_directory.rb b/features/data/cookbooks/directory_provider/recipes/set_the_accessibility_of_a_created_directory.rb deleted file mode 100644 index 913a11a62b..0000000000 --- a/features/data/cookbooks/directory_provider/recipes/set_the_accessibility_of_a_created_directory.rb +++ /dev/null @@ -1,55 +0,0 @@ -# -# Cookbook Name:: directory_provider -# Recipe:: set_the_accesiibility_of_a_created_directory -# -# Copyright 2009, Opscode -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this directory 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. -# - -directory "#{node[:tmpdir]}/octal0644" do - mode 0644 - action :create -end - -directory "#{node[:tmpdir]}/octal2644" do - mode 02644 - action :create -end - -directory "#{node[:tmpdir]}/decimal644" do - mode 644 - action :create -end - -directory "#{node[:tmpdir]}/decimal2644" do - mode 2644 - action :create -end - -directory "#{node[:tmpdir]}/string644" do - mode "644" - action :create -end - -directory "#{node[:tmpdir]}/string0644" do - mode "0644" - action :create -end - -directory "#{node[:tmpdir]}/string2644" do - mode "2644" - action :create -end - - diff --git a/features/data/cookbooks/execute_commands/metadata.rb b/features/data/cookbooks/execute_commands/metadata.rb deleted file mode 100644 index 591168fae2..0000000000 --- a/features/data/cookbooks/execute_commands/metadata.rb +++ /dev/null @@ -1,5 +0,0 @@ - -version "1.0" -maintainer "opscode" -maintainer_email "donotreply@opscode.com" -long_description "excercise the execute provider" diff --git a/features/data/cookbooks/execute_commands/recipes/4k.rb b/features/data/cookbooks/execute_commands/recipes/4k.rb deleted file mode 100644 index bc810bd979..0000000000 --- a/features/data/cookbooks/execute_commands/recipes/4k.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -execute "create-4k-file" do - command "dd if=/dev/random of=#{node[:tmpdir]}/execute-4k.txt bs=1024 count=5" -end - -execute "read-4k-file" do - command "cat #{node[:tmpdir]}/execute-4k.txt" -end diff --git a/features/data/cookbooks/execute_commands/recipes/debug.rb b/features/data/cookbooks/execute_commands/recipes/debug.rb deleted file mode 100644 index 5b76380508..0000000000 --- a/features/data/cookbooks/execute_commands/recipes/debug.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -execute "debug-log" do - command "ruby -e 'puts \"whats up\"; STDERR.puts \"doc!\"'" -end - diff --git a/features/data/cookbooks/execute_commands/recipes/default.rb b/features/data/cookbooks/execute_commands/recipes/default.rb deleted file mode 100644 index 6a6f98361f..0000000000 --- a/features/data/cookbooks/execute_commands/recipes/default.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Cookbook Name:: execute_commands -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "create-mastodon" do - command "echo wewt > #{node[:tmpdir]}/mastodon_rocks" -end diff --git a/features/data/cookbooks/execute_commands/recipes/umask.rb b/features/data/cookbooks/execute_commands/recipes/umask.rb deleted file mode 100644 index 7343c07eed..0000000000 --- a/features/data/cookbooks/execute_commands/recipes/umask.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Cookbook Name:: execute_commands -# Recipe:: umask -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "create-mastodon" do - umask '777' - command "echo wewt > /mastodon_rocks_umask" -end diff --git a/features/data/cookbooks/integration_setup/attributes/integration.rb b/features/data/cookbooks/integration_setup/attributes/integration.rb deleted file mode 100644 index c9da6119dc..0000000000 --- a/features/data/cookbooks/integration_setup/attributes/integration.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: integration_setup -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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 'tmpdir' - -int(Mash.new) -int[:tmpdir] = File.join(Dir.tmpdir, "chef_integration") - -tmpdir int[:tmpdir] diff --git a/features/data/cookbooks/integration_setup/recipes/default.rb b/features/data/cookbooks/integration_setup/recipes/default.rb deleted file mode 100644 index e89bbc3b1d..0000000000 --- a/features/data/cookbooks/integration_setup/recipes/default.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# Cookbook Name:: integration_setup -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -directory node[:int][:tmpdir] do - mode "1777" - action :create -end - diff --git a/features/data/cookbooks/lwrp/providers/default.rb b/features/data/cookbooks/lwrp/providers/default.rb deleted file mode 100644 index f66e2914f6..0000000000 --- a/features/data/cookbooks/lwrp/providers/default.rb +++ /dev/null @@ -1,9 +0,0 @@ -action :print_message do - puts new_resource.message -end - -action :touch_file do - file "#{node[:tmpdir]}/#{new_resource.filename}" do - action :create - end -end diff --git a/features/data/cookbooks/lwrp/providers/lwp_non_default.rb b/features/data/cookbooks/lwrp/providers/lwp_non_default.rb deleted file mode 100644 index f51dcae369..0000000000 --- a/features/data/cookbooks/lwrp/providers/lwp_non_default.rb +++ /dev/null @@ -1,3 +0,0 @@ -action :print_message do - puts new_resource.message -end diff --git a/features/data/cookbooks/lwrp/providers/lwp_overridden_load_current_resource.rb b/features/data/cookbooks/lwrp/providers/lwp_overridden_load_current_resource.rb deleted file mode 100644 index 58689150ee..0000000000 --- a/features/data/cookbooks/lwrp/providers/lwp_overridden_load_current_resource.rb +++ /dev/null @@ -1,8 +0,0 @@ -def load_current_resource - puts "Overridden load_current_resource" -end - -action :print_message do - puts new_resource.message -end - diff --git a/features/data/cookbooks/lwrp/providers/provider_is_omitted.rb b/features/data/cookbooks/lwrp/providers/provider_is_omitted.rb deleted file mode 100644 index 8c512e0f1e..0000000000 --- a/features/data/cookbooks/lwrp/providers/provider_is_omitted.rb +++ /dev/null @@ -1,3 +0,0 @@ -action :print_classes do - puts "P=#{self.class}, R=#{new_resource.class}" -end diff --git a/features/data/cookbooks/lwrp/recipes/default_everything.rb b/features/data/cookbooks/lwrp/recipes/default_everything.rb deleted file mode 100644 index 9125f0f90e..0000000000 --- a/features/data/cookbooks/lwrp/recipes/default_everything.rb +++ /dev/null @@ -1,4 +0,0 @@ -lwrp :default do - message "Default everything" - action :print_message -end diff --git a/features/data/cookbooks/lwrp/recipes/non_default_provider.rb b/features/data/cookbooks/lwrp/recipes/non_default_provider.rb deleted file mode 100644 index 019f3aa9ab..0000000000 --- a/features/data/cookbooks/lwrp/recipes/non_default_provider.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp :non_default_provider do - message "Non-default provider" - action :print_message - - provider :lwrp_lwp_non_default -end diff --git a/features/data/cookbooks/lwrp/recipes/non_default_resource.rb b/features/data/cookbooks/lwrp/recipes/non_default_resource.rb deleted file mode 100644 index 8df71ca218..0000000000 --- a/features/data/cookbooks/lwrp/recipes/non_default_resource.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp_lwr_non_default :non_default_lwr do - message "Non-default resource" - action :print_message - - provider Chef::Provider::Lwrp -end diff --git a/features/data/cookbooks/lwrp/recipes/overridden_provider_load_current_resource.rb b/features/data/cookbooks/lwrp/recipes/overridden_provider_load_current_resource.rb deleted file mode 100644 index 0b525aa541..0000000000 --- a/features/data/cookbooks/lwrp/recipes/overridden_provider_load_current_resource.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp :overridden_provider_load_current_resource do - message "meep meep" - action :print_message - - provider Chef::Provider::LwrpLwpOverriddenLoadCurrentResource -end diff --git a/features/data/cookbooks/lwrp/recipes/overridden_resource_initialize.rb b/features/data/cookbooks/lwrp/recipes/overridden_resource_initialize.rb deleted file mode 100644 index 6982ce35fa..0000000000 --- a/features/data/cookbooks/lwrp/recipes/overridden_resource_initialize.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp_lwr_overridden_initialize :overridden_resource_initialize do - message "meep meep" - action :print_message - - provider Chef::Provider::Lwrp -end diff --git a/features/data/cookbooks/lwrp/recipes/provider_invokes_resource.rb b/features/data/cookbooks/lwrp/recipes/provider_invokes_resource.rb deleted file mode 100644 index c2e94aa064..0000000000 --- a/features/data/cookbooks/lwrp/recipes/provider_invokes_resource.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp :lwrp_provider_invokes_resource do - filename "lwrp_touch_file.txt" - action :touch_file - - provider :lwrp -end diff --git a/features/data/cookbooks/lwrp/recipes/provider_is_a_class.rb b/features/data/cookbooks/lwrp/recipes/provider_is_a_class.rb deleted file mode 100644 index efdda31b0e..0000000000 --- a/features/data/cookbooks/lwrp/recipes/provider_is_a_class.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp :provider_is_a_class do - message "Provider is a class" - action :print_message - - provider Chef::Provider::Lwrp -end diff --git a/features/data/cookbooks/lwrp/recipes/provider_is_a_string.rb b/features/data/cookbooks/lwrp/recipes/provider_is_a_string.rb deleted file mode 100644 index 78f333bcd4..0000000000 --- a/features/data/cookbooks/lwrp/recipes/provider_is_a_string.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp :provider_is_a_string do - message "Provider is a string" - action :print_message - - provider "lwrp" -end diff --git a/features/data/cookbooks/lwrp/recipes/provider_is_a_symbol.rb b/features/data/cookbooks/lwrp/recipes/provider_is_a_symbol.rb deleted file mode 100644 index 2ca9963fd5..0000000000 --- a/features/data/cookbooks/lwrp/recipes/provider_is_a_symbol.rb +++ /dev/null @@ -1,6 +0,0 @@ -lwrp :provider_is_a_symbol do - message "Provider is a symbol" - action :print_message - - provider :lwrp -end diff --git a/features/data/cookbooks/lwrp/recipes/provider_is_omitted.rb b/features/data/cookbooks/lwrp/recipes/provider_is_omitted.rb deleted file mode 100644 index 89a15b385e..0000000000 --- a/features/data/cookbooks/lwrp/recipes/provider_is_omitted.rb +++ /dev/null @@ -1,3 +0,0 @@ -lwrp_provider_is_omitted :provider_is_omitted do - action :print_classes -end diff --git a/features/data/cookbooks/lwrp/resources/default.rb b/features/data/cookbooks/lwrp/resources/default.rb deleted file mode 100644 index 00be531184..0000000000 --- a/features/data/cookbooks/lwrp/resources/default.rb +++ /dev/null @@ -1,4 +0,0 @@ -actions :print_message, :touch_file - -attribute :message, :kind_of => String -attribute :filename, :kind_of => String diff --git a/features/data/cookbooks/lwrp/resources/lwr_non_default.rb b/features/data/cookbooks/lwrp/resources/lwr_non_default.rb deleted file mode 100644 index c29654eba3..0000000000 --- a/features/data/cookbooks/lwrp/resources/lwr_non_default.rb +++ /dev/null @@ -1,3 +0,0 @@ -actions :print_message - -attribute :message, :kind_of => String diff --git a/features/data/cookbooks/lwrp/resources/lwr_overridden_initialize.rb b/features/data/cookbooks/lwrp/resources/lwr_overridden_initialize.rb deleted file mode 100644 index 635ba237d5..0000000000 --- a/features/data/cookbooks/lwrp/resources/lwr_overridden_initialize.rb +++ /dev/null @@ -1,8 +0,0 @@ -def initialize(name, run_context=nil) - super - puts "Overridden initialize" -end - -actions :print_message - -attribute :message, :kind_of => String diff --git a/features/data/cookbooks/lwrp/resources/provider_is_omitted.rb b/features/data/cookbooks/lwrp/resources/provider_is_omitted.rb deleted file mode 100644 index 564537e6bf..0000000000 --- a/features/data/cookbooks/lwrp/resources/provider_is_omitted.rb +++ /dev/null @@ -1 +0,0 @@ -actions :print_classes diff --git a/features/data/cookbooks/manage_files/recipes/create_a_file.rb b/features/data/cookbooks/manage_files/recipes/create_a_file.rb deleted file mode 100644 index ae64c9a583..0000000000 --- a/features/data/cookbooks/manage_files/recipes/create_a_file.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/create_a_file.txt" do - action :create -end diff --git a/features/data/cookbooks/manage_files/recipes/default.rb b/features/data/cookbooks/manage_files/recipes/default.rb deleted file mode 100644 index 8b9f7ab0cf..0000000000 --- a/features/data/cookbooks/manage_files/recipes/default.rb +++ /dev/null @@ -1,19 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/manage_files/recipes/delete_a_file.rb b/features/data/cookbooks/manage_files/recipes/delete_a_file.rb deleted file mode 100644 index 85c5fec84f..0000000000 --- a/features/data/cookbooks/manage_files/recipes/delete_a_file.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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 'manage_files::create_a_file' - -file "#{node[:tmpdir]}/create_a_file.txt" do - action :delete -end diff --git a/features/data/cookbooks/manage_files/recipes/delete_a_file_that_does_not_already_exist.rb b/features/data/cookbooks/manage_files/recipes/delete_a_file_that_does_not_already_exist.rb deleted file mode 100644 index 5121bc67fa..0000000000 --- a/features/data/cookbooks/manage_files/recipes/delete_a_file_that_does_not_already_exist.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/create_a_file.txt" do - action :delete -end diff --git a/features/data/cookbooks/manage_files/recipes/manage_file_contents.rb b/features/data/cookbooks/manage_files/recipes/manage_file_contents.rb deleted file mode 100644 index 0eccce0b5b..0000000000 --- a/features/data/cookbooks/manage_files/recipes/manage_file_contents.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/aqua_teen.txt" do - content "I am using the e-photo plugin, you pop it on your back and go" - action :create -end diff --git a/features/data/cookbooks/manage_files/recipes/set_the_accessibility_of_a_created_file.rb b/features/data/cookbooks/manage_files/recipes/set_the_accessibility_of_a_created_file.rb deleted file mode 100644 index a4aac8ddfa..0000000000 --- a/features/data/cookbooks/manage_files/recipes/set_the_accessibility_of_a_created_file.rb +++ /dev/null @@ -1,79 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/octal0111.txt" do - owner 'nobody' - mode 0111 - action :create -end - -file "#{node[:tmpdir]}/octal0644.txt" do - owner 'nobody' - mode 0644 - action :create -end - -file "#{node[:tmpdir]}/octal2644.txt" do - owner 'nobody' - mode 02644 - action :create -end - -file "#{node[:tmpdir]}/decimal73.txt" do - owner 'nobody' - mode 73 - action :create -end - -file "#{node[:tmpdir]}/decimal644.txt" do - owner 'nobody' - mode 644 - action :create -end - -file "#{node[:tmpdir]}/decimal2644.txt" do - owner 'nobody' - mode 2644 - action :create -end - -file "#{node[:tmpdir]}/string111.txt" do - owner 'nobody' - mode "111" - action :create -end - -file "#{node[:tmpdir]}/string644.txt" do - owner 'nobody' - mode "644" - action :create -end - -file "#{node[:tmpdir]}/string0644.txt" do - owner 'nobody' - mode "0644" - action :create -end - -file "#{node[:tmpdir]}/string2644.txt" do - owner 'nobody' - mode "2644" - action :create -end - diff --git a/features/data/cookbooks/manage_files/recipes/set_the_owner_of_a_created_file.rb b/features/data/cookbooks/manage_files/recipes/set_the_owner_of_a_created_file.rb deleted file mode 100644 index f57c78650f..0000000000 --- a/features/data/cookbooks/manage_files/recipes/set_the_owner_of_a_created_file.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/create_a_file.txt" do - owner 'nobody' - action :create -end diff --git a/features/data/cookbooks/manage_files/recipes/touch_a_file.rb b/features/data/cookbooks/manage_files/recipes/touch_a_file.rb deleted file mode 100644 index 86c971c9ac..0000000000 --- a/features/data/cookbooks/manage_files/recipes/touch_a_file.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Cookbook Name:: files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -file "#{node[:tmpdir]}/touch_test.txt" do - action :touch -end diff --git a/features/data/cookbooks/metadata/metadata.rb b/features/data/cookbooks/metadata/metadata.rb deleted file mode 100644 index 9c6923a1d2..0000000000 --- a/features/data/cookbooks/metadata/metadata.rb +++ /dev/null @@ -1,17 +0,0 @@ - -version "1.0" -maintainer "Bobo T. Clown" -maintainer_email "bobo@example.com" -long_description "I have a long arm!" -supports :ubuntu, "> 8.04" - -#depends "bobo", "= 1.0" -#depends "bobotclown", "= 1.1" -#recommends "snark", "< 3.0" -#suggests "kindness", "> 2.0" -#conflicts "hatred" -# -#depends "foo(:bar, :baz)" -#provides "foo(:bar, :baz)" -#replaces "snarkitron" - diff --git a/features/data/cookbooks/metadata/recipes/default.rb b/features/data/cookbooks/metadata/recipes/default.rb deleted file mode 100644 index 541b504f0b..0000000000 --- a/features/data/cookbooks/metadata/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: metadata -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/no_attributes/README.rdoc b/features/data/cookbooks/no_attributes/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/no_attributes/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/no_attributes/metadata.rb b/features/data/cookbooks/no_attributes/metadata.rb deleted file mode 100644 index ed2938fa6d..0000000000 --- a/features/data/cookbooks/no_attributes/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures attribute_settings" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/no_attributes/recipes/default.rb b/features/data/cookbooks/no_attributes/recipes/default.rb deleted file mode 100644 index 58c7aeb4f7..0000000000 --- a/features/data/cookbooks/no_attributes/recipes/default.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "echo snakes#{node[:attribute_priority_was]} > #{node[:tmpdir]}/attribute_setting.txt" - diff --git a/features/data/cookbooks/node_cookbook_sync/README.rdoc b/features/data/cookbooks/node_cookbook_sync/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/node_cookbook_sync/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/node_cookbook_sync/attributes/attr_file.rb b/features/data/cookbooks/node_cookbook_sync/attributes/attr_file.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/node_cookbook_sync/attributes/attr_file.rb +++ /dev/null diff --git a/features/data/cookbooks/node_cookbook_sync/definitions/def_file.rb b/features/data/cookbooks/node_cookbook_sync/definitions/def_file.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/node_cookbook_sync/definitions/def_file.rb +++ /dev/null diff --git a/features/data/cookbooks/node_cookbook_sync/libraries/lib_file.rb b/features/data/cookbooks/node_cookbook_sync/libraries/lib_file.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/node_cookbook_sync/libraries/lib_file.rb +++ /dev/null diff --git a/features/data/cookbooks/node_cookbook_sync/metadata.rb b/features/data/cookbooks/node_cookbook_sync/metadata.rb deleted file mode 100644 index 850a993fbb..0000000000 --- a/features/data/cookbooks/node_cookbook_sync/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures node_cookbook_sync" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/node_cookbook_sync/recipes/default.rb b/features/data/cookbooks/node_cookbook_sync/recipes/default.rb deleted file mode 100644 index 7912164bf3..0000000000 --- a/features/data/cookbooks/node_cookbook_sync/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: node_cookbook_sync -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/packages/recipes/default.rb b/features/data/cookbooks/packages/recipes/default.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/packages/recipes/default.rb +++ /dev/null diff --git a/features/data/cookbooks/packages/recipes/gem_package.rb b/features/data/cookbooks/packages/recipes/gem_package.rb deleted file mode 100644 index b6bddffa8d..0000000000 --- a/features/data/cookbooks/packages/recipes/gem_package.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: packages -# Recipe:: gem_package -# -# Copyright 2009, Daniel DeLeo -# -# 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. -# - -directory "#{node[:tmpdir]}/installed-gems/" - -gem_package "chef-integration-test" do - source "http://localhost:8000" - version "0.1.0" - options "-i #{node[:tmpdir]}/installed-gems/" -end diff --git a/features/data/cookbooks/packages/recipes/install_apt_package.rb b/features/data/cookbooks/packages/recipes/install_apt_package.rb deleted file mode 100644 index 26db5b83fc..0000000000 --- a/features/data/cookbooks/packages/recipes/install_apt_package.rb +++ /dev/null @@ -1,3 +0,0 @@ -package("chef-integration-test") do - options("--force-yes") -end
\ No newline at end of file diff --git a/features/data/cookbooks/packages/recipes/install_dpkg_package.rb b/features/data/cookbooks/packages/recipes/install_dpkg_package.rb deleted file mode 100644 index f24b3f9814..0000000000 --- a/features/data/cookbooks/packages/recipes/install_dpkg_package.rb +++ /dev/null @@ -1,4 +0,0 @@ -dpkg_package("chef-integration-test") do - source("#{File.join(node[:tmpdir], 'chef-integration-test_1.0-1_amd64.deb')}") -end - diff --git a/features/data/cookbooks/packages/recipes/install_gem_noshell.rb b/features/data/cookbooks/packages/recipes/install_gem_noshell.rb deleted file mode 100644 index 27a0c7d2a4..0000000000 --- a/features/data/cookbooks/packages/recipes/install_gem_noshell.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: packages -# Recipe:: gem_package -# -# Copyright 2009, Daniel DeLeo -# -# 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. -# - -directory "#{node[:tmpdir]}/installed-gems/" - -gem_package "chef-integration-test" do - source "http://localhost:8000" - version "0.1.0" - options :install_dir => "#{node[:tmpdir]}/installed-gems/" -end diff --git a/features/data/cookbooks/packages/recipes/install_gem_package_twice.rb b/features/data/cookbooks/packages/recipes/install_gem_package_twice.rb deleted file mode 100644 index b6bddffa8d..0000000000 --- a/features/data/cookbooks/packages/recipes/install_gem_package_twice.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: packages -# Recipe:: gem_package -# -# Copyright 2009, Daniel DeLeo -# -# 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. -# - -directory "#{node[:tmpdir]}/installed-gems/" - -gem_package "chef-integration-test" do - source "http://localhost:8000" - version "0.1.0" - options "-i #{node[:tmpdir]}/installed-gems/" -end diff --git a/features/data/cookbooks/packages/recipes/macports_install_bad_package.rb b/features/data/cookbooks/packages/recipes/macports_install_bad_package.rb deleted file mode 100644 index 40ac646761..0000000000 --- a/features/data/cookbooks/packages/recipes/macports_install_bad_package.rb +++ /dev/null @@ -1,3 +0,0 @@ -package "fdsafdsa" do - action :install -end diff --git a/features/data/cookbooks/packages/recipes/macports_install_yydecode.rb b/features/data/cookbooks/packages/recipes/macports_install_yydecode.rb deleted file mode 100644 index 7c2475db37..0000000000 --- a/features/data/cookbooks/packages/recipes/macports_install_yydecode.rb +++ /dev/null @@ -1,3 +0,0 @@ -package "yydecode" do - action :install -end diff --git a/features/data/cookbooks/packages/recipes/macports_purge_yydecode.rb b/features/data/cookbooks/packages/recipes/macports_purge_yydecode.rb deleted file mode 100644 index e7ad245dfb..0000000000 --- a/features/data/cookbooks/packages/recipes/macports_purge_yydecode.rb +++ /dev/null @@ -1,3 +0,0 @@ -package "yydecode" do - action :purge -end diff --git a/features/data/cookbooks/packages/recipes/macports_remove_yydecode.rb b/features/data/cookbooks/packages/recipes/macports_remove_yydecode.rb deleted file mode 100644 index da1acca7ec..0000000000 --- a/features/data/cookbooks/packages/recipes/macports_remove_yydecode.rb +++ /dev/null @@ -1,3 +0,0 @@ -package "yydecode" do - action :remove -end diff --git a/features/data/cookbooks/packages/recipes/macports_upgrade_yydecode.rb b/features/data/cookbooks/packages/recipes/macports_upgrade_yydecode.rb deleted file mode 100644 index 3d008abdec..0000000000 --- a/features/data/cookbooks/packages/recipes/macports_upgrade_yydecode.rb +++ /dev/null @@ -1,7 +0,0 @@ -package "yydecode" do - action :remove -end - -package "yydecode" do - action :upgrade -end diff --git a/features/data/cookbooks/packages/recipes/manually_upgrade_gem_package.rb b/features/data/cookbooks/packages/recipes/manually_upgrade_gem_package.rb deleted file mode 100644 index db1de3fcbc..0000000000 --- a/features/data/cookbooks/packages/recipes/manually_upgrade_gem_package.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# Cookbook Name:: packages -# Recipe:: gem_package -# -# Copyright 2009, Daniel DeLeo -# -# 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. -# - -directory "#{node[:tmpdir]}/installed-gems/" - -gem_package "chef-integration-test" do - source "http://localhost:8000" - version "0.1.0" - options "-i #{node[:tmpdir]}/installed-gems/" -end - -gem_package "chef-integration-test" do - source "http://localhost:8000" - options "-i #{node[:tmpdir]}/installed-gems/" - version "0.1.1" -end diff --git a/features/data/cookbooks/packages/recipes/upgrade_gem_noshell.rb b/features/data/cookbooks/packages/recipes/upgrade_gem_noshell.rb deleted file mode 100644 index c009f38fcd..0000000000 --- a/features/data/cookbooks/packages/recipes/upgrade_gem_noshell.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: packages -# Recipe:: gem_package -# -# Copyright 2009, Daniel DeLeo -# -# 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. -# - -directory "#{node[:tmpdir]}/installed-gems/" - -gem_package "chef-integration-test" do - source "http://localhost:8000" - version "0.1.0" - options :install_dir => "#{node[:tmpdir]}/installed-gems/" -end - -gem_package "chef-integration-test-upgrade" do - package_name 'chef-integration-test' - source "http://localhost:8000" - options :install_dir => "#{node[:tmpdir]}/installed-gems/" - action :upgrade -end diff --git a/features/data/cookbooks/packages/recipes/upgrade_gem_package.rb b/features/data/cookbooks/packages/recipes/upgrade_gem_package.rb deleted file mode 100644 index 636d8b771b..0000000000 --- a/features/data/cookbooks/packages/recipes/upgrade_gem_package.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: packages -# Recipe:: gem_package -# -# Copyright 2009, Daniel DeLeo -# -# 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. -# - -directory "#{node[:tmpdir]}/installed-gems/" - -gem_package "chef-integration-test" do - source "http://localhost:8000" - version "0.1.0" - options "-i #{node[:tmpdir]}/installed-gems/" -end - -gem_package "chef-integration-test-upgrade" do - package_name 'chef-integration-test' - source "http://localhost:8000" - options "-i #{node[:tmpdir]}/installed-gems/" - action :upgrade -end diff --git a/features/data/cookbooks/recipe_include/README.rdoc b/features/data/cookbooks/recipe_include/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/recipe_include/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/recipe_include/metadata.rb b/features/data/cookbooks/recipe_include/metadata.rb deleted file mode 100644 index 07c1801d28..0000000000 --- a/features/data/cookbooks/recipe_include/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures recipe_include" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/recipe_include/recipes/default.rb b/features/data/cookbooks/recipe_include/recipes/default.rb deleted file mode 100644 index f05c067f4b..0000000000 --- a/features/data/cookbooks/recipe_include/recipes/default.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Cookbook Name:: attribute_include -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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 "recipe_include::second" - diff --git a/features/data/cookbooks/recipe_include/recipes/second.rb b/features/data/cookbooks/recipe_include/recipes/second.rb deleted file mode 100644 index f6dbe99d2f..0000000000 --- a/features/data/cookbooks/recipe_include/recipes/second.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Cookbook Name:: recipe_include -# Recipe:: second -# -# Copyright 2009, Opscode -# -# 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. -# - -execute "append to #{node[:tmpdir]}/fire_once" do - command "echo mars_volta >> #{node[:tmpdir]}/fire_once" -end - diff --git a/features/data/cookbooks/roles/recipes/default.rb b/features/data/cookbooks/roles/recipes/default.rb deleted file mode 100644 index aeedd4fe2b..0000000000 --- a/features/data/cookbooks/roles/recipes/default.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: roles -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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.debug(node.override.inspect) -Chef::Log.debug(node.default.inspect) -execute "echo #{node.reason} > #{File.join(node.tmpdir, "role_test_reason.txt")}" -execute "echo #{node.ossining} > #{File.join(node.tmpdir, "role_test_ossining.txt")}" -execute "echo #{node["languages"]["ruby"]["version"]} > #{File.join(node.tmpdir, "role_test_ruby_version.txt")}" - - diff --git a/features/data/cookbooks/roles/recipes/env_test.rb b/features/data/cookbooks/roles/recipes/env_test.rb deleted file mode 100644 index 65b4c1b894..0000000000 --- a/features/data/cookbooks/roles/recipes/env_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: roles -# Recipe:: env_test -# -# Copyright 2009, Opscode -# -# 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.debug(node.override.inspect) -Chef::Log.debug(node.default.inspect) -execute "echo #{node.reason} > #{File.join(node.tmpdir, "role_env_test_reason.txt")}" -execute "echo #{node.ossining} > #{File.join(node.tmpdir, "role_env_test_ossining.txt")}" -execute "echo #{node["languages"]["ruby"]["version"]} > #{File.join(node.tmpdir, "role_env_test_ruby_version.txt")}" - diff --git a/features/data/cookbooks/run_interval/recipes/default.rb b/features/data/cookbooks/run_interval/recipes/default.rb deleted file mode 100644 index d0e6c30d15..0000000000 --- a/features/data/cookbooks/run_interval/recipes/default.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# Cookbook Name:: run_interval -# Recipe:: default -# -# Copyright 2009, 2010, Opscode -# -# 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 chef-client to exit once this cookbook has been applied twice. -# The test depends on chef having run twice, so this number is tied to -# run_interval.feature! - -$run_interval_global ||= 2 - -$run_interval_global -= 1 -exit(2) if $run_interval_global == 0 diff --git a/features/data/cookbooks/scm/metadata.rb b/features/data/cookbooks/scm/metadata.rb deleted file mode 100644 index b9961a7123..0000000000 --- a/features/data/cookbooks/scm/metadata.rb +++ /dev/null @@ -1,9 +0,0 @@ -version "1.0" -maintainer "Ohai the Cat" -maintainer_email "ohai@cat.example.com" -description "SCM tests" -license 'Apache v2.0' -long_description "SCM integration/acceptance test recipes" - -recipe "scm::git", "git awesome" -recipe "scm::git-remotes", "git awesome repos" diff --git a/features/data/cookbooks/scm/recipes/git.rb b/features/data/cookbooks/scm/recipes/git.rb deleted file mode 100644 index a36f929e8e..0000000000 --- a/features/data/cookbooks/scm/recipes/git.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook Name:: scm -# Recipe:: git -# -# Copyright 2009, Opscode -# -# 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 the features are not being run from a git clone, you're out of luck. -git "the chef repo" do - repository "#{node[:tmpdir]}/test_git_repo" - reference "HEAD" - destination "#{node[:tmpdir]}/gitchef" - action :sync -end diff --git a/features/data/cookbooks/search/attributes/search_attrs.rb b/features/data/cookbooks/search/attributes/search_attrs.rb deleted file mode 100644 index 2593b3065e..0000000000 --- a/features/data/cookbooks/search/attributes/search_attrs.rb +++ /dev/null @@ -1 +0,0 @@ -search_files([ "search_one.txt", "search_two.txt" ]) diff --git a/features/data/cookbooks/search/recipes/default.rb b/features/data/cookbooks/search/recipes/default.rb deleted file mode 100644 index 01a72f416e..0000000000 --- a/features/data/cookbooks/search/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: search -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/search/recipes/search_data.rb b/features/data/cookbooks/search/recipes/search_data.rb deleted file mode 100644 index 6deefed9b3..0000000000 --- a/features/data/cookbooks/search/recipes/search_data.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# Cookbook Name:: search -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -# We have to sleep at least 10 seconds to confirm that the data has made it -# into the index. We can only rely on this because we are in a test environment -# in real-land Chef, the index is only eventually consistent.. and may take a -# variable amount of time. -sleep 10 -search(:users, "*:*") do |entry| - file "#{node[:tmpdir]}/#{entry["id"]}" -end - diff --git a/features/data/cookbooks/search/recipes/search_data_manual.rb b/features/data/cookbooks/search/recipes/search_data_manual.rb deleted file mode 100644 index af7b4e5f16..0000000000 --- a/features/data/cookbooks/search/recipes/search_data_manual.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: search -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -# We have to sleep at least 10 seconds to confirm that the data has made it -# into the index. We can only rely on this because we are in a test environment -# in real-land Chef, the index is only eventually consistent.. and may take a -# variable amount of time. - - -sleep 10 -objects, start, total = search(:users, "*:*", nil, 0, 10) - -objects.each do |entry| - file "#{node[:tmpdir]}/#{entry["id"]}" -end - - diff --git a/features/data/cookbooks/search/recipes/search_data_noblock.rb b/features/data/cookbooks/search/recipes/search_data_noblock.rb deleted file mode 100644 index b96c4688c2..0000000000 --- a/features/data/cookbooks/search/recipes/search_data_noblock.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# Cookbook Name:: search -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -# We have to sleep at least 10 seconds to confirm that the data has made it -# into the index. We can only rely on this because we are in a test environment -# in real-land Chef, the index is only eventually consistent.. and may take a -# variable amount of time. - - -sleep 10 -objects = search(:users, "*:*") - -objects.each do |entry| - file "#{node[:tmpdir]}/#{entry["id"]}" -end - diff --git a/features/data/cookbooks/show_cookbook/README.rdoc b/features/data/cookbooks/show_cookbook/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/show_cookbook/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/show_cookbook/attributes/attr_file.rb b/features/data/cookbooks/show_cookbook/attributes/attr_file.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/attributes/attr_file.rb +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/definitions/def_file.rb b/features/data/cookbooks/show_cookbook/definitions/def_file.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/definitions/def_file.rb +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/files/default/prime_time.txt b/features/data/cookbooks/show_cookbook/files/default/prime_time.txt deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/files/default/prime_time.txt +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/files/host-latte/prime_time.txt b/features/data/cookbooks/show_cookbook/files/host-latte/prime_time.txt deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/files/host-latte/prime_time.txt +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/files/mac_os_x-10.5/prime_time.txt b/features/data/cookbooks/show_cookbook/files/mac_os_x-10.5/prime_time.txt deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/files/mac_os_x-10.5/prime_time.txt +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/files/mac_os_x/prime_time.txt b/features/data/cookbooks/show_cookbook/files/mac_os_x/prime_time.txt deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/files/mac_os_x/prime_time.txt +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/libraries/lib_file.rb b/features/data/cookbooks/show_cookbook/libraries/lib_file.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/libraries/lib_file.rb +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/metadata.rb b/features/data/cookbooks/show_cookbook/metadata.rb deleted file mode 100644 index 6f06805f62..0000000000 --- a/features/data/cookbooks/show_cookbook/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures show_cookbook" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "1.0" diff --git a/features/data/cookbooks/show_cookbook/recipes/default.rb b/features/data/cookbooks/show_cookbook/recipes/default.rb deleted file mode 100644 index 6f972192cb..0000000000 --- a/features/data/cookbooks/show_cookbook/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: show_cookbook -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/show_cookbook/templates/default/prime_time.txt.erb b/features/data/cookbooks/show_cookbook/templates/default/prime_time.txt.erb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/templates/default/prime_time.txt.erb +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/templates/host-latte/prime_time.txt.erb b/features/data/cookbooks/show_cookbook/templates/host-latte/prime_time.txt.erb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/templates/host-latte/prime_time.txt.erb +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/templates/mac_os_x-10.5/prime_time.txt.erb b/features/data/cookbooks/show_cookbook/templates/mac_os_x-10.5/prime_time.txt.erb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/templates/mac_os_x-10.5/prime_time.txt.erb +++ /dev/null diff --git a/features/data/cookbooks/show_cookbook/templates/mac_os_x/prime_time.txt.erb b/features/data/cookbooks/show_cookbook/templates/mac_os_x/prime_time.txt.erb deleted file mode 100644 index e69de29bb2..0000000000 --- a/features/data/cookbooks/show_cookbook/templates/mac_os_x/prime_time.txt.erb +++ /dev/null diff --git a/features/data/cookbooks/sync_library_original/README.rdoc b/features/data/cookbooks/sync_library_original/README.rdoc deleted file mode 100644 index 8d774805b9..0000000000 --- a/features/data/cookbooks/sync_library_original/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/sync_library_original/libraries/sync_library.rb b/features/data/cookbooks/sync_library_original/libraries/sync_library.rb deleted file mode 100644 index 659529670b..0000000000 --- a/features/data/cookbooks/sync_library_original/libraries/sync_library.rb +++ /dev/null @@ -1,27 +0,0 @@ - -require 'chef/index_queue/amqp_client' -$sync_library_go_count ||= 0 -module SyncLibrary - - def go - Chef::Log.info('First generation library') - - # Publish the first run - $sync_library_go_count += 1 - if $sync_library_go_count < 2 - amqp = Chef::IndexQueue::AmqpClient.instance - queue = amqp.amqp_client.queue('sync_library_test') - queue.publish("first run complete") - - # Wait until the message is consumed / the sync_library cookbook is updated - mcount = 1 - while mcount > 0 - Chef::Log.info("Sleeping while message is being consumed") - sleep 1 - mcount = queue.message_count - end - end - - end - -end
\ No newline at end of file diff --git a/features/data/cookbooks/sync_library_original/metadata.rb b/features/data/cookbooks/sync_library_original/metadata.rb deleted file mode 100644 index 0191f053a1..0000000000 --- a/features/data/cookbooks/sync_library_original/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures sync_library" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/sync_library_original/recipes/default.rb b/features/data/cookbooks/sync_library_original/recipes/default.rb deleted file mode 100644 index bb77f98632..0000000000 --- a/features/data/cookbooks/sync_library_original/recipes/default.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook Name:: attribute_settings -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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 Chef::Recipe - include SyncLibrary -end - -# Run the library code -go - -$sync_library_global ||= 2 -$sync_library_global -= 1 -exit(2) if $sync_library_global == 0 - diff --git a/features/data/cookbooks/sync_library_updated/libraries/sync_library.rb b/features/data/cookbooks/sync_library_updated/libraries/sync_library.rb deleted file mode 100644 index 4a28bec485..0000000000 --- a/features/data/cookbooks/sync_library_updated/libraries/sync_library.rb +++ /dev/null @@ -1,8 +0,0 @@ - -module SyncLibrary - - def go - Chef::Log.info('Second generation library') - end - -end
\ No newline at end of file diff --git a/features/data/cookbooks/synchronize/recipes/default.rb b/features/data/cookbooks/synchronize/recipes/default.rb deleted file mode 100644 index b2c4976dc3..0000000000 --- a/features/data/cookbooks/synchronize/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: synchronize -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/synchronize_deps/metadata.json b/features/data/cookbooks/synchronize_deps/metadata.json deleted file mode 100644 index 146f154d6e..0000000000 --- a/features/data/cookbooks/synchronize_deps/metadata.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "synchronize_deps", - "description": "A fabulous new cookbook", - "long_description": "", - "maintainer": "Your Name", - "maintainer_email": "youremail@example.com", - "license": "Apache v2.0", - "platforms": { - }, - "dependencies": { - "synchronize": ">= 0.0.0" - }, - "recommendations": { - }, - "suggestions": { - }, - "conflicting": { - }, - "providing": { - }, - "replacing": { - }, - "attributes": { - }, - "groupings": { - }, - "recipes": { - }, - "version": "0.0.0" - }
\ No newline at end of file diff --git a/features/data/cookbooks/synchronize_deps/metadata.rb b/features/data/cookbooks/synchronize_deps/metadata.rb deleted file mode 100644 index b5b344c0bb..0000000000 --- a/features/data/cookbooks/synchronize_deps/metadata.rb +++ /dev/null @@ -1 +0,0 @@ -depends 'synchronize' diff --git a/features/data/cookbooks/synchronize_deps/recipes/default.rb b/features/data/cookbooks/synchronize_deps/recipes/default.rb deleted file mode 100644 index 007931b4c6..0000000000 --- a/features/data/cookbooks/synchronize_deps/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: synchronize_deps -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/template/README.rdoc b/features/data/cookbooks/template/README.rdoc deleted file mode 100644 index 3de2ec7a3c..0000000000 --- a/features/data/cookbooks/template/README.rdoc +++ /dev/null @@ -1,8 +0,0 @@ -= DESCRIPTION: - -= REQUIREMENTS: - -= ATTRIBUTES: - -= USAGE: - diff --git a/features/data/cookbooks/template/metadata.rb b/features/data/cookbooks/template/metadata.rb deleted file mode 100644 index ab4ed48e17..0000000000 --- a/features/data/cookbooks/template/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Installs/Configures template" -long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1" diff --git a/features/data/cookbooks/template/recipes/default.rb b/features/data/cookbooks/template/recipes/default.rb deleted file mode 100644 index bf251cec57..0000000000 --- a/features/data/cookbooks/template/recipes/default.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: template -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -node.set[:markov][:test] = { "value" => "sauce" } - -template "#{node[:tmpdir]}/template.txt" do - source "template.txt.erb" - variables node[:markov][:test] -end - diff --git a/features/data/cookbooks/template/recipes/interval.rb b/features/data/cookbooks/template/recipes/interval.rb deleted file mode 100644 index b7ff81984f..0000000000 --- a/features/data/cookbooks/template/recipes/interval.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Cookbook Name:: template -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -# can no longer set chef to run repeatedly in the foreground -# without some hackery like this: -Chef::Config[:interval] = 1 - -$run_count ||= %w{one two} -exit!(108) if $run_count.empty? - -Chef::Log.info("run count: #{$run_count}") - -vars = {:value => $run_count.shift} - -Chef::Log.error(:vars => vars.inspect, :RUN_COUNT => $run_count.inspect) - -template "#{node[:tmpdir]}/template.txt" do - source "template.txt.erb" - variables(vars) -end - diff --git a/features/data/cookbooks/template/recipes/render_node_attrs.rb b/features/data/cookbooks/template/recipes/render_node_attrs.rb deleted file mode 100644 index 336fb1c805..0000000000 --- a/features/data/cookbooks/template/recipes/render_node_attrs.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: template -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -node.set[:bawt] = "is fujins bot" -node.set[:botsnack] = "cheers!" - -template "#{node[:tmpdir]}/node.txt" do - source "node.txt.erb" -end - diff --git a/features/data/cookbooks/template/templates/default/node.txt.erb b/features/data/cookbooks/template/templates/default/node.txt.erb deleted file mode 100644 index 6c854288a7..0000000000 --- a/features/data/cookbooks/template/templates/default/node.txt.erb +++ /dev/null @@ -1,3 +0,0 @@ -bawt <%= node[:bawt] %> -!botsnack -<%= @node[:botsnack] %>
\ No newline at end of file diff --git a/features/data/cookbooks/template/templates/default/template.txt.erb b/features/data/cookbooks/template/templates/default/template.txt.erb deleted file mode 100644 index d568b87b40..0000000000 --- a/features/data/cookbooks/template/templates/default/template.txt.erb +++ /dev/null @@ -1 +0,0 @@ -<%= @value %> diff --git a/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/bar.txt b/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/bar.txt deleted file mode 100644 index 3567f3874e..0000000000 --- a/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/bar.txt +++ /dev/null @@ -1 +0,0 @@ -Space Manoeuvres stage 1
\ No newline at end of file diff --git a/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/baz.txt b/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/baz.txt deleted file mode 100644 index 63c03878e1..0000000000 --- a/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/baz.txt +++ /dev/null @@ -1 +0,0 @@ -micromega
\ No newline at end of file diff --git a/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/foo.txt b/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/foo.txt deleted file mode 100644 index c964b2828b..0000000000 --- a/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/foo.txt +++ /dev/null @@ -1 +0,0 @@ -tyrantanic
\ No newline at end of file diff --git a/features/data/cookbooks/transfer_remote_directories/recipes/transfer_directory.rb b/features/data/cookbooks/transfer_remote_directories/recipes/transfer_directory.rb deleted file mode 100644 index ce9163bc15..0000000000 --- a/features/data/cookbooks/transfer_remote_directories/recipes/transfer_directory.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Cookbook Name:: transfer_remote_directories -# Recipe:: transfer_directory -# -# Copyright 2009, Daniel DeLeo -# -# 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[:tmpdir]}/transfer_directory" do - source "transfer_directory_feature" - files_backup 10 - files_owner "root" - files_group "staff" - files_mode "0644" - owner "nobody" - group "nogroup" - mode "0755" -end diff --git a/features/data/cookbooks/transfer_remote_files/files/default/transfer_a_file_from_a_cookbook.txt b/features/data/cookbooks/transfer_remote_files/files/default/transfer_a_file_from_a_cookbook.txt deleted file mode 100644 index 9fb38fab62..0000000000 --- a/features/data/cookbooks/transfer_remote_files/files/default/transfer_a_file_from_a_cookbook.txt +++ /dev/null @@ -1 +0,0 @@ -easy like sunday morning diff --git a/features/data/cookbooks/transfer_remote_files/metadata.json b/features/data/cookbooks/transfer_remote_files/metadata.json deleted file mode 100644 index 382d0e36b4..0000000000 --- a/features/data/cookbooks/transfer_remote_files/metadata.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "transfer_remote_files", - "description": "A fabulous new cookbook", - "long_description": "", - "maintainer": "Your Name", - "maintainer_email": "youremail@example.com", - "license": "Apache v2.0", - "platforms": { - }, - "dependencies": { - "transfer_remote_files_definition": ">= 0.0.0" - }, - "recommendations": { - }, - "suggestions": { - }, - "conflicting": { - }, - "providing": { - }, - "replacing": { - }, - "attributes": { - }, - "groupings": { - }, - "recipes": { - }, - "version": "0.0.0" - }
\ No newline at end of file diff --git a/features/data/cookbooks/transfer_remote_files/metadata.rb b/features/data/cookbooks/transfer_remote_files/metadata.rb deleted file mode 100644 index 7c61151538..0000000000 --- a/features/data/cookbooks/transfer_remote_files/metadata.rb +++ /dev/null @@ -1 +0,0 @@ -depends "transfer_remote_files_definition" diff --git a/features/data/cookbooks/transfer_remote_files/recipes/change_remote_file_perms_trickery.rb b/features/data/cookbooks/transfer_remote_files/recipes/change_remote_file_perms_trickery.rb deleted file mode 100644 index 64ce440cc5..0000000000 --- a/features/data/cookbooks/transfer_remote_files/recipes/change_remote_file_perms_trickery.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: change_remote_file_perms_trickery -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -# The "trickery" comes from the fact that chef waits until all Resources are defined before actually - -r = remote_file "#{node[:tmpdir]}/transfer_a_file_from_a_cookbook.txt" do - source "transfer_a_file_from_a_cookbook.txt" - mode 0600 - action :nothing -end -# This creates the file out-of-band () -r.run_action(:create) - -remote_file "#{node[:tmpdir]}/transfer_a_file_from_a_cookbook.txt" do - source "transfer_a_file_from_a_cookbook.txt" - mode 0644 -end diff --git a/features/data/cookbooks/transfer_remote_files/recipes/default.rb b/features/data/cookbooks/transfer_remote_files/recipes/default.rb deleted file mode 100644 index 8bba761657..0000000000 --- a/features/data/cookbooks/transfer_remote_files/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: transfer_remote_files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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/features/data/cookbooks/transfer_remote_files/recipes/should_prefer_the_file_for_this_specific_host.rb b/features/data/cookbooks/transfer_remote_files/recipes/should_prefer_the_file_for_this_specific_host.rb deleted file mode 100644 index a89ea4c9af..0000000000 --- a/features/data/cookbooks/transfer_remote_files/recipes/should_prefer_the_file_for_this_specific_host.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Cookbook Name:: transfer_remote_files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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_file "#{node[:tmpdir]}/host_specific.txt" do - source "host_specific.txt" -end diff --git a/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_cookbook.rb b/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_cookbook.rb deleted file mode 100644 index ccc984e6d0..0000000000 --- a/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_cookbook.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Cookbook Name:: transfer_remote_files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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_file "#{node[:tmpdir]}/transfer_a_file_from_a_cookbook.txt" do - source "transfer_a_file_from_a_cookbook.txt" -end diff --git a/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_specific_cookbook.rb b/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_specific_cookbook.rb deleted file mode 100644 index 1d2159f853..0000000000 --- a/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_specific_cookbook.rb +++ /dev/null @@ -1,20 +0,0 @@ -# -# Cookbook Name:: transfer_remote_files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -transfer_cookbook "from_definition.txt" diff --git a/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_non-existent_file_from_a_cookbook.rb b/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_non-existent_file_from_a_cookbook.rb deleted file mode 100644 index 17cd8d24c8..0000000000 --- a/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_non-existent_file_from_a_cookbook.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# Cookbook Name:: transfer_remote_files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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_file "#{node[:tmpdir]}/transfer_a_non-existent_file_from_a_cookbook.txt" do - source "transfer_a_non-existent_file_from_a_cookbook.txt" -end diff --git a/features/data/cookbooks/transfer_remote_files_definition/definitions/transfer.rb b/features/data/cookbooks/transfer_remote_files_definition/definitions/transfer.rb deleted file mode 100644 index 6784c2e765..0000000000 --- a/features/data/cookbooks/transfer_remote_files_definition/definitions/transfer.rb +++ /dev/null @@ -1,6 +0,0 @@ -define :transfer_cookbook do - remote_file "#{node[:tmpdir]}/#{params[:name]}" do - source "easy.txt" - cookbook "transfer_remote_files_definition" - end -end
\ No newline at end of file diff --git a/features/data/cookbooks/transfer_remote_files_definition/files/default/easy.txt b/features/data/cookbooks/transfer_remote_files_definition/files/default/easy.txt deleted file mode 100644 index ba56156ef3..0000000000 --- a/features/data/cookbooks/transfer_remote_files_definition/files/default/easy.txt +++ /dev/null @@ -1 +0,0 @@ -easy like saturday morning
\ No newline at end of file diff --git a/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt b/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt deleted file mode 100644 index 5d01a3a2ba..0000000000 --- a/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt +++ /dev/null @@ -1,3 +0,0 @@ -This file should be transferred, since it's referred to in a "cookbook_file" directive in the -default recipe. - diff --git a/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_not_be_transferred.txt b/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_not_be_transferred.txt deleted file mode 100644 index eb8929c6e3..0000000000 --- a/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_not_be_transferred.txt +++ /dev/null @@ -1,2 +0,0 @@ -This file should NOT be transferred, since it's not referred to in the default recipe. - diff --git a/features/data/cookbooks/transfer_some_cookbook_files/recipes/default.rb b/features/data/cookbooks/transfer_some_cookbook_files/recipes/default.rb deleted file mode 100644 index f6ceaaf5be..0000000000 --- a/features/data/cookbooks/transfer_some_cookbook_files/recipes/default.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: transfer_some_cookbook_files -# Recipe:: default -# -# Copyright 2009, Opscode -# -# 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. -# - -cookbook_file "#{node[:tmpdir]}/should_be_transferred.txt" do - source "should_be_transferred.txt" -end - -template "#{node[:tmpdir]}/template_should_be_transferred.txt" do - source "should_be_transferred.erb" -end diff --git a/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb b/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb deleted file mode 100644 index e551ee9379..0000000000 --- a/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb +++ /dev/null @@ -1,2 +0,0 @@ -Should be transferred, as it's referred to in the default recipe. -<%= node[:fqdn] %> diff --git a/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_not_be_transferred.erb b/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_not_be_transferred.erb deleted file mode 100644 index 3e8c34637f..0000000000 --- a/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_not_be_transferred.erb +++ /dev/null @@ -1,3 +0,0 @@ -Should NOT be transferred, as it's not referred to in the default recipe. -<%= node[:fqdn] %> - diff --git a/features/data/cookbooks/version_deps/metadata.rb b/features/data/cookbooks/version_deps/metadata.rb deleted file mode 100644 index f8a8be821c..0000000000 --- a/features/data/cookbooks/version_deps/metadata.rb +++ /dev/null @@ -1 +0,0 @@ -depends "versions", "= 0.1.0" diff --git a/features/data/cookbooks/version_deps/recipes/default.rb b/features/data/cookbooks/version_deps/recipes/default.rb deleted file mode 100644 index 96be727c43..0000000000 --- a/features/data/cookbooks/version_deps/recipes/default.rb +++ /dev/null @@ -1 +0,0 @@ -include_recipe "versions" diff --git a/features/data/cookbooks/versions/metadata.rb b/features/data/cookbooks/versions/metadata.rb deleted file mode 100644 index e5200c3336..0000000000 --- a/features/data/cookbooks/versions/metadata.rb +++ /dev/null @@ -1,5 +0,0 @@ -version "0.1.0" -maintainer "Bobo T. Clown" -maintainer_email "bobo@example.com" -long_description "Can haz versions?" - diff --git a/features/data/cookbooks/versions/recipes/default.rb b/features/data/cookbooks/versions/recipes/default.rb deleted file mode 100644 index ea319bf0fa..0000000000 --- a/features/data/cookbooks/versions/recipes/default.rb +++ /dev/null @@ -1,5 +0,0 @@ -file "#{node[:tmpdir]}/thundercats_are_go.txt" do - content "1" - action :create -end - diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.json deleted file mode 100644 index 5c2dab5366..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - "dep_test_b": "< 2.0.0", - "dep_test_c": "< 2.0.0" - }, - "version": "1.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_a", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.rb deleted file mode 100644 index 667c04b9bd..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.rb +++ /dev/null @@ -1,8 +0,0 @@ -name "dep_test_a" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "1.0.0" -depends "dep_test_b", "< 2.0.0" -depends "dep_test_c", "< 2.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.json deleted file mode 100644 index 62eba94b04..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - }, - "version": "2.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_a", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.rb deleted file mode 100644 index 78d8b0b9c6..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "dep_test_a" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "2.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.json deleted file mode 100644 index 60991b83ee..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - "dep_test_b": "= 3.0.0" - }, - "version": "3.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_a", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.rb deleted file mode 100644 index 1b75897c50..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.rb +++ /dev/null @@ -1,7 +0,0 @@ -name "dep_test_a" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "3.0.0" -depends "dep_test_b", "= 3.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.json deleted file mode 100644 index 4bccc932c4..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - "dep_test_a": "< 2.0.0", - "dep_test_c": "< 2.0.0" - }, - "version": "1.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_b", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.rb deleted file mode 100644 index a4a4fd2c5e..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.rb +++ /dev/null @@ -1,8 +0,0 @@ -name "dep_test_b" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "1.0.0" -depends "dep_test_a", "< 2.0.0" -depends "dep_test_c", "< 2.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.json deleted file mode 100644 index 47ca16638e..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - "dep_test_a": "= 1.0.0", - "dep_test_c": "< 3.0.0" - }, - "version": "2.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_b", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.rb deleted file mode 100644 index 8bfd38bbb8..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.rb +++ /dev/null @@ -1,8 +0,0 @@ -name "dep_test_b" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "2.0.0" -depends "dep_test_a", "= 1.0.0" -depends "dep_test_c", "< 3.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.json deleted file mode 100644 index 2bc8f3228a..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - "dep_test_c": "= 4.0.0" - }, - "version": "3.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_b", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.rb deleted file mode 100644 index 6b9bda8f3f..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.rb +++ /dev/null @@ -1,7 +0,0 @@ -name "dep_test_b" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "3.0.0" -depends "dep_test_c", "= 4.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.json deleted file mode 100644 index b2377a1a20..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - "dep_test_a": "< 2.0.0", - "dep_test_b": "< 2.0.0" - }, - "version": "1.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_c", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.rb deleted file mode 100644 index 1c71ed4432..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.rb +++ /dev/null @@ -1,8 +0,0 @@ -name "dep_test_c" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "1.0.0" -depends "dep_test_a", "< 2.0.0" -depends "dep_test_b", "< 2.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.json deleted file mode 100644 index f3b924b03a..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - }, - "version": "2.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_c", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.rb deleted file mode 100644 index 03c581e895..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "dep_test_c" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "2.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.json deleted file mode 100644 index 954c5cff03..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "recommendations": { - }, - "description": "Tests cookbook versioning in environments", - "suggestions": { - }, - "attributes": { - }, - "platforms": { - }, - "long_description": "", - "conflicting": { - }, - "dependencies": { - }, - "version": "3.0.0", - "providing": { - }, - "maintainer": "Opscode", - "recipes": { - }, - "replacing": { - }, - "license": "Apache 2.0", - "name": "dep_test_c", - "maintainer_email": "do_not_reply@opscode.com", - "groupings": { - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.rb deleted file mode 100644 index 838753b7a4..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "dep_test_c" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "3.0.0"
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr1.rb b/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr1.rb deleted file mode 100644 index 6f8c07b814..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr1.rb +++ /dev/null @@ -1 +0,0 @@ -attr1 "attribute value 1" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr2.rb b/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr2.rb deleted file mode 100644 index 4b63880508..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr2.rb +++ /dev/null @@ -1 +0,0 @@ -attr2 "attribute value 2" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/recipes/default.rb deleted file mode 100644 index e0809f4e06..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# I don't do anything - diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.json deleted file mode 100644 index 5239e45a61..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "license": "Apache 2.0", - "replacing": { - - }, - "dependencies": { - - }, - "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES:\n\n= USAGE:\n\n", - "recipes": { - "default": "" - }, - "groupings": { - - }, - "recommendations": { - - }, - "description": "Description", - "platforms": { - - }, - "maintainer": "Opscode", - "version": "0.1.0", - "suggestions": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "conflicting": { - - }, - "name": "cookbook_invalid", - "attributes": { - - }, - "providing": { - } -} diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.rb deleted file mode 100644 index 1cf603edbf..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Description" -long_description "Long description" -version "0.1" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/attributes/attributes.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/attributes/attributes.rb deleted file mode 100644 index 2b811a5267..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/attributes/attributes.rb +++ /dev/null @@ -1 +0,0 @@ -attr "attribute value" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/recipes/default.rb deleted file mode 100644 index 98757496d7..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Used for manage_cookbooks.feature - diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/attributes/attributes.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/attributes/attributes.rb deleted file mode 100644 index 2b811a5267..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/attributes/attributes.rb +++ /dev/null @@ -1 +0,0 @@ -attr "attribute value" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.json deleted file mode 100644 index 2ccfffccd0..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "testcookbook_valid", - "description": "Description", - "long_description": "Long description", - "maintainer": "Opscode", - "maintainer_email": "do_not_reply@opscode.com", - "license": "Apache 2.0", - "platforms": { - }, - "dependencies": { - }, - "recommendations": { - }, - "suggestions": { - }, - "conflicting": { - }, - "providing": { - }, - "replacing": { - }, - "attributes": { - }, - "groupings": { - }, - "recipes": { - }, - "version": "0.1.0" -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.rb deleted file mode 100644 index 1cf603edbf..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Description" -long_description "Long description" -version "0.1" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/recipes/default.rb deleted file mode 100644 index 72ae379572..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Used for manage_cookbooks.feature -# v0.1.0 diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/attributes/attributes.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/attributes/attributes.rb deleted file mode 100644 index 2b811a5267..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/attributes/attributes.rb +++ /dev/null @@ -1 +0,0 @@ -attr "attribute value" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.json deleted file mode 100644 index 6dd70de9da..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "license": "Apache 2.0", - "replacing": { - - }, - "dependencies": { - "aws": [ - - ] - }, - "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES:\n\n= USAGE:\n\n", - "recipes": { - "default": "" - }, - "groupings": { - - }, - "recommendations": { - - }, - "description": "Description", - "platforms": { - - }, - "maintainer": "Opscode", - "version": "0.1.0", - "suggestions": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "conflicting": { - - }, - "name": "testcookbook_valid", - "attributes": { - - }, - "providing": { - } -} diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.rb deleted file mode 100644 index d3200e613c..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.rb +++ /dev/null @@ -1,7 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Description" -long_description "Long description" -version "0.1" -depends "aws" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/recipes/default.rb deleted file mode 100644 index 72ae379572..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Used for manage_cookbooks.feature -# v0.1.0 diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/attributes/attributes.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/attributes/attributes.rb deleted file mode 100644 index e34884e2c0..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/attributes/attributes.rb +++ /dev/null @@ -1 +0,0 @@ -attr "attribute value #2" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.json deleted file mode 100644 index 93c7fdbf60..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "license": "Apache 2.0", - "replacing": { - - }, - "dependencies": { - - }, - "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES:\n\n= USAGE:\n\n", - "recipes": { - "default": "" - }, - "groupings": { - - }, - "recommendations": { - - }, - "description": "Description", - "platforms": { - - }, - "maintainer": "Opscode", - "version": "0.2.0", - "suggestions": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "conflicting": { - - }, - "name": "testcookbook_valid", - "attributes": { - - }, - "providing": { - } -} diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.rb deleted file mode 100644 index dfb9ad051b..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Description #2" -long_description "Long description #2" -version "0.2" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/recipes/default.rb deleted file mode 100644 index c7cfb3ad59..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Used for manage_cookbooks.feature -# v0.2.0 diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/metadata.json deleted file mode 100644 index 29f1b613f2..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/metadata.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "license": "Apache 2.0", - "replacing": { - - }, - "dependencies": { - "no_such_cookbook": [ - - ] - }, - "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES:\n\n= USAGE:\n\n", - "recipes": { - "default": "" - }, - "groupings": { - - }, - "recommendations": { - - }, - "description": "Description", - "platforms": { - - }, - "maintainer": "Opscode", - "version": "0.1.0", - "suggestions": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "conflicting": { - - }, - "name": "testcookbook_valid", - "attributes": { - - }, - "providing": { - } -} diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/recipes/default.rb deleted file mode 100644 index f434e53ed7..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/recipes/default.rb +++ /dev/null @@ -1 +0,0 @@ -# tim should read some unix books
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.json deleted file mode 100644 index eae485e650..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "0.1.0", - "suggestions": { - - }, - "conflicting": { - - }, - "license": "Apache 2.0", - "providing": { - - }, - "maintainer": "Opscode", - "replacing": { - - }, - "platforms": { - - }, - "description": "Tests cookbook versioning in environments", - "recipes": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "name": "version_test", - "groupings": { - - }, - "attributes": { - - }, - "long_description": "", - "recommendations": { - - }, - "dependencies": { - - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.rb deleted file mode 100644 index 4d461dd3cd..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "version_test" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "0.1.0" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.json deleted file mode 100644 index e472affefd..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "0.1.1", - "suggestions": { - - }, - "conflicting": { - - }, - "license": "Apache 2.0", - "providing": { - - }, - "maintainer": "Opscode", - "replacing": { - - }, - "platforms": { - - }, - "description": "Tests cookbook versioning in environments", - "recipes": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "name": "version_test", - "groupings": { - - }, - "attributes": { - - }, - "long_description": "", - "recommendations": { - - }, - "dependencies": { - - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.rb deleted file mode 100644 index 7ac700dcff..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "version_test" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "0.1.1" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json deleted file mode 100644 index cd048cf9c8..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "0.10.0", - "suggestions": { - - }, - "conflicting": { - - }, - "license": "Apache 2.0", - "providing": { - - }, - "maintainer": "Opscode", - "replacing": { - - }, - "platforms": { - - }, - "description": "Tests cookbook versioning in environments", - "recipes": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "name": "version_test", - "groupings": { - - }, - "attributes": { - - }, - "long_description": "", - "recommendations": { - - }, - "dependencies": { - - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb deleted file mode 100644 index 8ef67b86f1..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "version_test" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "0.10.0" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.json deleted file mode 100644 index 887a1079cf..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "0.2.0", - "suggestions": { - - }, - "conflicting": { - - }, - "license": "Apache 2.0", - "providing": { - - }, - "maintainer": "Opscode", - "replacing": { - - }, - "platforms": { - - }, - "description": "Tests cookbook versioning in environments", - "recipes": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "name": "version_test", - "groupings": { - - }, - "attributes": { - - }, - "long_description": "", - "recommendations": { - - }, - "dependencies": { - - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.rb deleted file mode 100644 index d0ecaaa746..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "version_test" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "0.2.0" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json deleted file mode 100644 index 3fd425ab36..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "0.9.0", - "suggestions": { - - }, - "conflicting": { - - }, - "license": "Apache 2.0", - "providing": { - - }, - "maintainer": "Opscode", - "replacing": { - - }, - "platforms": { - - }, - "description": "Tests cookbook versioning in environments", - "recipes": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "name": "version_test", - "groupings": { - - }, - "attributes": { - - }, - "long_description": "", - "recommendations": { - - }, - "dependencies": { - - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb deleted file mode 100644 index f9af3f5faf..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "version_test" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "0.9.0" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json deleted file mode 100644 index a191fc8fa5..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "0.9.7", - "suggestions": { - - }, - "conflicting": { - - }, - "license": "Apache 2.0", - "providing": { - - }, - "maintainer": "Opscode", - "replacing": { - - }, - "platforms": { - - }, - "description": "Tests cookbook versioning in environments", - "recipes": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "name": "version_test", - "groupings": { - - }, - "attributes": { - - }, - "long_description": "", - "recommendations": { - - }, - "dependencies": { - - } -}
\ No newline at end of file diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb deleted file mode 100644 index 2594aff33c..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name "version_test" -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Tests cookbook versioning in environments" -version "0.9.7" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb deleted file mode 100644 index dc2a253959..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook Name:: template -# 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. -# diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/attributes/attributes.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/attributes/attributes.rb deleted file mode 100644 index e34884e2c0..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/attributes/attributes.rb +++ /dev/null @@ -1 +0,0 @@ -attr "attribute value #2" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.json deleted file mode 100644 index 6a82409f03..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "license": "Apache 2.0", - "replacing": { - - }, - "dependencies": { - - }, - "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES:\n\n= USAGE:\n\n", - "recipes": { - "default": "" - }, - "groupings": { - - }, - "recommendations": { - - }, - "description": "Description", - "platforms": { - - }, - "maintainer": "Opscode", - "version": "1.2.3", - "suggestions": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "conflicting": { - - }, - "name": "testcookbook_valid", - "attributes": { - - }, - "providing": { - } -} diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.rb deleted file mode 100644 index cbdc562407..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Description #2" -long_description "Long description #2" -version "2.0.0" diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/recipes/default.rb deleted file mode 100644 index c7cfb3ad59..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Used for manage_cookbooks.feature -# v0.2.0 diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.json deleted file mode 100644 index 480d510268..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "license": "Apache 2.0", - "replacing": { - - }, - "dependencies": { - - }, - "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES:\n\n= USAGE:\n\n", - "recipes": { - "default": "" - }, - "groupings": { - - }, - "recommendations": { - - }, - "description": "Description", - "platforms": { - - }, - "maintainer": "Opscode", - "version": "0.2.0", - "suggestions": { - - }, - "maintainer_email": "do_not_reply@opscode.com", - "conflicting": { - - }, - "name": "versions", - "attributes": { - - }, - "providing": { - } -} diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.rb deleted file mode 100644 index 75b51ed4fb..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.rb +++ /dev/null @@ -1,5 +0,0 @@ -version "0.2.0" -maintainer "Bobo T. Clown" -maintainer_email "bobo@example.com" -long_description "Can haz versions?" - diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/versions/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/versions/recipes/default.rb deleted file mode 100644 index 5ad34db7d6..0000000000 --- a/features/data/cookbooks_not_uploaded_at_feature_start/versions/recipes/default.rb +++ /dev/null @@ -1,5 +0,0 @@ -file "#{node[:tmpdir]}/thundercats_are_go.txt" do - content "2" - action :create -end - diff --git a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/attributes/attributes.rb b/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/attributes/attributes.rb deleted file mode 100644 index 2b811a5267..0000000000 --- a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/attributes/attributes.rb +++ /dev/null @@ -1 +0,0 @@ -attr "attribute value" diff --git a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/metadata.rb b/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/metadata.rb deleted file mode 100644 index ab0ae34b7e..0000000000 --- a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/metadata.rb +++ /dev/null @@ -1,8 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Description" -long_description "Long description" -version "0.1" - - diff --git a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/recipes/default.rb b/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/recipes/default.rb deleted file mode 100644 index 72ae379572..0000000000 --- a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_good_metadata_rb/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Used for manage_cookbooks.feature -# v0.1.0 diff --git a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/attributes/attributes.rb b/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/attributes/attributes.rb deleted file mode 100644 index 2b811a5267..0000000000 --- a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/attributes/attributes.rb +++ /dev/null @@ -1 +0,0 @@ -attr "attribute value" diff --git a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/metadata.rb b/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/metadata.rb deleted file mode 100644 index 794e09318d..0000000000 --- a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/metadata.rb +++ /dev/null @@ -1,8 +0,0 @@ -maintainer "Opscode" -maintainer_email "do_not_reply@opscode.com" -license "Apache 2.0" -description "Description" -long_description "Long description" -version "0.1" - -this_is_incorrect_metadata_rb diff --git a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/recipes/default.rb b/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/recipes/default.rb deleted file mode 100644 index 72ae379572..0000000000 --- a/features/data/cookbooks_repo_with_bad_metadata_rb/testcookbook_wrong_metadata_rb/recipes/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Used for manage_cookbooks.feature -# v0.1.0 diff --git a/features/data/gems/Marshal.4.8 b/features/data/gems/Marshal.4.8 Binary files differdeleted file mode 100644 index 3f5b6872f8..0000000000 --- a/features/data/gems/Marshal.4.8 +++ /dev/null diff --git a/features/data/gems/Marshal.4.8.Z b/features/data/gems/Marshal.4.8.Z Binary files differdeleted file mode 100644 index 9ee0ba8aee..0000000000 --- a/features/data/gems/Marshal.4.8.Z +++ /dev/null diff --git a/features/data/gems/gems/chef-integration-test-0.1.0.gem b/features/data/gems/gems/chef-integration-test-0.1.0.gem Binary files differdeleted file mode 100644 index bcf1c77fe2..0000000000 --- a/features/data/gems/gems/chef-integration-test-0.1.0.gem +++ /dev/null diff --git a/features/data/gems/gems/chef-integration-test-0.1.1.gem b/features/data/gems/gems/chef-integration-test-0.1.1.gem Binary files differdeleted file mode 100644 index bd34220285..0000000000 --- a/features/data/gems/gems/chef-integration-test-0.1.1.gem +++ /dev/null diff --git a/features/data/gems/latest_specs.4.8 b/features/data/gems/latest_specs.4.8 Binary files differdeleted file mode 100644 index fe10265d99..0000000000 --- a/features/data/gems/latest_specs.4.8 +++ /dev/null diff --git a/features/data/gems/latest_specs.4.8.gz b/features/data/gems/latest_specs.4.8.gz Binary files differdeleted file mode 100644 index 02d6bcb528..0000000000 --- a/features/data/gems/latest_specs.4.8.gz +++ /dev/null diff --git a/features/data/gems/prerelease_specs.4.8 b/features/data/gems/prerelease_specs.4.8 Binary files differdeleted file mode 100644 index 0ba94359df..0000000000 --- a/features/data/gems/prerelease_specs.4.8 +++ /dev/null diff --git a/features/data/gems/prerelease_specs.4.8.gz b/features/data/gems/prerelease_specs.4.8.gz Binary files differdeleted file mode 100644 index 987b28dbf9..0000000000 --- a/features/data/gems/prerelease_specs.4.8.gz +++ /dev/null diff --git a/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.0.gemspec.rz b/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.0.gemspec.rz Binary files differdeleted file mode 100644 index 203f9a39b0..0000000000 --- a/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.0.gemspec.rz +++ /dev/null diff --git a/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.1.gemspec.rz b/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.1.gemspec.rz Binary files differdeleted file mode 100644 index 5ef07d576d..0000000000 --- a/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.1.gemspec.rz +++ /dev/null diff --git a/features/data/gems/quick/chef-integration-test-0.1.0.gemspec.rz b/features/data/gems/quick/chef-integration-test-0.1.0.gemspec.rz Binary files differdeleted file mode 100644 index abfcc829ae..0000000000 --- a/features/data/gems/quick/chef-integration-test-0.1.0.gemspec.rz +++ /dev/null diff --git a/features/data/gems/quick/chef-integration-test-0.1.1.gemspec.rz b/features/data/gems/quick/chef-integration-test-0.1.1.gemspec.rz Binary files differdeleted file mode 100644 index a02b12f3bd..0000000000 --- a/features/data/gems/quick/chef-integration-test-0.1.1.gemspec.rz +++ /dev/null diff --git a/features/data/gems/quick/index b/features/data/gems/quick/index deleted file mode 100644 index 90931e30e9..0000000000 --- a/features/data/gems/quick/index +++ /dev/null @@ -1,2 +0,0 @@ -chef-integration-test-0.1.0 -chef-integration-test-0.1.1 diff --git a/features/data/gems/quick/index.rz b/features/data/gems/quick/index.rz Binary files differdeleted file mode 100644 index f2d07ee0b8..0000000000 --- a/features/data/gems/quick/index.rz +++ /dev/null diff --git a/features/data/gems/quick/latest_index b/features/data/gems/quick/latest_index deleted file mode 100644 index abea5bbbc1..0000000000 --- a/features/data/gems/quick/latest_index +++ /dev/null @@ -1 +0,0 @@ -chef-integration-test-0.1.1 diff --git a/features/data/gems/quick/latest_index.rz b/features/data/gems/quick/latest_index.rz Binary files differdeleted file mode 100644 index 3bc19aca4a..0000000000 --- a/features/data/gems/quick/latest_index.rz +++ /dev/null diff --git a/features/data/gems/specs.4.8 b/features/data/gems/specs.4.8 Binary files differdeleted file mode 100644 index 97e0f76065..0000000000 --- a/features/data/gems/specs.4.8 +++ /dev/null diff --git a/features/data/gems/specs.4.8.gz b/features/data/gems/specs.4.8.gz Binary files differdeleted file mode 100644 index 64f83a2682..0000000000 --- a/features/data/gems/specs.4.8.gz +++ /dev/null diff --git a/features/data/gems/yaml b/features/data/gems/yaml deleted file mode 100644 index 07fd79149a..0000000000 --- a/features/data/gems/yaml +++ /dev/null @@ -1,122 +0,0 @@ ---- !ruby/object:Gem::SourceIndex -gems: - chef-integration-test-0.1.0: !ruby/object:Gem::Specification - name: chef-integration-test - version: !ruby/object:Gem::Version - prerelease: false - segments: - - 0 - - 1 - - 0 - version: 0.1.0 - platform: ruby - authors: - - Daniel DeLeo - autorequire: - bindir: bin - cert_chain: [] - - date: 2009-10-16 23:00:00 -07:00 - default_executable: - dependencies: [] - - description: A gem that's sole use is it existence; for integration testing chef's gem package support - email: dan@kallistec.com - executables: [] - - extensions: [] - - extra_rdoc_files: [] - - files: [] - - has_rdoc: true - homepage: http://wiki.opscode.com/display/opscode/Contributing - licenses: [] - - post_install_message: - rdoc_options: [] - - require_paths: - - lib - required_ruby_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: - required_rubygems_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: - requirements: [] - - rubyforge_project: - rubygems_version: 1.3.7 - signing_key: - specification_version: 3 - summary: A gem that's sole use is it existence; for integration testing chef's gem package support - test_files: [] - - chef-integration-test-0.1.1: !ruby/object:Gem::Specification - name: chef-integration-test - version: !ruby/object:Gem::Version - prerelease: false - segments: - - 0 - - 1 - - 1 - version: 0.1.1 - platform: ruby - authors: - - Daniel DeLeo - autorequire: - bindir: bin - cert_chain: [] - - date: 2009-10-16 23:00:00 -07:00 - default_executable: - dependencies: [] - - description: A gem that's sole use is it existence; for integration testing chef's gem package support - email: dan@kallistec.com - executables: [] - - extensions: [] - - extra_rdoc_files: [] - - files: [] - - has_rdoc: true - homepage: http://wiki.opscode.com/display/opscode/Contributing - licenses: [] - - post_install_message: - rdoc_options: [] - - require_paths: - - lib - required_ruby_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: - required_rubygems_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: - requirements: [] - - rubyforge_project: - rubygems_version: 1.3.7 - signing_key: - specification_version: 3 - summary: A gem that's sole use is it existence; for integration testing chef's gem package support - test_files: [] - diff --git a/features/data/gems/yaml.Z b/features/data/gems/yaml.Z Binary files differdeleted file mode 100644 index d7adf257e1..0000000000 --- a/features/data/gems/yaml.Z +++ /dev/null diff --git a/features/data/json_attribs/attribute_settings.json b/features/data/json_attribs/attribute_settings.json deleted file mode 100644 index effc4941e8..0000000000 --- a/features/data/json_attribs/attribute_settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "attribute_priority_was": "from_json_file" -}
\ No newline at end of file diff --git a/features/data/json_attribs/json_runlist_and_attrs.json b/features/data/json_attribs/json_runlist_and_attrs.json deleted file mode 100644 index 52d5eec123..0000000000 --- a/features/data/json_attribs/json_runlist_and_attrs.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "attribute_priority_was": "from_json_file", - "run_list": ["recipe[integration_setup]","recipe[no_attributes::default]"] -}
\ No newline at end of file diff --git a/features/data/myapp.bundle b/features/data/myapp.bundle Binary files differdeleted file mode 100644 index 5416cc8aec..0000000000 --- a/features/data/myapp.bundle +++ /dev/null diff --git a/features/data/node-load-test.rb b/features/data/node-load-test.rb deleted file mode 100755 index db2f56a30d..0000000000 --- a/features/data/node-load-test.rb +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/ruby -# -# A simple load test - -$: << File.join(File.dirname(__FILE__), "..", "..", "chef", "lib") -$: << File.join(File.dirname(__FILE__), "..", "..", "chef-solr", "lib") - -require 'chef' -require 'chef/client' -require 'tmpdir' - -unless ARGV[0] && ARGV[1] && ARGV[2] - puts "USAGE: ./node-load-test.rb [nodes] [interval] [splay] (json_attribs)" - exit 10 -end - -Chef::Config.from_file("/etc/chef/client.rb") -json_attrs = Hash.new -if ARGV[3] - json_attrs = Chef::JSONCompat.from_json(IO.read(ARGV[3])) -end -Chef::Log.level = :info -processes = Array.new -STDOUT.sync = true -STDERR.sync = true - -Kernel.srand - -0.upto(ARGV[0].to_i) do |i| - cid = Process.fork - if cid - puts "Spawned #{cid}" - processes << cid - else - dir = File.join(Dir.tmpdir, "chef-#{i.to_s}") - Dir.mkdir(dir) unless File.exists?(dir) - Chef::Config[:file_store_path] = File.join(dir, "file_store") - Chef::Config[:file_cache_path] = File.join(dir, "cache") - Chef::Config[:client_key] = File.join(dir, "client.pem") - Chef::Config[:splay] = ARGV[2] - Chef::Config[:interval] = ARGV[1] - Chef::Config[:log_location] = File.join(dir, "client.log") - Chef::Config[:node_name] = "test#{i}" - Chef::Log.info("Starting test#{i}") - loop do - begin - c = Chef::Client.new - c.node_name = "test#{i}" - c.safe_name = "test#{i}" - c.json_attribs = json_attrs - c.run - - Chef::Log.info("Child #{i} is finished") - Chef::Log.info("Sleeping for #{Chef::Config[:interval]} interval seconds") - sleep Chef::Config[:interval].to_i - - splay = rand Chef::Config[:splay].to_i - Chef::Log.info("Splay sleep #{splay} seconds") - sleep splay - rescue - Chef::Log.info("Child #{i} died!") - Chef::Log.info("Sleeping for #{Chef::Config[:interval]} interval seconds") - sleep Chef::Config[:interval].to_i - retry - end - end - puts "Child #{i} is exiting!" - exit 0 - end -end - -Signal.trap("INT") do - processes.each do |pid| - Process.kill("INT", pid) - end - Process.waitall - puts "Killed all children - Exiting!" - exit 0 -end - -while(true) do - sleep 1 -end - diff --git a/features/data/node-simple.rb b/features/data/node-simple.rb deleted file mode 100755 index 5c9d7ac886..0000000000 --- a/features/data/node-simple.rb +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/ruby -# -# A simple load test - -$: << File.join(File.dirname(__FILE__), "..", "..", "chef", "lib") -$: << File.join(File.dirname(__FILE__), "..", "..", "chef-solr", "lib") - -require 'chef' -require 'chef/client' - -client = Chef::Client.new -client.run_ohai -301.upto(1000) do |i| - client.node = nil - client.build_node("node#{i}", true) - puts "node#{i}" - client.node.cdb_save -end diff --git a/features/data/search-tests/do_knife_search_test.rb b/features/data/search-tests/do_knife_search_test.rb deleted file mode 100755 index f5f12b889c..0000000000 --- a/features/data/search-tests/do_knife_search_test.rb +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env ruby - -# node name -# chef config secret -# mixin recipe definition DSL core or chef mixin language -# OR -# Chef::Rest ob - -require 'uri' - -ALL_TESTS = [] - -class QueryTest - include Chef::Mixin::Language - - attr_reader :type, :query, :expected - - def initialize(type, query, expected) - @type = type - @query = query - @expected = Set.new(expected) - end - - def same_type?(q) - (@type.class == String && q.type.class == String) || - (@type == q.type) - end - - def and(q) - raise "types must match" unless same_type? q - QueryTest.new(@type, "(#{@query} AND #{q.query})", - @expected.intersection(q.expected)) - end - - def or(q) - raise "types must match" unless same_type? q - QueryTest.new(@type, "(#{@query} OR #{q.query})", - @expected.union(q.expected)) - end - - def show(s) - s.to_a.join(", ") - end - - def compare_results(results) - got = Set.new(results) - if @expected != got - puts "FAIL: #{@type} #{@query}" - puts "expected: #{show(@expected)}" - puts " got: #{show(got)}" - raise "search test failed" - else - puts "OK: (#{@expected.size}) #{@type} #{@query}" - end - true - end - - def execute - compare_results search(@type, @query).map { |o| o.name } - rescue Exception => e - puts "ERROR: query failed for #{@query}" - raise e - end -end - -def query(obj_type, query_string, expected_result) - q = QueryTest.new(obj_type, query_string, expected_result) - #q.execute - ALL_TESTS << q - q -end - -def random_bool_query(queries, n) - q_count = queries.size - ops = [:and, :or] - ans = queries[rand(q_count)] - n.times do |i| - ans = ans.send(ops[rand(2)], queries[rand(q_count)]) - end - ans.execute -end - -# Exact searches: -query :node, "tag:apples", ["a"] -query :node, "tag:apes", ["b", "c"] -query :node, "tag:not_a_tag_value", [] -query :node, 'run_list:recipe\[bravo\]', ["ab", "b"] -query :node, 'run_list:recipe\[zulu\]', [] -query :node, 'run_list:recipe\[alpha\]', ["a", "ab"] - -# data bag item searching -query "toys", 'colors:green', ["data_bag_item_toys_marbles"] -query "toys", 'colors:white', ["data_bag_item_toys_marbles"] -query "fruit", 'names:lemon', ["data_bag_item_fruit_citrus"] -query "toys", 'baseballs:4 OR colors:black', ["data_bag_item_toys_marbles", - "data_bag_item_toys_balls"] - -# basic client list search -# query :client, '*:*', ['ac', 'bc', 'cc'] - -# role search -query :role, 'name:pro*', ['prod'] -query :role, 'run_list:recipe\[base\]', ['prod', 'web'] -query :role, 'run_list:role\[monitoring\]', ['prod'] -query :role, 'key:456', ['web'] -query :role, 'key:[1 TO 5000]', ['web', 'prod'] - -# Negation: -query :node, '(run_list:recipe\[bravo\] NOT run_list:recipe\[alpha\])', ["b"] -query :node, "(tag:ap* NOT tag:apples)", ["b", "c"] - -# Prefix searches: - -query :node, "tag:a*", ["a", "ab", "b", "c"] -query :node, "tag:app*", ["a"] -query :node, "tag:ap*", ["a", "b", "c"] -query :node, "tag:zulu*", [] - - -# Range searches: - -query :node, 'value:[* TO *]', ["a", "b", "c"] -query :node, 'value:[1 TO 2]', ['a', 'b'] -query :node, 'value:[1 TO 3]', ['a', 'b', 'c'] -query :node, 'value:[2 TO *]', ['b', 'c'] -query :node, 'value:[* TO 2]', ['a', 'b'] -query :node, 'value:[* TO 5]', ['a', 'b', 'c'] -query :node, 'value:[5 TO *]', [] -# exclusive range -query :node, 'value:{1 TO 3}', ['b'] -# more negation tests -query :node, '(value:[1 TO 3] NOT value:[1 TO 2])', ['c'] - -# Quotes -query :node, 'multi_word:"foo bar baz"', ['a'] -query :node, 'multi_word:foo*', ['a', 'c'] - -# internal escaped quotes don't work, but prefix query for an escaped -# quote does -# query :node, 'quotes:"\"one\" \"two\" \"three\""', ['ab'] -# query :node, 'quotes:\"one\"*', ['ab'] -query :node, 'quotes:\"*', ['ab'] - -# nested keys -query :node, 'nested_b1_a2_a3:B1_A2_A3-a', ['a'] -query :node, 'nested_b1_a2_a3:B1_A2_A3-b', ['b'] -query :node, 'nested_b1_a2_a3:B1_A2_A3-c', ['c'] -query :node, 'nested_a1_b2_a3:A1_B2_A3-*', ['a', 'b', 'c'] - -# # nested expando (only w/ new stuff) -if Chef::Config["wildcard_in_key_tests"] - query :node, 'nested_b1_*_a3:B1_A2_A3-a', ['a'] - query :node, 'nested_b1_a2_*:B1_A2_A3-b', ['b'] - query :node, 'nested_b1_a2_a3:B1_A2_A3-c', ['c'] - query :node, 'nested_*_b2_a3:A1_B2_A3-*', ['a', 'b', 'c'] -end - - -ALL_TESTS.each do |q| - q.execute -end - -node_tests = ALL_TESTS.select { |x| x.type == :node } -role_tests = ALL_TESTS.select { |x| x.type == :role } -data_bag_tests = ALL_TESTS.select { |x| x.type.class == String } - -# AND/OR precedence -[node_tests, role_tests].each do |test_list| - 10.times do |i| - random_bool_query(test_list, 2) - random_bool_query(test_list, 3) - random_bool_query(test_list, 4) - end -end - diff --git a/features/data/search-tests/search-test-nodes.rb b/features/data/search-tests/search-test-nodes.rb deleted file mode 100644 index 653ce58400..0000000000 --- a/features/data/search-tests/search-test-nodes.rb +++ /dev/null @@ -1,174 +0,0 @@ -example_nodes = { - 'a' => Proc.new do - n = Chef::Node.new - n.name 'a' - n.run_list << "alpha" - n.tag "apples" - n.nested({:a1 => { - :a2 => {:a3 => "A1_A2_A3-a"}, - :b2 => {:a3 => "A1_B2_A3-a"} - }, - :b1 => { - :a2 => {:a3 => "B1_A2_A3-a"}, - :b2 => {:a3 => "B1_B2_A3-a"} - } - }) - n.value 1 - n.multi_word "foo bar baz" - n - end, - - 'b' => Proc.new do - n = Chef::Node.new - n.name 'b' - n.run_list << "bravo" - n.tag "apes" - n.nested({:a1 => { - :a2 => {:a3 => "A1_A2_A3-b"}, - :b2 => {:a3 => "A1_B2_A3-b"} - }, - :b1 => { - :a2 => {:a3 => "B1_A2_A3-b"}, - :b2 => {:a3 => "B1_B2_A3-b"} - } - }) - n.value 2 - n.multi_word "bar" - n - end, - - 'ab' => Proc.new do - n = Chef::Node.new - n.name 'ab' - n.run_list << "alpha" - n.run_list << "bravo" - n.tag "ack" - n.multi_word "bar foo" - n.quotes "\"one\" \"two\" \"three\"" - n - end, - - 'c' => Proc.new do - n = Chef::Node.new - n.name 'c' - n.run_list << "charlie" - n.tag "apes" - n.nested({:a1 => { - :a2 => {:a3 => "A1_A2_A3-c"}, - :b2 => {:a3 => "A1_B2_A3-c"} - }, - :b1 => { - :a2 => {:a3 => "B1_A2_A3-c"}, - :b2 => {:a3 => "B1_B2_A3-c"} - } - }) - n.value 3 - n.multi_word "foo" - n - end -} - -example_data_bags = { - 'toys' => Proc.new do - items = [] - bag = Chef::DataBag.new - bag.name "toys" - bag.save rescue nil - item = Chef::DataBagItem.new - item_data = { - "id" => "marbles", - "colors" => ["black", "white", "green", "red", "blue"] - } - item.data_bag "toys" - item.raw_data = item_data - item.save - items << item - - item = Chef::DataBagItem.new - item_data = { - "id" => "balls", - "baseballs" => 4, - "soccerballs" => 2, - "footballs" => 1 - } - item.data_bag "toys" - item.raw_data = item_data - item.save - items << item - items - end, - - 'fruit' => Proc.new do - items = [] - bag = Chef::DataBag.new - bag.name "fruit" - bag.save rescue nil - item = Chef::DataBagItem.new - item_data = { - "id" => "citrus", - "names" => ["orange", "lemon", "lime"] - } - item.data_bag "fruit" - item.raw_data = item_data - item.save - items << item - - item = Chef::DataBagItem.new - item_data = { - "id" => "tropical", - "names" => ["banana", "papaya", "mango"] - } - item.data_bag "fruit" - item.raw_data = item_data - item.save - items << item - items - end -} - -example_roles = { - 'prod' => - Proc.new do - r = Chef::Role.new - r.name "prod" - r.run_list << "base" - r.run_list << "role[monitoring]" - r.default_attributes["key"] = 123 - r.save - r - end, - 'web' => - Proc.new do - r = Chef::Role.new - r.name "web" - r.run_list << "base" - r.run_list << "nginx" - r.default_attributes["key"] = 456 - r.save - r - end - -} - -example_nodes.each do |name, nproc| - n = nproc.call - n.save - puts "saved node: #{name}" -end - -example_data_bags.each do |name, nproc| - items = nproc.call - puts "saved #{items.size} data bag items" -end - -%w(ac ab cc).each do |client_name| - client = Chef::ApiClient.new - client.name client_name - client.save - puts "saved client: #{client.name}" -end - -example_roles.each do |name, r| - a_role = r.call - puts "saved role: #{a_role.name}" -end diff --git a/features/data/test_git_repo.tar.gz b/features/data/test_git_repo.tar.gz Binary files differdeleted file mode 100644 index 8c34c11c10..0000000000 --- a/features/data/test_git_repo.tar.gz +++ /dev/null diff --git a/features/knife/coobook_upload.feature b/features/knife/coobook_upload.feature deleted file mode 100644 index f3f9438361..0000000000 --- a/features/knife/coobook_upload.feature +++ /dev/null @@ -1,23 +0,0 @@ -@knife @cookbook_upload @knife_cookbook_upload -Feature: Upload Cookbooks with Knife - In order to use cookbooks I have written - As a knife user - I want to upload my cookbooks - - @regression - Scenario: Uploading a new version updates the metadata on the server - Given I am an administrator - When I upload the 'version_updated' cookbook with knife - When I 'GET' to the path '/cookbooks/version_updated' - Then the inflated response should equal '{"version_updated"=>{"url"=>"http://127.0.0.1:4000/cookbooks/version_updated", "versions"=>[{"url"=>"http://127.0.0.1:4000/cookbooks/version_updated/2.0.0", "version"=>"2.0.0"}]}}' - - Scenario: Uploading a bad cookbook to the server from a repository with bad metadata.rb (CHEF-2923) - Given I am an administrator - When I upload the 'testcookbook_wrong_metadata_rb' cookbook with knife from a repository with bad metadata.rb - Then knife should not succeed - - Scenario: Uploading a good cookbook to the server from a repository with bad metadata.rb (CHEF-2923) - Given I am an administrator - When I upload the 'testcookbook_good_metadata_rb' cookbook with knife from a repository with bad metadata.rb - Then knife should succeed - diff --git a/features/language/attribute_inclusion.feature b/features/language/attribute_inclusion.feature deleted file mode 100644 index 094b2eb4ab..0000000000 --- a/features/language/attribute_inclusion.feature +++ /dev/null @@ -1,20 +0,0 @@ -@language @attribute_inclusion -Feature: Attribute Inclusion - In order to encapsulate functionality and re-use it - As a developer - I want to include an attribute file from another one - - Scenario: Include an attribute directly - Given a validated node - And it includes the recipe 'attribute_include' - When I run the chef-client - Then the run should exit '0' - And a file named 'mars_volta' should contain 'mars_volta is dope' only '1' time - - Scenario: Include a default attribute file - Given a validated node - And it includes the recipe 'attribute_include_default' - When I run the chef-client - Then the run should exit '0' - And a file named 'mars_volta' should contain 'mars_volta is dope' only '1' time - diff --git a/features/language/delayed_notifications.feature b/features/language/delayed_notifications.feature deleted file mode 100644 index 87373d8609..0000000000 --- a/features/language/delayed_notifications.feature +++ /dev/null @@ -1,51 +0,0 @@ -@language @delayed_notifications -Feature: Delayed Notifications - In order to not impact the system we are configuring unduly - As a developer - I want to be able to trigger an action on a resource only at the end of a run - - Scenario: Notify a resource from a single source - Given a validated node - And it includes the recipe 'delayed_notifications::notify_a_resource_from_a_single_source' - When I run the chef-client - Then the run should exit '0' - And a file named 'notified_file.txt' should exist - - Scenario: Notify a resource from multiple sources - Given a validated node - And it includes the recipe 'delayed_notifications::notify_a_resource_from_multiple_sources' - When I run the chef-client - Then the run should exit '0' - And a file named 'notified_file.txt' should contain 'bob dylan' only '1' time - - Scenario: Notify different resources for different actions - Given a validated node - And it includes the recipe 'delayed_notifications::notify_different_resources_for_different_actions' - When I run the chef-client - Then the run should exit '0' - And a file named 'notified_file_2.txt' should exist - And a file named 'notified_file_3.txt' should exist - - Scenario: Notify a resource that is defined later in the recipe - Given a validated node - And it includes the recipe 'delayed_notifications::forward_references' - When I run the chef-client - Then the run should exit '0' - And a file named 'notified_file.txt' should exist - - Scenario: Notifying a resource that doesn't exist should fail before convergence starts - Given a validated node - And it includes the recipe 'delayed_notifications::invalid_forward_reference' - When I run the chef-client - Then the run should exit '1' - And 'stdout' should not have 'should-not-execute' - And a file named 'notified_file.txt' should not exist - - Scenario: Notifying a resource with invalid syntax should fail before convergence starts - Given a validated node - And it includes the recipe 'delayed_notifications::bad_syntax_notifies' - When I run the chef-client - Then the run should exit '1' - And 'stdout' should not have 'should-not-execute' - And a file named 'notified_file.txt' should not exist - diff --git a/features/language/recipe_inclusion.feature b/features/language/recipe_inclusion.feature deleted file mode 100644 index c280428d75..0000000000 --- a/features/language/recipe_inclusion.feature +++ /dev/null @@ -1,21 +0,0 @@ -@language @recipe_inclusion -Feature: Recipe Inclusion - In order to encapsulate functionality and re-use it - As a developer - I want to include a recipe from another one - - Scenario: Include a recipe directly - Given a validated node - And it includes the recipe 'recipe_include' - When I run the chef-client - Then the run should exit '0' - And a file named 'fire_once' should contain 'mars_volta' only '1' time - - Scenario: Include a recipe multipe times - Given a validated node - And it includes the recipe 'recipe_include' - And it includes the recipe 'recipe_include::second' - When I run the chef-client - Then the run should exit '0' - And a file named 'fire_once' should contain 'mars_volta' only '1' time - diff --git a/features/provider/deploy/deploy.feature b/features/provider/deploy/deploy.feature deleted file mode 100644 index 66e71668a7..0000000000 --- a/features/provider/deploy/deploy.feature +++ /dev/null @@ -1,108 +0,0 @@ -@provider @git @deploy @provider_deploy - -Feature: Deploy - In order to repeatably and reliably deploy web apps from a source repository from the comfort of chef - As an OpsDev - I want to have automated deployments - - Scenario: Deploy an app for the first time - Given a validated node - And it includes the recipe 'deploy' - And I have a clone of the rails app in the data/tmp dir - And that I have 'rails' '2.3.4' installed - And that I have 'sqlite3-ruby' '1.2.5' installed - When I run the chef-client - Then the run should exit '0' - And a file named 'deploy/shared' should exist - And a file named 'deploy/shared/cached-copy/.git' should exist - And a file named 'deploy/current/app' should exist - And a file named 'deploy/current/config/database.yml' should exist - And a file named 'deploy/current/db/production.sqlite3' should exist - And a file named 'deploy/current/tmp/restart.txt' should exist - - Scenario: Deploy an app again - Given a validated node - And it includes the recipe 'deploy' - And I have a clone of the rails app in the data/tmp dir - And that I have 'rails' '2.3.4' installed - And that I have 'sqlite3-ruby' '1.2.5' installed - When I run the chef-client - And I run the chef-client again - And there should be 'two' releases - - Scenario: Deploy an app with custom layout attributes and callbacks - Given a validated node - And it includes the recipe 'deploy::callbacks' - And I have a clone of the rails app in the data/tmp dir - And that I have 'rails' '2.3.4' installed - And that I have 'sqlite3-ruby' '1.2.5' installed - When I run the chef-client - Then the run should exit '0' - And a callback named <callback_file> should exist - | before_migrate.rb | - | before_symlink.rb | - | before_restart.rb | - | after_restart.rb | - And the callback named <callback> should have run - | before_restart.rb | - | after_restart.rb | - - Scenario: Deploy an app with resources inside the callbacks (embedded recipes) - Given a validated node - And it includes the recipe 'deploy::embedded_recipe_callbacks' - And I have a clone of the rails app in the data/tmp dir - And that I have 'rails' '2.3.4' installed - And that I have 'sqlite3-ruby' '1.2.5' installed - When I run the chef-client - Then the run should exit '0' - And a file named 'deploy/current/app/before_symlink_was_here.txt' should exist - And a file named 'deploy/current/tmp/restart.txt' should exist - - Scenario: Deploy twice and rollback once using timestamped based deploy - Given a test git repo in the temp directory - And a validated node - And it includes the recipe 'deploy::deploy_commit1' - When I run the chef-client - Then the run should exit '0' - Then there should be 'one' release - When I remove 'recipe[deploy::deploy_commit1]' from the node's run list - And I add 'deploy::deploy_commit2' to the node's run list - And I run the chef-client - Then the run should exit '0' - Then there should be 'two' releases - When I remove 'recipe[deploy::deploy_commit2]' from the node's run list - And I add 'deploy::rollback_commit2' to the node's run list - And I run the chef-client - Then the run should exit '0' - Then there should be 'one' release - - Scenario: Make changes, commit them, deploy again using revision based strategy and do rollback - Given a validated node - And it includes the recipe 'deploy::revision_deploy' - And I have a clone of the rails app in the data/tmp dir - And that I have 'rails' '2.3.4' installed - And that I have 'sqlite3-ruby' '1.2.5' installed - And I run the chef-client - Then the run should exit '0' - When I make changes and do commit in rails app repo - And I run the chef-client - Then the run should exit '0' - And there should be 'two' releases - When I remove 'recipe[deploy::revision_deploy]' from the node's run list - And I add 'deploy::revision_rollback' to the node's run list - And I run the chef-client - Then the run should exit '0' - And current release revision should be "61e5cb77acb7400667df009ffef01306dcca4a07" - And there should be 'one' release - - Scenario: Deploy an app twice using the idempotent revision deploy strategy - Given a validated node - And it includes the recipe 'deploy::revision_deploy' - And I have a clone of the rails app in the data/tmp dir - And that I have 'rails' '2.3.4' installed - And that I have 'sqlite3-ruby' '1.2.5' installed - When I run the chef-client - And I run the chef-client at log level 'info' - Then the run should exit '0' - And there should be 'one' release - And the second chef run should have skipped deployment diff --git a/features/provider/directory/create_directories.feature b/features/provider/directory/create_directories.feature deleted file mode 100644 index c9587ae0bd..0000000000 --- a/features/provider/directory/create_directories.feature +++ /dev/null @@ -1,41 +0,0 @@ -@provider @provider_directory -Feature: Create Directories - In order to save time - As a Developer - I want to create directories - - Scenario: Create a directory - Given a validated node - And it includes the recipe 'directory_provider::create' - When I run the chef-client - Then the run should exit '0' - And a directory named 'isis' should exist - - Scenario: Set the owner of a created directory - Given a validated node - And it includes the recipe 'directory_provider::create' - When I run the chef-client - Then the run should exit '0' - And the directory named 'isis' should be owned by 'nobody' - - Scenario: Change the owner of a created directory - Given a validated node - And it includes the recipe 'directory_provider::owner_update' - When I run the chef-client - Then the run should exit '0' - And the directory named 'isis' should be owned by 'root' - - Scenario: Set the accessibility of a created directory - Given a validated node - And it includes the recipe 'directory_provider::set_the_accessibility_of_a_created_directory' - When I run the chef-client - Then the run should exit '0' - And the directory named 'octal0644' should have octal mode '0644' - And the directory named 'octal2644' should have octal mode '2644' - And the directory named 'decimal644' should have decimal mode '644' - And the directory named 'decimal2644' should have decimal mode '2644' - And the directory named 'string644' should have octal mode '644' - And the directory named 'string0644' should have octal mode '0644' - And the directory named 'string2644' should have octal mode '2644' - - diff --git a/features/provider/directory/delete_directories.feature b/features/provider/directory/delete_directories.feature deleted file mode 100644 index e98ec2140e..0000000000 --- a/features/provider/directory/delete_directories.feature +++ /dev/null @@ -1,21 +0,0 @@ -@provider @provider_directory -Feature: Delete Directories - In order to save time - As a Developer - I want to manage directories declaratively - - Scenario: Delete a directory - Given a validated node - And it includes the recipe 'directory_provider::delete' - When I run the chef-client at log level 'info' - Then the run should exit '0' - And a directory named 'particles' should not exist - And 'stdout' should have 'INFO: Deleting directory' - - Scenario: Delete a directory that already does not exist - Given a validated node - And it includes the recipe 'directory_provider::delete_nonexistent' - When I run the chef-client at log level 'info' - Then the run should exit '0' - And 'stdout' should not have 'INFO: Deleting directory' - diff --git a/features/provider/execute/run_commands.feature b/features/provider/execute/run_commands.feature deleted file mode 100644 index 28dd70482a..0000000000 --- a/features/provider/execute/run_commands.feature +++ /dev/null @@ -1,45 +0,0 @@ -@provider @provider_execute -Feature: Run Commands - In order to utilize the plethora of useful command line utilities - As a Developer - I want to execute commands from within chef - - Scenario: Execute a command - Given a validated node - And it includes the recipe 'execute_commands' - When I run the chef-client - Then the run should exit '0' - And a file named 'mastodon_rocks' should exist - - Scenario: Execute a command with umask value 777 - Given a validated node - And it includes the recipe 'execute_commands::umask' - When I run the chef-client - Then the run should exit '0' - And '/mastodon_rocks_umask' should exist and raise error when copying - - Scenario: Execute a command with client logging to file - Given a validated node - And it includes the recipe 'execute_commands' - When I run the chef-client with logging to the file 'silly-monkey.log' - Then the run should exit '0' - And a file named 'mastodon_rocks' should exist - - Scenario: Execute a command with more than 4k of output - Given a validated node - And it includes the recipe 'execute_commands::4k' - When I run the chef-client - Then the run should exit '0' - And a file named 'execute-4k.txt' should exist - - Scenario: Execute a command at the debug log level - Given a validated node - And it includes the recipe 'execute_commands::debug' - When I run the chef-client at log level 'debug' - Then the run should exit '0' - And 'stdout' should have 'DEBUG: Executing ruby -e .puts "whats up"; STDERR.puts "doc!".' - And 'stdout' should have 'DEBUG: ---- Begin output of ruby -e .puts "whats up"; STDERR.puts "doc!". ----' - And 'stdout' should have 'DEBUG: STDOUT: whats up' - And 'stdout' should have 'DEBUG: STDERR: doc!' - And 'stdout' should have 'DEBUG: ---- End output of ruby -e .puts "whats up"; STDERR.puts "doc!". ----' - And 'stdout' should have 'DEBUG: Ran ruby -e .puts "whats up"; STDERR.puts "doc!". returned 0' diff --git a/features/provider/file/manage_files.feature b/features/provider/file/manage_files.feature deleted file mode 100644 index f0df166985..0000000000 --- a/features/provider/file/manage_files.feature +++ /dev/null @@ -1,66 +0,0 @@ -@provider @provider_file -Feature: Manage Files - In order to save time - As a Developer - I want to manage files declaratively - - Scenario: Create a file - Given a validated node - And it includes the recipe 'manage_files::create_a_file' - When I run the chef-client - Then the run should exit '0' - And a file named 'create_a_file.txt' should exist - - Scenario: Set the owner of a created file - Given a validated node - And it includes the recipe 'manage_files::set_the_owner_of_a_created_file' - When I run the chef-client - Then the run should exit '0' - And the file named 'create_a_file.txt' should be owned by 'nobody' - - Scenario: Delete a file - Given a validated node - And it includes the recipe 'manage_files::delete_a_file' - When I run the chef-client - Then the run should exit '0' - And a file named 'create_a_file.txt' should not exist - - Scenario: Delete a file that already does not exist - Given a validated node - And it includes the recipe 'manage_files::delete_a_file_that_does_not_already_exist' - When I run the chef-client - Then the run should exit '0' - - Scenario: Touch a file - Given a validated node - And it includes the recipe 'manage_files::touch_a_file' - And we have an empty file named 'touch_test.txt' - And we have the atime/mtime of 'touch_test.txt' - When I run the chef-client - Then the run should exit '0' - And the atime of 'touch_test.txt' should be different - And the mtime of 'touch_test.txt' should be different - - Scenario: Set the accessibility of a created file - Given a validated node - And it includes the recipe 'manage_files::set_the_accessibility_of_a_created_file' - When I run the chef-client - Then the run should exit '0' - And the file named 'octal0111.txt' should have octal mode '0111' - And the file named 'octal0644.txt' should have octal mode '0644' - And the file named 'octal2644.txt' should have octal mode '2644' - And the file named 'decimal73.txt' should have decimal mode '73' - And the file named 'decimal644.txt' should have decimal mode '644' - And the file named 'decimal2644.txt' should have decimal mode '2644' - And the file named 'string111.txt' should have octal mode '111' - And the file named 'string644.txt' should have octal mode '644' - And the file named 'string0644.txt' should have octal mode '0644' - And the file named 'string2644.txt' should have octal mode '2644' - - Scenario: Set the contents of a file - Given a validated node - And it includes the recipe 'manage_files::manage_file_contents' - When I run the chef-client - Then the run should exit '0' - And a file named 'aqua_teen.txt' should contain 'I am using the e-photo plugin, you pop it on your back and go' - diff --git a/features/provider/package/apt_package.feature b/features/provider/package/apt_package.feature deleted file mode 100644 index 72f2e0cbab..0000000000 --- a/features/provider/package/apt_package.feature +++ /dev/null @@ -1,19 +0,0 @@ -@provider @package @apt -Feature: Install apt Packages from the Filesystem - In order to automate installation of software in apt repositories - As a Sysadmin - I want chef to install deb packages - - Scenario: Install an apt package using the package resource - Given I am running on a debian compatible OS - And my dpkg architecture is 'amd64' - And the apt server is running - And I have configured my apt sources for integration tests - And I have updated my apt cache - And a validated node - And it includes the recipe 'packages::install_apt_package' - When I run the chef-client with '-l debug' - Then the run should exit '0' - And the dpkg package 'chef-integration-test' should be installed - - diff --git a/features/provider/package/dpkg_package.feature b/features/provider/package/dpkg_package.feature deleted file mode 100644 index 482e498157..0000000000 --- a/features/provider/package/dpkg_package.feature +++ /dev/null @@ -1,20 +0,0 @@ -@provider @package @dpkg -Feature: Install deb Packages from the Filesystem - In order to automate installation of software distributed as deb packages - As a Sysadmin - I want chef to install deb packages - - Scenario: Install a deb package using the dpkg resource - Given I am running on a debian compatible OS - And my dpkg architecture is 'amd64' - And the deb package 'chef-integration-test_1.0' is available - And a validated node - And it includes the recipe 'packages::install_dpkg_package' - When I run the chef-client with '-l debug' - Then the run should exit '0' - And the dpkg package 'chef-integration-test' should be installed - - - - - diff --git a/features/provider/package/gem_package.feature b/features/provider/package/gem_package.feature deleted file mode 100644 index 457304aecf..0000000000 --- a/features/provider/package/gem_package.feature +++ /dev/null @@ -1,48 +0,0 @@ -@provider @package @rubygems -Feature: Gem package - In order to manage software and applications that require ruby gem packages - As an OpsDev - I want to install upgrade and remove rubygems - - Scenario: Installing a gem that is not installed - Given a validated node - And it includes the recipe 'packages::gem_package' - And the gems server is running - When I run the chef-client - Then the run should exit '0' - And the gem 'chef-integration-test' version '0.1.0' should be installed - - Scenario: Installing a gem using only the gems api - Given a validated node - And it includes the recipe 'packages::install_gem_noshell' - And the gems server is running - When I run the chef-client - Then the run should exit '0' - And the gem 'chef-integration-test' version '0.1.0' should be installed - - Scenario: Upgrading a gem to a newer version - Given a validated node - And it includes the recipe 'packages::upgrade_gem_package' - And the gems server is running - When I run the chef-client - Then the run should exit '0' - And the gem 'chef-integration-test' version '0.1.0' should be installed - And the gem 'chef-integration-test' version '0.1.1' should be installed - - Scenario: Upgrading a gem using only the gems api - Given a validated node - And it includes the recipe 'packages::upgrade_gem_noshell' - And the gems server is running - When I run the chef-client - Then the run should exit '0' - And the gem 'chef-integration-test' version '0.1.0' should be installed - And the gem 'chef-integration-test' version '0.1.1' should be installed - - Scenario: Upgrading a gem manually by specifying a different version - Given a validated node - And it includes the recipe 'packages::manually_upgrade_gem_package' - And the gems server is running - When I run the chef-client - Then the run should exit '0' - And the gem 'chef-integration-test' version '0.1.0' should be installed - And the gem 'chef-integration-test' version '0.1.1' should be installed diff --git a/features/provider/package/macports.feature b/features/provider/package/macports.feature deleted file mode 100644 index 50914ac3a5..0000000000 --- a/features/provider/package/macports.feature +++ /dev/null @@ -1,19 +0,0 @@ -@provider @package @macports -Feature: Macports integration - In order to easily manage my OS X machines - As a Developer - I want to manage packages installed on OS X machines - - Scenario Outline: OS X package management - Given that I have the MacPorts package system installed - When I run chef-solo with the '<recipe>' recipe - Then the run should exit '<exitcode>' - And there <should> be a binary on the path called '<binary>' - - Examples: - | recipe | binary | should | exitcode | - | packages::macports_install_yydecode | yydecode | should | 0 | - | packages::macports_remove_yydecode | yydecode | should not | 0 | - | packages::macports_upgrade_yydecode | yydecode | should | 0 | - | packages::macports_purge_yydecode | yydecode | should not | 0 | - | packages::macports_install_bad_package | fdsafdsa | should not | 1 | diff --git a/features/provider/remote_directory/transfer_remote_directories.feature b/features/provider/remote_directory/transfer_remote_directories.feature deleted file mode 100644 index c474a686bc..0000000000 --- a/features/provider/remote_directory/transfer_remote_directories.feature +++ /dev/null @@ -1,18 +0,0 @@ -@provider @remote_directory -Feature: Transfer remote directories - In order to install copies of many files to many hosts - As an OpsDev - I want to transfer directories from remote locations - - Scenario: Transfer a directory from a cookbook - Given a validated node - And it includes the recipe 'transfer_remote_directories::transfer_directory' - When I run the chef-client - Then the run should exit '0' - And a file named 'transfer_directory/foo.txt' should contain 'tyrantanic' - And a file named 'transfer_directory/bar.txt' should contain 'Space Manoeuvres stage 1' - And a file named 'transfer_directory/baz.txt' should contain 'micromega' - - - - diff --git a/features/provider/remote_file/transfer_remote_files.feature b/features/provider/remote_file/transfer_remote_files.feature deleted file mode 100644 index 9474698a13..0000000000 --- a/features/provider/remote_file/transfer_remote_files.feature +++ /dev/null @@ -1,66 +0,0 @@ -@provider @remote_file -Feature: Transfer Remote Files - In order to easily manage many systems at once - As a Developer - I want to manage the contents of files remotely - - Scenario: Transfer a file from a cookbook - Given a validated node - And it includes the recipe 'transfer_remote_files::transfer_a_file_from_a_cookbook' - When I run the chef-client - Then the run should exit '0' - And a file named 'transfer_a_file_from_a_cookbook.txt' should contain 'easy like sunday morning' - - Scenario: Scenario: Attempting to use a non-existent cookbook file causes an error - Given a validated node - And it includes the recipe 'transfer_remote_files::transfer_a_non-existent_file_from_a_cookbook' - When I run the chef-client - Then the run should exit '1' - And 'stdout' should have 'cookbook transfer_remote_files does not contain file files/transfer_a_non-existent_file_from_a_cookbook.txt' - - Scenario: Should prefer the file for this specific host - Given a validated node - And it includes the recipe 'transfer_remote_files::should_prefer_the_file_for_this_specific_host' - And the cookbook has a 'file' named 'host_specific.txt' in the 'host' specific directory - And the cookbook has a 'file' named 'host_specific.txt' in the 'platform-version' specific directory - And the cookbook has a 'file' named 'host_specific.txt' in the 'platform' specific directory - And the cookbook has a 'file' named 'host_specific.txt' in the 'default' specific directory - And I upload the cookbook - When I run the chef-client - Then the run should exit '0' - And a file named 'host_specific.txt' should be from the 'host' specific directory - - Scenario: Should prefer the file for the correct platform version - Given a validated node - And it includes the recipe 'transfer_remote_files::should_prefer_the_file_for_this_specific_host' - And the cookbook has a 'file' named 'host_specific.txt' in the 'platform-version' specific directory - And the cookbook has a 'file' named 'host_specific.txt' in the 'platform' specific directory - And the cookbook has a 'file' named 'host_specific.txt' in the 'default' specific directory - And I upload the cookbook - When I run the chef-client - Then the run should exit '0' - And a file named 'host_specific.txt' should be from the 'platform-version' specific directory - - Scenario: Should prefer the file for the correct platform - Given a validated node - And it includes the recipe 'transfer_remote_files::should_prefer_the_file_for_this_specific_host' - And the cookbook has a 'file' named 'host_specific.txt' in the 'platform' specific directory - And the cookbook has a 'file' named 'host_specific.txt' in the 'default' specific directory - And I upload the cookbook - When I run the chef-client - Then the run should exit '0' - And a file named 'host_specific.txt' should be from the 'platform' specific directory - - Scenario: Transfer a file from a specific cookbook - Given a validated node - And it includes the recipe 'transfer_remote_files::transfer_a_file_from_a_specific_cookbook' - When I run the chef-client - Then the run should exit '0' - And a file named 'from_definition.txt' should contain 'easy like saturday morning' - - Scenario: Change permissions for a pre-existing remote_file - Given a validated node - And it includes the recipe 'transfer_remote_files::change_remote_file_perms_trickery' - When I run the chef-client - Then the run should exit '0' - And the file named 'transfer_a_file_from_a_cookbook.txt' should have octal mode '0644' diff --git a/features/provider/scm/git.feature b/features/provider/scm/git.feature deleted file mode 100644 index f0ff2a1e04..0000000000 --- a/features/provider/scm/git.feature +++ /dev/null @@ -1,31 +0,0 @@ -@provider @git - -Feature: Git - In order to use files stored in git so I can deploy apps and use edge versions of software - As a Developer - I want to clone and update git repositories - - Scenario: Clone a git repo - Given a test git repo in the temp directory - And a validated node - And it includes the recipe 'scm::git' - When I run the chef-client - Then the run should exit '0' - And a file named 'gitchef/.git' should exist - And a file named 'gitchef/what_revision_am_i' should exist - - Scenario: Clone a git repo with additional repositories - Given a test git repo in the temp directory - And a validated node - And it includes the recipe 'scm::git-remotes' - When I run the chef-client - Then the run should exit '0' - And a remote repository named 'hi' should exist in 'gitchef2' - And a remote repository named 'lo' should exist in 'gitchef2' - And a remote repository named 'waugh' should exist in 'gitchef2' - When I remove the remote repository named 'lo' from 'gitchef2' - And I run the chef-client again - Then the run should exit '0' - And a remote repository named 'hi' should exist in 'gitchef2' - And a remote repository named 'lo' should exist in 'gitchef2' - And a remote repository named 'waugh' should exist in 'gitchef2' diff --git a/features/provider/template/template.feature b/features/provider/template/template.feature deleted file mode 100644 index 684f1cc499..0000000000 --- a/features/provider/template/template.feature +++ /dev/null @@ -1,31 +0,0 @@ -@provider @template -Feature: Templates - In order to easily manage many systems at once - As a Developer - I want to manage the contents of files programatically - - Scenario: Render a template from a cookbook - Given a validated node - And it includes the recipe 'template' - When I run the chef-client - Then the run should exit '0' - And a file named 'template.txt' should contain 'sauce' - - Scenario: Render a template accessing the node directly - Given a validated node - And it includes the recipe 'template::render_node_attrs' - When I run the chef-client - Then the run should exit '0' - And a file named 'node.txt' should contain 'bawt is fujins bot' - And a file named 'node.txt' should contain 'cheers!' - -# Read the JIRA ticket for the full story, but what we're testing is that the -# template resource executes correctly the second time it's run in the same -# chef process - @regression @chef_1384 - Scenario: Render a template twice running as a daemon - Given a validated node - And it includes the recipe 'template::interval' - When I run the chef-client for no more than '30' seconds - Then the run should exit '108' - And a file named 'template.txt' should contain 'two' diff --git a/features/search/search_data.feature b/features/search/search_data.feature deleted file mode 100644 index 7d4b5c17ad..0000000000 --- a/features/search/search_data.feature +++ /dev/null @@ -1,46 +0,0 @@ -@search -Feature: Search Data - In order to access information about my infrastructure - As a Developer - I want to search the data - - Scenario: Search the user index - Given a validated node - And it includes the recipe 'search::search_data' - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - When I run the chef-client with '-l debug' - Then the run should exit '0' - And a file named 'francis' should exist - And a file named 'axl_rose' should exist - - Scenario: Search the user index without a block - Given a validated node - And it includes the recipe 'search::search_data_noblock' - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - When I run the chef-client - Then the run should exit '0' - And a file named 'francis' should exist - And a file named 'axl_rose' should exist - - Scenario: Search the user index without a block, with manual paging - Given a validated node - And it includes the recipe 'search::search_data_manual' - And a 'data_bag' named 'users' exists - And a 'data_bag_item' named 'francis' exists - And a 'data_bag_item' named 'axl_rose' exists - When I run the chef-client - Then the run should exit '0' - And a file named 'francis' should exist - And a file named 'axl_rose' should exist - - @correctness - Scenario: Search the node and data bag index and verify correctness - Given I am an administrator - And a set of nodes pre-populated with known, searchable data - And the search index has been committed - When I execute a randomized set of searches across my infrastructure - Then all of the searches should return the expected results
\ No newline at end of file diff --git a/features/steps/cookbook_steps.rb b/features/steps/cookbook_steps.rb deleted file mode 100644 index fadfc354a4..0000000000 --- a/features/steps/cookbook_steps.rb +++ /dev/null @@ -1,438 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Author:: Christopher Walters (<cw@opscode.com>) -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2008, 2010 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. -# - -require 'chef/cookbook/file_system_file_vendor' -require 'chef/cookbook_uploader' -require 'chef/cookbook_loader' - -def compare_manifests(manifest1, manifest2) - Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment| - next unless manifest1[segment] - manifest2.should have_key(segment) - - manifest2_records_by_path = manifest2[segment].inject({}) {|memo,manifest2_record| memo[manifest2_record[:path]] = manifest2_record; memo} - manifest1[segment].each do |manifest1_record| - path = manifest1_record[:path] - - manifest2_records_by_path.should have_key(path) - manifest1_record.should == manifest2_records_by_path[path] - end - end -end - -Before do - FileUtils.mkdir "#{datadir}/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty" unless File.exist?("#{datadir}/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty") - extra_cookbook_repo = File.join(datadir, "cookbooks_not_uploaded_at_feature_start") - Chef::Cookbook::FileVendor.on_create {|manifest| Chef::Cookbook::FileSystemFileVendor.new(manifest, extra_cookbook_repo) } - @cookbook_loader_not_uploaded_at_feature_start = Chef::CookbookLoader.new(extra_cookbook_repo) -end - -Given /^a local cookbook repository$/ do - Dir.mkdir(File.join(tmpdir, 'cookbooks_dir')) - Dir.mkdir(File.join(tmpdir, 'cookbooks_dir', 'cookbooks')) - Dir.mkdir(File.join(tmpdir, 'cookbooks_dir', 'config')) - system("cp #{datadir}/Rakefile #{tmpdir}/cookbooks_dir") - system("cp -r #{datadir}/config/* #{tmpdir}/cookbooks_dir/config") - system("cp -r #{datadir}/cookbooks/* #{tmpdir}/cookbooks_dir/cookbooks") - cleanup_dirs << "#{tmpdir}/cookbooks_dir" -end - -Given /^a local cookbook named '(.+)'$/ do |cb| - Dir.mkdir(File.join(tmpdir, 'cookbooks_dir')) - Dir.mkdir(File.join(tmpdir, 'cookbooks_dir', 'cookbooks')) - Dir.mkdir(File.join(tmpdir, 'cookbooks_dir', 'config')) - system("cp #{datadir}/Rakefile #{tmpdir}/cookbooks_dir") - system("cp -r #{datadir}/config/* #{tmpdir}/cookbooks_dir/config") - system("cp -r #{datadir}/cookbooks/#{cb} #{tmpdir}/cookbooks_dir/cookbooks") - cleanup_dirs << "#{tmpdir}/cookbooks_dir" -end - -Given "I upload the cookbook" do - cookbook_name, recipe_name = recipe.split('::') - shell_out!("#{KNIFE_CMD} cookbook upload -c #{KNIFE_CONFIG} -a -o #{INTEGRATION_COOKBOOKS}") -end - -Given "I have uploaded a frozen cookbook named '$cookbook_name' at version '$cookbook_version'" do |name, version| - shell_out!("#{KNIFE_CMD} cookbook upload #{name} -c #{KNIFE_CONFIG} -o #{EXTRA_COOKBOOKS} --freeze --force") -end - -Given /^I delete the cookbook's on disk checksum files$/ do - #pp :checksums => @last_uploaded_cookbook.checksums.keys - #pending # express the regexp above with the code you wish you had - @last_uploaded_cookbook.checksums.keys.each do |file_checksum| - file_location_in_checksum_repo = File.join(datadir, 'repo', 'checksums', file_checksum[0...2], file_checksum) - #pp :expected_cksum_path => {file_checksum => file_location_in_checksum_repo} - #puts "deleting checksum file #{file_location_in_checksum_repo}" - FileUtils.rm(file_location_in_checksum_repo) - end -end - -Given /^I have restored the original 'sync_library' cookbook$/ do - # Copy the original cookbook - source = File.join(datadir, 'cookbooks', 'sync_library_original') - dest = File.join(datadir, 'cookbooks', 'sync_library') - FileUtils.mkdir_p(dest) - - system("cp -r #{source}/. #{dest}/.") - shell_out!("#{KNIFE_CMD} cookbook upload -c #{KNIFE_CONFIG} -o #{INTEGRATION_COOKBOOKS} sync_library") -end - -When /^I run the task to generate cookbook metadata for '(.+)'$/ do |cb| - self.cookbook = cb - When('I run the task to generate cookbook metadata') -end - -When /^I run the task to generate cookbook metadata$/ do - to_run = "#{KNIFE_CMD} cookbook metadata" - if cookbook - to_run += " #{cookbook}" - else - to_run += " -a" - end - to_run += " -o #{File.join(tmpdir, 'cookbooks_dir', 'cookbooks')}" - Dir.chdir(File.join(tmpdir, 'cookbooks_dir', 'cookbooks')) do - self.status = Chef::Mixin::Command.popen4(to_run) do |p, i, o, e| - self.stdout = o.gets(nil) - self.stderr = o.gets(nil) - end - end -end - -##### -# Cookbook upload/download-specific steps -##### - -When "I upload a cookbook named '$name' at version '$version'" do |name, version| - - - call_as_admin do - cookbook = @cookbook_loader_not_uploaded_at_feature_start[name] - uploader = Chef::CookbookUploader.new(cookbook, [EXTRA_COOKBOOKS], :rest => rest) - begin - uploader.upload_cookbook - rescue Exception => e - @exception = e - end - end -end - -When /^I create a versioned cookbook(?: named '(.*?)')?(?: versioned '(.*?)')? with '(.*?)'$/ do |request_name, request_version, cookbook_name| - cookbook = @cookbook_loader_not_uploaded_at_feature_start[cookbook_name] - raise ArgumentError, "no such cookbook in cookbooks_not_uploaded_at_feature_start: #{cookbook_name}" unless cookbook - - begin - self.api_response = rest.put_rest("/cookbooks/#{request_name}/#{request_version}", cookbook) - self.inflated_response = api_response - rescue => e - self.exception = e - end -end - -# The argument handling in the above step defn isn't working for me, so dup city. -# :/ -When "I create a cookbook named '$cookbook_name' with only the metadata file" do |cookbook_name| - cookbook = @cookbook_loader_not_uploaded_at_feature_start[cookbook_name.to_sym] - raise ArgumentError, "no such cookbook in cookbooks_not_uploaded_at_feature_start: #{cookbook_name}" unless cookbook - - begin - self.api_response = rest.put_rest("/cookbooks/#{cookbook_name}/1.0.0", cookbook) - self.inflated_response = api_response - rescue => e - Chef::Log.debug("Caught exception #{e} from HTTP request") - self.exception = e - end -end - -When /^I create a sandbox named '(.+)' for cookbook '([^\']+)'(?: minus files '(.+)')?$/ do |sandbox_name, cookbook_name, filenames_to_exclude| - cookbook = @cookbook_loader_not_uploaded_at_feature_start[cookbook_name] - raise ArgumentError, "no such cookbook in cookbooks_not_uploaded_at_feature_start: #{cookbook_name}" unless cookbook - - if filenames_to_exclude - filenames_to_exclude = filenames_to_exclude.split(",").inject({}) { |memo, filename| memo[filename] = 1; memo } - else - filenames_to_exclude = Hash.new - end - - # add all the checksums from the given cookbook into the sandbox. - checksums = Hash.new - Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment| - next unless cookbook.manifest[segment] - cookbook.manifest[segment].each do |manifest_record| - # include the checksum, unless it was included in the filenames to exclude - checksums[manifest_record[:checksum]] = nil unless filenames_to_exclude.has_key?(manifest_record[:path]) - end - end - - sandbox = { - :checksums => checksums - } - - begin - self.api_response = self.inflated_response = nil - self.exception = nil - - self.inflated_response = rest.post_rest('/sandboxes', sandbox) - self.sandbox_url = self.inflated_response['uri'] - - @stash['sandbox_response'] = self.inflated_response - rescue - Chef::Log.debug("Caught exception in sandbox create (POST) request: #{$!.message}: #{$!.backtrace.join("\n")}") - self.exception = $! - end -end - -Then /^I upload a file named '(.+)' from cookbook '(.+)' to the sandbox/ do |path, cookbook_name| - cookbook = @cookbook_loader_not_uploaded_at_feature_start[cookbook_name] - raise ArgumentError, "no such cookbook in cookbooks_not_uploaded_at_feature_start: #{cookbook_name}" unless cookbook - - if path =~ /([^\/]+)\/(.+)/ - segment, path_no_segment = $1, $2 - else - segment = :root_files - path_no_segment = path - end - if cookbook.manifest[segment] - manifest_record = cookbook.manifest[segment].find {|manifest_record| manifest_record[:path] == path } - end - raise ArgumentError, "no such file in cookbooks_not_uploaded_at_feature_start/#{cookbook_name}: #{path}" unless manifest_record - - full_path = File.join(datadir, "cookbooks_not_uploaded_at_feature_start", cookbook_name, path) - - begin - url = @stash['sandbox_response']['checksums'][manifest_record[:checksum]]['url'] - upload_to_sandbox(full_path, manifest_record[:checksum], url) - rescue - Chef::Log.debug("Caught exception in cookbook/sandbox checksum upload (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}") - self.exception = $! - end -end - -# Shortcut for uploading a whole cookbook based on data in the -# cookbooks_not_uploaded_at_feature_start directory -Then /I fully upload a sandboxed cookbook (force-)?named '([^\']+)' versioned '([^\']+)' with '(.+)'/ do |forced, request_name, request_version, cookbook_name| - @last_uploaded_cookbook = cookbook = @cookbook_loader_not_uploaded_at_feature_start[cookbook_name] - raise ArgumentError, "no such cookbook in cookbooks_not_uploaded_at_feature_start: #{cookbook_name}" unless cookbook - - # If they said 'force-named', we will reach into the cookbook and change its - # name. This is to get around the fact that CookbookLoader uses the - # directory name as the cookbook name. This is super awesome right here. - if forced == "force-" - # If the paths contain the name of the old cookbook name, change it to the - # new cookbook name. - Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment| - next unless cookbook.manifest[segment] - cookbook.manifest[segment].each do |manifest_record| - if manifest_record[:path] =~ /^(.+)\/#{cookbook.name}\/(.+)$/ - manifest_record[:path] = "#{$1}/#{request_name}/#{$2}" - end - end - end - cookbook.name = request_name - cookbook.manifest[:cookbook_name] = request_name - cookbook.manifest[:name] = "#{cookbook.manifest[:cookbook_name]}-#{cookbook.manifest[:version]}" - end - - When "I create a sandbox named 'sandbox1' for cookbook '#{cookbook_name}'" - Then "the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$'" - - Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment| - next unless cookbook.manifest[segment] - cookbook.manifest[segment].each do |manifest_record| - full_path = File.join(datadir, "cookbooks_not_uploaded_at_feature_start", cookbook_name, manifest_record[:path]) - - begin - csum_entry = @stash['sandbox_response']['checksums'][manifest_record[:checksum]] - next unless csum_entry['url'] - url = @stash['sandbox_response']['checksums'][manifest_record[:checksum]]['url'] - upload_to_sandbox(full_path, manifest_record[:checksum], url) - rescue - Chef::Log.debug("Caught exception in cookbook/sandbox checksum upload (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}") - self.exception = $! - end - Then "the response code should be '200'" - end - end - - When "I commit the sandbox" - Then "I should not get an exception" - When "I create a versioned cookbook named '#{request_name}' versioned '#{request_version}' with '#{cookbook_name}'" - Then "I should not get an exception" -end - -When /I download the cookbook manifest for '(.+)' version '(.+)'$/ do |cookbook_name, cookbook_version| - self.api_response = self.inflated_response = self.exception = nil - - When "I 'GET' to the path '/cookbooks/#{cookbook_name}/#{cookbook_version}'" - @downloaded_cookbook = self.inflated_response -end - -Then /the downloaded cookbook manifest contents should match '(.+)'$/ do |cookbook_name| - expected_cookbook = @cookbook_loader_not_uploaded_at_feature_start[cookbook_name] - raise ArgumentError, "no such cookbook in cookbooks_not_uploaded_at_feature_start: #{cookbook_name}" unless expected_cookbook - - downloaded_cookbook_manifest = Mash.new(@downloaded_cookbook.manifest) - downloaded_cookbook_manifest.delete("uri") - - # remove the uri's from the manifest records - Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment| - next unless downloaded_cookbook_manifest[segment] - downloaded_cookbook_manifest[segment].each do |downloaded_manifest_record| - downloaded_manifest_record.delete("url") - end - end - - # ensure that each file expected (from the cookbook on disk) was downloaded, - # and then do the opposite. - begin - compare_manifests(expected_cookbook.manifest, downloaded_cookbook_manifest) - compare_manifests(downloaded_cookbook_manifest, expected_cookbook.manifest) - rescue - pp({:expected_cookbook_manifest => expected_cookbook.manifest}) - pp({:downloaded_cookbook_manifest => downloaded_cookbook_manifest}) - - raise - end -end - -When /I download the file '([^\']+)' from the downloaded cookbook manifest/ do |path| - raise "no @downloaded_cookbook" unless @downloaded_cookbook - - # TODO: timh, 2010-5-26: Cookbook really should have a "get me a file by its - # path" method. - if path =~ /^([^\/]+)\/(.+)$/ - segment, path_in_segment = $1, $2 - else - segment = :root_files - path_in_segment = path - end - - raise "no such file #{path}" unless @downloaded_cookbook.manifest[segment] - found_manifest_record = @downloaded_cookbook.manifest[segment].find {|manifest_record| manifest_record[:path] == path} - raise "no such file #{path}" unless found_manifest_record - - begin - cookbook_name = @downloaded_cookbook.name - cookbook_version = @downloaded_cookbook.version - - checksum = found_manifest_record[:checksum] - - self.api_response = nil - self.inflated_response = nil - self.exception = nil - - url = found_manifest_record[:url] - downloaded_cookbook_file = rest.get_rest(url, true) - @downloaded_cookbook_file_contents = IO.read(downloaded_cookbook_file.path) - rescue - self.exception = $! - end -end - -Then /^the downloaded cookbook file contents should match the pattern '(.+)'$/ do |pattern| - raise "no @downloaded_cookbook_file_contents" unless @downloaded_cookbook_file_contents - - @downloaded_cookbook_file_contents.should =~ /#{pattern}/ -end - -Then /^the dependencies in its metadata should be an empty hash$/ do - inflated_response.metadata.dependencies.should == {} -end - -Then /^the metadata should include a dependency on '(.+)'$/ do |key| - inflated_response.metadata.dependencies.should have_key(key) -end - -Then "the cookbook version document should be frozen" do - inflated_response.should be_frozen_version -end - -RSpec::Matchers.define :have_been_deleted do - match do |file_name| - ! File.exist?(file_name) - end - failure_message_for_should do |file_name| - "Expected file #{file_name} to have been deleted but it was not" - end - failure_message_for_should_not do |player| - "Expected file #{file_name} to not have been deleted but it was (i.e., it should exist)" - end - description do - "The file should have been deleted" - end -end - -Then /^the cookbook's files should have been deleted$/ do - #pp @last_uploaded_cookbook - @last_uploaded_cookbook.checksums.keys.each do |file_checksum| - file_location_in_checksum_repo = File.join(datadir, 'repo', 'checksums', file_checksum[0...2], file_checksum) - #pp :expected_cksum_path => {file_checksum => file_location_in_checksum_repo} - file_location_in_checksum_repo.should have_been_deleted - end -end - -RSpec::Matchers.define :have_checksum_document do |checksum| - match do |checksum_list| - checksum_list.include?(checksum) - end - failure_message_for_should do |checksum_list| - "Expected checksum document #{checksum} to exist in couchdb but it is not in the list of existing checksums:\n#{checksum_list.sort.join("\n")}\n" - end - failure_message_for_should_not do |checksum_list| - "Expected checksum document #{checksum} not to exist in couchdb but it is in the list of existing checksums:\n#{checksum_list.sort.join("\n")}\n" - end - description do - "The checksum should exist" - end -end - -Then /^the cookbook's checksums should be removed from couchdb$/ do - #pp @last_uploaded_cookbook - all_checksum_docs = couchdb_rest_client.get_rest('/_design/checksums/_view/all')["rows"] - checksums_in_couchdb = all_checksum_docs.map {|c| c["key"]} - #pp :checksums_in_couchdb => checksums_in_couchdb - @last_uploaded_cookbook.checksums.keys.each do |checksum| - checksums_in_couchdb.should_not have_checksum_document(checksum) - end -end - -Given "I upload multiple versions of the 'version_test' cookbook" do - When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.1.0' with 'version_test_0.1.0'" - When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.1.1' with 'version_test_0.1.1'" - When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.2.0' with 'version_test_0.2.0'" -end - -Given "I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly" do - When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.9.0' with 'version_test_0.9.0'" - When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.10.0' with 'version_test_0.10.0'" - When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.9.7' with 'version_test_0.9.7'" -end - -Given "I upload the set of 'dep_test_*' cookbooks" do - %w{a b c}.each do |letter| - %w{1 2 3}.each do |number| - When "I fully upload a sandboxed cookbook force-named 'dep_test_#{letter}' versioned '#{number}.0.0' with 'dep_test_#{letter}_#{number}.0.0'" - end - end -end - -Then /^cookbook '(.+)' should have version '(.+)'$/ do |cookbook, version| - Then "the inflated responses key '#{cookbook}' should exist" - Then "the inflated responses key 'dep_test_a' should match '\"version\":\"#{version}\"' as json" -end diff --git a/features/steps/deploy_steps.rb b/features/steps/deploy_steps.rb deleted file mode 100644 index 43dac5d6ce..0000000000 --- a/features/steps/deploy_steps.rb +++ /dev/null @@ -1,109 +0,0 @@ -require 'chef/shell_out' -require 'chef/mixin/shell_out' -include Chef::Mixin::ShellOut - -# Given /^I have a clone of typo in the data\/tmp dir$/ do -# cmd = "git clone #{datadir}/typo.bundle #{tmpdir}/gitrepo/typo" -# `#{cmd}` -# end -def gem_installed?(gem_name, version) - cmd = "gem list -i #{gem_name} -v #{version}" - `#{cmd}`=~ /true/ ? true : false -end - -Given /^I have a clone of the rails app in the data\/tmp dir$/ do - cmd = "git clone #{datadir}/myapp.bundle #{tmpdir}/gitrepo/myapp" - `#{cmd}` -end - -When /^I make changes and do commit in rails app repo$/ do - cmd = <<-CMD - cd #{tmpdir}/gitrepo/myapp && - git checkout -qb master && - echo 1 >> test_file && - git add test_file && - git commit -m "Modified file" - CMD - - `#{cmd}` -end - -And /^current release revision should be "(.*)"$/ do |revision| - File.readlink("#{tmpdir}/deploy/current").split("/").last.should == revision -end - - -Given /^that I have '(.*)' '(.*)' installed$/ do |gem_name, version| - unless gem_installed?(gem_name, version) - pending "This Cucumber feature will not execute, as #{gem_name} #{version} is not installed." - end -end - -Given /^a test git repo in the temp directory$/ do - test_git_repo_tarball_filename = "#{datadir}/test_git_repo.tar.gz" - cmd = Chef::ShellOut.new("tar xzvf #{test_git_repo_tarball_filename} -C #{tmpdir}") - cmd.run_command.exitstatus.should == 0 -end - -When /^I remove the remote repository named '(.+)' from '(.+)'$/ do |remote_name, repository_dir| - shell_out!("git remote rm #{remote_name}", Hash[:cwd => File.join(tmpdir, repository_dir)]) -end - -Then /^I should hear about it$/ do - puts "==deploy:" - puts `ls #{tmpdir}/deploy/` - puts "==Releases:" - puts `ls #{tmpdir}/deploy/releases/` - puts "==Releases/*/" - puts `ls #{tmpdir}/deploy/releases/*/` - puts "==Releases/*/db" - puts `ls #{tmpdir}/deploy/releases/*/db/` - puts "==Releases/*/config/" - puts `ls #{tmpdir}/deploy/releases/*/config/` - puts "==current:" - puts `ls #{tmpdir}/deploy/current/` - puts "==current/db:" - puts `ls #{tmpdir}/deploy/current/db/` - puts "==current/deploy:" - puts `ls #{tmpdir}/deploy/current/deploy/` - puts "==current/app:" - puts `ls #{tmpdir}/deploy/current/app/` - puts "==current/config:" - puts `ls #{tmpdir}/deploy/current/config/` - puts "==shared/config/app_config.yml" - puts `ls #{tmpdir}/deploy/shared/config/` -end - -Then /^there should be '(.*)' releases?$/ do |n| - numnums = {"one" => 1, "two" => 2, "three" => 3} - n = numnums.has_key?(n) ? numnums[n] : n.to_i - @releases = Dir.glob(tmpdir + "/deploy/releases/*") - @releases.size.should eql(n) -end - -Then /^a callback named <callback_file> should exist$/ do |callback_files| - callback_files.raw.each do |file| - want_file = "deploy/current/deploy/#{file.first}" - Then "a file named '#{want_file}' should exist" - end -end - -Then /^the callback named <callback> should have run$/ do |callback_files| - callback_files.raw.each do |file| - hook_name = file.first.gsub(/\.rb$/, "") - evidence_file = "deploy/current/app/" + hook_name - expected_contents = {"hook_name" => hook_name, "env" => "production"} - actual_contents = Chef::JSONCompat.from_json(IO.read(File.join(tmpdir, evidence_file))) - expected_contents.should == actual_contents - end -end - -Then /^the second chef run should have skipped deployment$/ do - expected_deploy = "#{tmpdir}/deploy/releases/62c9979f6694612d9659259f8a68d71048ae9a5b" - Then "'stdout' should not have 'INFO: Already deployed app at #{expected_deploy}. Rolling back to it - use action :force_deploy to re-checkout this revision.'" -end - -Then /^a remote repository named '(.*)' should exist in '(.*)'$/ do |remote_name, repository_dir| - remotes = shell_out!('git remote', Hash[:cwd => File.join(tmpdir, repository_dir)]).stdout.split(/\s/) - remotes.should include remote_name -end diff --git a/features/steps/directory_steps.rb b/features/steps/directory_steps.rb deleted file mode 100644 index c3d8798f02..0000000000 --- a/features/steps/directory_steps.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -Then /^a directory named '(.+)' should exist$/ do |dir| - File.directory?(File.join(tmpdir, dir)).should be(true) -end - -Then /^a directory named '(.+)' should not exist$/ do |dir| - File.directory?(File.join(tmpdir, dir)).should be(false) -end - -Then /^the directory named '(.+)' should be owned by '(.+)'$/ do |dirname, owner| - uid = Etc.getpwnam(owner).uid - cstats = File.stat(File.join(tmpdir, dirname)) - cstats.uid.should == uid -end - -Then /^the directory named '(.+)' should have octal mode '(.+)'$/ do |dirname, expected_mode| - cstats = File.stat(File.join(tmpdir, dirname)) - (cstats.mode & 007777).should == expected_mode.oct -end - -Then /^the directory named '(.+)' should have decimal mode '(.+)'$/ do |dirname, expected_mode| - cstats = File.stat(File.join(tmpdir, dirname)) - (cstats.mode & 007777).should == expected_mode.to_i -end diff --git a/features/steps/file_steps.rb b/features/steps/file_steps.rb deleted file mode 100644 index 39b0b21247..0000000000 --- a/features/steps/file_steps.rb +++ /dev/null @@ -1,107 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'etc' - -### -# Given -### - -Given /^we have an empty file named '(.+)'$/ do |filename| - filename = File.new(File.join(tmpdir, filename), 'w') - filename.close -end - -Given /^we have an empty file named '(.+)' in the client cache$/ do |filename| - cache_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "tmp", "cache")) - filename = File.new(File.join(cache_dir, filename), 'w') - filename.close -end - -Given /^we have the atime\/mtime of '(.+)'$/ do |filename| - @mtime = File.mtime(File.join(tmpdir, filename)) - @atime = File.atime(File.join(tmpdir, filename)) -end - -#### -# Then -#### - -Then /^a file named '(.+)' should exist$/ do |filename| - File.exists?(File.join(tmpdir, filename)).should be(true) -end - -Then /^a file named '(.+)' should not exist$/ do |filename| - File.exists?(File.join(tmpdir, filename)).should be(false) -end - -#currently using absolute path (specified in recipe execute_commands/recipes/umask.rb) -Then /^'(.+)' should exist and raise error when copying$/ do |filename| - File.exists?(filename).should be(true) - lambda{copy(filename, filename + "_copy", false)}.should raise_error() - File.delete(filename) -end - - -Then /^the (.)time of '(.+)' should be different$/ do |time_type, filename| - case time_type - when "m" - current_mtime = File.mtime(File.join(tmpdir, filename)) - current_mtime.should_not == @mtime - when "a" - current_atime = File.atime(File.join(tmpdir, filename)) - current_atime.should_not == @atime - end -end - -Then /^a file named '(.+)' should contain '(.+)'$/ do |filename, contents| - file = IO.read(File.join(tmpdir, filename)) - file.should =~ /#{contents}/m -end - -Then /^a file named '(.+)' should be from the '(.+)' specific directory$/ do |filename, specificity| - file = IO.read(File.join(tmpdir, filename)) - file.should == "#{specificity}\n" -end - -Then /^a file named '(.+)' should contain '(.+)' only '(.+)' time$/ do |filename, string, count| - seen_count = 0 - IO.foreach(File.join(tmpdir, filename)) do |line| - if line =~ /#{string}/ - seen_count += 1 - end - end - seen_count.should == count.to_i -end - -Then /^the file named '(.+)' should be owned by '(.+)'$/ do |filename, owner| - uid = Etc.getpwnam(owner).uid - cstats = File.stat(File.join(tmpdir, filename)) - cstats.uid.should == uid -end - -Then /^the file named '(.+)' should have octal mode '(.+)'$/ do |filename, expected_mode| - cstats = File.stat(File.join(tmpdir, filename)) - (cstats.mode & 007777).should == expected_mode.oct -end - -Then /^the file named '(.+)' should have decimal mode '(.+)'$/ do |filename, expected_mode| - cstats = File.stat(File.join(tmpdir, filename)) - (cstats.mode & 007777).should == expected_mode.to_i -end - diff --git a/features/steps/fixture_steps.rb b/features/steps/fixture_steps.rb deleted file mode 100644 index b3ef44f85c..0000000000 --- a/features/steps/fixture_steps.rb +++ /dev/null @@ -1,421 +0,0 @@ - -require 'ostruct' - -Before do - @fixtures = { - 'client' => { - 'isis' => Proc.new do - c = Chef::ApiClient.new - c.name "isis" - c.create_keys - c - end, - 'isis_update' => { - 'name' => 'isis', - 'private_key' => true - }, - 'neurosis' => Proc.new do - c = Chef::ApiClient.new - c.name "neurosis" - c.create_keys - c - end, - 'adminmonkey' => Proc.new do - c = Chef::ApiClient.new - c.name "adminmonkey" - c.admin true - c.create_keys - c - end - }, - 'sandbox' => { - # The filename part of these 'checksums' hashes isn't used by the API (the - # value side of that hash is ignored), and is here for documentation's sake. - 'sandbox1' => { - :checksums => { - Chef::CookbookVersion.checksum_cookbook_file(File.join(datadir, "cookbooks_not_uploaded_at_feature_start", "test_cookbook", "recipes", "default.rb")) => nil - }, - }, - 'sandbox2' => { - :checksums => { - Chef::CookbookVersion.checksum_cookbook_file(File.join(datadir, "cookbooks_not_uploaded_at_feature_start", "test_cookbook", "attributes", "attr1.rb")) => nil, - Chef::CookbookVersion.checksum_cookbook_file(File.join(datadir, "cookbooks_not_uploaded_at_feature_start", "test_cookbook", "attributes", "attr2.rb")) => nil - }, - }, - }, - 'sandbox_file' => { - "sandbox1_file1" => File.join(datadir, "cookbooks_not_uploaded_at_feature_start", "test_cookbook", "recipes", "default.rb"), - - "sandbox2_file1" => File.join(datadir, "cookbooks_not_uploaded_at_feature_start", "test_cookbook", "attributes", "attr1.rb"), - "sandbox2_file2" => File.join(datadir, "cookbooks_not_uploaded_at_feature_start", "test_cookbook", "attributes", "attr2.rb"), - }, - 'signing_caller' =>{ - :user_id=>'bobo', :secret_key => "/tmp/poop.pem" - }, - 'registration' => { - 'bobo' => Proc.new do - OpenStruct.new({ :save => true }) - end, - 'not_admin' => Proc.new do - OpenStruct.new({ :save => true }) - end - }, - 'data_bag' => { - 'users' => Proc.new do - b = Chef::DataBag.new - b.name "users" - b - end, - 'rubies' => Proc.new do - b = Chef::DataBag.new - b.name "rubies" - b - end - }, - 'data_bag_item' => { - 'francis' => Proc.new do - i = Chef::DataBagItem.new - i.data_bag "users" - i.raw_data = { "id" => "francis" } - i - end, - 'francis_extra' => Proc.new do - i = Chef::DataBagItem.new - i.data_bag "users" - i.raw_data = { "id" => "francis", "extra" => "majority" } - i - end, - 'axl_rose' => Proc.new do - i = Chef::DataBagItem.new - i.data_bag "users" - i.raw_data = { "id" => "axl_rose" } - i - end - }, - 'role' => { - 'webserver' => Proc.new do - r = Chef::Role.new - r.name "webserver" - r.description "monkey" - r.env_run_lists({"cucumber" => ["role[db]"], "_default" => []}) - r.run_list("role[webserver]", "role[base]") - r.default_attributes({ 'a' => 'b' }) - r.override_attributes({ 'c' => 'd' }) - r - end, - 'db' => Proc.new do - r = Chef::Role.new - r.name "db" - r.description "monkey" - r.recipes("role::db", "role::base") - r.default_attributes({ 'a' => 'bake' }) - r.override_attributes({ 'c' => 'down' }) - r - end, - 'role_not_exist' => Proc.new do - r = Chef::Role.new - r.name 'role_not_exist' - r.description "Non-existent nested role" - r.run_list << "role[not_exist]" - r - end, - 'attribute_settings_default' => Proc.new do - r = Chef::Role.new - r.name "attribute_settings_default" - r.description "sets a default value" - r.run_list("recipe[attribute_settings]") - r.default_attributes({ 'attribute_priority_was' => "came from role[attribute_settings_default] default attributes" }) - r - end, - 'attribute_settings_override' => Proc.new do - r = Chef::Role.new - r.name "attribute_settings_override" - r.description "sets a default value" - r.run_list("recipe[attribute_settings_override]") - r.override_attributes({ 'attribute_priority_was' => "came from role[attribute_settings_override] override attributes" }) - r - end, - 'role1_includes_role2' => Proc.new do - r = Chef::Role.new - r.name "role1_includes_role2" - r.description "role1 includes role2" - r.run_list("role[role2_included_by_role1]") - r - end, - 'role2_included_by_role1' => Proc.new do - r = Chef::Role.new - r.name "role2_included_by_role1" - r.description "role2 is included by role1" - r.run_list("recipe[attribute_settings_override]") - r - end, - 'role_test' => Proc.new do - r = Chef::Role.new - r.name "role_test" - r.description "A simple test role" - r.run_list("recipe[roles]") - r.default_attributes({ - "reason" => "unbalancing", - "ossing" => "this time around" - }) - r.override_attributes({ - "ossining" => "whatever", - "snakes" => "on a plane" - }) - r - end, - 'role_env_test' => Proc.new do - r = Chef::Role.new - r.name "role_env_test" - r.description "A simple test role with environment specific run list" - r.env_run_lists({ - "_default" => [], - "cucumber" => ['recipe[roles::env_test]'] - }) - r.default_attributes({ - "reason" => "unbalancing", - "ossining" => "this time around" - }) - r.override_attributes({ - "ossining" => "whatever", - "snakes" => "on a plane" - }) - r - end - }, - 'node' => { - 'opsmaster' => Proc.new do - n = Chef::Node.new - n.name 'opsmaster' - n.chef_environment 'production' - n.snakes "on a plane" - n.zombie "we're not unreasonable, I mean no-ones gonna eat your eyes" - n - end, - 'webserver' => Proc.new do - n = Chef::Node.new - n.name 'webserver' - n.run_list << "tacos" - n.snakes "on a plane" - n.zombie "we're not unreasonable, I mean no-ones gonna eat your eyes" - n - end, - 'dbserver' => Proc.new do - n = Chef::Node.new - n.name 'dbserver' - n.run_list << "oracle" - n.just "kidding - who uses oracle?" - n - end, - 'searchman' => Proc.new do - n = Chef::Node.new - n.name 'searchman' - n.run_list << "oracle" - n.default_attrs = { "one" => "two", "three" => "four" } - n.override_attrs = { "one" => "five" } - n.set["walking"] = "tall" - n - end, - 'sync' => Proc.new do - n = Chef::Node.new - n.name 'sync' - n.run_list << "node_cookbook_sync" - n - end, - 'role_not_exist' => Proc.new do - n = Chef::Node.new - n.name 'role_not_exist' - n.run_list << "role[not_exist]" - n - end, - 'paradise' => Proc.new do - n = Chef::Node.new - n.name 'paradise' - n.run_list << "version_test" - n - end, - 'has_environment' => Proc.new do - n = Chef::Node.new - n.name 'has_environment' - n.chef_environment 'cookbooks_test' - n.run_list << "version_test" - n - end, - 'really_deep_node' => Proc.new do - array = [] - hash = {} - max_levels = 50 - - max_levels.times do |num_level| - array = [num_level, "really_deep_string_in_array", array] - hash = {"really_deep_string_in_hash_#{num_level}" => hash} - num_level += 1 - end - - n = Chef::Node.new - n.name 'really_deep_node' - n.run_list << "deep_node_recipe" - n.deep_array = array - n.deep_hash = hash - n - end, - 'empty' => Proc.new do - n = Chef::Node.new - n.name 'empty' - n - end - }, - 'hash' => { - 'nothing' => Hash.new, - 'name only' => { :name => 'test_cookbook' } - }, - 'environment' => { - 'default_attr_test' => Proc.new do - e = Chef::Environment.new - e.name 'default_attr_test' - e.description 'Test default attrs for environments' - e.default_attributes({"attribute_priority_was" => "came from environment default_attr_test default attributes"}) - e - end, - 'cucumber' => Proc.new do - e = Chef::Environment.new - e.name 'cucumber' - e.description 'I like to run tests' - e.default_attributes({"attribute_priority_was" => "came from environment cucumber default attributes"}) - e.override_attributes({"attribute_priority_was" => "came from environment cucumber override attributes"}) - e - end, - 'production' => Proc.new do - e = Chef::Environment.new - e.name 'production' - e.description 'The real deal' - e - end, - 'skynet' => Proc.new do - e = Chef::Environment.new - e.name 'skynet' - e.description 'test cookbook version constraints' - e.cookbook 'version_test', '> 0.1.0' - e - end, - 'chef-1607' => Proc.new do - e = Chef::Environment.new - e.name 'chef-1607' - e.description 'test cookbook version constraints' - e.cookbook 'version_test', '> 0.0.0' - e - end, - 'cookbooks-0.1.0' => Proc.new do - e = Chef::Environment.new - e.name 'cookbooks_test' - e.description 'use cookbook version 0.1.0' - e.cookbook 'version_test', '= 0.1.0' - e - end, - 'cookbooks-0.1.1' => Proc.new do - e = Chef::Environment.new - e.name 'cookbooks_test' - e.description 'use cookbook version 0.1.1' - e.cookbook 'version_test', '= 0.1.1' - e - end, - 'cookbooks-0.2.0' => Proc.new do - e = Chef::Environment.new - e.name 'cookbooks_test' - e.description 'use cookbook version 0.2.0' - e.cookbook 'version_test', '= 0.2.0' - e - end - } - } - @stash = {} -end - -def sign_request(http_method, path, private_key, user_id, body = "") - timestamp = Time.now.utc.iso8601 - sign_obj = Mixlib::Auth::SignedHeaderAuth.signing_object( - :http_method=>http_method, - :path=>path, - :body=>body, - :user_id=>user_id, - :timestamp=>timestamp) - signed = sign_obj.sign(private_key).merge({:host => "localhost"}) - signed.inject({}){|memo, kv| memo["#{kv[0].to_s.upcase}"] = kv[1];memo} -end - -def get_fixture(stash_name, stash_key) - fixy = @fixtures[stash_name][stash_key] - if fixy.kind_of?(Proc) - fixy.call - else - fixy - end -end - -Given "I am a non admin client" do - r = Chef::REST.new(Chef::Config[:registration_url], Chef::Config[:validation_client_name], Chef::Config[:validation_key]) - r.register("not_admin", "#{tmpdir}/not_admin.pem") - c = Chef::ApiClient.cdb_load("not_admin") - c.cdb_save - @rest = Chef::REST.new(Chef::Config[:registration_url], 'not_admin', "#{tmpdir}/not_admin.pem") -end - -Given /^an? '(.+)' named '(.+)'$/ do |stash_name, stash_key| - # BUGBUG: I need to reference fixtures individually, but the fixtures, as written, store under the type, not the fixture's identifier and I don't currently have time to re-write the tests - - key = case stash_name - when 'file','hash' - stash_key - else - stash_name - end - @stash[key] = get_fixture(stash_name, stash_key) -end - -Given "I am an administrator" do - make_admin -end - -Given "I am a non-admin" do - make_non_admin -end - -Given /^an? '(.+)' named '(.+)' exists$/ do |stash_name, stash_key| - call_as_admin do - @stash[stash_name] = get_fixture(stash_name, stash_key) - - #if @stash[stash_name].respond_to?(:cdb_save) - # @stash[stash_name].cdb_save - if @stash[stash_name].respond_to?(:save) - @stash[stash_name].save - else - request_path = "/#{stash_name.pluralize}" - request(request_path, { - :method => "POST", - "HTTP_ACCEPT" => 'application/json', - "CONTENT_TYPE" => 'application/json', - :input => Chef::JSONCompat.to_json(@stash[stash_name]) - }.merge(sign_request("POST", request_path, OpenSSL::PKey::RSA.new(IO.read("#{tmpdir}/client.pem")), "bobo"))) - end - end -end - -Given /^sending the method '(.+)' to the '(.+)' with '(.+)'/ do |method, stash_name, update_value| - update_value = Chef::JSONCompat.from_json(update_value) if update_value =~ /^\[|\{/ - @stash[stash_name].send(method.to_sym, update_value) -end - -Given /^changing the '(.+)' field '(.+)' to '(.+)'$/ do |stash_name, stash_key, stash_value| - @stash[stash_name].send(stash_key.to_sym, stash_value) -end - -Given /^removing the '(.+)' field '(.+)'$/ do |stash_name, key| - @stash[stash_name].send(key.to_sym, '') -end - -Given /^there are no (.+)$/ do |stash_name| -end - -Given /^I wait for '(\d+)' seconds$/ do |time| - sleep time.to_i -end diff --git a/features/steps/knife_steps.rb b/features/steps/knife_steps.rb deleted file mode 100644 index 169dd5bcd2..0000000000 --- a/features/steps/knife_steps.rb +++ /dev/null @@ -1,46 +0,0 @@ -When "I upload the '$cookbook_name' cookbook with knife" do |cookbook_name| - cookbook_fixture = File.join(FEATURES_DATA, "cookbooks_not_uploaded_at_feature_start", cookbook_name) - cookbook_dir = ::Tempfile.open("knife-cuke-cookbook-dir").path - FileUtils.rm(cookbook_dir) - FileUtils.mkdir_p(cookbook_dir) - FileUtils.cp_r(cookbook_fixture, cookbook_dir) - shell_out!("#{KNIFE_CMD} cookbook upload #{cookbook_name} -o #{cookbook_dir} -c #{KNIFE_CONFIG}") -end - -When "I upload the '$cookbook_name' cookbook with knife from a repository with bad metadata\.rb" do |cookbook_name| - cookbook_fixture = File.join(FEATURES_DATA, "cookbooks_repo_with_bad_metadata_rb", cookbook_name) - cookbook_dir = ::Tempfile.open("knife-bad-cookbook-dir").path - FileUtils.rm(cookbook_dir) - FileUtils.mkdir_p(cookbook_dir) - FileUtils.cp_r(cookbook_fixture, cookbook_dir) - @knife_command_result = shell_out("#{KNIFE_CMD} cookbook upload #{cookbook_name} -o #{cookbook_dir} -c #{KNIFE_CONFIG}") -end - -When "I run knife '$knife_subcommand'" do |knife_subcommand| - @knife_command_result = shell_out("#{KNIFE_CMD} #{knife_subcommand} -c #{KNIFE_CONFIG}") -end - -RSpec::Matchers.define :be_successful do - match do |shell_out_result| - shell_out_result.status.success? - end - failure_message_for_should do |shell_out_result| - "Expected command #{shell_out_result.command} to exit successfully, but it exited with status #{shell_out_result.exitstatus}.\n"\ - "STDOUT OUTPUT:\n#{shell_out_result.stdout}\nSTDERR OUTPUT:\n#{shell_out_result.stderr}\n" - end - failure_message_for_should_not do |shell_out_result| - "Expected command #{shell_out_result.command} to fail, but it exited with status #{shell_out_result.exitstatus}.\n"\ - "STDOUT OUTPUT:\n#{shell_out_result.stdout}\nSTDERR OUTPUT:\n#{shell_out_result.stderr}\n" - end - description do - "The shell out command should exit 0" - end -end - -Then /^knife should succeed$/ do - @knife_command_result.should be_successful -end - -Then /^knife should not succeed$/ do - @knife_command_result.should_not be_successful -end diff --git a/features/steps/node_steps.rb b/features/steps/node_steps.rb deleted file mode 100644 index 43466df9f6..0000000000 --- a/features/steps/node_steps.rb +++ /dev/null @@ -1,88 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -### -# Given -### -Given /^a validated node$/ do - # client should have cached ohai assigned to it - client.register(ohai[:fqdn], :client_key => client_key ) - client.build_node - client.node.run_list << "integration_setup" -end - -Given /^a validated node in the '(\w+)' environment$/ do |env| - # client should have cached ohai assigned to it - client.register - client.build_node - client.node.chef_environment(env) - client.node.run_list << "integration_setup" -end - -Given /^a validated node with an empty runlist$/ do - # client should have cached ohai assigned to it - client.register - client.build_node -end - - -Given /^it includes the recipe '([^\']+)'$/ do |recipe| - self.recipe = recipe - client.node.run_list << recipe - client.node.save -end - -Given /^it includes the recipe '([^\']+)' at version '([^\']+)'$/ do |recipe, version| - self.recipe = "recipe[#{recipe},#{version}]" - client.node.run_list << "recipe[#{recipe}@#{version}]" - client.node.save -end - -Given /^it includes no recipes$/ do - self.recipe = "" - client.node.run_list.reset! - client.node.save -end - -Given /^it includes the role '([^\']+)'$/ do |role| - self.recipe = "role[#{role}]" - client.node.run_list << "role[#{role}]" - client.node.save -end - -### -# When -### -When /^I remove '([^']*)' from the node's run list$/ do |run_list_item| - client.node.run_list.remove(run_list_item) - client.node.save -end - -When /^I add '([^']*)' to the node's run list$/ do |run_list_item| - client.node.run_list << run_list_item - client.node.save -end - - -When /^the node is converged$/ do - client.run -end - -When /^the node is retrieved from the API$/ do - self.inflated_response = Chef::Node.load(client.node.name) -end diff --git a/features/steps/packages.rb b/features/steps/packages.rb deleted file mode 100644 index 982cb25fd7..0000000000 --- a/features/steps/packages.rb +++ /dev/null @@ -1,144 +0,0 @@ -def debian_compatible? - (ohai[:platform] == 'debian') || (ohai[:platform] == "ubuntu") -end - -def chef_test_dpkg_installed? - shell_out("dpkg -l chef-integration-test").status.success? -end - -def purge_chef_integration_debs - if debian_compatible? && chef_test_dpkg_installed? - shell_out!("dpkg -r chef-integration-test") - shell_out("dpkg --clear-avail") - end -end - -Given /^I have configured my apt sources for integration tests$/ do - File.open("/etc/apt/sources.list.d/chef-integration-test.list", "w+") do |f| - f.puts "deb http://localhost:9000/ sid main" - end -end - -def remove_integration_test_apt_source - FileUtils.rm("/etc/apt/sources.list.d/chef-integration-test.list") -rescue Errno::ENOENT - Chef::Log.info("Attempted to remove integration test from /etc/apt/sources.list.d but it didn't exist") -end - -After("@apt") do - remove_integration_test_apt_source - purge_chef_integration_debs - shell_out! "apt-get clean" if debian_compatible? -end - -Before('@dpkg') do - purge_chef_integration_debs if debian_compatible? -end - -Before('@apt') do - purge_chef_integration_debs - shell_out!("apt-get clean") if debian_compatible? -end - -After('@dpkg') do - purge_chef_integration_debs -end - -Given "I am running on a debian compatible OS" do - unless debian_compatible? - pending("This test can only run on debian or ubuntu, but you have #{ohai[:platform]}") - end -end - -Given "my dpkg architecture is 'amd64'" do - unless `dpkg --print-architecture`.strip == "amd64" - pending("This scenario can only run on an amd64 system") - end -end - -Given "the deb package '$pkg_name' is available" do |pkg_name| - source = File.expand_path(File.dirname(__FILE__) + "/../data/apt/#{pkg_name}-1_amd64.deb") - dest = File.join(tmpdir, File.basename(source)) - FileUtils.cp(source, dest) -end - -Given "the apt server is running" do - self.apt_server_thread = Thread.new do - trap("INT") do - apt_server.shutdown - apt_server_thread.join - end - - apt_server.start - end - - Chef::Log.debug "Waiting for apt server to start" - until tcp_test_port("localhost", 9000) do - Chef::Log.debug "." - sleep 1 - end - Chef::Log.debug "done" -end - -Given "I have updated my apt cache" do - shell_out!("apt-get update") -end - -Given /^the gems server is running$/ do - self.gemserver_thread = Thread.new do - trap("INT") do - gemserver.shutdown - gemserver_thread.join - end - - gemserver.start - end -end - -Given /^that I have the (.+) package system installed$/ do |package_system| - unless package_system_available?(package_system) - pending "This Cucumber feature will not execute, as it is missing the #{package_system} packaging system." - end -end - -Then /^there should be a binary on the path called '(.+)'$/ do |binary_name| - binary_name.strip! - result = `which #{binary_name}` - result.should_not =~ /not found/ -end - -Then /^there should not be a binary on the path called '(.+)'$/ do |binary_name| - binary_name.strip! - result = `which #{binary_name}`.strip - - unless result.empty? - result.should =~ /not found/ - end -end - -Then /^the gem '(.+)' version '(.+)' should be installed$/ do |gem_name, version| - Then "a file named 'installed-gems/gems/#{gem_name}-#{version}' should exist" -end - -Then "the gem '$gem_name' version '$version' should not be installed" do |gem_name, version| - Then "a file named 'installed-gems/gems/#{gem_name}-#{version}' should not exist" -end - -def dpkg_should_be_installed(pkg_name) - shell_out!("dpkg -l #{pkg_name}") -end - -Then "the dpkg package '$package_name' should be installed" do |package_name| - dpkg_should_be_installed(package_name) -end - -def tcp_test_port(hostname, port) - tcp_socket = TCPSocket.new(hostname, port) - true -rescue Errno::ETIMEDOUT - false -rescue Errno::ECONNREFUSED - false -ensure - tcp_socket && tcp_socket.close -end diff --git a/features/steps/pending_steps.rb b/features/steps/pending_steps.rb deleted file mode 100644 index b97707f36b..0000000000 --- a/features/steps/pending_steps.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Author:: Christopher Walters (<cw@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -When "I haven't yet fixed CHEF-1816, this test should be pending" do - pending "CHEF-1816: Timestamp deploy provider rollback doesn't work" -end diff --git a/features/steps/recipe_steps.rb b/features/steps/recipe_steps.rb deleted file mode 100644 index 711873779f..0000000000 --- a/features/steps/recipe_steps.rb +++ /dev/null @@ -1,23 +0,0 @@ -Given /^the cookbook has a '(.+)' named '(.+)' in the '(.+)' specific directory$/ do |file_type, filename, specificity| - cookbook_name, recipe_name = recipe.split('::') - type_dir = file_type == 'file' ? 'files' : 'templates' - specific_dir = nil - case specificity - when "host" - specific_dir = "host-#{client.node[:fqdn]}" - when "platform-version" - specific_dir = "#{client.node[:platform]}-#{client.node[:platform_version]}" - when "platform" - specific_dir = client.node[:platform] - when "default" - specific_dir = "default" - end - new_file_dir = File.expand_path(File.dirname(__FILE__) + "/../data/cookbooks/#{cookbook_name}/#{type_dir}/#{specific_dir}") - cleanup_dirs << new_file_dir unless new_file_dir =~ /default$/ - system("mkdir -p #{new_file_dir}") - new_file_name = File.join(new_file_dir, filename) - cleanup_files << new_file_name - new_file = File.open(new_file_name, "w") - new_file.puts(specificity) - new_file.close -end diff --git a/features/steps/request_steps.rb b/features/steps/request_steps.rb deleted file mode 100644 index 199ff8d6c1..0000000000 --- a/features/steps/request_steps.rb +++ /dev/null @@ -1,98 +0,0 @@ -Given /^I dump the contents of the search index$/ do - rest.get_rest("/search/").each do |index_name, index_url| - puts "INDEX NAME: `#{index_name}'" - pp rest.get_rest(index_url.sub("http://127.0.0.1:4000", '')) - end -end - -When /^I '([^']*)' (?:to )?the path '([^']*)'$/ do |http_method, request_uri| - begin - self.api_response = rest.send("#{http_method}_rest".downcase.to_sym, request_uri) - self.inflated_response = self.api_response - rescue - Chef::Log.debug("Caught exception in request: #{$!.message}") - self.exception = $! - end -end - -When /^I '(.+)' the path '(.+)' using a wrong private key$/ do |http_method, request_uri| - key = OpenSSL::PKey::RSA.generate(2048) - File.open(File.join(tmpdir, 'false_key.pem'), "w") { |f| f.print key } - @rest = Chef::REST.new(Chef::Config[:chef_server_url], 'snakebite' , File.join(tmpdir, 'false_key.pem')) - - When "I '#{http_method}' the path '#{request_uri}'" -end - -When /^I (.+) the client$/ do |action| - raise ArgumentError, "You can only create or save clients" unless action =~ /^(create|save)$/ - client = stash['client'] - request_body = {:name => client.name, :admin => client.admin} - begin - self.inflated_response = @rest.post_rest("clients", request_body) if action == 'create' - self.inflated_response = @rest.put_rest("clients/#{client.name}", request_body) if action == 'save' - rescue - self.exception = $! - end -end - -When /^I '(.+)' the '(.+)' to the path '(.+)'$/ do |http_method, stash_key, request_uri| - begin - self.api_response = rest.send("#{http_method.to_s.downcase}_rest".downcase.to_sym, request_uri, stash[stash_key]) - self.inflated_response = self.api_response - rescue - self.exception = $! - end -end - -When /^I '(.+)' the '(.+)' to the path '(.+)' using a wrong private key$/ do |http_method, stash_key, request_uri| - key = OpenSSL::PKey::RSA.generate(2048) - File.open(File.join(tmpdir, 'false_key.pem'), "w") { |f| f.print key } - @rest = Chef::REST.new(Chef::Config[:chef_server_url], 'snakebite' , File.join(tmpdir, 'false_key.pem')) - - When "I '#{http_method}' the '#{stash_key}' to the path '#{request_uri}'" -end - -When /^I delete local private key/ do - Chef::FileCache.delete("private_key.pem") -end - -When /^I register '(.+)'$/ do |user| - begin - rest = Chef::REST.new(Chef::Config[:registration_url]) - rest.register("bobo") - rescue - self.exception = $! - end -end - -When /^I authenticate as '(.+)'$/ do |reg| - begin - rest.authenticate(reg, 'tclown') - rescue - self.exception = $! - end -end - -When "I edit the '$not_admin' client" do |client| - stash['client'] = @rest.get_rest("/clients/not_admin") -end - -When "I set '$property' to true" do |property| - stash['client'].send(property.to_sym, true) -end - -def call_as_admin(&block) - orig_rest = @rest - orig_node_name = Chef::Config[:node_name] - orig_client_key = Chef::Config[:client_key] - begin - @rest = admin_rest - Chef::Config[:node_name] = @rest.auth_credentials.client_name - Chef::Config[:client_key] = @rest.auth_credentials.key_file - yield - ensure - @rest = orig_rest - Chef::Config[:node_name] = orig_node_name - Chef::Config[:client_key] = orig_client_key - end -end diff --git a/features/steps/response_steps.rb b/features/steps/response_steps.rb deleted file mode 100644 index 881db9ac6a..0000000000 --- a/features/steps/response_steps.rb +++ /dev/null @@ -1,233 +0,0 @@ - -# Walk array/hash to determine maximum depth. A scalar (anything but an -# Array or Hash) has depth 0. -def count_structure_levels(obj) - if obj.respond_to?(:keys) - # empty hash also has depth 0. - max_depth = 0 - obj.keys.each do |key| - child_levels = 1 + count_structure_levels(obj[key]) - max_depth = [max_depth, child_levels].max - end - max_depth - elsif obj.is_a?(Array) - # empty array also has depth 0. - max_depth = 0 - obj.each do |child| - child_levels = 1 + count_structure_levels(child) - max_depth = [max_depth, child_levels].max - end - max_depth - else - 0 - end -end - -Then /^I should get a '(.+)' exception$/ do |exception| - self.exception.message.to_s.should == exception -end - -Then /^I should not get an exception$/ do - self.exception.should == nil -end - -Then /^the response code should be '(.+)'$/ do |response_code| - case response_code.to_i - when 200 - self.api_response.code.should == 200 - when 400 - self.exception.to_s.should match(/(Bad Request|400)/) - when 404 - Then "I should get a 'RestClient::ResourceNotFound' exception" - when 412 - self.exception.to_s.should match(/(Precondition Failed|412)/) - end -end - -Then /^the response exception body should match '(.+)'/ do |regex| - raise "last response wasn't exception" unless self.exception - raise "last response exception had no body" unless self.exception.response && self.exception.response.body - - self.exception.response.body.should =~ /#{regex}/m -end - -Then /^the inflated responses key '(.+)' should be the integer '(\d+)'$/ do |key, int| - inflated_response[key].should == int.to_i -end - -Then /^the inflated responses key '(\w+)' should match '(.+)'$/ do |key, regex| - puts self.inflated_response.inspect if ENV['DEBUG'] - self.inflated_response[key].should =~ /#{regex}/m -end - -Then /^the inflated responses key '(.+)' should be literally '(.+)'$/ do |key, literal| - puts self.inflated_response.inspect if ENV['DEBUG'] - to_check = case literal - when "true" - true - when "false" - false - end - - self.inflated_response[key].should == to_check -end - -Then /^the inflated response should match '(.+)' as json$/ do |regex| - puts self.inflated_response.inspect if ENV["DEBUG"] - Chef::JSONCompat.to_json(self.inflated_response).should =~ /#{regex}/m -end - -Then /^the inflated responses key '(.+)' should match '(.+)' as json$/ do |key, regex| - puts self.inflated_response.inspect if ENV["DEBUG"] - Chef::JSONCompat.to_json(self.inflated_response[key]).should =~ /#{regex}/m -end - -Then /^the inflated responses key '(.+)' item '(\d+)' should be '(.+)'$/ do |key, index, to_equal| - inflated_response[key][index.to_i].should == to_equal -end - -Then /^the inflated responses key '(.+)' item '(\d+)' should be a kind of '(.+)'$/ do |key, index, constant| - inflated_response[key][index.to_i].should be_a_kind_of(eval(constant)) -end - -Then /^the inflated responses key '(.+)' item '(\d+)' key '(.+)' should be '(.+)'$/ do |key, index, sub_key, to_equal| - inflated_response[key][index.to_i][sub_key].should == to_equal -end - -Then /^the inflated responses key '(.+)' item '(\d+)' should respond to '(.+)' with '(.*)'$/ do |key, index, method_name, method_value| - inflated_response[key][index.to_i].send(method_name.to_sym).should == method_value -end - -Then /^the inflated responses key '(.+)' sub-key '(.+)' should be an empty hash$/ do |key, sub_key| - inflated_response[key][sub_key].should == {} -end - -Then /^the inflated responses key '(\w+)' sub-key '(\w+)' should match '(.+)'$/ do |key, sub_key, regex| - inflated_response[key][sub_key].should =~ /#{regex}/m -end - -Then /^the inflated responses key '(\w+)' sub-key '(\w+)' item '(\d+)' sub-key '(\w+)' should match '(.+)'$/ do |key, sub_key, index, second_sub_key, regex| - inflated_response[key][sub_key][index.to_i][second_sub_key].should =~ /#{regex}/m -end - -Then /^the inflated responses key '(\w+)' sub-key '(\w+)' item '(\d+)' sub-key '(\w+)' should equal '(.+)'$/ do |key, sub_key, index, second_sub_key, equal| - inflated_response[key][sub_key][index.to_i][second_sub_key].should == equal -end - -Then /^the inflated responses key '(\w+)' sub-key '(\w+)' should be '(\d+)' items long$/ do |key, sub_key, length| - inflated_response[key][sub_key].length.should == length.to_i -end - -Then /^the inflated responses key '(\w+)' should be '(\d+)' items long$/ do |key, length| - inflated_response[key].length.should == length.to_i -end - -Then /^the inflated responses key '(.+)' should not exist$/ do |key| - self.inflated_response.has_key?(key).should == false -end - -Then /^the inflated responses key '(.+)' should exist$/ do |key| - self.inflated_response.has_key?(key).should == true -end - -Then /^the inflated responses key '(.+)'.to_s should be '(.+)'$/ do |key, expected_value| - self.inflated_response[key].to_s.should == expected_value -end - -Then /^the inflated response should be an empty array$/ do - self.inflated_response.should == [] -end - -Then /^the inflated response should be an empty hash$/ do - self.inflated_response.should == {} -end - -Then /^the inflated response should include '(.+)'$/ do |entry| - if inflated_response.size == 1 - Array(inflated_response).first.should match(/#{entry}/) - else - inflated_response.detect { |n| n =~ /#{entry}/ }.should_not be_empty - end -end - -Then /^the inflated response should be '(.+)' items long$/ do |length| - if length.respond_to?(:keys) - self.inflated_response.keys.length.should == length.to_i - else - self.inflated_response.length.should == length.to_i - end -end - -Then /^the '(.+)' header should match '(.+)'$/ do |header, regex| - self.api_response.headers[header].should =~ /#{regex}/ -end - -Then /^the inflated responses key '(.+)' should include '(.+)'$/ do |key, regex| - if self.inflated_response[key].size == 1 - self.inflated_response[key].first.should match(/#{regex}/) - else - self.inflated_response[key].detect { |n| n =~ /#{regex}/ }.should_not be_empty - end -end - -Then /^the inflated response should match the '(.+)'$/ do |stash_name| - stash[stash_name].each do |k,v| - self.inflated_response[k.to_s].should == v - end -end - -Then /^the inflated response should be the '(.+)'$/ do |stash_key| - self.inflated_response.should == stash[stash_key] -end - -Then /^the stringified response should be the stringified '(.+)'$/ do |stash_key| - self.api_response.to_s.should == stash[stash_key].to_s -end - -Then /^the inflated response should be a kind of '(.+)'$/ do |thing| - self.inflated_response.should be_a_kind_of(eval(thing)) -end - -Then "the inflated response should equal '$code'" do |code| - # cucumber can suck it, I'm using real code. - expected = eval(code) - inflated_response.should == expected -end - -Then /^the inflated response should respond to '(.+)' with '(.+)'$/ do |method, to_match| - to_match = Chef::JSONCompat.from_json(to_match) if to_match =~ /^\[|\{/ - to_match = true if to_match == 'true' - to_match = false if to_match == 'false' - self.inflated_response.to_hash[method].should == to_match -end - -Then /^the inflated response should respond to '(.+)' and match '(.+)'$/ do |method, to_match| - self.inflated_response.to_hash[method].should == to_match -end - -Then /^the inflated response should respond to '(.+)' and match '(.+)' as json$/ do |method, regex| - Chef::JSONCompat.to_json(self.inflated_response.to_hash[method]).should =~ /#{regex}/m -end - -#And the 'deep_array' component has depth of '50' levels -Then /^the '(.+)' component has depth of '(.+)' levels$/ do |method, levels| - count_structure_levels(self.inflated_response.to_hash[method]).should == levels.to_i -end - -Then /^the fields in the inflated response should match the '(.+)'$/ do |stash_name| - self.inflated_response.each do |k,v| - unless k =~ /^_/ || k == 'couchrest-type' - stash[stash_name][k.to_sym].should == v - end - end -end - -Then /^the data_bag named '(.+)' should not have an item named '(.+)'$/ do |data_bag, item| - exists = true - begin - Chef::DataBagItem.load(data_bag, item, @couchdb) - rescue - exists = false - end - exists.should == false -end diff --git a/features/steps/result_steps.rb b/features/steps/result_steps.rb deleted file mode 100644 index 0978c13299..0000000000 --- a/features/steps/result_steps.rb +++ /dev/null @@ -1,15 +0,0 @@ -Then /^I should see "(.*)"$/ do |text| - response.body.to_s.should =~ /#{text}/m -end - -Then /^I should not see "(.*)"$/ do |text| - response.body.to_s.should_not =~ /#{text}/m -end - -Then /^I should see an? (\w+) message$/ do |message_type| - response.should have_xpath("//*[@class='#{message_type}']") -end - -Then /^the (.*) ?request should fail/ do |_| - response.should_not be_successful -end
\ No newline at end of file diff --git a/features/steps/run_client_steps.rb b/features/steps/run_client_steps.rb deleted file mode 100644 index 2bc517605e..0000000000 --- a/features/steps/run_client_steps.rb +++ /dev/null @@ -1,317 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 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. -# - -require 'chef/shell_out' -require 'chef/mixin/shell_out' -require 'chef/index_queue/amqp_client' - -include Chef::Mixin::ShellOut - -CHEF_CLIENT = File.join(CHEF_PROJECT_ROOT, "chef", "bin", "chef-client") - -def chef_client_command_string - @log_level ||= ENV["LOG_LEVEL"] ? ENV["LOG_LEVEL"] : "error" - @chef_args ||= "" - @config_file ||= File.expand_path(File.join(configdir, 'client.rb')) - - "#{File.join(File.dirname(__FILE__), "..", "..", "chef", "bin", "chef-client")} -l #{@log_level} -c #{@config_file} #{@chef_args}" -end - -### -# When -### -When /^I run the chef\-client$/ do - status = Chef::Mixin::Command.popen4(chef_client_command_string()) do |p, i, o, e| - @stdout = o.gets(nil) - @stderr = e.gets(nil) - end - @status = status -end - -When /^I run the chef\-client in the background with '(.+)'$/ do |args| - @stdout_filename = "/tmp/chef.run_interval.stdout.#{$$}.txt" - @stderr_filename = "/tmp/chef.run_interval.stderr.#{$$}.txt" - - @chef_args = "#{args}" - @client_pid = Process.fork do - STDOUT.reopen(File.open(@stdout_filename, "w")) - STDERR.reopen(File.open(@stderr_filename, "w")) - exec chef_client_command_string() - exit 2 - end -end - -When /^I stop the background chef\-client after '(\d+)' seconds$/ do |timeout| - begin - sleep timeout.to_i - Process.kill("KILL", @client_pid) - rescue Errno::ESRCH - # Kill didn't work; the process exited while we were waiting, like - # it's supposed to. - end - - # Read these in so they can be used in later steps. - @stdout = IO.read(@stdout_filename) - @stderr = IO.read(@stderr_filename) -end - -Then /^the background chef\-client should not be running$/ do - system("ps -af | grep #{@client_pid} | grep -vq grep") - $?.exitstatus.should == 0 -end - -When "I run the chef-client for no more than '$timeout' seconds" do |timeout| - cmd = shell_out("#{CHEF_CLIENT} -l info -i 1 -s 1 -c #{File.expand_path(File.join(configdir, 'client.rb'))}", :timeout => timeout.to_i) - @status = cmd.status -end - -When /^I run the chef\-client again$/ do - When "I run the chef-client" -end - -When /^I run the chef\-client with '(.+)'$/ do |args| - @chef_args = args - When "I run the chef-client" -end - -When "I run the chef-client with '$options' and the '$config_file' config" do |options, config_file| - @config_file = File.expand_path(File.join(configdir, "#{config_file}.rb")) - @chef_args = options - When "I run the chef-client" -end - -When /^I run the chef\-client with '(.+)' for '(.+)' seconds$/ do |args, run_for| - @chef_args = args - When "I run the chef-client for '#{run_for}' seconds" -end - -When /^I run the chef\-client for '(.+)' seconds$/ do |run_for| - # Normal behavior depends on the run_interval/recipes/default.rb to count down - # and exit subordinate chef-client after two runs. However, we will forcably - # kill the client if that didn't work. - begin - stdout_filename = "/tmp/chef.run_interval.stdout.#{$$}.txt" - stderr_filename = "/tmp/chef.run_interval.stderr.#{$$}.txt" - client_pid = Process.fork do - STDOUT.reopen(File.open(stdout_filename, "w")) - STDERR.reopen(File.open(stderr_filename, "w")) - exec chef_client_command_string() - exit 2 - end - - killer_pid = Process.fork { - sleep run_for.to_i - - # Send KILL to the child chef-client. Due to OHAI-223, where ohai sometimes - # ignores/doesn't exit correctly on receipt of SIGINT, brutally kill the - # subprocess. - begin - Process.kill("KILL", client_pid) - rescue Errno::ESRCH - # Kill didn't work; the process exited while we were waiting, like - # it's supposed to. - end - } - - Process.waitpid2(killer_pid) - @status = Process.waitpid2(client_pid).last - - # Read these in so they can be used in later steps. - @stdout = IO.read(stdout_filename) - @stderr = IO.read(stderr_filename) - ensure - # clean up after ourselves. - File.delete(stdout_filename) - File.delete(stderr_filename) - end -end - -When /^I run the chef\-client at log level '(.+)'$/ do |log_level| - @log_level = log_level.to_sym - When "I run the chef-client" -end - -When 'I run the chef-client with json attributes' do - @log_level = :debug - @chef_args = "-j #{File.join(FEATURES_DATA, 'json_attribs', 'attribute_settings.json')}" - When "I run the chef-client" -end - -When "I run the chef-client with json attributes '$json_file_basename'" do |json_file_basename| - @log_level = :debug - @chef_args = "-j #{File.join(FEATURES_DATA, 'json_attribs', "#{json_file_basename}.json")}" - When "I run the chef-client" -end - -When /^I run the chef\-client with config file '(.+)'$/ do |config_file| - @config_file = config_file - When "I run the chef-client" -end - -When /^I run the chef\-client with logging to the file '(.+)'$/ do |log_file| - -config_data = <<CONFIG -supportdir = File.expand_path(File.join(File.dirname(__FILE__), "..")) -tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp")) - -log_level :debug -log_location File.join(tmpdir, "silly-monkey.log") -file_cache_path File.join(tmpdir, "cache") -ssl_verify_mode :verify_none -registration_url "http://127.0.0.1:4000" -template_url "http://127.0.0.1:4000" -remotefile_url "http://127.0.0.1:4000" -search_url "http://127.0.0.1:4000" -role_url "http://127.0.0.1:4000" -client_url "http://127.0.0.1:4000" -chef_server_url "http://127.0.0.1:4000" -validation_client_name "validator" -systmpdir = File.expand_path(File.join(Dir.tmpdir, "chef_integration")) -validation_key File.join(systmpdir, "validation.pem") -client_key File.join(systmpdir, "client.pem") -CONFIG - - @config_file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'data', 'config', 'client-with-logging.rb')) - File.open(@config_file, "w") do |file| - file.write(config_data) - end - - self.cleanup_files << @config_file - - - @status = Chef::Mixin::Command.popen4("#{File.join(File.dirname(__FILE__), "..", "..", "chef", "bin", "chef-client")} -c #{@config_file} #{@chef_args}") do |p, i, o, e| - @stdout = o.gets(nil) - @stderr = e.gets(nil) - end -end - -When /^I update cookbook 'sync_library' from 'sync_library_updated' after the first run$/ do - amqp = Chef::IndexQueue::AmqpClient.instance - queue = amqp.amqp_client.queue("sync_library_test") - queue.subscribe(:timeout => 10) do |message| - if "first run complete" == message[:payload] - - # Copy the updated library file over - source = File.join(datadir, 'cookbooks', 'sync_library_updated') - dest = File.join(datadir, 'cookbooks', 'sync_library') - cmd = "cp -r #{source}/. #{dest}/." - system(cmd) - - # Upload the updated cookbook - knife_cmd = "#{KNIFE_CMD} cookbook upload -c #{KNIFE_CONFIG} -o #{INTEGRATION_COOKBOOKS} sync_library" - shell_out!(knife_cmd) - - # Ack to release the client - queue.delivery_tag = message[:delivery_details][:delivery_tag] - queue.ack - break - end - end -end - -### -# Then -### -Then /^the run should exit '(.+)'$/ do |exit_code| - if ENV['LOG_LEVEL'] == 'debug' - puts @status.inspect - puts @status.exitstatus - end - begin - @status.exitstatus.should eql(exit_code.to_i) - rescue - print_output - raise - end - print_output if ENV["LOG_LEVEL"] == "debug" -end - -Then "I print the debug log" do - print_output -end - -Then /^the run should exit from being signaled$/ do - begin - @status.signaled?.should == true - rescue - print_output - raise - end - print_output if ENV["LOG_LEVEL"] == "debug" -end - - -def print_output - puts "--- run stdout:" - puts @stdout - puts "--- run stderr:" - puts @stderr -end - -# Matcher for regular expression which uses normal string interpolation for -# the actual (target) value instead of expecting it, as stdout/stderr which -# get matched against may have lots of newlines, which looks ugly when -# inspected, as the newlines show up as \n -class NoInspectMatch - def initialize(expected_regex) - @expected_regex = expected_regex - end - def matches?(target) - @target = target - @target =~ @expected_regex - end - def failure_message - "expected #{@target} should match #{@expected_regex}" - end - def negative_failure_message - "expected #{@target} not to match #{@expected_regex}" - end -end -def noinspect_match(expected_regex) - NoInspectMatch.new(expected_regex) -end - - -Then /^'(.+)' should have '(.+)'$/ do |which, to_match| - if which == "stdout" || which == "stderr" - self.instance_variable_get("@#{which}".to_sym).should noinspect_match(/#{to_match}/m) - else - self.instance_variable_get("@#{which}".to_sym).should match(/#{to_match}/m) - end -end - -Then /^'(.+)' should not have '(.+)'$/ do |which, to_match| - to_match = Regexp.escape(to_match) - if which == "stdout" || which == "stderr" - self.instance_variable_get("@#{which}".to_sym).should_not noinspect_match(/#{to_match}/m) - else - self.instance_variable_get("@#{which}".to_sym).should_not match(/#{to_match}/m) - end -end - -Then /^'(.+)' should appear on '(.+)' '(.+)' times$/ do |to_match, which, count| - seen_count = 0 - self.instance_variable_get("@#{which}".to_sym).split("\n").each do |line| - seen_count += 1 if line =~ /#{to_match}/ - end - seen_count.should == count.to_i -end - -Then "I inspect the contents of the features tmpdir" do - puts `ls -halpR #{tmpdir}` -end diff --git a/features/steps/run_solo.rb b/features/steps/run_solo.rb deleted file mode 100644 index 458e80714d..0000000000 --- a/features/steps/run_solo.rb +++ /dev/null @@ -1,78 +0,0 @@ -# This is kind of a crazy-ass setup, but it works. -When /^I run chef-solo with the '(.+)' recipe$/ do |recipe_name| - # Set up the JSON file with the recipe we want to run. - dna_file = "#{tmpdir}/chef-solo-features-dna.json" - File.open(dna_file, "w") do |fp| - fp.write("{ \"run_list\": [\"#{recipe_name}\"] }") - end - - cleanup_files << "#{tmpdir}/chef-solo-features-dna.json" - - # Set up the cache dir. - cache_dir = "#{tmpdir}/chef-solo-cache-features" - system("mkdir -p #{cache_dir}") - cleanup_dirs << cache_dir - - # Cookbook dir - cookbook_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'data', 'cookbooks')) - system("cp -r #{cookbook_dir} #{cache_dir}") - - # Config file - config_file = "#{tmpdir}/chef-solo-config-features.rb" - File.open(config_file, "w") do |fp| - fp.write("cookbook_path \"#{cache_dir}/cookbooks\"\n") - fp.write("file_cache_path \"#{cache_dir}/cookbooks\"\n") - end - cleanup_files << config_file - - binary_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'chef', 'bin', 'chef-solo')) - command = "#{binary_path} -c #{config_file} -j #{dna_file}" - command += " -l debug" if Chef::Log.debug? - - # Run it - puts "Running solo: #{command}" if Chef::Log.debug? - - status = Chef::Mixin::Command.popen4(command) do |p, i, o, e| - @stdout = o.gets(nil) - @stderr = o.gets(nil) - end - @status = status - - print_output if Chef::Log.debug? -end - - -# This is kind of a crazy-ass setup, but it works. -When /^I run chef-solo without cookbooks$/ do - - # Set up the cache dir. - cache_dir = "#{tmpdir}/chef-solo-cache-features" - system("mkdir -p #{cache_dir}") - cleanup_dirs << cache_dir - - # Empty Cookbook dir - system("mkdir #{cache_dir}/cookbooks") - - # Config file - config_file = "#{tmpdir}/chef-solo-config-features.rb" - File.open(config_file, "w") do |fp| - fp.write("cookbook_path \"#{cache_dir}/cookbooks\"\n") - fp.write("file_cache_path \"#{cache_dir}/cookbooks\"\n") - end - cleanup_files << config_file - - binary_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'chef', 'bin', 'chef-solo')) - command = "#{binary_path} -c #{config_file}" - command += " -l debug" if ENV['LOG_LEVEL'] == 'debug' - - # Run it - puts "Running solo: #{command}" if ENV['LOG_LEVEL'] == 'debug' - - status = Chef::Mixin::Command.popen4(command) do |p, i, o, e| - @stdout = o.gets(nil) - @stderr = o.gets(nil) - end - @status = status - - print_output if ENV['LOG_LEVEL'] == 'debug' -end diff --git a/features/steps/sandbox_steps.rb b/features/steps/sandbox_steps.rb deleted file mode 100644 index 4aeea093ef..0000000000 --- a/features/steps/sandbox_steps.rb +++ /dev/null @@ -1,137 +0,0 @@ -require 'chef/sandbox' - -# Upload the given file to the sandbox which was created by 'when I create a -# sandbox named' -def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url) - - checksum64 = Base64.encode64([sandbox_file_checksum].pack("H*")).strip - timestamp = Time.now.utc.iso8601 - file_contents = File.read(sandbox_filename) - # TODO - 5/28/2010, cw: make signing and sending the request streaming - sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object( - :http_method => :put, - :path => URI.parse(url).path, - :body => file_contents, - :timestamp => timestamp, - :user_id => rest.client_name - ) - headers = { - 'content-type' => 'application/x-binary', - 'content-md5' => checksum64, - :accept => 'application/json' - } - headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key))) - - # Don't set inflated_response as S3 (for the Platform) doesn't return JSON. - # Only Open Source does. - self.inflated_response = nil - self.exception = nil - self.api_response = RestClient::Request.execute( - :method => :put, - :url => url, - :headers => headers, - :payload => file_contents - ) -end - - -When /^I create a sandbox named '([^\']+)'$/ do |sandbox_name| - begin - sandbox = get_fixture('sandbox', sandbox_name) - raise "no such sandbox in fixtures: #{sandbox_name}" unless sandbox - - @stash['sandbox'] = sandbox - - self.api_response = nil - self.exception = nil - self.inflated_response = rest.post_rest('/sandboxes', sandbox) - self.sandbox_url = self.inflated_response['uri'] - - @stash['sandbox_response'] = self.inflated_response - rescue - Chef::Log.debug("Caught exception in sandbox create (POST) request: #{$!.message}: #{$!.backtrace.join("\n")}") - self.exception = $! - end -end - -When /^I commit the sandbox$/ do - begin - sandbox = @stash['sandbox'] - - # sandbox_url is fully qualified (with http://, sandboxes, etc.) - self.api_response = nil - self.exception = nil - self.inflated_response = rest.put_rest("#{self.sandbox_url}", {:is_completed => true}) - - @stash.delete('sandbox_response') - rescue - Chef::Log.debug("Caught exception in sandbox commit (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}") - self.exception = $! - end -end - -Then /^I upload a file named '([^\']+)' to the sandbox$/ do |stash_sandbox_filename| - begin - sandbox = @stash['sandbox'] - raise "no sandbox defined, have you called 'When I create a sandbox'" unless sandbox - - sandbox_filename = get_fixture('sandbox_file', stash_sandbox_filename) - raise "no such stash_sandbox_filename in fixtures: #{stash_sandbox_filename}" unless sandbox_filename - - sandbox_file_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_filename) - if @stash['sandbox_response']['checksums'].key?(sandbox_file_checksum) - Chef::Log.debug "uploading a file '#{stash_sandbox_filename}' with correct checksum #{sandbox_file_checksum}" - url = @stash['sandbox_response']['checksums'][sandbox_file_checksum]['url'] - else - Chef::Log.debug "Sandbox doesn't have a checksum #{sandbox_file_checksum}, assuming a negative test" - Chef::Log.debug "using checksum 'F157'... just kidding, using #{sandbox_file_checksum}" - url = @stash['sandbox_response']['uri'] + "/#{sandbox_file_checksum}" - end - - upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url) - rescue - Chef::Log.debug("Caught exception in sandbox checksum upload (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}") - self.exception = $! - end -end - -# Upload a file sandbox_filename_to_upload, but post it to the URL specified by -# sandbox_file_for_checksum, to cause the checksum check to fail. -Then /^I upload a file named '([^\']+)' using the checksum of '(.+)' to the sandbox$/ do |stash_upload_filename, stash_checksum_filename| - begin - sandbox = @stash['sandbox'] - - sandbox_upload_filename = get_fixture('sandbox_file', stash_upload_filename) - sandbox_checksum_filename = get_fixture('sandbox_file', stash_checksum_filename) - raise "no such stash_upload_filename in fixtures: #{stash_upload_filename}" unless sandbox_upload_filename - raise "no such stash_checksum_filename in fixtures: #{stash_checksum_filename}" unless stash_checksum_filename - - use_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_checksum_filename) - url = @stash['sandbox_response']['checksums'][use_checksum]['url'] - - upload_to_sandbox(sandbox_upload_filename, use_checksum, url) - rescue - Chef::Log.debug("Caught exception in bad sandbox checksum upload (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}") - self.exception = $! - end -end - -#Then the sandbox file 'sandbox2_file1' should need upload -Then /^the sandbox file '(.+)' should need upload$/ do |stash_filename| - sandbox = @stash['sandbox_response'] - - sandbox_filename = get_fixture('sandbox_file', stash_filename) - sandbox_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_filename) - - sandbox['checksums'][sandbox_checksum]['needs_upload'] == true -end - -Then /^the sandbox file '(.+)' should not need upload$/ do |stash_filename| - sandbox = @stash['sandbox_response'] - - sandbox_filename = get_fixture('sandbox_file', stash_filename) - sandbox_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_filename) - - sandbox['checksums'][sandbox_checksum]['needs_upload'] == false -end - diff --git a/features/steps/search_steps.rb b/features/steps/search_steps.rb deleted file mode 100644 index 3dd179eebe..0000000000 --- a/features/steps/search_steps.rb +++ /dev/null @@ -1,90 +0,0 @@ -Given "the search index has been committed" do - sleep 1 # allow time for the objects to transit rabbitmq and opscode-expander. - RestClient.get("http://localhost:8983/solr/update?commit=true&waitFlush=true") -end - -Then "there should be '$expected_count' total search results" do |expected_count| - expected_count = expected_count.to_i - inflated_response.should respond_to(:[]) - inflated_response.should have_key("total") - inflated_response["total"].should == expected_count -end - -Then "a '$result_item_klass' with item name '$result_item_name' should be in the search result" do |result_item_klass, result_item_name| - inflated_response.should respond_to(:[]) - inflated_response.should have_key("rows") - - found_match = false - expected_klass = eval(result_item_klass) - - inflated_response['rows'].each do |item| - next unless item.name == result_item_name - found_match = true - item.should be_a_kind_of(expected_klass) - end - - unless found_match - msg = "expected to find a #{result_item_klass} with item name #{result_item_name} in the inflated response but it's not there\n" - msg << "actual inflated response is #{inflated_response.inspect}" - raise msg - end -end - -Then "a '$result_item_klass' with id '$result_item_id' should be in the search result" do |result_item_klass, result_item_id| - inflated_response.should respond_to(:[]) - inflated_response.should have_key("rows") - - result_item = inflated_response["rows"].find {|item| item["id"] == result_item_id } - unless result_item - msg = "expected to find a #{result_item_klass} with 'id' #{result_item_id} in the inflated response but it's not there\n" - msg << "actual inflated response is #{inflated_response.inspect}" - raise msg - end - expected_klass = eval(result_item_klass) - - result_item.should be_a_kind_of(expected_klass) -end - -Given "PL-540 is resolved in favor of not removing this feature" do - pending -end - -Given /^a set of nodes pre-populated with known, searchable data$/ do - node_script = File.join(datadir, 'search-tests', 'search-test-nodes.rb') - shell_out! "knife exec #{get_knife_config} < #{node_script}", :timeout => 240 -end - -When /^I execute a randomized set of searches across my infrastructure$/ do - search_script = File.join(datadir, 'search-tests', 'do_knife_search_test.rb') - @shell_result = shell_out "knife exec #{get_knife_config} < #{search_script}" -end - -Then /^all of the searches should return the expected results$/ do - io = StringIO.new(@shell_result.stdout) - while io.eof? == false - l = io.readline - next unless l =~ /^(OK|FAIL|ERROR)/ - case $1 - when "OK" - next - when "FAIL" - message = [l, io.readline, io.readline].join("\n") - puts @shell_result.stdout - raise message - when "ERROR" - puts @shell_result.stdout - raise l - end - end -end - -# return a set of knife command line parameters that -# are based on the current Chef::Rest config being -# used by the feature tests -def get_knife_config - [ - "--user", @rest.auth_credentials.client_name, - "--server-url", @rest.url, - "--key", @rest.auth_credentials.key_file - ].join(" ") -end diff --git a/features/steps/webrat_steps.rb b/features/steps/webrat_steps.rb deleted file mode 100644 index b152a1501d..0000000000 --- a/features/steps/webrat_steps.rb +++ /dev/null @@ -1,39 +0,0 @@ -# Commonly used webrat steps -# http://github.com/brynary/webrat - -When /^I go to \/(.*)$/ do |path| - visit path -end - -When /^I press "(.*)"$/ do |button| - click_button(button) -end - -When /^I follow "(.*)"$/ do |link| - click_link(link) -end - -When /^I fill in "(.*)" with "(.*)"$/ do |field, value| - fill_in(field, :with => value) -end - -When /^I select "(.*)" from "(.*)"$/ do |value, field| - select(value, :from => field) -end - -When /^I check "(.*)"$/ do |field| - check(field) -end - -When /^I uncheck "(.*)"$/ do |field| - uncheck(field) -end - -When /^I choose "(.*)"$/ do |field| - choose(field) -end - -When /^I attach the file at "(.*)" to "(.*)" $/ do |path, field| - attach_file(field, path) -end - diff --git a/features/support/couchdb_replicate.rb b/features/support/couchdb_replicate.rb deleted file mode 100644 index bd54ec2758..0000000000 --- a/features/support/couchdb_replicate.rb +++ /dev/null @@ -1,127 +0,0 @@ -# -# Author:: Tim Hinderliter (<tim@opscode.com>) -# Copyright:: Copyright (c) 2010 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. -# - -# Under high load with lots of replications going on, CouchDB builtin -# replication (through the builtin '$DB/_replicate' endpoint) can crash, causing -# further replications to fail by timing out. This then requires a restart of -# CouchDB. -# -# This code is a manual implementation of CouchDB replication, using standard -# bulk GET's and PUT's. We use RestClient and JSON parsing. - -require 'rubygems' -require 'rest-client' -require 'chef/log' -require 'chef/json_compat' - -# Bulk GET all documents in the given db, using the given page size. -# Calls the required block for each page size, passing in an array of -# rows. -def bulk_get_paged(db, page_size) - last_key = nil - - paged_rows = nil - until (paged_rows && paged_rows.length == 0) do - url = "#{db}/_all_docs?limit=100&include_docs=true" - if last_key - url += "&startkey=#{CGI.escape(last_key.to_json)}&skip=1" - end - #puts "bulk_get_paged: url = #{url}" - - paged_results_str = RestClient.get(url) - - # Pass :create_additions=>false so JSON parser does *not* expand - # custom classes (such as Chef::Node, etc), and instead sticks only - # to Array, Hash, String, etc. - paged_results = Chef::JSONCompat.from_json(paged_results_str, :create_additions => false) - paged_rows = paged_results['rows'] - - if paged_rows.length > 0 - yield paged_rows - last_key = paged_rows.last['key'] - end - end -end - -# Replicate a (set of) source databases to a (set of) target databases. Uses -# manual bulk GET/POST as Couch's internal _replicate endpoint crashes and -# starts to time out after some number of runs. -def replicate_dbs(replication_specs, delete_source_dbs = false) - replication_specs = [replication_specs].flatten - - Chef::Log.debug "replicate_dbs: replication_specs = #{replication_specs.inspect}, delete_source_dbs = #{delete_source_dbs}" - - replication_specs.each do |spec| - source_db = spec[:source_db] - target_db = spec[:target_db] - - # Delete and re-create the target db - begin - Chef::Log.debug("Deleting #{target_db}, if exists") - RestClient.delete(target_db) - rescue RestClient::ResourceNotFound => e - end - - # Sometimes Couch returns a '412 Precondition Failed' when creating a database, - # via a PUT to its URL, as the DELETE from the previous step has not yet finished. - # This condition disappears if you try again. So here we try up to 10 times if - # PreconditionFailed occurs. See - # http://tickets.opscode.com/browse/CHEF-1788 and - # http://tickets.opscode.com/browse/CHEF-1764. - # - # According to https://issues.apache.org/jira/browse/COUCHDB-449, setting the - # 'X-Couch-Full-Commit: true' header on the DELETE should work around this issue, - # but it does not. - db_created = nil - max_tries = 10 - num_tries = 1 - while !db_created && num_tries <= max_tries - begin - Chef::Log.debug("Creating #{target_db}") - RestClient.put(target_db, nil) - db_created = true - rescue RestClient::PreconditionFailed => e - if num_tries <= max_tries - Chef::Log.debug("In creating #{target_db} try #{num_tries}/#{max_tries}, got #{e}; try again") - sleep 0.25 - else - Chef::Log.error("In creating #{target_db}, tried #{max_tries} times: got #{e}; giving up") - end - end - num_tries += 1 - end - - Chef::Log.debug("Replicating #{source_db} to #{target_db} using bulk (batch) method") - bulk_get_paged(source_db, 100) do |paged_rows| - #puts "incoming paged_rows is #{paged_rows.inspect}" - paged_rows = paged_rows.map do |row| - doc_in_row = row['doc'] - doc_in_row.delete '_rev' - doc_in_row - end - - RestClient.post("#{target_db}/_bulk_docs", Chef::JSONCompat.to_json({"docs" => paged_rows}), :content_type => "application/json") - end - - # Delete the source if asked to.. - if delete_source_dbs - Chef::Log.debug("Deleting #{source_db}") - RestClient.delete(source_db) - end - end -end
\ No newline at end of file diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 4c40efc499..0000000000 --- a/features/support/env.rb +++ /dev/null @@ -1,336 +0,0 @@ -# Copyright:: Copyright (c) 2008 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. -# - -Thread.abort_on_exception = true - -require 'rubygems' -require 'rspec/expectations' - -CHEF_PROJECT_ROOT = File.expand_path(File.dirname(__FILE__) + '/../../') -KNIFE_CONFIG = CHEF_PROJECT_ROOT + '/features/data/config/knife.rb' -KNIFE_CMD = File.expand_path(File.join(CHEF_PROJECT_ROOT, "chef", "bin", "knife")) -FEATURES_DATA = File.join(CHEF_PROJECT_ROOT, "features", "data") -INTEGRATION_COOKBOOKS = File.join(FEATURES_DATA, "cookbooks") -EXTRA_COOKBOOKS = File.join(FEATURES_DATA, "cookbooks_not_uploaded_at_feature_start") - -$:.unshift(CHEF_PROJECT_ROOT) -$:.unshift(CHEF_PROJECT_ROOT + '/chef/lib') -$:.unshift(CHEF_PROJECT_ROOT + '/chef-server-api/lib') -$:.unshift(CHEF_PROJECT_ROOT + '/chef-server-webui/lib') -$:.unshift(CHEF_PROJECT_ROOT + '/chef-solr/lib') - -require 'chef' -require 'chef/config' -require 'chef/client' -require 'chef/environment' -require 'chef/data_bag' -require 'chef/data_bag_item' -require 'chef/api_client' -require 'chef/checksum' -require 'chef/sandbox' -require 'chef/solr_query' -require 'chef/certificate' -require 'chef/cookbook_version' -require 'chef/cookbook_loader' -require 'chef/mixin/shell_out' -require 'tmpdir' -require 'chef/streaming_cookbook_uploader' -require 'webrick' -require 'restclient' -require 'features/support/couchdb_replicate' - -include Chef::Mixin::ShellOut - -Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners' -Ohai::Config[:disabled_plugins ]<< 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java' - -ENV['LOG_LEVEL'] ||= 'error' - -def setup_logging - Chef::Config.from_file(File.join(File.dirname(__FILE__), '..', 'data', 'config', 'server.rb')) - if ENV['DEBUG'] == 'true' || ENV['LOG_LEVEL'] == 'debug' - Chef::Config[:log_level] = :debug - Chef::Log.level = :debug - else - Chef::Config[:log_level] = ENV['LOG_LEVEL'].to_sym - Chef::Log.level = ENV['LOG_LEVEL'].to_sym - end - Ohai::Log.logger = Chef::Log.logger -end - -def delete_databases - c = Chef::REST.new(Chef::Config[:couchdb_url], nil, nil) - %w{chef_integration chef_integration_safe}.each do |db| - begin - c.delete_rest("#{db}/") - rescue - end - end -end - -def create_databases - Chef::Log.info("Creating bootstrap databases") - cdb = Chef::CouchDB.new(Chef::Config[:couchdb_url], "chef_integration") - - # Sometimes Couch returns a '412 Precondition Failed' when creating a database, - # via a PUT to its URL, as the DELETE from the previous step in delete_databases - # has not yet finished. This condition disappears if you try again. So here we - # try up to 10 times if PreconditionFailed occurs. See - # http://tickets.opscode.com/browse/CHEF-1788 and - # http://tickets.opscode.com/browse/CHEF-1764. - # - # According to https://issues.apache.org/jira/browse/COUCHDB-449, setting the - # 'X-Couch-Full-Commit: true' header on the DELETE should work around this issue, - # but it does not. - db_created = nil - max_tries = 10 - num_tries = 1 - while !db_created && num_tries <= max_tries - begin - cdb.create_db - db_created = true - rescue Net::HTTPServerException => e - unless e.response.code.to_i == 412 - # Re-raise if we got anything but 412. - raise - end - - if num_tries <= max_tries - Chef::Log.debug("In creating chef_integration try #{num_tries}/#{max_tries}, got #{e}; try again") - sleep 0.25 - else - Chef::Log.error("In creating chef_integration, tried #{max_tries} times: got #{e}; giving up") - end - end - num_tries += 1 - end - - cdb.create_id_map - Chef::Node.create_design_document - Chef::Role.create_design_document - Chef::DataBag.create_design_document - Chef::ApiClient.create_design_document - Chef::WebUIUser.create_design_document - Chef::CookbookVersion.create_design_document - Chef::Sandbox.create_design_document - Chef::Checksum.create_design_document - Chef::Environment.create_design_document - - Chef::Certificate.generate_signing_ca - Chef::Certificate.gen_validation_key - Chef::Certificate.gen_validation_key(Chef::Config[:web_ui_client_name], Chef::Config[:web_ui_key]) - Chef::Environment.create_default_environment - system("cp #{File.join(Dir.tmpdir, "chef_integration", "validation.pem")} #{Dir.tmpdir}") - system("cp #{File.join(Dir.tmpdir, "chef_integration", "webui.pem")} #{Dir.tmpdir}") - c = Chef::ApiClient.cdb_load(Chef::Config[:web_ui_client_name]) - c.admin(true) - c.cdb_save - - cmd = [KNIFE_CMD, "cookbook", "upload", "-a", "-o", INTEGRATION_COOKBOOKS, "-u", Chef::Config[:web_ui_client_name], "-k", File.join(Dir.tmpdir, "webui.pem"), "-c", KNIFE_CONFIG] - Chef::Log.info("Uploading fixture cookbooks with #{cmd.join(' ')}") - cmd << {:timeout => 120} - shell_out!(*cmd) -end - -def prepare_replicas - replicate_dbs({ :source_db => "#{Chef::Config[:couchdb_url]}/chef_integration", :target_db => "#{Chef::Config[:couchdb_url]}/chef_integration_safe" }) -end - -def cleanup - if File.exists?(Chef::Config[:validation_key]) - File.unlink(Chef::Config[:validation_key]) - end - if File.exists?(Chef::Config[:web_ui_key]) - File.unlink(Chef::Config[:web_ui_key]) - end -end - -### -# Pre-testing setup -### -setup_logging -cleanup -delete_databases -create_databases -prepare_replicas - -Chef::Log.info("Ready to run tests") - -### -# The Cucumber World -### -module ChefWorld - - attr_accessor :recipe, :cookbook, :api_response, :inflated_response, :log_level, - :chef_args, :config_file, :stdout, :stderr, :status, :exception, - :gemserver_thread, :sandbox_url - - def self.ohai - # ohai takes a while, so only ever run it once. - @ohai ||= begin - o = Ohai::System.new - o.all_plugins - o - end - end - - def ohai - ChefWorld.ohai - end - - def client - @client ||= begin - c = Chef::Client.new - c.ohai = ohai - c - end - end - - def client_key - File.join(tmpdir, "client.pem") - end - - def rest - @rest ||= Chef::REST.new('http://localhost:4000', nil, nil) - end - - def tmpdir - @tmpdir ||= File.join(Dir.tmpdir, "chef_integration") - end - - def server_tmpdir - @server_tmpdir ||= File.expand_path(File.join(datadir, "tmp")) - end - - def datadir - @datadir ||= File.join(File.dirname(__FILE__), "..", "data") - end - - def configdir - @configdir ||= File.join(File.dirname(__FILE__), "..", "data", "config") - end - - def cleanup_files - @cleanup_files ||= Array.new - end - - def cleanup_dirs - @cleanup_dirs ||= Array.new - end - - def stash - @stash ||= Hash.new - end - - def gemserver - @gemserver ||= WEBrick::HTTPServer.new( - :Port => 8000, - :DocumentRoot => datadir + "/gems/", - # Make WEBrick STFU - :Logger => Logger.new(StringIO.new), - :AccessLog => [ StringIO.new, WEBrick::AccessLog::COMMON_LOG_FORMAT ] - ) - end - - attr_accessor :apt_server_thread - - def apt_server - @apt_server ||= WEBrick::HTTPServer.new( - :Port => 9000, - :DocumentRoot => datadir + "/apt/var/www/apt", - # Make WEBrick STFU - :Logger => Logger.new(StringIO.new), - :AccessLog => [ StringIO.new, WEBrick::AccessLog::COMMON_LOG_FORMAT ] - ) - end - - def make_admin - admin_client - @rest = Chef::REST.new(Chef::Config[:registration_url], 'bobo', "#{tmpdir}/bobo.pem") - #Chef::Config[:client_key] = "#{tmpdir}/bobo.pem" - #Chef::Config[:node_name] = "bobo" - end - - def admin_rest - admin_client - @admin_rest ||= Chef::REST.new(Chef::Config[:registration_url], 'bobo', "#{tmpdir}/bobo.pem") - end - - def admin_client - unless @admin_client - r = Chef::REST.new(Chef::Config[:registration_url], Chef::Config[:validation_client_name], Chef::Config[:validation_key]) - r.register("bobo", "#{tmpdir}/bobo.pem") - c = Chef::ApiClient.cdb_load("bobo") - c.admin(true) - c.cdb_save - @admin_client = c - end - end - - def make_non_admin - r = Chef::REST.new(Chef::Config[:registration_url], Chef::Config[:validation_client_name], Chef::Config[:validation_key]) - r.register("not_admin", "#{tmpdir}/not_admin.pem") - c = Chef::ApiClient.cdb_load("not_admin") - c.cdb_save - @rest = Chef::REST.new(Chef::Config[:registration_url], 'not_admin', "#{tmpdir}/not_admin.pem") - #Chef::Config[:client_key] = "#{tmpdir}/not_admin.pem" - #Chef::Config[:node_name] = "not_admin" - end - - def couchdb_rest_client - Chef::REST.new('http://localhost:5984/chef_integration', false, false) - end - - -end - -World(ChefWorld) - -Before do - data_tmp = File.join(File.dirname(__FILE__), "..", "data", "tmp") - system("rm -rf #{data_tmp}/*") - system("rm -rf #{tmpdir}") - - system("mkdir -p #{tmpdir}") - system("cp -r #{File.join(Dir.tmpdir, "validation.pem")} #{File.join(tmpdir, "validation.pem")}") - system("cp -r #{File.join(Dir.tmpdir, "webui.pem")} #{File.join(tmpdir, "webui.pem")}") - - replicate_dbs({:source_db => "#{Chef::Config[:couchdb_url]}/chef_integration_safe", - :target_db => "#{Chef::Config[:couchdb_url]}/chef_integration"}) - - s = Chef::SolrQuery.new - s.delete_database("chef_integration") - s.commit -end - -After do - gemserver.shutdown - gemserver_thread && gemserver_thread.join - - apt_server.shutdown - apt_server_thread && apt_server_thread.join - - cleanup_files.each do |file| - system("rm #{file}") - end - cleanup_dirs.each do |dir| - system("rm -rf #{dir}") - end - cj = Chef::REST::CookieJar.instance - cj.keys.each do |key| - cj.delete(key) - end -end diff --git a/features/support/packages.rb b/features/support/packages.rb deleted file mode 100644 index fdbe931f6f..0000000000 --- a/features/support/packages.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Provides a method to quickly lookup whether we have -# a given packaging system installed. -def package_system_available?(name) - case name - when 'MacPorts' - uname = `uname` - (uname =~ /Darwin/ && File.exist?('/opt') && shell_out("which port").status.success?) - else - false - end -end diff --git a/scripts/features-screen b/scripts/features-screen deleted file mode 100755 index 969c9c3de6..0000000000 --- a/scripts/features-screen +++ /dev/null @@ -1,28 +0,0 @@ -# Start up a Chef environment with: -# screen -c scripts/features-screen -# from the chef base directory. -hardstatus alwayslastline '%w' - -screen -t "couchdb" 0 -stuff "sudo rake dev:features:start:couchdb\012" -sleep 3 - -screen -t "rabbitmq" 1 -stuff "sudo rake dev:features:start:rabbitmq\012" -sleep 3 - -screen -t "chef_solr" 2 -stuff "sudo rake dev:features:start:chef_solr\012" -sleep 3 - -screen -t "chef_expander" 3 -stuff "sudo rake dev:features:start:chef_expander\012" -sleep 3 - -screen -t "chef_server" 4 -stuff "sudo rake dev:features:start:chef_server\012" -sleep 3 - -screen -t "chef_webui" 5 -stuff "sudo rake dev:features:start:chef_webui\012" -sleep 3 diff --git a/scripts/mac-dev-screen b/scripts/mac-dev-screen deleted file mode 100755 index 671bd23b83..0000000000 --- a/scripts/mac-dev-screen +++ /dev/null @@ -1,24 +0,0 @@ -# Start up a Chef environment with: -# screen -c scripts/mac-dev-screen -# from the chef base directory. -hardstatus alwayslastline '%w' - -screen -t "couchdb" 0 -stuff "sudo rake dev:start:couchdb\012" -sleep 3 - -screen -t "rabbitmq" 1 -stuff "sudo rake dev:start:rabbitmq\012" -sleep 3 - -screen -t "chef_solr" 2 -stuff "sudo rake dev:start:chef_solr\012" -sleep 3 - -screen -t "chef_solr_indexer" 3 -stuff "sudo rake dev:start:chef_solr_indexer\012" -sleep 3 - -screen -t "chef_server" 4 -stuff "sudo rake dev:start:chef_server\012" -sleep 3 diff --git a/scripts/mac-dev-start b/scripts/mac-dev-start deleted file mode 100755 index b2b029335a..0000000000 --- a/scripts/mac-dev-start +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'pp' -require 'appscript' -require 'mixlib/cli' - -class MacDevStart - include Mixlib::CLI - include Appscript - - SERVICES = %w{couchdb rabbitmq chef_solr chef_expander chef_server chef_webui} - - option :environment, - :short => '-e ENV', - :long => '--environment ENV', - :default => 'test', - :description => 'Set the environment (test|dev), defaults to test' - - def run - @srcdir = File.expand_path(File.dirname(__FILE__)) - - @base_cmd = case config[:environment] - when 'test' - "cd #{@srcdir} && rake dev:features:start:" - when 'dev' - "cd #{@srcdir} && rake dev:start:" - else - puts "--environment must be set to either 'test' or 'dev'" - puts @opt_parser - exit 1 - end - - STDOUT.puts "Starting services:" - pp SERVICES - start_services(SERVICES) - end - - def create_tab - @window.activate - app("System Events").application_processes["Terminal.app"].keystroke("t", :using=>:command_down) - end - - def terminal_app - @terminal_app ||= app("Terminal") - end - - def create_term_window - terminal_app.windows.first.activate - app("System Events").application_processes["Terminal.app"].keystroke("n", :using=>:command_down) - @window = terminal_app.windows.first.get - end - - def start_service_in_tab(service, tab) - # use xterm escape codes to set the tab title to the service running in the tab. - cmd = "unset PROMPT_COMMAND; echo -e \"\\033]0;#{service}\\007\"; #{@base_cmd}#{service}" - app('Terminal').do_script(cmd, :in => @window.tabs[tab].get) - end - - def start_services(services) - create_term_window - - tab_index = 1 # applescript indexes from 1 instead of 0 - - (services.size - 1).times { create_tab } - - services.each do |service| - start_service_in_tab(service, tab_index) - tab_index += 1 - end - end -end - -if __FILE__ == $0 - os = MacDevStart.new - os.parse_options - os.run -end |