summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/client/master.rb17
-rwxr-xr-xtest/client/master.rb36
2 files changed, 44 insertions, 9 deletions
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb
index 261119bfa..4fe78df11 100644
--- a/lib/puppet/client/master.rb
+++ b/lib/puppet/client/master.rb
@@ -270,12 +270,6 @@ class Puppet::Client::MasterClient < Puppet::Client
end
@objects = nil
- # First create the default scheduling objects
- Puppet::Type.type(:schedule).mkdefaultschedules
-
- # And filebuckets
- Puppet::Type.type(:filebucket).mkdefaultbucket
-
# Now convert the objects to real Puppet objects
@objects = objects.to_type
@@ -317,6 +311,17 @@ class Puppet::Client::MasterClient < Puppet::Client
else
raise ArgumentError, "Configuration timeout must be an integer"
end
+
+ mkdefault_objects
+ end
+
+ # Make the default objects necessary for function.
+ def mkdefault_objects
+ # First create the default scheduling objects
+ Puppet::Type.type(:schedule).mkdefaultschedules
+
+ # And filebuckets
+ Puppet::Type.type(:filebucket).mkdefaultbucket
end
# Mark that we should restart. The Puppet module checks whether we're running,
diff --git a/test/client/master.rb b/test/client/master.rb
index 41e2df111..8a7bf4f8b 100755
--- a/test/client/master.rb
+++ b/test/client/master.rb
@@ -160,9 +160,6 @@ class TestMasterClient < Test::Unit::TestCase
assert($methodsrun.include?(method), "method %s was not run" % method)
end
assert(! $methodsrun.include?(:getplugins), "plugins were synced even tho disabled")
- # Make sure we've got schedules
- assert(Puppet::Type.type(:schedule)["hourly"], "Could not retrieve hourly schedule")
- assert(Puppet::Type.type(:filebucket)["puppet"], "Could not retrieve default bucket")
# Now set pluginsync
Puppet[:pluginsync] = true
@@ -498,6 +495,39 @@ end
assert_equal(time, master.compile_time, "time was not retrieved from cache")
assert(FileTest.exists?(file), "file was not created on second run")
end
+
+ def test_default_objects
+ # Make sure they start out missing
+ assert_nil(Puppet::Type.type(:filebucket)["puppet"],
+ "default filebucket already exists")
+ assert_nil(Puppet::Type.type(:schedule)["daily"],
+ "default schedules already exists")
+
+ master = mkclient()
+
+ # Now make sure they got created
+ assert(Puppet::Type.type(:filebucket)["puppet"],
+ "default filebucket not found")
+ assert(Puppet::Type.type(:schedule)["daily"],
+ "default schedules not found")
+
+ # clear everything, and make sure we can recreate them
+ Puppet::Type.allclear
+ assert_nil(Puppet::Type.type(:filebucket)["puppet"],
+ "default filebucket not removed")
+ assert_nil(Puppet::Type.type(:schedule)["daily"],
+ "default schedules not removed")
+ assert_nothing_raised { master.mkdefault_objects }
+ assert(Puppet::Type.type(:filebucket)["puppet"],
+ "default filebucket not found")
+ assert(Puppet::Type.type(:schedule)["daily"],
+ "default schedules not found")
+
+
+ # Make sure we've got schedules
+ assert(Puppet::Type.type(:schedule)["hourly"], "Could not retrieve hourly schedule")
+ assert(Puppet::Type.type(:filebucket)["puppet"], "Could not retrieve default bucket")
+ end
end
# $Id$