diff options
author | Michael V. O'Brien <michael@reductivelabs.com> | 2007-09-25 12:00:07 -0500 |
---|---|---|
committer | Michael V. O'Brien <michael@reductivelabs.com> | 2007-09-25 12:00:07 -0500 |
commit | ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3 (patch) | |
tree | 8c8960cac1d7b3e8b48e44163062be3b3f4c201f /lib/puppet/util/instance_loader.rb | |
parent | f8ab62b212788a4591276c95b5f67217f7517e4e (diff) | |
parent | ffaa8ce07979f4db860950fa9be08ca37964206f (diff) | |
download | puppet-ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3.tar.gz puppet-ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3.tar.xz puppet-ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3.zip |
Merge branch 'master' of git://reductivelabs.com/puppet
Diffstat (limited to 'lib/puppet/util/instance_loader.rb')
-rwxr-xr-x | lib/puppet/util/instance_loader.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/util/instance_loader.rb b/lib/puppet/util/instance_loader.rb index 1a64c9c69..f280014eb 100755 --- a/lib/puppet/util/instance_loader.rb +++ b/lib/puppet/util/instance_loader.rb @@ -5,6 +5,12 @@ require 'puppet/util' # of Puppet::Util::Autoload module Puppet::Util::InstanceLoader include Puppet::Util + + # Are we instance-loading this type? + def instance_loading?(type) + defined?(@autoloaders) and @autoloaders.include?(symbolize(type)) + end + # Define a new type of autoloading. def instance_load(type, path, options = {}) @autoloaders ||= {} @@ -54,7 +60,7 @@ module Puppet::Util::InstanceLoader # Retrieve an alread-loaded instance, or attempt to load our instance. def loaded_instance(type, name) name = symbolize(name) - instances = instance_hash(type) + return nil unless instances = instance_hash(type) unless instances.include? name if instance_loader(type).load(name) unless instances.include? name @@ -70,5 +76,3 @@ module Puppet::Util::InstanceLoader instances[name] end end - -# $Id$ |