Class: Vagrant::LXC::Action::SetupPackageFiles

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-lxc/action/setup_package_files.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ SetupPackageFiles

Returns a new instance of SetupPackageFiles.



7
8
9
10
11
12
# File 'lib/vagrant-lxc/action/setup_package_files.rb', line 7

def initialize(app, env)
  @app = app

  env["package.include"]     ||= []
  env["package.vagrantfile"] ||= nil
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-lxc/action/setup_package_files.rb', line 14

def call(env)
  @env = env

  create_package_temp_dir
  move_rootfs_to_pkg_dir
  copy_box_files_to_pkg_dir

  @app.call env

  recover # called to cleanup temp directory
end

#recoverObject



26
27
28
29
30
# File 'lib/vagrant-lxc/action/setup_package_files.rb', line 26

def recover(*)
  if @temp_dir && File.exist?(@temp_dir)
    FileUtils.rm_rf(@temp_dir)
  end
end