Sha256: 75ad383baa00796d147301ce614b9f165444cdd93ba83d834709b1a51f904f5d

Contents?: true

Size: 942 Bytes

Versions: 18

Compression:

Stored size: 942 Bytes

Contents

module Vagrant
  class Action
    module VM
      class Import
        def initialize(app, env)
          @app = app
        end

        def call(env)
          env.ui.info I18n.t("vagrant.actions.vm.import.importing", :name => env.env.box.name)

          # Import the virtual machine
          env.env.vm.vm = VirtualBox::VM.import(env.env.box.ovf_file.to_s) do |progress|
            env.ui.report_progress(progress.percent, 100, false)
          end

          # Flag as erroneous and return if import failed
          raise Errors::VMImportFailure.new if !env["vm"].vm

          # Import completed successfully. Continue the chain
          @app.call(env)
        end

        def recover(env)
          if env["vm"].created?
            return if env["vagrant.error"].is_a?(Errors::VagrantError)

            # Interrupted, destroy the VM
            env["actions"].run(:destroy)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
vagrantup-0.6.8 lib/vagrant/action/vm/import.rb
vagrantup-0.6.7 lib/vagrant/action/vm/import.rb
vagrantup-0.6.6 lib/vagrant/action/vm/import.rb
vagrantup-0.6.5 lib/vagrant/action/vm/import.rb
vagrantup-0.6.4 lib/vagrant/action/vm/import.rb
vagrantup-0.6.3 lib/vagrant/action/vm/import.rb
vagrantup-0.6.2 lib/vagrant/action/vm/import.rb
vagrantup-0.6.1 lib/vagrant/action/vm/import.rb
vagrantup-0.6.0 lib/vagrant/action/vm/import.rb
vagrant-0.6.8 lib/vagrant/action/vm/import.rb
vagrant-0.6.7 lib/vagrant/action/vm/import.rb
vagrant-0.6.6 lib/vagrant/action/vm/import.rb
vagrant-0.6.5 lib/vagrant/action/vm/import.rb
vagrant-0.6.4 lib/vagrant/action/vm/import.rb
vagrant-0.6.3 lib/vagrant/action/vm/import.rb
vagrant-0.6.2 lib/vagrant/action/vm/import.rb
vagrant-0.6.1 lib/vagrant/action/vm/import.rb
vagrant-0.6.0 lib/vagrant/action/vm/import.rb