"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/plugins/synced_folders/nfs/action_cleanup.rb" (20 Nov 2020, 795 Bytes) of package /linux/misc/vagrant-2.2.14.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 require "log4r"
    2 
    3 module VagrantPlugins
    4   module SyncedFolderNFS
    5     class ActionCleanup
    6       def initialize(app, env)
    7         @app    = app
    8         @logger = Log4r::Logger.new("vagrant::synced_folders::nfs")
    9       end
   10 
   11       def call(env)
   12         if !env[:nfs_valid_ids]
   13           @logger.warn("nfs_valid_ids not set, cleanup cannot occur")
   14           return @app.call(env)
   15         end
   16 
   17         if !env[:machine].env.host.capability?(:nfs_prune)
   18           @logger.info("Host doesn't support pruning NFS. Skipping.")
   19           return @app.call(env)
   20         end
   21 
   22         @logger.info("NFS pruning. Valid IDs: #{env[:nfs_valid_ids].inspect}")
   23         env[:machine].env.host.capability(
   24           :nfs_prune, env[:machine].ui, env[:nfs_valid_ids])
   25         @app.call(env)
   26       end
   27     end
   28   end
   29 end