Sha256: 9ab11946ade59e7219d5db62be80c578d241c9cbc9d66ff2a1b3d3728059f5be

Contents?: true

Size: 1013 Bytes

Versions: 23

Compression:

Stored size: 1013 Bytes

Contents

# frozen_string_literal: true

require 'vagrant-libvirt/util/nfs'
require 'yaml'

module VagrantPlugins
  module ProviderLibvirt
    module Action
      class PruneNFSExports
        include VagrantPlugins::ProviderLibvirt::Util::Nfs

        def initialize(app, _env)
          @logger = Log4r::Logger.new('vagrant_libvirt::action::prune_nfs_exports')
          @app = app
        end

        def call(env)
          @machine = env[:machine]

          if using_nfs?
            @logger.info('Using NFS, prunning NFS settings from host')
            if env[:host]
              uuid = env[:machine].id
              # get all uuids
              uuids = env[:machine].provider.driver.connection.servers.all.map(&:id)
              # not exiisted in array will removed from nfs
              uuids.delete(uuid)
              env[:host].capability(
                :nfs_prune, env[:machine].ui, uuids
              )
            end
          end

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
vagrant-libvirt-0.12.2 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.12.1 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.12.0 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.11.2 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.11.1 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.8 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.7 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.6 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.5 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.4 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.3 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.2 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.1 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.10.0 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.9.0 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.8.2 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.8.1 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.8.0 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.7.0 lib/vagrant-libvirt/action/prune_nfs_exports.rb
vagrant-libvirt-0.6.3 lib/vagrant-libvirt/action/prune_nfs_exports.rb