Sha256: 2ddad2ee6505c995838b304bdf9068fa8e32acbef4e4de81e7b20175df6502fc

Contents?: true

Size: 946 Bytes

Versions: 17

Compression:

Stored size: 946 Bytes

Contents

module Veewee
  module Provider
    module Kvm
      module BoxCommand
        # Destroy a vm
        def destroy(options={})
          unless exists_vm? or exists_volume?
            env.ui.error "Error:: You tried to destroy a non-existing box '#{name}'"
            raise Veewee::Error,"Error:: You tried to destroy a non-existing box '#{name}'"
          end

          self.poweroff if running?
          destroy_vm if exists_vm?

          vol_exists = exists_volume?
          env.logger.info "Volume exists?: #{vol_exists}"
          destroy_volume if vol_exists
        end

        def destroy_vm
          matched_servers=@connection.servers.all(:name => name)
          matched_servers.first.destroy() unless matched_servers.nil?
        end

        def destroy_volume
          @connection.volumes.all(:name => @volume_name).first.destroy
        end
      end # End Module

    end # End Module
  end # End Module
end # End Module

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
veewee-0.5.0.alpha4 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.5.0.alpha3 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.5.0.alpha2 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.5.0.alpha1 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.5.1 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.5 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.5.pre1 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.4 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.3 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.2 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.1 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.4.0 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.3.12 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.3.11 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.3.10 lib/veewee/provider/kvm/box/destroy.rb
veewee-0.3.9 lib/veewee/provider/kvm/box/destroy.rb
veewee-atlassian-0.3.11 lib/veewee/provider/kvm/box/destroy.rb