class HashiCorp::VagrantVMwareDesktop::Action::Export

Public Class Methods

new(app, env) click to toggle source
# File lib/vagrant-vmware-desktop/action/export.rb, line 5
def initialize(app, env)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/vagrant-vmware-desktop/action/export.rb, line 9
def call(env)
  @env = env

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

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

  if Vagrant::Util::Platform.respond_to?(:wsl?) && Vagrant::Util::Platform.wsl?
    path = Vagrant::Util::Platform.wsl_to_windows_path(path)
  end

  @env[:ui].info I18n.t("vagrant.actions.vm.export.exporting")
  @env[:machine].provider.driver.export(path)

  @app.call(env)
end