Class: Actions::Staypuft::Host::TriggerProvisioning

Inherits:
Dynflow::Action
  • Object
show all
Defined in:
app/lib/actions/staypuft/host/trigger_provisioning.rb

Instance Method Summary collapse

Instance Method Details

#plan(host) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/lib/actions/staypuft/host/trigger_provisioning.rb', line 20

def plan(host)
  fail 'cannot provision unmanaged host' unless host.managed?

  sequence do
    # set the env to 'provisioning' to avoid compiling the
    # production catalog when actually not applying it, which
    # might cause errors
    plan_action Actions::Staypuft::Host::Update, host,
                :environment_id => Environment.get_or_create_provisioning.id
    plan_self host_id: host.id
  end
end

#runObject



33
34
35
36
37
38
39
40
# File 'app/lib/actions/staypuft/host/trigger_provisioning.rb', line 33

def run
  host = ::Host.find(input[:host_id])
  host.expire_token
  host.set_token
  host.save!
  host.send :setTFTP
  restart host
end