Sha256: b35d3eb9d258703833779a526ea8c23cf2eaad5040d9dbee53b76f04315e82ae

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

class Base::StopMachine
  include Interactor

  # @param client
  # @param action_handler
  # @param machine_spec
  def call
    machine_id = context.machine_spec.reference["server_id"]
    context.action_handler.perform_action "Power off machine #{machine_id}\n" do
      context.client.post("server/#{machine_id}/stop")
    end

    machine = GetMachine.call(*context).machine
    while machine["state"] != "stopped"
      Timeout.timeout(60) do
        sleep 20
        machine = GetMachine.call(*context).machine
      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/stop_machine.rb