Class: Actions::ForemanPatch::Round::Create

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/foreman_patch/round/create.rb

Instance Method Summary collapse

Instance Method Details

#plan(group, window) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/lib/actions/foreman_patch/round/create.rb', line 10

def plan(group, window)
  action_subject(group, window)

  round = window.rounds.create!({
    group: group,
    name: group.name,
    description: group.description,
    priority: group.priority,
    max_unavailable: group.max_unavailable,
  })

  plan_self(round: round.to_action_input)
  plan_action(Actions::ForemanPatch::Round::ResolveHosts, round)
end

#resource_locksObject



6
7
8
# File 'app/lib/actions/foreman_patch/round/create.rb', line 6

def resource_locks
  :link
end

#roundObject



29
30
31
# File 'app/lib/actions/foreman_patch/round/create.rb', line 29

def round
  @round = ::ForemanPatch::Round.find(input[:round][:id])
end

#runObject



25
26
27
# File 'app/lib/actions/foreman_patch/round/create.rb', line 25

def run
  output[:round] = round.to_action_input
end