class Vagrant::LXC::Action::CompressRootFS

Public Class Methods

new(app, env) click to toggle source
# File lib/vagrant-lxc/action/compress_rootfs.rb, line 7
def initialize(app, env)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/vagrant-lxc/action/compress_rootfs.rb, line 11
def call(env)
  raise Vagrant::Errors::VMPowerOffToPackage if env[:machine].provider.state.id != :stopped

  env[:ui].info I18n.t("vagrant.actions.lxc.compressing_rootfs")
  @rootfs = env['package.rootfs'] = env[:machine].provider.driver.compress_rootfs

  @app.call env

  recover # called to remove the rootfs tarball
end
recover(*) click to toggle source
# File lib/vagrant-lxc/action/compress_rootfs.rb, line 22
def recover(*)
  if @rootfs && File.exist?(@rootfs)
    FileUtils.rm_rf(File.dirname @rootfs)
  end
end