diff options
author | John Keiser <jkeiser@opscode.com> | 2014-08-20 11:53:28 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2014-08-22 09:20:50 -0700 |
commit | 1d24016c8033d4839b3ff07a324672f434868538 (patch) | |
tree | 07498560d03dbfdb4099c5fa1c24f9e32af02f8b /lib | |
parent | 21d87873e784f97aad21d92eeef9b3a059e16b67 (diff) | |
download | chef-zero-1d24016c8033d4839b3ff07a324672f434868538.tar.gz |
Get organization endpoint passing oc-chef-pedant
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef_zero/endpoints/organization_endpoint.rb | 6 | ||||
-rw-r--r-- | lib/chef_zero/endpoints/organizations_endpoint.rb | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef_zero/endpoints/organization_endpoint.rb b/lib/chef_zero/endpoints/organization_endpoint.rb index 554982f..b33b105 100644 --- a/lib/chef_zero/endpoints/organization_endpoint.rb +++ b/lib/chef_zero/endpoints/organization_endpoint.rb @@ -17,8 +17,12 @@ module ChefZero org[key] = value end org = JSON.pretty_generate(org) + 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) - already_json_response(200, populate_defaults(request, org)) + json_response(200, "uri" => "#{build_uri(request.base_uri, request.rest_path)}") end def delete(request) diff --git a/lib/chef_zero/endpoints/organizations_endpoint.rb b/lib/chef_zero/endpoints/organizations_endpoint.rb index 1609a6b..835faf9 100644 --- a/lib/chef_zero/endpoints/organizations_endpoint.rb +++ b/lib/chef_zero/endpoints/organizations_endpoint.rb @@ -25,7 +25,7 @@ module ChefZero create_data_dir(request, request.rest_path, name, :requestor => request.requestor) org = { - "guid" => UUIDTools::UUID.random_create, + "guid" => UUIDTools::UUID.random_create.to_s.gsub('-', ''), "assigned_at" => Time.now.to_s } org_path = request.rest_path + [ name ] |