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.



7
8
9
# File 'lib/vagrant-libvirt/action/prune_nfs_exports.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
21
22
23
# File 'lib/vagrant-libvirt/action/prune_nfs_exports.rb', line 11

def call(env)
  if env[:host]
    uuid = env[:machine].id
    # get all uuids
    uuids = env[:libvirt_compute].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