summaryrefslogtreecommitdiff
path: root/lib/chef_zero/endpoints/organization_policy_groups_endpoint.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef_zero/endpoints/organization_policy_groups_endpoint.rb')
-rw-r--r--lib/chef_zero/endpoints/organization_policy_groups_endpoint.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef_zero/endpoints/organization_policy_groups_endpoint.rb b/lib/chef_zero/endpoints/organization_policy_groups_endpoint.rb
index 51e0812..38e1481 100644
--- a/lib/chef_zero/endpoints/organization_policy_groups_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_policy_groups_endpoint.rb
@@ -1,5 +1,6 @@
require 'ffi_yajl'
require 'chef_zero/rest_base'
+require 'chef_zero/chef_data/data_normalizer'
module ChefZero
module Endpoints
@@ -25,6 +26,7 @@ module ChefZero
# vanilla /policy_groups.
if request.rest_path.last == "policy_groups"
policy_group_names = list_data_or_else(request, nil, [])
+ puts "List #{request.rest_path}: #{policy_group_names}"
# no policy groups, so sad.
if policy_group_names.size == 0
return already_json_response(200, '{}')
@@ -77,7 +79,8 @@ module ChefZero
revision_id = parse_json(get_data(request))
result = get_data(request, ["organizations", uri_params[:org_name], "policies",
uri_params[:policy_name], "revisions", revision_id], :nil)
- return already_json_response(200, result)
+ result = ChefData::DataNormalizer.normalize_policy(parse_json(result), uri_params[:policy_name], revision_id)
+ return json_response(200, result)
end
end # end get()
@@ -246,8 +249,9 @@ module ChefZero
policy_path = request.rest_path.first(2) + ["policies", request.rest_path.last,
"revisions", current_revision_id]
- full_policy_doc = get_data(request, policy_path)
- return already_json_response(200, full_policy_doc)
+ full_policy_doc = parse_json(get_data(request, policy_path))
+ full_policy_doc = ChefData::DataNormalizer.normalize_policy(full_policy_doc, request.rest_path.last, current_revision_id)
+ return json_response(200, full_policy_doc)
end
return error(404, "Don't know what to do with path #{request.rest_path}")