Skip to content

Commit

Permalink
Refs #10720 - Use API v2 response for vm_compute_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter Huf authored and dLobatog committed Jun 20, 2015
1 parent ce6cae1 commit b95c1e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v2/hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def status

def vm_compute_attributes
render :json => {} unless @host
attrs = @host.vm_compute_attributes
attrs = @host.vm_compute_attributes || {}
safe_attrs = {}
attrs.each_pair do |k,v|
# clean up the compute attributes to be suitable for output
Expand All @@ -146,7 +146,7 @@ def vm_compute_attributes
safe_attrs[k] = v
end
end
render :json => { :compute_attributes => safe_attrs }
render :json => safe_attrs
end

api :PUT, "/hosts/:id/puppetrun", N_("Force a Puppet agent run on the host")
Expand Down
2 changes: 1 addition & 1 deletion test/functional/api/v2/hosts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def last_host
get :vm_compute_attributes, { :id => host.to_param }
assert_response :success
data = JSON.parse(@response.body)
assert_equal data, "compute_attributes" => { "cpus" => 4 }
assert_equal data, "cpus" => 4
ComputeResource.any_instance.unstub(:vm_compute_attributes_for)
end

Expand Down

0 comments on commit b95c1e1

Please sign in to comment.