Class: VagrantPlugins::ProviderVeertu::Action::Export

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Export

Returns a new instance of Export.



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

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("vagrant::provider::veertu_5_0")
end

Instance Method Details

#call(env) ⇒ Object

Raises:

  • (Vagrant::Errors::VMPowerOffToPackage)


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-veertu/action/export.rb', line 12

def call(env)
  @env = env

	  #env[:ui].output(@env[:machine].state.id)
  raise Vagrant::Errors::VMPowerOffToPackage if \
    @env[:machine].state.id != :stopped

  export

  @app.call(env)
end

#exportObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vagrant-veertu/action/export.rb', line 24

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, 100, false)
  end

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

#ovf_pathObject



36
37
38
# File 'lib/vagrant-veertu/action/export.rb', line 36

def ovf_path
  File.join(@env["export.temp_dir"], "box.vmz")
end