diff options
author | Luke Kanies <luke@madstop.com> | 2007-10-03 16:32:10 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-10-03 16:32:10 -0500 |
commit | b45a7ca82d9c59d577c2eedb18531f64e55813d1 (patch) | |
tree | aa3dee742340f57315d82101147de530eadbda34 /lib/puppet/module.rb | |
parent | fa643e61c7451c2c46623d2c801a42c6c7640e1e (diff) | |
download | puppet-b45a7ca82d9c59d577c2eedb18531f64e55813d1.tar.gz puppet-b45a7ca82d9c59d577c2eedb18531f64e55813d1.tar.xz puppet-b45a7ca82d9c59d577c2eedb18531f64e55813d1.zip |
Adding more behaviours to the Puppet::Module spec,
and fixing some bugs in the process.
Specifically, modules were no longer correctly handling
fully qualified files, and they do so once again.
Diffstat (limited to 'lib/puppet/module.rb')
-rw-r--r-- | lib/puppet/module.rb | 13 |
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 |