Class: Actions::ForemanPatch::Round::AddMissingHosts
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::ForemanPatch::Round::AddMissingHosts
- Defined in:
- app/lib/actions/foreman_patch/round/add_missing_hosts.rb
Instance Method Summary collapse
Instance Method Details
#plan(round, *hosts) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/lib/actions/foreman_patch/round/add_missing_hosts.rb', line 6 def plan(round, *hosts) hosts = hosts.flatten action_subject(round, hosts: hosts.map(&:to_action_input)) # Don't add already run hosts hosts -= round.cycle.hosts round.group.hosts.where(id: hosts).each do |host| round.invocations.find_or_create_by!(host_id: host.id) end end |