From e40fcd441e6e3869a6f4c6a802603085c471f740 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Tue, 26 Aug 2014 12:16:21 -0700 Subject: Fix organizations to honor full_name --- lib/chef_zero/endpoints/organizations_endpoint.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chef_zero/endpoints/organizations_endpoint.rb b/lib/chef_zero/endpoints/organizations_endpoint.rb index 835faf9..3a34fe4 100644 --- a/lib/chef_zero/endpoints/organizations_endpoint.rb +++ b/lib/chef_zero/endpoints/organizations_endpoint.rb @@ -15,8 +15,8 @@ module ChefZero end def post(request) - contents = request.body - name = JSON.parse(contents, :create_additions => false)['name'] + contents = JSON.parse(request.body, :create_additions => false) + name = contents['name'] if name.nil? error(400, "Must specify 'name' in JSON") elsif exists_data_dir?(request, request.rest_path + [ name ]) @@ -27,7 +27,7 @@ module ChefZero org = { "guid" => UUIDTools::UUID.random_create.to_s.gsub('-', ''), "assigned_at" => Time.now.to_s - } + }.merge(contents) org_path = request.rest_path + [ name ] set_data(request, org_path + [ 'org' ], JSON.pretty_generate(org)) -- cgit v1.2.1