Class: Actions::ForemanPatch::Window::Create

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

Instance Method Summary collapse

Instance Method Details

#plan(window_plan, cycle) ⇒ Object



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

def plan(window_plan, cycle)
  action_subject(window_plan, cycle)

  window = cycle.windows.create!(window_plan.to_params)

  sequence do
    concurrence do
      window_plan.groups.each do |group|
        plan_action(Actions::ForemanPatch::Round::Create, group, window)
      end
    end

    plan_action(Actions::ForemanPatch::Window::Publish, window)
  end

  plan_self(window: window.to_action_input)
end

#resource_locksObject



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

def resource_locks
  :link
end

#runObject



28
29
30
# File 'app/lib/actions/foreman_patch/window/create.rb', line 28

def run
  output.update(window: window.to_action_input)
end

#windowObject



32
33
34
# File 'app/lib/actions/foreman_patch/window/create.rb', line 32

def window
  @window = ::ForemanPatch::Window.find(input[:window][:id])
end