Sha256: 795cc6bab329e8c6517bea92a7c22abf17fdd5a49c138c71f18ac722bf37dd11

Contents?: true

Size: 686 Bytes

Versions: 1

Compression:

Stored size: 686 Bytes

Contents

class Base::ReadyMachine
  include Interactor

  # @param client
  # @param action_handler
  # @param machine_spec
  def call
    client = context.client
    machine_id = context.machine_spec.reference["server_id"]

    machine = GetMachine.call(*context).machine
    return if machine["state"] == "started"
    context.action_handler.perform_action "Powering up, wait for machine #{machine_id}\n" do
      client.post("server/#{machine_id}/start")
      while machine["state"] != "started"
        Timeout.timeout(60) do
          sleep 5
          client.post("server/#{machine_id}/start")
          machine = GetMachine.call(*context).machine
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chef-provisioning-upcloud-0.2.0 lib/chef/provisioning/interactors/base/ready_machine.rb