From ae7634c600535ba3f64ce8af31afc6fef9dab31c Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 12 Aug 2015 08:46:24 -0400 Subject: Disable CS12 pedant flags Chef Zero does not yet 100% support CS12, hence we need to disable several of the failing tests until the code is written. --- spec/run_oc_pedant.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index efcaf8d..c0ba702 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -43,7 +43,15 @@ begin '--skip-omnibus', '--skip-usags', '--exclude-internal-orgs', - '--skip-headers' + '--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) -- cgit v1.2.1 From 3197fc49cacb71c9c55de40935a5e08303afb7a3 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 12 Aug 2015 08:52:25 -0400 Subject: Preliminary support for _identifiers API Adding preliminary support for the _identifiers REST endpoint. --- .../endpoints/node_identifiers_endpoint.rb | 22 ++++++++++++++++++++++ lib/chef_zero/server.rb | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 lib/chef_zero/endpoints/node_identifiers_endpoint.rb 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/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) ], -- cgit v1.2.1