Sha256: c3f332b22ce806bb892a306eea0a2694691e292f3a370a974f79488fe1913bcc

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 Bytes

Contents

#
# Author:: Mohit Sethi (<mohit@sethis.in>)
# Copyright:: Copyright (c) 2013 Mohit Sethi.
#

require "log4r"

module VagrantPlugins
  module HP
    module Action
      # This deletes the running server, if there is one.
      class HaltServer
        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant_hp::action::delete_server")
        end

        def call(env)
          if env[:machine].id
            @logger.info(I18n.t("vagrant_hp.deleting_server"))
            server = env[:hp_compute].servers.get(env[:machine].id)
            server.stop # verify this
            env[:machine].id = nil
          end
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-hp-0.1.2 lib/vagrant-hp/action/halt_server.rb
vagrant-hp-0.1.1 lib/vagrant-hp/action/halt_server.rb