diff options
Diffstat (limited to 'chef-server-api')
61 files changed, 0 insertions, 6825 deletions
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 6cc84178c2..0000000000 --- a/chef-server-api/Gemfile +++ /dev/null @@ -1,36 +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, :require => false # load individual parts as needed -gem "chef-solr", ChefServerApi::VERSION, :require => "chef/solr" - -group(:dev) do - gem "thin" - gem "pry" -end - -group :test do - gem "rake" - - gem "rspec", "~> 2.5" - gem "webrat" - gem "webrat-rspec-rails" -end - -group(:prod) 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 3f6607f736..0000000000 --- a/chef-server-api/Rakefile +++ /dev/null @@ -1,52 +0,0 @@ -require File.dirname(__FILE__) + '/lib/chef-server-api/version' - -require 'rubygems' -require 'rubygems/package_task' - -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"), nil, "chef-server-api.gemspec", 1) - -Gem::PackageTask.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 d9c8ea1a10..0000000000 --- a/chef-server-api/chef-server-api.gemspec +++ /dev/null @@ -1,34 +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 "extlib", "~> 0.9.16" - 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 d1b180ad1f..0000000000 --- a/chef-server-api/lib/chef-server-api/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module ChefServerApi - VERSION = '10.18.0' -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 |