Issue #2782 has been updated by Markus Roberts.

Excluding the duplicated when-clause changes, this branch changes:

* XMLRPC::Service::Interface.new ... from one incorrect usage to another; the 
correct pattern is:

<pre>
    @interface = XMLRPC::Service::Interface.new("status") {
      add_method("int status()")
    }
</pre>

The block does not receive an argument, and the present code only works because 
of a bug in ruby 1.8.x; the code on the branch would work most of the time in 
any version, but exposes a race condition which is the reason for the block.

* File --> ::File; we need a better fix for this.
* Guards calls to stat with an argument, "stat(false)" whereas they are 
incorrect and should just be changed to stat with no arguments
* Makes the following change, which I do not understand:

<pre>
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index 87f1bb1..5e51099 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -55,6 +55,16 @@ module Puppet::Rails
 
             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
</pre>

* Makes the following change which directly related to the title of the ticket:

<pre>
diff --git a/lib/puppet/util/classgen.rb b/lib/puppet/util/classgen.rb
index 1aa9613..c68fcef 100644
--- a/lib/puppet/util/classgen.rb
+++ b/lib/puppet/util/classgen.rb
@@ -128,11 +128,23 @@ module Puppet::Util::ClassGen
         return klass
     end
 
+    # const_defined? in Ruby 1.9 behaves differently in terms
+    # of which class hierarchy it polls for nested namespaces
+    #
+    # See http://redmine.ruby-lang.org/issues/show/1915
+    def is_constant_defined?(const)
+      if ::RUBY_VERSION =~ /1.9/
+        const_defined?(const, false)
+      else
+        const_defined?(const)
+      end
+    end
+
     # Handle the setting and/or removing of the associated constant.
     def handleclassconst(klass, name, options)
         const = genconst_string(name, options)
 
-        if const_defined? const
+        if is_constant_defined?(const)
             if options[:overwrite]
                 Puppet.info "Redefining %s in %s" % [name, self]
                 remove_const(const)
</pre>


----------------------------------------
Bug #2782: Changes in Ruby 1.9.x const_set and const_get prevent puppetd from 
properly executing
http://projects.puppetlabs.com/issues/2782

Author: Al Hoang
Status: Code Insufficient
Priority: Low
Assigned to: Markus Roberts
Category: unknown
Target version: Rowlf
Affected version: 0.25.1
Keywords: Ruby 1.9
Branch: http://github.com/hoanga/puppet/tree/0.25.x_1.9.1


Hello,

Attached is a patch with modifications to get puppetd to properly execute when 
puppetd --trace --verbose --debug is run on the command line.

Some changes are:
* Explicitly use the top-level File object in lib/puppet/type/file.rb
* Add some checks on RUBY_VERSION and avoid called @resource.stat(false)
* Call a Ruby 1.8.x compatible version of const_defined? if RUBY_VERSION looks 
like it is 1.9.x

Here are some useful links that might help explain some of the changes to 
const_set and const_set in Ruby 1.9.x:

http://issues.apache.org/jira/browse/BUILDR-140
http://jira.codehaus.org/browse/JRUBY-4197
http://redmine.ruby-lang.org/issues/show/1915
http://markmail.org/message/zr5vh2333yr3k3qi


Please note that this assumes that the changes from ticket #2781 are already 
applied



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to