Project

General

Profile

Actions

Feature #353

closed

YAML output for hosts page

Added by Bash Shell almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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


Related issues 1 (0 open1 closed)

Related to Foreman - Refactor #288: move dashboard controller actions (besides index) to hosts controllerClosedOhad Levy05/29/2010Actions
Actions

Also available in: Atom PDF