Sha256: a2e9a6d2dbed215cbf06d3e17d739f3338ef97808b129229d1e48a7ba3946a5e

Contents?: true

Size: 714 Bytes

Versions: 32

Compression:

Stored size: 714 Bytes

Contents

require "fileutils"

module Vagrant
  module LXC
    module Action
      class CompressRootFS
        def initialize(app, env)
          @app = app
        end

        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

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

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
vagrant-lxc-1.4.3 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.4.2 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.4.1 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-2.1-patch-1.4.0 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.4.0 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.3.1 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.3.0 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.2.4 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.2.3 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.2.2 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.2.1 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.2.0 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.1.0 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.0.1 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.0.0 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.0.0.alpha.3 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.0.0.alpha.2 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-1.0.0.alpha.1 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-0.8.0 lib/vagrant-lxc/action/compress_rootfs.rb
vagrant-lxc-0.7.0 lib/vagrant-lxc/action/compress_rootfs.rb