Project

General

Profile

Actions

Feature #11167

open

Show host parameters in the index

Added by Walter Huf almost 9 years ago. Updated almost 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Is there a way to get all of the hosts' parameters right from the hosts index? I want to get all of the hosts with their parameters without doing an HTTP request for every single host.

This seems to work for me, but perhaps there is a better way:

--- a/app/views/api/v2/hosts/main.json.rabl
+++ b/app/views/api/v2/hosts/main.json.rabl
@@ -9,7 +9,7 @@ attributes :ip, :environment_id, :environment_name, :last_report, :mac, :realm_i
            :enabled, :puppet_ca_proxy_id, :managed, :use_image, :image_file, :uuid, :compute_resource_id, :compute_resource_name,
            :compute_profile_id, :compute_profile_name, :capabilities, :provision_method,
            :puppet_proxy_id, :certname, :image_id, :image_name, :created_at, :updated_at,
-           :last_compile, :puppet_status
+           :last_compile, :puppet_status, :parameters

 if SETTINGS[:organizations_enabled]
   attributes :organization_id, :organization_name
Actions #1

Updated by Dominic Cleal almost 9 years ago

  • Category set to API

That'd be the only way at the moment. If we did this by default it'd end up with a lot of additional database queries for people who don't want this or other associations - instead all associated data is only on the per-resource GET/show page.

Ideally the API would support customisation of the response fields.

Actions

Also available in: Atom PDF