Sha256: d1dc50c3e5638895c6d3c0f38144a52a0e3fcedc79da586996786e4e5cd676a4

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

module Actions
  module ForemanSalt
    if defined? ForemanTasks
      class ReportImport < Actions::EntryAction
        def resource_locks
          :report_import
        end

        def plan(job, proxy_id)
          plan_self(:job_id => job[:job_id], :report => job[:result], :proxy_id => proxy_id)
        end

        def run
          ::User.as_anonymous_admin do
            reports = ::ForemanSalt::ReportImporter.import(input[:report], input[:proxy_id])

            output[:state] = { :message => "Imported #{reports.count} new reports" }
            output[:hosts] = reports.map { |report| report.host.name }
          end
        end

        def humanized_name
          _("Process Highstate Report: #{input[:job_id]}")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_salt-2.0.1 app/lib/actions/foreman_salt/report_import.rb
foreman_salt-2.0.0 app/lib/actions/foreman_salt/report_import.rb