Class: Actions::Katello::BulkAgentAction

Inherits:
BulkAction
  • Object
show all
Defined in:
app/lib/actions/katello/bulk_agent_action.rb

Instance Method Summary collapse

Instance Method Details

#plan(agent_action, hosts, args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/lib/actions/katello/bulk_agent_action.rb', line 4

def plan(agent_action, hosts, args)
  host_ids = hosts.map(&:id)

  histories = ::Katello::Agent::Dispatcher.create_histories(
    host_ids: host_ids
  )

  grouped_histories = {}
  histories.each { |h| grouped_histories[h.host_id] = h.id }
  options = {
    dispatch_histories: grouped_histories,
    type: agent_action.agent_message,
    content: args[:content],
    bulk: true
  }
  super(agent_action, hosts, options)
end

#spawn_plansObject



22
23
24
25
26
27
28
29
30
31
# File 'app/lib/actions/katello/bulk_agent_action.rb', line 22

def spawn_plans
  args = input[:args].first
  histories = ::Katello::Agent::DispatchHistory.where(id: args[:dispatch_histories].slice(*current_batch.map(&:to_s)).values)
  ::Katello::Agent::Dispatcher.dispatch(
    args[:type].to_sym,
    histories,
    content: args[:content]
  )
  super
end