Sha256: c7a18a48e30ae49ffe29c863cedbf095d485f6b7a473981fa6c651d29f6f7537

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

module ForemanHostRundeck
  module HostsControllerExtensions
    extend ActiveSupport::Concern

    included do
      alias_method_chain :index, :rundeck
      alias_method_chain :show, :rundeck
    end

    def index_with_rundeck(title = nil)
      if params[:format] == 'yaml'
        result = {}
        hosts = resource_base.search_for(params[:search], :order => params[:order]).includes(included_associations)
        hosts.each { |h| result.update(RundeckFormatter.new(h).output) }
        render :text => result.to_yaml
      else
        index_without_rundeck(title)
      end
    end

    def show_with_rundeck
      if params[:format] == 'yaml'
        render :text => RundeckFormatter.new(@host, params[:add_enc_output]).output.to_yaml
      else
        show_without_rundeck
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_host_rundeck-0.0.3 app/controllers/concerns/foreman_host_rundeck/hosts_controller_extensions.rb