From b95c1e1be9aedce0446f32fa242b4389b9d63ccc Mon Sep 17 00:00:00 2001 From: Walter Huf Date: Fri, 19 Jun 2015 14:12:38 -0700 Subject: [PATCH] Refs #10720 - Use API v2 response for vm_compute_attributes --- app/controllers/api/v2/hosts_controller.rb | 4 ++-- test/functional/api/v2/hosts_controller_test.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v2/hosts_controller.rb b/app/controllers/api/v2/hosts_controller.rb index 49c655d87c5..38c22d4e645 100644 --- a/app/controllers/api/v2/hosts_controller.rb +++ b/app/controllers/api/v2/hosts_controller.rb @@ -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 @@ -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") diff --git a/test/functional/api/v2/hosts_controller_test.rb b/test/functional/api/v2/hosts_controller_test.rb index d5141627559..f3c7f0bfd02 100644 --- a/test/functional/api/v2/hosts_controller_test.rb +++ b/test/functional/api/v2/hosts_controller_test.rb @@ -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