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

Inherits:
Mount show all
Defined in:
lib/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

#send_log

Constructor Details

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

Instance Method Details

#file_path(relpath, client = nil) ⇒ Object



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

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



700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
# File 'lib/puppet/network/handler/fileserver.rb', line 700

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



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

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

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

Returns:

  • (Boolean)


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

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

#path(client) ⇒ Object



674
675
676
# File 'lib/puppet/network/handler/fileserver.rb', line 674

def path(client)
  ''
end

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

Returns:

  • (Boolean)


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

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

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  true
end