diff options
24 files changed, 129 insertions, 311 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cf9890..743232b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Chef Zero CHANGELOG =================== +$ 5.0 (pending) + +* updates to be compatible with current Chef Server 12 behaviors +* update oc-chef-pedant to 2.0 +* remove chef-pedant support + # 4.2.3 * [PR#143](https://github.com/chef/chef-zero/pull/143): Fix server_scope: :context @@ -3,7 +3,7 @@ gemspec gem 'rest-client', :github => 'chef/rest-client' -gem 'chef-pedant', :github => 'chef/chef-pedant', :tag => '1.0.46' +gem 'oc-chef-pedant', :github => 'chef/chef-server' -gem 'chef', :github => 'opscode/chef', :tag => '12.2.1' +gem 'chef', :github => 'chef/chef', :tag => '12.4.1' @@ -10,9 +10,9 @@ task :spec do system('rspec spec/*_spec.rb') end -desc "run pedant" +desc "run oc pedant" task :pedant do - require File.expand_path('spec/run_pedant') + require File.expand_path('spec/run_oc_pedant') end desc "run oc pedant" diff --git a/chef-zero.gemspec b/chef-zero.gemspec index 8538040..3bb0af6 100644 --- a/chef-zero.gemspec +++ b/chef-zero.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.add_dependency 'mixlib-log', '~> 1.3' s.add_dependency 'hashie', '~> 2.0' s.add_dependency 'uuidtools', '~> 2.1' - s.add_dependency 'ffi-yajl', '>= 1.1', '< 3.0' + s.add_dependency 'ffi-yajl', '~> 2.2' s.add_dependency 'rack' s.add_development_dependency 'rake' diff --git a/gemfiles/latest-chef.gemfile b/gemfiles/latest-chef.gemfile index ba98724..47420d6 100644 --- a/gemfiles/latest-chef.gemfile +++ b/gemfiles/latest-chef.gemfile @@ -2,4 +2,4 @@ source 'https://rubygems.org' gemspec :path => "../" -gem 'chef', :github => 'opscode/chef' +gem 'chef', :github => 'chef/chef' diff --git a/gemfiles/latest-pedant.gemfile b/gemfiles/latest-pedant.gemfile deleted file mode 100644 index f5fdb86..0000000 --- a/gemfiles/latest-pedant.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -source 'https://rubygems.org' - -gemspec :path => "../" - -gem 'rest-client', :git => 'git://github.com/opscode/rest-client.git' -gem 'chef-pedant', :github => 'opscode/chef-pedant' -gem 'chef', '>= 11.0' diff --git a/gemfiles/oc-chef-pedant.gemfile b/gemfiles/oc-chef-pedant.gemfile index 26324c3..dcdee27 100644 --- a/gemfiles/oc-chef-pedant.gemfile +++ b/gemfiles/oc-chef-pedant.gemfile @@ -1,7 +1,6 @@ source 'https://rubygems.org' gemspec :path => '../' -gem 'rest-client', :github => 'opscode/rest-client', :branch => 'lcg/1.6.7-version-lying' -gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => '81f3b4ecbc09d04950f2819b38a6a8f906ada2a7' -gem 'oc-chef-pedant', :git => 'git@github.com:opscode/oc-chef-pedant', :ref => '3c0eb31f1e49aa947b81ad51387b7a68adbc5f91' -gem 'chef', :github => 'opscode/chef' +gem 'rest-client', :github => 'chef/rest-client', :branch => 'lcg/1.6.7-version-lying' +gem 'oc-chef-pedant', :github => 'chef/oc-chef-pedant', :tag => '2.0.0' +gem 'chef', :github => 'chef/chef' diff --git a/lib/chef_zero/chef_data/data_normalizer.rb b/lib/chef_zero/chef_data/data_normalizer.rb index ab45d76..404db03 100644 --- a/lib/chef_zero/chef_data/data_normalizer.rb +++ b/lib/chef_zero/chef_data/data_normalizer.rb @@ -14,11 +14,11 @@ module ChefZero acls end - def self.normalize_client(client, name) + def self.normalize_client(client, name, orgname = nil) client['name'] ||= name - client['admin'] ||= false - client['admin'] = !!client['admin'] + client['clientname'] ||= name client['public_key'] ||= PUBLIC_KEY + client['orgname'] ||= orgname client['validator'] ||= false client['validator'] = !!client['validator'] client['json_class'] ||= "Chef::ApiClient" diff --git a/lib/chef_zero/chef_data/default_creator.rb b/lib/chef_zero/chef_data/default_creator.rb index 60b495a..d1a0118 100644 --- a/lib/chef_zero/chef_data/default_creator.rb +++ b/lib/chef_zero/chef_data/default_creator.rb @@ -160,7 +160,7 @@ module ChefZero 'users' => {}, 'org' => {}, - 'containers' => %w(clients containers cookbooks data environments groups nodes roles sandboxes), + 'containers' => %w(clients containers cookbooks data environments groups nodes roles sandboxes policies cookbook_artifacts), 'groups' => %w(admins billing-admins clients users), 'association_requests' => {} } diff --git a/lib/chef_zero/endpoints/actor_endpoint.rb b/lib/chef_zero/endpoints/actor_endpoint.rb index 342619c..1572ac1 100644 --- a/lib/chef_zero/endpoints/actor_endpoint.rb +++ b/lib/chef_zero/endpoints/actor_endpoint.rb @@ -65,7 +65,13 @@ module ChefZero else response = FFI_Yajl::Parser.parse(result[2], :create_additions => false) end - response['private_key'] = private_key if private_key + + if request.rest_path[2] == 'clients' + response['private_key'] = private_key ? private_key : false + else + response['private_key'] = private_key if private_key + end + response.delete('public_key') if !updating_public_key && request.rest_path[2] == 'users' response.delete('password') json_response(result[0], response) @@ -77,7 +83,7 @@ module ChefZero def populate_defaults(request, response_json) response = FFI_Yajl::Parser.parse(response_json, :create_additions => false) if request.rest_path[2] == 'clients' - response = ChefData::DataNormalizer.normalize_client(response, request.rest_path[3]) + response = ChefData::DataNormalizer.normalize_client(response,request.rest_path[3], request.rest_path[1]) else response = ChefData::DataNormalizer.normalize_user(response, request.rest_path[3], identity_keys, server.options[:osc_compat], request.method) end diff --git a/lib/chef_zero/endpoints/node_identifiers_endpoint.rb b/lib/chef_zero/endpoints/node_identifiers_endpoint.rb new file mode 100644 index 0000000..9f89a98 --- /dev/null +++ b/lib/chef_zero/endpoints/node_identifiers_endpoint.rb @@ -0,0 +1,22 @@ +require 'ffi_yajl' +require 'chef_zero/rest_base' +require 'uuidtools' + +module ChefZero + module Endpoints + # /organizations/NAME/nodes/NAME/_identifiers + class NodeIdentifiersEndpoint < RestBase + def get(request) + if get_data(request, request.rest_path[0..3]) + result = { + :id => UUIDTools::UUID.parse_raw(request.rest_path[0..4].to_s).to_s.gsub('-',''), + :authz_id => '0'*32, + :org_id => UUIDTools::UUID.parse_raw(request.rest_path[0..1].to_s).to_s.gsub('-','') } + json_response(200, result) + else + raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}") + end + end + end + end +end diff --git a/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb b/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb index 608d548..e1b6a7e 100644 --- a/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb +++ b/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb @@ -6,23 +6,14 @@ module ChefZero # /organizations/ORG/association_requests class OrganizationAssociationRequestsEndpoint < RestBase def post(request) - json = FFI_Yajl::Parser.parse(request.body, :create_additions => false) - username = json['user'] - orgname = request.rest_path[1] - id = "#{username}-#{orgname}" - - if exists_data?(request, [ 'organizations', orgname, 'users', username ]) - raise RestErrorResponse.new(409, "User #{username} is already in organization #{orgname}") - end - - create_data(request, request.rest_path, username, '{}') - json_response(201, { "uri" => build_uri(request.base_uri, request.rest_path + [ id ]) }) + ChefZero::Endpoints::OrganizationUserBase.post(self, request, 'user') end def get(request) orgname = request.rest_path[1] - result = list_data(request).map { |username| { "id" => "#{username}-#{orgname}", 'username' => username } } - json_response(200, result) + ChefZero::Endpoints::OrganizationUserBase.get(self, request) do |username| + { "id" => "#{username}-#{orgname}", 'username' => username } + end end end end diff --git a/lib/chef_zero/endpoints/organization_endpoint.rb b/lib/chef_zero/endpoints/organization_endpoint.rb index bc5c3f0..a5512db 100644 --- a/lib/chef_zero/endpoints/organization_endpoint.rb +++ b/lib/chef_zero/endpoints/organization_endpoint.rb @@ -16,18 +16,23 @@ module ChefZero new_org.each do |key, value| org[key] = value end - org = FFI_Yajl::Encoder.encode(org, :pretty => true) + save_org = FFI_Yajl::Encoder.encode(org, :pretty => true) if new_org['name'] != request.rest_path[-1] # This is a rename return error(400, "Cannot rename org #{request.rest_path[-1]} to #{new_org['name']}: rename not supported for orgs") end - set_data(request, request.rest_path + [ 'org' ], org) - json_response(200, "uri" => "#{build_uri(request.base_uri, request.rest_path)}") + set_data(request, request.rest_path + [ 'org' ], save_org) + json_response(200, { + "uri" => "#{build_uri(request.base_uri, request.rest_path)}", + "name" => org['name'], + "org_type" => org['org_type'], + "full_name" => org['full_name'] + }) end def delete(request) org = get_data(request, request.rest_path + [ 'org' ]) - delete_data_dir(request, request.rest_path) + delete_data_dir(request, request.rest_path, :recursive) already_json_response(200, populate_defaults(request, org)) end diff --git a/lib/chef_zero/endpoints/organization_user_base.rb b/lib/chef_zero/endpoints/organization_user_base.rb new file mode 100644 index 0000000..aaa2e3a --- /dev/null +++ b/lib/chef_zero/endpoints/organization_user_base.rb @@ -0,0 +1,29 @@ +require 'ffi_yajl' +require 'chef_zero/rest_base' + +module ChefZero + module Endpoints + module OrganizationUserBase + + def self.get(obj, request, &block) + result = obj.list_data(request).map(&block) + obj.json_response(200, result) + end + + def self.post(obj, request, key) + json = FFI_Yajl::Parser.parse(request.body, :create_additions => false) + username = json[key] + orgname = request.rest_path[1] + id = "#{username}-#{orgname}" + + if obj.exists_data?(request, [ 'organizations', orgname, 'users', username ]) + raise RestErrorResponse.new(409, "User #{username} is already in organization #{orgname}") + end + + obj.create_data(request, request.rest_path, username, '{}') + obj.json_response(201, { "uri" => obj.build_uri(request.base_uri, request.rest_path + [ id ]) }) + end + + end + end +end diff --git a/lib/chef_zero/endpoints/organization_user_endpoint.rb b/lib/chef_zero/endpoints/organization_user_endpoint.rb index ef922d4..8fd97d4 100644 --- a/lib/chef_zero/endpoints/organization_user_endpoint.rb +++ b/lib/chef_zero/endpoints/organization_user_endpoint.rb @@ -20,29 +20,7 @@ module ChefZero json_response(200, ChefData::DataNormalizer.normalize_user(user, request.rest_path[3], ['username'], server.options[:osc_compat])) end - def post(request) - orgname = request.rest_path[1] - username = request.rest_path[3] - - users = get_data(request, [ 'organizations', orgname, 'groups', 'users' ]) - users = FFI_Yajl::Parser.parse(users, :create_additions => false) - - create_data(request, [ 'organizations', orgname, 'users' ], username, '{}') - - # /organizations/ORG/association_requests/USERNAME-ORG - begin - delete_data(request, [ 'organizations', orgname, 'association_requests', username], :data_store_exceptions) - rescue DataStore::DataNotFoundError - end - - # Add the user to the users group if it isn't already there - if !users['users'] || !users['users'].include?(username) - users['users'] ||= [] - users['users'] |= [ username ] - set_data(request, [ 'organizations', orgname, 'groups', 'users' ], FFI_Yajl::Encoder.encode(users, :pretty => true)) - end - json_response(200, {}) - end + # Note: post to a named org user is not permitted, alllow invalid method handling (405) end end end diff --git a/lib/chef_zero/endpoints/organization_users_endpoint.rb b/lib/chef_zero/endpoints/organization_users_endpoint.rb index ed70cf6..e914820 100644 --- a/lib/chef_zero/endpoints/organization_users_endpoint.rb +++ b/lib/chef_zero/endpoints/organization_users_endpoint.rb @@ -1,13 +1,17 @@ require 'ffi_yajl' require 'chef_zero/rest_base' +require 'chef_zero/endpoints/organization_user_base' module ChefZero module Endpoints # /organizations/ORG/users class OrganizationUsersEndpoint < RestBase + def post(request) + ChefZero::Endpoints::OrganizationUserBase.post(self, request, 'username') + end + def get(request) - result = list_data(request).map { |username| { "user" => { "username" => username } } } - json_response(200, result) + ChefZero::Endpoints::OrganizationUserBase.get(self, request) { |username| { "user" => { "username" => username } } } end end end diff --git a/lib/chef_zero/endpoints/organizations_endpoint.rb b/lib/chef_zero/endpoints/organizations_endpoint.rb index 88816e8..41bf03b 100644 --- a/lib/chef_zero/endpoints/organizations_endpoint.rb +++ b/lib/chef_zero/endpoints/organizations_endpoint.rb @@ -17,8 +17,11 @@ module ChefZero def post(request) contents = FFI_Yajl::Parser.parse(request.body, :create_additions => false) name = contents['name'] + full_name = contents['full_name'] if name.nil? error(400, "Must specify 'name' in JSON") + elsif full_name.nil? + error(400, "Must specify 'full_name' in JSON") elsif exists_data_dir?(request, request.rest_path + [ name ]) error(409, "Organization already exists") else @@ -43,8 +46,12 @@ module ChefZero set_data(request, validator_path, validator) end + json_response(201, { "uri" => "#{build_uri(request.base_uri, org_path)}", + "name" => name, + "org_type" => org["org_type"], + "full_name" => full_name, "clientname" => validator_name, "private_key" => private_key }) diff --git a/lib/chef_zero/endpoints/search_endpoint.rb b/lib/chef_zero/endpoints/search_endpoint.rb index 3a093be..a9ad2bf 100644 --- a/lib/chef_zero/endpoints/search_endpoint.rb +++ b/lib/chef_zero/endpoints/search_endpoint.rb @@ -10,13 +10,15 @@ module ChefZero # /search/INDEX class SearchEndpoint < RestBase def get(request) - results = search(request) + orgname = request.rest_path[1] + results = search(request, orgname) results['rows'] = results['rows'].map { |name,uri,value,search_value| value } json_response(200, results) end def post(request) - full_results = search(request) + orgname = request.rest_path[1] + full_results = search(request, orgname) keys = FFI_Yajl::Parser.parse(request.body, :create_additions => false) partial_results = full_results['rows'].map do |name, uri, doc, search_value| data = {} @@ -45,10 +47,10 @@ module ChefZero private - def search_container(request, index) + def search_container(request, index, orgname) relative_parts, normalize_proc = case index when 'client' - [ ['clients'], Proc.new { |client, name| ChefData::DataNormalizer.normalize_client(client, name) } ] + [ ['clients'], Proc.new { |client, name| ChefData::DataNormalizer.normalize_client(client, name, orgname) } ] when 'node' [ ['nodes'], Proc.new { |node, name| ChefData::DataNormalizer.normalize_node(node, name) } ] when 'environment' @@ -92,7 +94,7 @@ module ChefZero end end - def search(request) + def search(request, orgname = nil) # Extract parameters index = request.rest_path[3] query_string = request.query_params['q'] || '*:*' @@ -104,7 +106,7 @@ module ChefZero rows = rows.to_i if rows # Get the search container - container, expander = search_container(request, index) + container, expander = search_container(request, index, orgname) # Search! result = [] diff --git a/lib/chef_zero/endpoints/user_organizations_endpoint.rb b/lib/chef_zero/endpoints/user_organizations_endpoint.rb index b6decb9..3eb13c4 100644 --- a/lib/chef_zero/endpoints/user_organizations_endpoint.rb +++ b/lib/chef_zero/endpoints/user_organizations_endpoint.rb @@ -13,7 +13,7 @@ module ChefZero result = result.map do |orgname| org = get_data(request, [ 'organizations', orgname, 'org' ]) org = FFI_Yajl::Parser.parse(org, :create_additions => false) - ChefData::DataNormalizer.normalize_organization(org, orgname) + { "organization" => ChefData::DataNormalizer.normalize_organization(org, orgname) } end json_response(200, result) end diff --git a/lib/chef_zero/server.rb b/lib/chef_zero/server.rb index 9cf7b39..672f795 100644 --- a/lib/chef_zero/server.rb +++ b/lib/chef_zero/server.rb @@ -61,6 +61,7 @@ require 'chef_zero/endpoints/environment_recipes_endpoint' require 'chef_zero/endpoints/environment_role_endpoint' require 'chef_zero/endpoints/license_endpoint' require 'chef_zero/endpoints/node_endpoint' +require 'chef_zero/endpoints/node_identifiers_endpoint' require 'chef_zero/endpoints/organizations_endpoint' require 'chef_zero/endpoints/organization_endpoint' require 'chef_zero/endpoints/organization_association_requests_endpoint' @@ -540,6 +541,7 @@ module ChefZero [ "/organizations/*/environments/*/roles/*", EnvironmentRoleEndpoint.new(self) ], [ "/organizations/*/nodes", RestListEndpoint.new(self) ], [ "/organizations/*/nodes/*", NodeEndpoint.new(self) ], + [ "/organizations/*/nodes/*/_identifiers", NodeIdentifiersEndpoint.new(self) ], [ "/organizations/*/policies/*/*", PoliciesEndpoint.new(self) ], [ "/organizations/*/principals/*", PrincipalEndpoint.new(self) ], [ "/organizations/*/roles", RestListEndpoint.new(self) ], diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 79d92e7..c0ba702 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -24,14 +24,14 @@ begin require 'rspec/core' require 'pedant' - require 'pedant/opensource/platform' - require 'pedant/multitenant' require 'pedant/organization' #Pedant::Config.rerun = true Pedant.config.suite = 'api' + Pedant.config.internal_server = 'http://localhost:8889' Pedant.config[:config_file] = 'spec/support/oc_pedant.rb' + Pedant.config[:server_api_version] = 0 Pedant.setup([ '--skip-knife', '--skip-keys', @@ -42,8 +42,16 @@ begin '--skip-authorization', '--skip-omnibus', '--skip-usags', - '--skip-internal_orgs', - '--skip-rename_org' + '--exclude-internal-orgs', + '--skip-headers', + + # Chef 12 features not yet 100% supported by Chef Zero + '--skip-policies', + '--skip-server-api-version', + '--skip-cookbook-artifacts', + '--skip-containers', + '--skip-api-v1' + ]) result = RSpec::Core::Runner.run(Pedant.config.rspec_args) diff --git a/spec/run_pedant.rb b/spec/run_pedant.rb deleted file mode 100644 index 30ffa2d..0000000 --- a/spec/run_pedant.rb +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env ruby -require 'bundler' -require 'bundler/setup' - -require 'chef_zero/server' -require 'rspec/core' - -tmpdir = nil - -def start_local_server(chef_repo_path) - Dir.mkdir(chef_repo_path) if !File.exists?(chef_repo_path) - - # 11.6 and below had a bug where it couldn't create the repo children automatically - if Chef::VERSION.to_f < 11.8 - %w(clients cookbooks data_bags environments nodes roles users).each do |child| - Dir.mkdir("#{chef_repo_path}/#{child}") if !File.exists?("#{chef_repo_path}/#{child}") - end - end - - # Start the new server - Chef::Config.repo_mode = 'everything' - Chef::Config.chef_repo_path = chef_repo_path - Chef::Config.versioned_cookbooks = true - chef_fs = Chef::ChefFS::Config.new.local_fs - data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs) - server = ChefZero::Server.new(:port => 8889, :data_store => data_store) - ENV['SINGLE_ORG'] = 'true' - server.start_background - server -end - -begin - if ENV['CHEF_FS'] - require 'chef/chef_fs/chef_fs_data_store' - require 'chef/chef_fs/config' - require 'tmpdir' - require 'fileutils' - require 'chef/version' - require 'chef_zero/data_store/v1_to_v2_adapter' - - # Create chef repository - tmpdir = Dir.mktmpdir - chef_repo_path = "#{tmpdir}/repo" - - # Capture setup data into master_chef_repo_path - server = start_local_server(chef_repo_path) - - elsif ENV['SINGLE_ORG'] - server = ChefZero::Server.new(:port => 8889, :single_org => 'chef') - server.start_background - - elsif ENV['FILE_STORE'] - require 'tmpdir' - require 'chef_zero/data_store/raw_file_store' - tmpdir = Dir.mktmpdir - data_store = ChefZero::DataStore::RawFileStore.new(tmpdir, true) - data_store = ChefZero::DataStore::DefaultFacade.new(data_store, true, false) - server = ChefZero::Server.new(:port => 8889, :single_org => 'chef', :data_store => data_store) - server.start_background - - else - server = ChefZero::Server.new(:port => 8889, :single_org => false, :osc_compat => true) - server.data_store.create_dir([ 'organizations' ], 'pedant') - server.start_background - end - - unless ENV['SKIP_PEDANT'] - require 'pedant' - require 'pedant/opensource' - - #Pedant::Config.rerun = true - - Pedant.config.suite = 'api' - Pedant.config[:config_file] = 'spec/support/pedant.rb' - - Pedant.setup([ - '--skip-knife', - '--skip-validation', - '--skip-authentication', - '--skip-authorization', - '--skip-keys', - '--skip-omnibus', - '--skip-cookbook_artifacts' - ]) - - result = RSpec::Core::Runner.run(Pedant.config.rspec_args) - else - require 'net/http' - response = Net::HTTP.new('127.0.0.1', 8889).get("/environments", { 'Accept' => 'application/json'}).body - if response =~ /_default/ - result = 0 - else - puts "GET /environments returned #{response}. Expected _default!" - result = 1 - end - end - - server.stop if server.running? -ensure - FileUtils.remove_entry_secure(tmpdir) if tmpdir -end - -exit(result) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index 60e3629..e3bcf27 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -77,9 +77,6 @@ superuser_name 'pivotal' superuser_key key webui_key key -# Set the platform_class -platform_class Pedant::MultiTenantPlatform - requestors({ :clients => { # The the admin user, for the purposes of getting things rolling @@ -132,3 +129,4 @@ verify_error_messages false ruby_users_endpoint? false ruby_acls_endpoint? false ruby_org_assoc? false +chef_12? true diff --git a/spec/support/pedant.rb b/spec/support/pedant.rb deleted file mode 100644 index 29a0ec1..0000000 --- a/spec/support/pedant.rb +++ /dev/null @@ -1,129 +0,0 @@ -# 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. - -# This annotated Pedant configuration file details the various -# configuration settings available to you. It is separate from the -# actual Pedant::Config class because not all settings have sane -# defaults, and not all settings are appropriate in all settings. - -################################################################################ -# You MUST specify the address of the server the API requests will be -# sent to. Only specify protocol, hostname, and port. -if ENV['SINGLE_ORG'] || ENV['FILE_STORE'] - chef_server 'http://127.0.0.1:8889' -else - chef_server 'http://127.0.0.1:8889/organizations/pedant' -end - -# If you are doing development testing, you can specify the address of -# the Solr server. The presence of this parameter will enable tests -# to force commits to Solr, greatly decreasing the amout of time -# needed for testing the search endpoint. This is only an -# optimization for development! If you are testing a "live" Chef -# Server, or otherwise do not have access to the Solr server from your -# testing location, you should not specify a value for this parameter. -# The tests will still run, albeit slower, as they will now need to -# poll for a period to ensure they are querying committed results. -#search_server "http://localhost:8983" - -# Related to the 'search_server' parameter, this specifies the maximum -# amout of time (in seconds) that search endpoint requests should be -# retried before giving up. If not explicitly set, it will default to -# 65 seconds; only set it if you know that your Solr commit interval -# differs significantly from this. -maximum_search_time 0 - -# OSC sends erchef a host header with a port, so this option needs -# # to be enabled for Pedant tests to work correctly -explicit_port_url true - -# We're starting to break tests up into groups based on different -# criteria. The proper API tests (the results of which are viewable -# to OPC customers) should be the only ones run by Pedant embedded in -# OPC installs. There are other specs that help us keep track of API -# cruft that we want to come back and fix later; these shouldn't be -# viewable to customers, but we should be able to run them in -# development and CI environments. If this parameter is missing or -# explicitly `false` only the customer-friendly tests will be run. -# -# This is mainly here for documentation purposes, since the -# command-line `opscode-pedant` utility ultimately determines this -# value. -include_internal false - -# Test users. The five users specified below are required; their -# names (:user, :non_org_user, etc.) are indicative of their role -# within the tests. All users must have a ':name' key. If they have -# a ':create_me' key, Pedant will create these users for you. If you -# are using pre-existing users, you must supply a ':key_file' key, -# which should be the fully-qualified path /on the machine Pedant is -# running on/ to a private key for that user. -key = 'spec/support/stickywicket.pem' -superuser_name 'admin' -superuser_key key -webui_key key - -# The Policies endpoint is feature-flagged during development. Zero supports -# the policies endpoint, so turn it on: -policies? true - -# Set the platform_class -platform_class Pedant::OpenSourcePlatform - -requestors({ - :clients => { - # The the admin user, for the purposes of getting things rolling - :admin => { - :name => "pedant_admin_client", - :create_me => true, - :create_knife => true, - :admin => true - }, - :non_admin => { - :name => 'pedant_client', - :create_me => true, - :create_knife => true - }, - :bad => { - :name => 'bad_client', - :bogus => true - } - }, - :users => { - :admin => { - :name => "admin", - :key_file => key, - :create_me => false, - :create_knife => false, - :admin => true - }, - :non_admin => { - :name => "pedant_non_admin_user", - :create_me => true, - :create_knife => true, - :admin => false - }, - # A user for Knife tests. A knife.rb and key files will be set up - # for this user - :knife_user => { - :name => "knifey", - :create_me => true, - :create_knife => true - } - } -}) - -self[:tags] = [:validation, :authentication, :authorization] -verify_error_messages false |