Class: Vagrant::LXC::Action::CompressRootFS
- Inherits:
-
Object
- Object
- Vagrant::LXC::Action::CompressRootFS
- Defined in:
- lib/vagrant-lxc/action/compress_rootfs.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ CompressRootFS
constructor
A new instance of CompressRootFS.
- #recover ⇒ Object
Constructor Details
#initialize(app, env) ⇒ CompressRootFS
Returns a new instance of CompressRootFS.
7 8 9 |
# File 'lib/vagrant-lxc/action/compress_rootfs.rb', line 7 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# 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 ⇒ Object
22 23 24 25 26 |
# 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 |