Sha256: 138294138ae12548d0e6527b40d000c40b97b6526143a5ee38cb167b6a0fe03a

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

module Vagrant
  module LXC
    module Action
      class RemoveTemporaryFiles
        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant::lxc::action::remove_tmp_files")
        end

        def call(env)
          @logger.debug 'Removing temporary files'
          driver = env[:machine].provider.driver
          # To prevent host-side data loss, it's important that all mounts under /tmp are unmounted
          # before we proceed with the `rm -rf` operation. See #68 and #360.
          driver.attach("findmnt -R /tmp -o TARGET --list --noheadings | xargs -L 1 --no-run-if-empty umount")
          driver.attach("rm -rf /tmp/*")

          @app.call env
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-lxc-1.3.0 lib/vagrant-lxc/action/remove_temporary_files.rb