diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2011-03-25 14:34:18 -0700 |
|---|---|---|
| committer | Luke Kanies <luke@puppetlabs.com> | 2011-03-25 14:34:18 -0700 |
| commit | de2e84eb93416cebe6d5a92ee88ba9c98cd52661 (patch) | |
| tree | 9f3965b14998a7f26ace494a211cac01a10999bb /lib/puppet/parser | |
| parent | 072baff5b5cec91d31a581d416225b70f425b2f0 (diff) | |
| parent | e16a38349c596c4a6ea682173e0cc704dedc98a7 (diff) | |
| download | puppet-de2e84eb93416cebe6d5a92ee88ba9c98cd52661.tar.gz puppet-de2e84eb93416cebe6d5a92ee88ba9c98cd52661.tar.xz puppet-de2e84eb93416cebe6d5a92ee88ba9c98cd52661.zip | |
Merge branch 'tickets/master/6850-resource_type_listing_and_converting' into next
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/type_loader.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/puppet/parser/type_loader.rb b/lib/puppet/parser/type_loader.rb index 140c9f2ca..1fba73d0b 100644 --- a/lib/puppet/parser/type_loader.rb +++ b/lib/puppet/parser/type_loader.rb @@ -92,6 +92,34 @@ class Puppet::Parser::TypeLoader end end + def import_all + require 'find' + + module_names = [] + # Collect the list of all known modules + environment.modulepath.each do |path| + Dir.chdir(path) do + Dir.glob("*").each do |dir| + next unless FileTest.directory?(dir) + module_names << dir + end + end + end + + module_names.uniq! + # And then load all files from each module, but (relying on system + # behavior) only load files from the first module of a given name. E.g., + # given first/foo and second/foo, only files from first/foo will be loaded. + module_names.each do |name| + mod = Puppet::Module.new(name, environment) + Find.find(File.join(mod.path, "manifests")) do |path| + if path =~ /\.pp$/ or path =~ /\.rb$/ + import(path) + end + end + end + end + def known_resource_types environment.known_resource_types end |
