From e655c7857e9568ece4555e627fc7d3aa372449ae Mon Sep 17 00:00:00 2001 From: John Keiser Date: Fri, 18 Apr 2014 13:20:40 -0700 Subject: Add support for "/organizations/chef" prefix --- lib/chef_zero/endpoints/environment_nodes_endpoint.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/chef_zero/endpoints/environment_nodes_endpoint.rb') diff --git a/lib/chef_zero/endpoints/environment_nodes_endpoint.rb b/lib/chef_zero/endpoints/environment_nodes_endpoint.rb index 91755ef..6e221fd 100644 --- a/lib/chef_zero/endpoints/environment_nodes_endpoint.rb +++ b/lib/chef_zero/endpoints/environment_nodes_endpoint.rb @@ -7,13 +7,13 @@ module ChefZero class EnvironmentNodesEndpoint < RestBase def get(request) # 404 if environment does not exist - get_data(request, request.rest_path[0..1]) + get_data(request, request.rest_path[0..3]) result = {} - list_data(request, ['nodes']).each do |name| - node = JSON.parse(get_data(request, ['nodes', name]), :create_additions => false) - if node['chef_environment'] == request.rest_path[1] - result[name] = build_uri(request.base_uri, ['nodes', name]) + list_data(request, request.rest_path[0..1] + ['nodes']).each do |name| + node = JSON.parse(get_data(request, request.rest_path[0..1] + ['nodes', name]), :create_additions => false) + if node['chef_environment'] == request.rest_path[3] + result[name] = build_uri(request.base_uri, request.rest_path[0..1] + ['nodes', name]) end end json_response(200, result) -- cgit v1.2.1