summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-11-15 21:29:18 -0600
committerLuke Kanies <luke@madstop.com>2007-11-15 21:29:18 -0600
commit9290cc89a2206fb5204578f8e91208857a48b147 (patch)
tree60eccb1ac688e6a9ca618155cdc141a23e6f6498 /lib/puppet/network
parentffb4c2dbc7314b364d25e4f7be599ef05b767b44 (diff)
downloadpuppet-9290cc89a2206fb5204578f8e91208857a48b147.tar.gz
puppet-9290cc89a2206fb5204578f8e91208857a48b147.tar.xz
puppet-9290cc89a2206fb5204578f8e91208857a48b147.zip
Modifying how default resources are created; they are now
added to the configuration by the master client, rather than by the creating types.
Diffstat (limited to 'lib/puppet/network')
-rw-r--r--lib/puppet/network/client/master.rb21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb
index 2b0c99d33..691681f9e 100644
--- a/lib/puppet/network/client/master.rb
+++ b/lib/puppet/network/client/master.rb
@@ -49,15 +49,6 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
Puppet.settings[:dynamicfacts].split(/\s*,\s*/).collect { |fact| fact.downcase }
end
- # Add our default resources to the configuration.
- def add_default_resources(configuration)
- # First create the default scheduling objects
- Puppet::Type.type(:schedule).add_default_schedules(configuration)
-
- # And filebuckets
- Puppet::Type.type(:filebucket).add_default_filebucket(configuration)
- end
-
# Cache the config
def cache(text)
Puppet.info "Caching configuration at %s" % self.cachefile
@@ -558,6 +549,18 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
private
+ # Add our default resources to the configuration.
+ def add_default_resources(configuration)
+ # These are the only two resource types with default resources.
+ # We should probably iterate across all of them, but I think that's
+ # unnecessarily expensive at this point.
+ [:schedule, :filebucket].each do |resource_type|
+ Puppet::Type.type(resource_type).create_default_resources.each do |resource|
+ configuration.add_resource(resource) unless configuration.resource(resource_type, resource.title)
+ end
+ end
+ end
+
# Use our cached config, optionally specifying whether this is
# necessary because of a failure.
def use_cached_config(because_of_failure = false)