[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Luke Kanies luke at reductivelabs.com
Wed Jul 14 10:29:39 UTC 2010


The following commit has been merged in the upstream branch:
commit 740fd6b301af89ab3aad89bca183ad1fcdc24ac4
Merge: 8971d8beae2c409f9052f27c3f80ad3bdfff4de2 4a06379f8770c164e42bcc410d874076c6e95f24
Author: Luke Kanies <luke at reductivelabs.com>
Date:   Mon Dec 21 16:23:44 2009 -0800

    Merge branch '0.25.x'
    
    Conflicts:
    	lib/puppet/agent.rb
    	lib/puppet/application/puppetd.rb
    	lib/puppet/parser/ast/leaf.rb
    	lib/puppet/util/rdoc/parser.rb

diff --combined lib/puppet/agent.rb
index 7bd9741,7896605..0960737
--- a/lib/puppet/agent.rb
+++ b/lib/puppet/agent.rb
@@@ -48,16 -48,14 +48,16 @@@ class Puppet::Agen
              return
          end
          splay
 +        result = nil
          with_client do |client|
              begin
 -                sync.synchronize { lock { client.run(*args) } }
 +                sync.synchronize { lock { result = client.run(*args) } }
-             rescue => detail
+             rescue Exception => detail
                  puts detail.backtrace if Puppet[:trace]
                  Puppet.err "Could not run %s: %s" % [client_class, detail]
              end
          end
 +        result
      end
  
      def stop
@@@ -124,7 -122,7 +124,7 @@@
      def with_client
          begin
              @client = client_class.new
-         rescue => detail
+         rescue Exception => detail
              puts detail.backtrace if Puppet[:trace]
              Puppet.err "Could not create instance of %s: %s" % [client_class, detail]
              return
diff --combined lib/puppet/application/puppetd.rb
index c1f7331,37a5d00..9302cf1
--- a/lib/puppet/application/puppetd.rb
+++ b/lib/puppet/application/puppetd.rb
@@@ -21,7 -21,6 +21,7 @@@ Puppet::Application.new(:puppetd) d
          {
              :waitforcert => 120,  # Default to checking for certs every 5 minutes
              :onetime => false,
 +            :detailed_exitcodes => false,
              :verbose => false,
              :debug => false,
              :centrallogs => false,
@@@ -66,10 -65,6 +66,10 @@@
          options[:waitforcert] = 0 unless @explicit_waitforcert
      end
  
 +    option("--detailed-exitcodes") do |arg|
 +        options[:detailed_exitcodes] = true
 +    end
 +
      option("--logdest DEST", "-l DEST") do |arg|
          begin
              Puppet::Util::Log.newdestination(arg)
@@@ -100,25 -95,19 +100,25 @@@
          unless options[:client]
              $stderr.puts "onetime is specified but there is no client"
              exit(43)
 +            return
          end
  
          @daemon.set_signal_traps
  
          begin
 -            @agent.run
 +            report = @agent.run
          rescue => detail
              if Puppet[:trace]
                  puts detail.backtrace
              end
              Puppet.err detail.to_s
          end
 -        exit(0)
 +
 +        if not Puppet[:noop] and options[:detailed_exitcodes] then
 +            exit(report.exit_status)
 +        else
 +            exit(0)
 +        end
      end
  
      command(:main) do
@@@ -136,8 -125,7 +136,8 @@@
          Puppet.settings.handlearg("--no-daemonize")
          options[:verbose] = true
          options[:onetime] = true
 +        options[:detailed_exitcodes] = true
-         options[:waitforcert] = 0
+         options[:waitforcert] = 0 unless @explicit_waitforcert
      end
  
      # Handle the logging settings.
@@@ -172,13 -160,6 +172,6 @@@
              exit(14)
          end
  
-         # FIXME: we should really figure out how to distribute the CRL
-         # to clients. In the meantime, we just disable CRL checking if
-         # the CRL file doesn't exist
-         unless File::exist?(Puppet[:cacrl])
-             Puppet[:cacrl] = 'false'
-         end
- 
          handlers = nil
  
          if options[:serve].empty?
diff --combined lib/puppet/configurer.rb
index b63df07,3e72fa5..72aef91
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@@ -93,7 -93,7 +93,7 @@@ class Puppet::Configure
              duration = thinmark do
                  result = catalog_class.find(name, fact_options.merge(:ignore_cache => true))
              end
-         rescue => detail
+         rescue Exception => detail
              puts detail.backtrace if Puppet[:trace]
              Puppet.err "Could not retrieve catalog from remote server: %s" % detail
          end
@@@ -123,6 -123,7 +123,7 @@@
      # Convert a plain resource catalog into our full host catalog.
      def convert_catalog(result, duration)
          catalog = result.to_ral
+         catalog.finalize
          catalog.retrieval_duration = duration
          catalog.host_config = true
          catalog.write_class_file
@@@ -133,7 -134,12 +134,12 @@@
      # This just passes any options on to the catalog,
      # which accepts :tags and :ignoreschedules.
      def run(options = {})
-         prepare()
+         begin
+             prepare()
+         rescue Exception => detail
+             puts detail.backtrace if Puppet[:trace]
+             Puppet.err "Failed to prepare catalog: %s" % detail
+         end
  
          if catalog = options[:catalog]
              options.delete(:catalog)
@@@ -144,17 -150,13 +150,17 @@@
  
          begin
              benchmark(:notice, "Finished catalog run") do
 -                catalog.apply(options)
 +                transaction = catalog.apply(options)
 +                transaction.generate_report
 +                report = transaction.report
              end
 +            report
          rescue => detail
              puts detail.backtrace if Puppet[:trace]
              Puppet.err "Failed to apply catalog: %s" % detail
 +            return
          end
 -
 +    ensure
          # Now close all of our existing http connections, since there's no
          # reason to leave them lying open.
          Puppet::Network::HttpPool.clear_http_instances
diff --combined lib/puppet/defaults.rb
index 590de83,f128e60..050fcaa
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@@ -86,10 -86,6 +86,10 @@@ module Puppe
          :mkusers => [false,
              "Whether to create the necessary user and group that puppetd will
              run as."],
 +        :manage_internal_file_permissions => [true,
 +            "Whether Puppet should manage the owner, group, and mode of files 
 +            it uses internally"
 +            ],
          :path => {:default => "none",
              :desc => "The shell search path.  Defaults to whatever is inherited
                  from the parent process.",
@@@ -288,7 -284,6 +288,7 @@@
      )
  
      setdefaults(:ca,
 +        :ca_name => ["$certname", "The name to use the Certificate Authority certificate."],
          :cadir => {  :default => "$ssldir/ca",
              :owner => "service",
              :group => "service",
@@@ -527,6 -522,18 +527,18 @@@
              authority requests.  It's a separate server because it cannot
              and does not need to horizontally scale."],
          :ca_port => ["$masterport", "The port to use for the certificate authority."],
+         :catalog_format => {
+             :default => "",
+             :desc => "(Deprecated for 'preferred_serialization_format') What format to
+                      use to dump the catalog.  Only supports 'marshal' and 'yaml'.  Only
+                      matters on the client, since it asks the server for a specific format.",
+             :hook => proc { |value|
+                 if value
+                     Puppet.warning "Setting 'catalog_format' is deprecated; use 'preferred_serialization_format' instead."
+                     Puppet.settings[:preferred_serialization_format] = value
+                 end
+             }
+         },
          :preferred_serialization_format => ["pson", "The preferred means of serializing
              ruby instances for passing over the wire.  This won't guarantee that all
              instances will be serialized using this method, since not all classes
@@@ -659,9 -666,6 +671,9 @@@
              used when networked databases are used."],
          :dbsocket => [ "", "The database socket location. Only used when networked
              databases are used.  Will be ignored if the value is an empty string."],
 +        :dbconnections => [ 0, "The number of database connections. Only used when
 +            networked databases are used.  Will be ignored if the value is an empty
 +            string or is less than 1."],
          :railslog => {:default => "$logdir/rails.log",
              :mode => 0600,
              :owner => "service",
diff --combined lib/puppet/rails.rb
index c941d8f,87f1bb1..34ca58c
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@@ -22,6 -22,10 +22,10 @@@ module Puppet::Rail
              ActiveRecord::Base.logger.level = Logger::DEBUG
          end
  
+         if (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR <= 1)
+             ActiveRecord::Base.allow_concurrency = true
+         end
+ 
          ActiveRecord::Base.verify_active_connections!
  
          begin
@@@ -51,16 -55,6 +55,16 @@@
  
              socket          = Puppet[:dbsocket]
              args[:socket]   = socket unless socket.empty?
 +	        
 +            connections     = Puppet[:dbconnections].to_i
 +            args[:pool]     = connections if connections > 0 
 +        when "oracle_enhanced":
 +	        args[:database] = Puppet[:dbname] unless Puppet[:dbname].empty?
 +	        args[:username] = Puppet[:dbuser] unless Puppet[:dbuser].empty?
 +	        args[:password] = Puppet[:dbpassword] unless Puppet[:dbpassword].empty?
 +
 +            connections     = Puppet[:dbconnections].to_i
 +            args[:pool]     = connections if connections > 0
          else
              raise ArgumentError, "Invalid db adapter %s" % adapter
          end
diff --combined lib/puppet/ssl/host.rb
index d7993e7,11e11c5..98061c5
--- a/lib/puppet/ssl/host.rb
+++ b/lib/puppet/ssl/host.rb
@@@ -10,7 -10,6 +10,7 @@@ require 'puppet/util/cacher
  class Puppet::SSL::Host
      # Yay, ruby's strange constant lookups.
      Key = Puppet::SSL::Key
 +    CA_NAME = Puppet::SSL::CA_NAME
      Certificate = Puppet::SSL::Certificate
      CertificateRequest = Puppet::SSL::CertificateRequest
      CertificateRevocationList = Puppet::SSL::CertificateRevocationList
@@@ -31,6 -30,7 +31,6 @@@
          end
      end
  
 -    CA_NAME = "ca"
      # This is the constant that people will use to mark that a given host is
      # a certificate authority.
      def self.ca_name
@@@ -171,7 -171,7 +171,7 @@@
  
              # get the CA cert first, since it's required for the normal cert
              # to be of any use.
 -            return nil unless Certificate.find("ca") unless ca?
 +            return nil unless Certificate.find(CA_NAME) unless ca?
              return nil unless @certificate = Certificate.find(name)
  
              unless certificate_matches_key?
@@@ -224,7 -224,7 +224,7 @@@
              @ssl_store.add_file(Puppet[:localcacert])
  
              # If there's a CRL, add it to our store.
 -            if crl = Puppet::SSL::CertificateRevocationList.find("ca")
 +            if crl = Puppet::SSL::CertificateRevocationList.find(CA_NAME)
                  @ssl_store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK
                  @ssl_store.add_crl(crl.content)
              end
@@@ -235,12 -235,11 +235,11 @@@
  
      # Attempt to retrieve a cert, if we don't already have one.
      def wait_for_cert(time)
-         return if certificate
          begin
+             return if certificate
              generate
- 
              return if certificate
-         rescue StandardError => detail
+         rescue Exception => detail
              Puppet.err "Could not request certificate: %s" % detail.to_s
              if time < 1
                  puts "Exiting; failed to retrieve certificate and watiforcert is disabled"
diff --combined lib/puppet/util/rdoc/parser.rb
index 3f04fbf,fff8aab..4d0ac48
--- a/lib/puppet/util/rdoc/parser.rb
+++ b/lib/puppet/util/rdoc/parser.rb
@@@ -15,8 -15,6 +15,8 @@@ module RDo
  class Parser
      extend ParserFactory
  
 +    attr_accessor :ast, :input_file_name, :top_level
 +
      # parser registration into RDoc
      parse_files_matching(/\.(rb|pp)$/)
  
@@@ -41,6 -39,8 +41,6 @@@
          @top_level
      end
  
 -    private
 -
      # Due to a bug in RDoc, we need to roll our own find_module_named
      # The issue is that RDoc tries harder by asking the parent for a class/module
      # of the name. But by doing so, it can mistakenly use a module of same name
@@@ -147,31 -147,15 +147,31 @@@
  
      # create documentation for include statements we can find in +code+
      # and associate it with +container+
 -    def scan_for_include(container, code)
 +    def scan_for_include_or_require(container, code)
          code = [code] unless code.is_a?(Array)
          code.each do |stmt|
 -            scan_for_include(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
 +            scan_for_include_or_require(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
  
 -            if stmt.is_a?(Puppet::Parser::AST::Function) and stmt.name == "include"
 +            if stmt.is_a?(Puppet::Parser::AST::Function) and ['include','require'].include?(stmt.name)
                  stmt.arguments.each do |included|
 -                    Puppet.debug "found include: %s" % included.value
 -                    container.add_include(Include.new(included.value, stmt.doc))
 +                    Puppet.debug "found #{stmt.name}: #{included.value}"
 +                    container.send("add_#{stmt.name}",Include.new(included.value, stmt.doc))
 +                end
 +            end
 +        end
 +    end
 +
 +    # create documentation for realize statements we can find in +code+
 +    # and associate it with +container+
 +    def scan_for_realize(container, code)
 +        code = [code] unless code.is_a?(Array)
 +        code.each do |stmt|
 +            scan_for_realize(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
 +
 +            if stmt.is_a?(Puppet::Parser::AST::Function) and stmt.name == 'realize'
 +                stmt.arguments.each do |realized|
 +                    Puppet.debug "found #{stmt.name}: #{realized}"
 +                    container.add_realize(Include.new(realized.to_s, stmt.doc))
                  end
              end
          end
@@@ -200,9 -184,20 +200,20 @@@
  
              if stmt.is_a?(Puppet::Parser::AST::Resource) and !stmt.type.nil?
                  begin
-                     ref = resource_stmt_to_ref(stmt)
-                     Puppet.debug "rdoc: found resource: %s[%s]" % [ref.type, ref.title]
-                     container.add_resource(ref)
+                     type = stmt.type.split("::").collect { |s| s.capitalize }.join("::")
+                     title = stmt.title.is_a?(Puppet::Parser::AST::ASTArray) ? stmt.title.to_s.gsub(/\[(.*)\]/,'\1') : stmt.title.to_s
+                     Puppet.debug "rdoc: found resource: %s[%s]" % [type,title]
+ 
+                     param = []
+                     stmt.params.children.each do |p|
+                         res = {}
+                         res["name"] = p.param
+                         res["value"] = "#{p.value.to_s}" unless p.value.nil?
+ 
+                         param << res
+                     end
+ 
+                     container.add_resource(PuppetResource.new(type, title, stmt.doc, param))
                  rescue => detail
                      raise Puppet::ParseError, "impossible to parse resource in #{stmt.file} at line #{stmt.line}: #{detail}"
                  end
@@@ -210,16 -205,6 +221,16 @@@
          end
      end
  
 +    def resource_stmt_to_ref(stmt)
 +        type = stmt.type.split("::").collect { |s| s.capitalize }.join("::")
 +        title = stmt.title.is_a?(Puppet::Parser::AST::ASTArray) ? stmt.title.to_s.gsub(/\[(.*)\]/,'\1') : stmt.title.to_s
 +
 +        param = stmt.params.children.collect do |p|
 +            {"name" => p.param, "value" => p.value.to_s}
 +        end
 +        PuppetResource.new(type, title, stmt.doc, param)
 +    end
 +
      # create documentation for a class named +name+
      def document_class(name, klass, container)
          Puppet.debug "rdoc: found new class %s" % name
@@@ -242,8 -227,7 +253,8 @@@
          code = klass.code.children if klass.code.is_a?(Puppet::Parser::AST::ASTArray)
          code ||= klass.code
          unless code.nil?
 -            scan_for_include(cls, code)
 +            scan_for_include_or_require(cls, code)
 +            scan_for_realize(cls, code)
              scan_for_resource(cls, code) if Puppet.settings[:document_all]
          end
  
@@@ -266,8 -250,7 +277,8 @@@
          code = node.code.children if node.code.is_a?(Puppet::Parser::AST::ASTArray)
          code ||= node.code
          unless code.nil?
 -            scan_for_include(n, code)
 +            scan_for_include_or_require(n, code)
 +            scan_for_realize(n, code)
              scan_for_vardef(n, code)
              scan_for_resource(n, code) if Puppet.settings[:document_all]
          end
@@@ -308,8 -291,8 +319,8 @@@
  
          # register method into the container
          meth =  AnyMethod.new(declaration, name)
 -        container.add_method(meth)
          meth.comment = define.doc
 +        container.add_method(meth)
          look_for_directives_in(container, meth.comment) unless meth.comment.empty?
          meth.params = "( " + declaration + " )"
          meth.visibility = :public
@@@ -323,13 -306,13 +334,13 @@@
      # that contains the documentation
      def parse_elements(container)
          Puppet.debug "rdoc: scanning manifest"
 -        @ast.hostclasses.values.sort { |a,b| a.classname <=> b.classname }.each do |klass|
 -            name = klass.classname
 +        @ast.hostclasses.values.sort { |a,b| a.name <=> b.name }.each do |klass|
 +            name = klass.name
              if klass.file == @input_file_name
                  unless name.empty?
                      document_class(name,klass,container)
                  else # on main class document vardefs
 -                    code = klass.code.children unless klass.code.is_a?(Puppet::Parser::AST::ASTArray)
 +                    code = klass.code.children if klass.code.is_a?(Puppet::Parser::AST::ASTArray)
                      code ||= klass.code
                      scan_for_vardef(container, code) unless code.nil?
                  end
@@@ -370,9 -353,9 +381,9 @@@
                      comments += $1 + "\n"
                  elsif line =~ /^[ \t]*Facter.add\(['"](.*?)['"]\)/
                      current_fact = Fact.new($1,{})
 -                    container.add_fact(current_fact)
                      look_for_directives_in(container, comments) unless comments.empty?
                      current_fact.comment = comments
 +                    container.add_fact(current_fact)
                      current_fact.record_location(@top_level)
                      comments = ""
                      Puppet.debug "rdoc: found custom fact %s" % current_fact.name
@@@ -463,4 -446,4 +474,4 @@@
          comment.sub!(/^#--.*/m, '')
      end
  end
 -end
 +end
diff --combined spec/integration/defaults.rb
index 0e9a03f,292abbb..590be13
--- a/spec/integration/defaults.rb
+++ b/spec/integration/defaults.rb
@@@ -29,6 -29,17 +29,17 @@@ describe "Puppet defaults" d
          end
      end
  
+     describe "when setting the :catalog_format" do
+         it "should log a deprecation notice" do
+             Puppet.expects(:warning)
+             Puppet.settings[:catalog_format] = 'marshal'
+         end
+         it "should copy the value to :preferred_serialization_format" do
+             Puppet.settings[:catalog_format] = 'marshal'
+             Puppet.settings[:preferred_serialization_format].should == 'marshal'
+         end
+     end
+ 
      it "should have a clientyamldir setting" do
          Puppet.settings[:clientyamldir].should_not be_nil
      end
@@@ -204,9 -215,4 +215,9 @@@
              Puppet.settings[:report_server].should == "report_server"
          end
      end
 +    
 +    it "should have a :caname setting that defaults to the cert name" do
 +        Puppet.settings[:certname] = "foo"
 +        Puppet.settings[:ca_name].should == "foo"
 +    end
  end
diff --combined spec/unit/application/puppetd.rb
index 3806085,e5a5167..04c6daf
--- a/spec/unit/application/puppetd.rb
+++ b/spec/unit/application/puppetd.rb
@@@ -40,7 -40,7 +40,7 @@@ describe "puppetd" d
  
      describe "in preinit" do
          before :each do
-             @pupetd.stubs(:trap)
+             @puppetd.stubs(:trap)
          end
  
          it "should catch INT" do
@@@ -205,10 -205,6 +205,10 @@@
                  @puppetd.options.expects(:[]=).with(:onetime,true)
                  @puppetd.setup_test
              end
 +            it "should set options[:detailed_exitcodes] to true" do
 +                @puppetd.options.expects(:[]=).with(:detailed_exitcodes,true)
 +                @puppetd.setup_test
 +            end
              it "should set waitforcert to 0" do
                  @puppetd.options.expects(:[]=).with(:waitforcert,0)
                  @puppetd.setup_test
@@@ -457,7 -453,6 +457,7 @@@
  
              before :each do
                  @puppetd.options.stubs(:[]).with(:client).returns(:client)
 +                @puppetd.options.stubs(:[]).with(:detailed_exitcodes).returns(false)
                  @puppetd.stubs(:exit).with(0)
                  Puppet.stubs(:newservice)
              end
@@@ -489,29 -484,6 +489,29 @@@
                  @puppetd.onetime
              end
  
 +            describe "and --detailed-exitcodes" do
 +                before :each do
 +                    @puppetd.options.stubs(:[]).with(:detailed_exitcodes).returns(true)
 +                end
 +
 +                it "should exit with report's computed exit status" do
 +                    Puppet.stubs(:[]).with(:noop).returns(false)
 +                    report = stub 'report', :exit_status => 666
 +                    @agent.stubs(:run).returns(report)
 +                    @puppetd.expects(:exit).with(666)
 +
 +                    @puppetd.onetime
 +                end
 +
 +                it "should always exit with 0 if --noop" do
 +                    Puppet.stubs(:[]).with(:noop).returns(true)
 +                    report = stub 'report', :exit_status => 666
 +                    @agent.stubs(:run).returns(report)
 +                    @puppetd.expects(:exit).with(0)
 +
 +                    @puppetd.onetime
 +                end
 +            end
          end
  
          describe "without --onetime" do
diff --combined spec/unit/parser/resource/reference.rb
index e082136,a703f92..064c51b
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@@ -40,10 -40,15 +40,15 @@@ describe Puppet::Parser::Resource::Refe
          ref.to_s.should == "File[/tmp/yay]"
      end
  
-     it "should canonize resource references" do
+     it "should canonize resource reference types" do
          ref = @type.new(:type => "foo::bar", :title => "/tmp/yay")
          ref.to_s.should == "Foo::Bar[/tmp/yay]"
      end
+ 
+     it "should canonize resource reference values" do
+         ref = @type.new(:type => "file", :title => "/tmp/yay/")
+         ref.to_s.should == "File[/tmp/yay]"
+     end
  end
  
  describe Puppet::Parser::Resource::Reference, " when modeling defined types" do
@@@ -84,7 -89,7 +89,7 @@@
          scope = @compiler.topscope.class.new(:parent => @compiler.topscope, :namespace => "other", :parser => @parser)
  
          ref = @type.new(:type => "class", :title => "top", :scope => scope)
 -        ref.definedtype.classname.should equal(top.classname)
 +        ref.definedtype.name.should equal(top.name)
      end
  
      it "should only look for fully qualified definitions" do
@@@ -94,6 -99,6 +99,6 @@@
          scope = @compiler.topscope.class.new(:parent => @compiler.topscope, :namespace => "other", :parser => @parser)
  
          ref = @type.new(:type => "top", :title => "foo", :scope => scope)
 -        ref.definedtype.classname.should equal(top.classname)
 +        ref.definedtype.name.should equal(top.name)
      end
  end
diff --combined spec/unit/rails.rb
index 8ecd77a,6dee55b..da6db15
--- a/spec/unit/rails.rb
+++ b/spec/unit/rails.rb
@@@ -39,6 -39,7 +39,7 @@@ describe Puppet::Rails, "when initializ
          ActiveRecord::Base.stubs(:logger).returns(logger)
          logger.expects(:level=).with(Logger::DEBUG)
  
+         ActiveRecord::Base.stubs(:allow_concurrency=)
          ActiveRecord::Base.stubs(:verify_active_connections!)
          ActiveRecord::Base.stubs(:establish_connection)
          Puppet::Rails.stubs(:database_arguments)
@@@ -46,6 -47,16 +47,16 @@@
          Puppet::Rails.connect
      end
  
+     describe "on ActiveRecord 2.1.x" do
+         confine "ActiveRecord 2.1.x" => (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR <= 1)
+ 
+         it "should set ActiveRecord::Base.allow_concurrency" do
+             ActiveRecord::Base.expects(:allow_concurrency=).with(true)
+ 
+             Puppet::Rails.connect
+         end
+     end
+ 
      it "should call ActiveRecord::Base.verify_active_connections!" do
          ActiveRecord::Base.expects(:verify_active_connections!)
  
@@@ -76,7 -87,7 +87,7 @@@ describe Puppet::Rails, "when initializ
      end
  end
  
 -describe Puppet::Rails, "when initializing a mysql or postgresql connection" do
 +describe Puppet::Rails, "when initializing a mysql connection" do
      confine "Cannot test without ActiveRecord" => Puppet.features.rails?
  
      it "should provide the adapter, log_level, and host, username, password, and database arguments" do
@@@ -117,105 -128,4 +128,105 @@@
              :socket => "testsocket"
          }
      end
 +
 +    it "should provide the adapter, log_level, and host, username, password, database, socket, and connections arguments" do
 +        Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
 +        Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
 +        Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
 +        Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
 +        Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
 +        Puppet.settings.stubs(:value).with(:dbname).returns("testname")
 +        Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
 +        Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
 +
 +        Puppet::Rails.database_arguments.should == {
 +            :adapter => "mysql",
 +            :log_level => "testlevel",
 +            :host => "testserver",
 +            :username => "testuser",
 +            :password => "testpassword",
 +            :database => "testname",
 +            :socket => "testsocket",
 +            :pool => 1
 +        }
 +    end
 +end
 +
 +describe Puppet::Rails, "when initializing a postgresql connection" do
 +    confine "Cannot test without ActiveRecord" => Puppet.features.rails?
 +
 +    it "should provide the adapter, log_level, and host, username, password, and database arguments" do
 +        Puppet.settings.stubs(:value).with(:dbadapter).returns("postgresql")
 +        Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
 +        Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
 +        Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
 +        Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
 +        Puppet.settings.stubs(:value).with(:dbname).returns("testname")
 +        Puppet.settings.stubs(:value).with(:dbsocket).returns("")
 +
 +        Puppet::Rails.database_arguments.should == {
 +            :adapter => "postgresql",
 +            :log_level => "testlevel",
 +            :host => "testserver",
 +            :username => "testuser",
 +            :password => "testpassword",
 +            :database => "testname"
 +        }
 +    end
 +
 +    it "should provide the adapter, log_level, and host, username, password, database, and socket arguments" do
 +        Puppet.settings.stubs(:value).with(:dbadapter).returns("postgresql")
 +        Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
 +        Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
 +        Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
 +        Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
 +        Puppet.settings.stubs(:value).with(:dbname).returns("testname")
 +        Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
 +
 +        Puppet::Rails.database_arguments.should == {
 +            :adapter => "postgresql",
 +            :log_level => "testlevel",
 +            :host => "testserver",
 +            :username => "testuser",
 +            :password => "testpassword",
 +            :database => "testname",
 +            :socket => "testsocket"
 +        }
 +    end
 +end
 +
 +describe Puppet::Rails, "when initializing an Oracle connection" do
 +    confine "Cannot test without ActiveRecord" => Puppet.features.rails?
 +
 +    it "should provide the adapter, log_level, and username, password, and database arguments" do
 +        Puppet.settings.stubs(:value).with(:dbadapter).returns("oracle_enhanced")
 +        Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
 +        Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
 +        Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
 +        Puppet.settings.stubs(:value).with(:dbname).returns("testname")
 +
 +        Puppet::Rails.database_arguments.should == {
 +            :adapter => "oracle_enhanced",
 +            :log_level => "testlevel",
 +            :username => "testuser",
 +            :password => "testpassword",
 +            :database => "testname"
 +        }
 +    end
 +
 +    it "should provide the adapter, log_level, and host, username, password, database, and socket arguments" do
 +        Puppet.settings.stubs(:value).with(:dbadapter).returns("oracle_enhanced")
 +        Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
 +        Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
 +        Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
 +        Puppet.settings.stubs(:value).with(:dbname).returns("testname")
 +
 +        Puppet::Rails.database_arguments.should == {
 +            :adapter => "oracle_enhanced",
 +            :log_level => "testlevel",
 +            :username => "testuser",
 +            :password => "testpassword",
 +            :database => "testname",
 +        }
 +    end
  end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list