Class: VagrantPlugins::ProviderLibvirt::Action::PruneNFSExports

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-libvirt/action/prune_nfs_exports.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ PruneNFSExports

Returns a new instance of PruneNFSExports.



6
7
8
# File 'lib/vagrant-libvirt/action/prune_nfs_exports.rb', line 6

def initialize(app, _env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-libvirt/action/prune_nfs_exports.rb', line 10

def call(env)
  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

  @app.call(env)
end