summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-02-17 17:55:57 -0600
committerLuke Kanies <luke@madstop.com>2009-02-18 22:38:45 -0600
commit2573ef1c4c2d472f9cf41ab3a1b67b7408d704b4 (patch)
tree56a20fea8bed3cf997bcf16fca5fbb98f0f66c9a /lib/puppet
parent9c18d5aa4214f565b81b6cac07736fe072954bb1 (diff)
downloadpuppet-2573ef1c4c2d472f9cf41ab3a1b67b7408d704b4.tar.gz
puppet-2573ef1c4c2d472f9cf41ab3a1b67b7408d704b4.tar.xz
puppet-2573ef1c4c2d472f9cf41ab3a1b67b7408d704b4.zip
Added support for finding modules from an environment
This uses the environment to search for the modules, rather than relying on the Puppet::Module class to know how to handle environments. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/node/environment.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index b64b9c2c4..d4c04469c 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -28,4 +28,21 @@ class Puppet::Node::Environment
def initialize(name)
@name = name
end
+
+ def module(name)
+ Puppet::Module.each_module(self[:modulepath]) do |mod|
+ return mod if mod.name == name
+ end
+
+ return nil
+ end
+
+ # Return all modules from this environment.
+ def modules
+ result = []
+ Puppet::Module.each_module(self[:modulepath]) do |mod|
+ result << mod
+ end
+ result
+ end
end