From b9dd7ee7e2bf296a8551942c12d6b69624b4457f Mon Sep 17 00:00:00 2001 From: luke Date: Thu, 19 Jul 2007 18:12:20 +0000 Subject: [PATCH] The first round of bug-fixes in preparation for beaker git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2714 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/metatype/providers.rb | 5 +++++ lib/puppet/parser/ast/collexpr.rb | 6 ++++-- lib/puppet/provider/host/netinfo.rb | 1 - test/language/functions.rb | 8 ++++---- test/ral/providers/package/apt.rb | 12 ++++++++++++ 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/lib/puppet/metatype/providers.rb b/lib/puppet/metatype/providers.rb index 652c3c683..8210dd382 100644 --- a/lib/puppet/metatype/providers.rb +++ b/lib/puppet/metatype/providers.rb @@ -114,6 +114,11 @@ class Puppet::Type def self.provide(name, options = {}, &block) name = Puppet::Util.symbolize(name) + if obj = @providers[name] + Puppet.debug "Reloading %s %s provider" % [name, self.name] + unprovide(name) + end + parent = if pname = options[:parent] options.delete(:parent) if pname.is_a? Class diff --git a/lib/puppet/parser/ast/collexpr.rb b/lib/puppet/parser/ast/collexpr.rb index e9f2e63e0..5fb11c709 100644 --- a/lib/puppet/parser/ast/collexpr.rb +++ b/lib/puppet/parser/ast/collexpr.rb @@ -44,8 +44,10 @@ class CollExpr < AST::Branch case @oper when "and", "or": - raise Puppet::ParseError, "Puppet does not currently support collecting exported resources with more than one condition" - #oper = @oper.upcase + if form == :exported + raise Puppet::ParseError, "Puppet does not currently support collecting exported resources with more than one condition" + end + oper = @oper.upcase when "==": oper = "=" else oper = @oper diff --git a/lib/puppet/provider/host/netinfo.rb b/lib/puppet/provider/host/netinfo.rb index dfdc4b447..97a3b99e7 100644 --- a/lib/puppet/provider/host/netinfo.rb +++ b/lib/puppet/provider/host/netinfo.rb @@ -1,7 +1,6 @@ # Manage NetInfo POSIX objects. Probably only used on OS X, but I suppose # it could be used elsewhere. require 'puppet/provider/nameservice/netinfo' -require 'puppet/provider/host/netinfo' Puppet::Type.type(:host).provide :netinfo, :parent => Puppet::Provider::NameService::NetInfo, :netinfodir => "machines" do diff --git a/test/language/functions.rb b/test/language/functions.rb index 2d882382d..34207de17 100755 --- a/test/language/functions.rb +++ b/test/language/functions.rb @@ -398,17 +398,17 @@ class TestLangFunctions < Test::Unit::TestCase interp = mkinterp scope = mkscope(:interp => interp) - fun = interp.newdefine("fun::test") + fun = interp.newdefine("yay::ness") foo = interp.newdefine("foo::bar") search = Puppet::Parser::Functions.function(:search) assert_nothing_raised do - scope.function_search(["foo", "fun"]) + scope.function_search(["foo", "yay"]) end ffun = ffoo = nil - assert_nothing_raised do - ffun = scope.finddefine("test") + assert_nothing_raised("Search path change did not work") do + ffun = scope.finddefine("ness") ffoo = scope.finddefine('bar') end diff --git a/test/ral/providers/package/apt.rb b/test/ral/providers/package/apt.rb index a56233c0b..a82f1bc3a 100755 --- a/test/ral/providers/package/apt.rb +++ b/test/ral/providers/package/apt.rb @@ -66,6 +66,12 @@ class AptPackageProviderTest < PuppetTest::TestCase '--purge', 'faff' ).returns(0) + pkg.provider.expects( + :dpkg + ).with( + '--purge', + 'faff' + ).returns(0) pkg.evaluate.each { |state| state.transaction = self; state.forward } end @@ -134,6 +140,12 @@ class AptPackageProviderTest < PuppetTest::TestCase '--purge', 'faff' ).returns(0) + pkg.provider.expects( + :dpkg + ).with( + '--purge', + 'faff' + ).returns(0) pkg.evaluate.each { |state| state.transaction = self; state.forward } end