Project

General

Profile

Feature #11167

Show host parameters in the index

Added by Walter Huf over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

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

History

#1 Updated by Dominic Cleal over 7 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.

Also available in: Atom PDF