diff options
author | Luke Kanies <luke@madstop.com> | 2007-09-06 20:50:26 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-09-06 20:50:26 -0500 |
commit | caad11a9d15210017f75918b50184bc12f2cc1d0 (patch) | |
tree | 27e3262179eb45017ef27b93b2ce492c321cf331 | |
parent | 7abc78ad25979c62b585127a8f2a32c55e96819f (diff) | |
download | puppet-caad11a9d15210017f75918b50184bc12f2cc1d0.tar.gz puppet-caad11a9d15210017f75918b50184bc12f2cc1d0.tar.xz puppet-caad11a9d15210017f75918b50184bc12f2cc1d0.zip |
Fixing some broken tests in the master client, and adding a test for #800 but it is unfortunately disabled because we cannot realistically fix it using the current design. It will be easy after the REST refactor, though.
-rw-r--r-- | lib/puppet/metatype/metaparams.rb | 2 | ||||
-rw-r--r-- | lib/puppet/network/client/master.rb | 2 | ||||
-rw-r--r-- | lib/puppet/network/handler/master.rb | 15 | ||||
-rwxr-xr-x | test/network/client/master.rb | 53 |
4 files changed, 38 insertions, 34 deletions
diff --git a/lib/puppet/metatype/metaparams.rb b/lib/puppet/metatype/metaparams.rb index 0e31bb41c..92f12e6cb 100644 --- a/lib/puppet/metatype/metaparams.rb +++ b/lib/puppet/metatype/metaparams.rb @@ -274,7 +274,7 @@ class Puppet::Type # nil. unless object self.fail "Could not retrieve dependency '%s[%s]' of %s" % - [tname.to_s.capitalize, self.ref, name] + [tname.to_s.capitalize, @resource.ref, name] end # Are we requiring them, or vice versa? See the method docs diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index b9f77f61d..c6d7cd75d 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -694,5 +694,3 @@ class Puppet::Network::Client::Master < Puppet::Network::Client sleep(time) end end - -# $Id$ diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb index 18f37ca4a..c8db277ba 100644 --- a/lib/puppet/network/handler/master.rb +++ b/lib/puppet/network/handler/master.rb @@ -43,7 +43,7 @@ class Puppet::Network::Handler @local = false end - args[:Local] = local? + args[:Local] = true if hash.include?(:CA) and hash[:CA] @ca = Puppet::SSLCertificates::CA.new() @@ -77,17 +77,16 @@ class Puppet::Network::Handler fact_handler.set(client, facts) # And get the configuration from the config handler - config = config_handler.configuration(client) + begin + config = config_handler.configuration(client) + rescue => detail + puts detail.backtrace + raise + end return translate(config.extract) end - def local=(val) - @local = val - config_handler.local = val - fact_handler.local = val - end - private # Manipulate the client name as appropriate. diff --git a/test/network/client/master.rb b/test/network/client/master.rb index 7896d4019..a29254d16 100755 --- a/test/network/client/master.rb +++ b/test/network/client/master.rb @@ -45,30 +45,23 @@ class TestMasterClient < Test::Unit::TestCase @master = Puppet::Network::Client.master end - def mkmaster(file = nil) - master = nil - - file ||= mktestmanifest() + def mkmaster(options = {}) + options[:UseNodes] = false + options[:Local] = true + unless options[:Code] + options[:Manifest] ||= mktestmanifest + end # create our master - assert_nothing_raised() { - # this is the default server setup - master = Puppet::Network::Handler.master.new( - :Manifest => file, - :UseNodes => false, - :Local => true - ) - } + # this is the default server setup + master = Puppet::Network::Handler.master.new(options) return master end def mkclient(master = nil) master ||= mkmaster() - client = nil - assert_nothing_raised() { - client = Puppet::Network::Client.master.new( - :Master => master - ) - } + client = Puppet::Network::Client.master.new( + :Master => master + ) return client end @@ -183,7 +176,7 @@ class TestMasterClient < Test::Unit::TestCase FileUtils.mkdir_p(Puppet[:statedir]) manifest = mktestmanifest - master = mkmaster(manifest) + master = mkmaster(:Manifest => manifest) client = mkclient(master) @@ -448,7 +441,7 @@ end manifest = tempfile() File.open(manifest, "w") { |f| f.puts "file { '#{file}': content => yay }" } - driver = mkmaster(manifest) + driver = mkmaster(:Manifest => manifest) driver.local = false master = mkclient(driver) @@ -532,7 +525,6 @@ end master.local = false driver = master.send(:instance_variable_get, "@driver") driver.local = false - driver.send(:config_handler).local = false # Retrieve the configuration master.getconfig @@ -720,6 +712,21 @@ end client.run end end -end -# $Id$ + # #800 -- we cannot fix this using the current design. + def disabled_test_invalid_relationships_do_not_get_cached + # Make a master with an invalid relationship + master = mkmaster :Code => "notify { one: require => File[yaytest] }" + master.local = false # so it gets cached + client = mkclient(master) + client.local = false + + client.getconfig + # Doesn't throw an exception, but definitely fails. + client.apply + + # Make sure the config is not cached. + config = Puppet.config[:localconfig] + ".yaml" + assert(! File.exists?(config), "Cached an invalid configuration") + end +end |