summaryrefslogtreecommitdiffstats
path: root/lib/puppet/module.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-05 00:08:15 -0500
committerLuke Kanies <luke@madstop.com>2007-10-05 00:08:15 -0500
commit275af562b462813ddf5ddbad2192ddc2bf57770c (patch)
treeaceabf68095b8c34fd599f245022a9aaab0984da /lib/puppet/module.rb
parentce0178316d8cefd072f53d39b59ce47332f6ec8f (diff)
parent29accba1b9343f4967c15d36506b3bf60d5f0f9c (diff)
downloadpuppet-275af562b462813ddf5ddbad2192ddc2bf57770c.tar.gz
puppet-275af562b462813ddf5ddbad2192ddc2bf57770c.tar.xz
puppet-275af562b462813ddf5ddbad2192ddc2bf57770c.zip
Merge branch 'routing' of http://git.rickbradley.com/puppet into routing
Diffstat (limited to 'lib/puppet/module.rb')
-rw-r--r--lib/puppet/module.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
index dc30d8167..45860c74d 100644
--- a/lib/puppet/module.rb
+++ b/lib/puppet/module.rb
@@ -27,8 +27,8 @@ class Puppet::Module
return nil
end
- modpath = modulepath(environment).collect { |p|
- File::join(p, modname)
+ modpath = modulepath(environment).collect { |path|
+ File::join(path, modname)
}.find { |f| File::directory?(f) }
return nil unless modpath
@@ -72,10 +72,9 @@ class Puppet::Module
# Otherwise, try to find manifests matching +pat+ relative to +cwd+
def self.find_manifests(start, options = {})
cwd = options[:cwd] || Dir.getwd
- path, pat = split_path(start)
- mod = find(path, options[:environment])
- if mod
- return mod.manifests(pat)
+ module_name, pattern = split_path(start)
+ if module_name and mod = find(module_name, options[:environment])
+ return mod.manifests(pattern)
else
abspat = File::expand_path(start, cwd)
files = Dir.glob(abspat).reject { |f| FileTest.directory?(f) }
@@ -87,6 +86,8 @@ class Puppet::Module
end
# Split the path into the module and the rest of the path.
+ # This method can and often does return nil, so anyone calling
+ # it needs to handle that.
def self.split_path(path)
if path =~ %r/^#{File::SEPARATOR}/
return nil