Class: HashiCorp::VagrantVMwareDesktop::Action::Export

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vmware-desktop/action/export.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Export

Returns a new instance of Export.



8
9
10
# File 'lib/vagrant-vmware-desktop/action/export.rb', line 8

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

Raises:

  • (Vagrant::Errors::VMPowerOffToPackage)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vagrant-vmware-desktop/action/export.rb', line 12

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