Class: Actions::Staypuft::Host::WaitUntilProvisioned

Inherits:
Base
  • Object
show all
Defined in:
app/lib/actions/staypuft/host/wait_until_provisioned.rb

Instance Method Summary collapse

Instance Method Details

#plan(host) ⇒ Object



21
22
23
# File 'app/lib/actions/staypuft/host/wait_until_provisioned.rb', line 21

def plan(host)
  plan_self host_id: host.id
end

#run(event = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/lib/actions/staypuft/host/wait_until_provisioned.rb', line 25

def run(event = nil)
  case event
  when nil
    suspend do |suspended_action|
      Rails.cache.write(
          ::Staypuft::Concerns::HostOrchestrationBuildHook.cache_id(input[:host_id]),
          { execution_plan_id: suspended_action.execution_plan_id,
            step_id:           suspended_action.step_id })
    end
  when Hash
    output[:installed_at] = event.fetch(:installed_at).to_s
  when Dynflow::Action::Skip
    output[:installed_at] = Time.now.utc.to_s
  else
    raise TypeError
  end
end

#run_progressObject



47
48
49
# File 'app/lib/actions/staypuft/host/wait_until_provisioned.rb', line 47

def run_progress
  0.1
end

#run_progress_weightObject



43
44
45
# File 'app/lib/actions/staypuft/host/wait_until_provisioned.rb', line 43

def run_progress_weight
  4
end