Sha256: 2c8ae177f77aede8580a48d18304c4e6debc246db97a4d2693dd357672f325ab

Contents?: true

Size: 651 Bytes

Versions: 2

Compression:

Stored size: 651 Bytes

Contents

require "log4r"

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

        def call(env)
          if env[:machine].id
            env[:ui].info(I18n.t("vagrant_openstack.deleting_server"))
            server = env[:openstack_compute].servers.get(env[:machine].id)
            server.destroy
            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-openstack-provider-0.1.1 lib/vagrant-openstack/action/delete_server.rb
vagrant-openstack-provider-0.1 lib/vagrant-openstack/action/delete_server.rb