Feature #353
YAML output for hosts page
| Status: | Closed | Start: | 07/16/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 100% |
||
| Category: | API | |||
| Target version: | 0.1-6 | |||
| Backlog: | Difficulity: | |||
| Votes: | 0 |
Description
The index function in the hosts controller could be changed to something like the following:
def index
@search = Host.search(params[:search])
@hosts = @search.paginate :page => params[:page], :include => [:hostgroup, :domain, :operatingsystem, :environment]
@via = "fact_values_"
@last_reports = Report.maximum(:id, :group => :host_id, :conditions => {:host_id => @hosts})
respond_to do |format|
format.html
format.yml { render :text => @search.map(&:name).to_yaml }
end
end
This would output a list of hosts in simple YAML format which can be directly fed to other scripts.
This is similar to what happens in the OutofSync and Error page.
Related issues
| related to Foreman - Refactor #288: move dashboard controller actions (besides index) to hosts controller | Closed | 05/29/2010 |
Associated revisions
Revision a90a43fa657846be92fc2b8aa4e50e1d22b423fe
Fixes #353 - Added responder for YAML output in HostsController#index
History
Updated by Ohad Levy over 1 year ago
I think it makes more sense to handle this in one common controller (e.g. get out all of the hosts actions out of the dashboard controller, then we can unify them all to provide yaml / json output.
Updated by Jochen Schalanda over 1 year ago
- File 0001-Fixes-353-Added-responder-for-YAML-output-in-HostsCo.patch added
- Target version set to 0.2
The proposed patch adds a responder for YAML output in HostsController#index.
It also changes the JSON output to a simple array of the hosts instead of the nested hash with only one key/value-pair and makes it possible to use the search parameter to narrow down the returned hosts.
Updated by Jochen Schalanda over 1 year ago
- Status changed from New to Ready For Testing
- % Done changed from 0 to 100
Applied in changeset a90a43fa657846be92fc2b8aa4e50e1d22b423fe.
Updated by Ohad Levy over 1 year ago
- Category set to API
- Status changed from Ready For Testing to Closed
- Assigned to set to Jochen Schalanda
- Target version changed from 0.2 to 0.1-6
