Sha256: 5187dc1c7808f0171edac6e59668e622e2f270f0721a7ee1a6bd9488dd0b9a3f

Contents?: true

Size: 1.19 KB

Versions: 23

Compression:

Stored size: 1.19 KB

Contents

require "fileutils"
require 'vagrant/util/platform'

module VagrantPlugins
  module ProviderVirtualBox
    module Action
      class Export
        def initialize(app, env)
          @app = app
        end

        def call(env)
          @env = env

          raise Vagrant::Errors::VMPowerOffToPackage if \
            @env[:machine].state.id != :poweroff

          export

          @app.call(env)
        end

        def export
          @env[:ui].info I18n.t("vagrant.actions.vm.export.exporting")
          @env[:machine].provider.driver.export(ovf_path) do |progress|
            @env[:ui].clear_line
            @env[:ui].report_progress(progress.percent, 100, false)
          end

          # Clear the line a final time so the next data can appear
          # alone on the line.
          @env[:ui].clear_line
        end

        def ovf_path
          path = File.join(@env["export.temp_dir"], "box.ovf")

          # If we're within WSL, we should use the correct path rather than
          # the mnt path. GH-9059
          if Vagrant::Util::Platform.wsl?
            path = Vagrant::Util::Platform.wsl_to_windows_path(path)
          end

          return path
        end
      end
    end
  end
end

Version data entries

23 entries across 19 versions & 3 rubygems

Version Path
vagrant-unbundled-2.2.7.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.6.2 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.6.1 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.6.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.5.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.4.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.3.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.2.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.2.0.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.1.4.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.1.2.0 plugins/providers/virtualbox/action/export.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/export.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/export.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/export.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/export.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/export.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.1.1.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.0.4.0 plugins/providers/virtualbox/action/export.rb
vagrant-unbundled-2.0.3.0 plugins/providers/virtualbox/action/export.rb