Feature #353
closedYAML output for hosts page
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.
Files
Updated by Ohad Levy over 14 years 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 about 14 years ago
- File 0001-Fixes-353-Added-responder-for-YAML-output-in-HostsCo.patch 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 about 14 years ago
- Status changed from New to Ready For Testing
- % Done changed from 0 to 100
Applied in changeset a90a43fa657846be92fc2b8aa4e50e1d22b423fe.
Updated by Ohad Levy about 14 years ago
- Category set to API
- Status changed from Ready For Testing to Closed
- Assignee set to Jochen Schalanda
- Target version changed from 0.2 to 0.1-6