Class: Puppet::Network::Handler::FileServer::PluginMount

Inherits:
Mount show all
Defined in:
lib/vendor/puppet/network/handler/fileserver.rb

Overview

A special mount class specifically for the plugins mount – just has some magic to effectively do a union mount of the ‘plugins’ directory of all modules.

Instance Attribute Summary

Attributes inherited from Mount

#name

Instance Method Summary collapse

Methods inherited from Mount

#clientmap, #copy, #expand, #expandable?, #fileobj, #initialize, #localmap, #path=, #properties, #read_file, #reclist, #subdir, #sync, #to_s

Methods inherited from AuthStore

#allow, #allowed?, #deny, #empty?, #globalallow?, #initialize, #interpolate, #reset_interpolation, #to_s

Methods included from Util::Logging

#clear_deprecation_warnings, #deprecation_warning, #send_log

Constructor Details

This class inherits a constructor from Puppet::Network::Handler::FileServer::Mount

Instance Method Details

#file_path(relpath, client = nil) ⇒ Object



699
700
701
702
# File 'lib/vendor/puppet/network/handler/fileserver.rb', line 699

def file_path(relpath, client = nil)
  return nil unless mod = valid_modules(client).find { |m| m.plugin(relpath) }
  mod.plugin(relpath)
end

#list(relpath, recurse, ignore, client = nil) ⇒ Object

create a list of files by merging all modules



705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/vendor/puppet/network/handler/fileserver.rb', line 705

def list(relpath, recurse, ignore, client = nil)
  result = []
  valid_modules(client).each do |mod|
    if modpath = mod.plugin(relpath)
      if FileTest.directory?(modpath) and recurse
        ary = reclist(modpath, recurse, ignore)
        ary ||= []
        result += ary
      else
        result += [["/", File.stat(modpath).ftype]]
      end
    end
  end
  result
end

#mod_file_path(mod, relpath, client = nil) ⇒ Object



695
696
697
# File 'lib/vendor/puppet/network/handler/fileserver.rb', line 695

def mod_file_path(mod, relpath, client = nil)
  File.join(mod, PLUGINS, relpath)
end

#mod_path_exists?(mod, relpath, client = nil) ⇒ Boolean

Returns:

  • (Boolean)


683
684
685
# File 'lib/vendor/puppet/network/handler/fileserver.rb', line 683

def mod_path_exists?(mod, relpath, client = nil)
  ! mod.plugin(relpath).nil?
end

#path(client) ⇒ Object



679
680
681
# File 'lib/vendor/puppet/network/handler/fileserver.rb', line 679

def path(client)
  ''
end

#path_exists?(relpath, client = nil) ⇒ Boolean

Returns:

  • (Boolean)


687
688
689
# File 'lib/vendor/puppet/network/handler/fileserver.rb', line 687

def path_exists?(relpath, client = nil)
  !valid_modules(client).find { |mod| mod.plugin(relpath) }.nil?
end

#valid?Boolean

Returns:

  • (Boolean)


691
692
693
# File 'lib/vendor/puppet/network/handler/fileserver.rb', line 691

def valid?
  true
end