Issue #18041 has been updated by Josh Cooper.

The problem actually is that we sort an array of keys, and then call collect, 
expecting the hash key and value will be yielded. But since it's an array, the 
`hash` variable is nil. The code is wanting to do:

<pre>
loaded.keys.sort { |a,b| a[0] <=> b[0] }.collect do |path|
 "#{path}: #{loaded[path][0]}"
end
</pre>
----------------------------------------
Bug #18041: Puppet::Util::Autoload.list_loaded is broken
https://projects.puppetlabs.com/issues/18041#change-78481

Author: Josh Cooper
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 3.0.2
Affected Puppet version: 0.24.0
Keywords: autoload
Branch: 


The `list_loaded` method does:

<pre>
      loaded.keys.sort { |a,b| a[0] <=> b[0] }.collect do |path, hash|
        "#{path}: #{hash[:file]}"
      end
</pre>

The method was added in `7befe1bc`, but was broken in `6700adcacd`, because the 
code that adds autoloaded files to the hash uses a different hashkey. Calling 
this method results in:

<pre>
1.8.7 :011 > loader.class.list_loaded
NoMethodError: undefined method `[]' for nil:NilClass
        from /Users/josh/work/puppet/lib/puppet/util/autoload.rb:25:in 
`list_loaded'
        from /Users/josh/work/puppet/lib/puppet/util/autoload.rb:24:in `collect'
        from /Users/josh/work/puppet/lib/puppet/util/autoload.rb:24:in 
`list_loaded'
        from (irb):11
</pre>

Since this method blows up if called, it is safe to remove.


-- 
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 puppet-bugs@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-bugs+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to