ryanycoleman / puppet_module_provider

puppet_module provider for the Puppet package type
10 stars 6 forks source link

Could not evaluate: undefined method `map' #4

Open djjudas21 opened 10 years ago

djjudas21 commented 10 years ago

Every puppet run, my Puppetmaster prints out an error for each Forge module that has been installed with rcoleman/module.

Error: /Stage[main]/Uob_puppet::Forgemodules/Module[saz/timezone]: Could not evaluate: undefined method `map' for #<Puppet::Node::Environment:0x7f698db18c78>
Error: /Stage[main]/Uob_puppet::Forgemodules/Module[puppetlabs/tftp]: Could not evaluate: undefined method `map' for #<Puppet::Node::Environment:0x7f698db0f150>
Error: /Stage[main]/Uob_puppet::Forgemodules/Module[nibalizer/puppetboard]: Could not evaluate: undefined method `map' for #<Puppet::Node::Environment:0x7f698db04c28>
Error: /Stage[main]/Uob_puppet::Forgemodules/Module[puppetlabs/ruby]: Could not evaluate: undefined method `map' for #<Puppet::Node::Environment:0x7f698dafaac0>
Error: /Stage[main]/Uob_puppet::Forgemodules/Module[thias/sysctl]: Could not evaluate: undefined method `map' for #<Puppet::Node::Environment:0x7f698daf1178>

It has been doing this for sometime but I assumed it was related to PUP-2882 which was fixed today in Puppet 3.7.0, but this hasn't fixed the problem. Please could you investigate?

The problem occurs with v0.0.3 of your module and several versions of Puppet, including v3.6.x and 3.7.x.

Thanks, Jonathan

jmtd commented 10 years ago

I get this too, puppet 3.6.2, appears to not matter which module it is but reproducible with razorsedge/network fwiw.

dowlingw commented 10 years ago

Some additional confirmations:

Here is the output from a delcaration for module { 'puppetlabs/ntp': ensure => installed }:

==> default: /etc/puppet/modules/puppet_module/lib/puppet/provider/module/forge.rb:40: warning: class variable access from toplevel
==> default: Error: /Stage[main]/Main/Module[puppetlabs/ntp]: Could not evaluate: undefined method `map' for production:Puppet::Node::Environment

The corresponding line appears to be:

    @@module.list.map do |module_path, modules|

from the function block:

  def self.installed
    @@module.list.map do |module_path, modules|

      modules.map do |mod|
        #puts mod.inspect
        {
          :name => mod.forge_name,
          :ensure => mod.version,
          :modulepath => module_path,
          :provider => :puppet_module,
        }
      end

    end.flatten
  end
dowlingw commented 10 years ago

Had a quick look into Puppet faces, it appears that even though the Puppet face for modules is still 1.0.0, there is a change between Puppet 3.4.3 and 3.7.2 that breaks the face.

I'll lodge a bug on the Puppet tracker, and am testing a pull request for this module to both address the issue and specify an explicit dependency on version 1.0.0 of the module face (currently :current).

dowlingw commented 10 years ago

I have lodged a bug on the Puppet ticket system for the original issue: https://tickets.puppetlabs.com/browse/PUP-3563

vikas027 commented 9 years ago

I also has the same error on puppet v4.2.2

go8ose commented 9 years ago

Would it be possible for this provider to handle both aspects of this face? If it finds a list of modules, it uses it's existing code. If an exception is thrown on the map access, it tries to process the returned value as a hash?

I have almost no knowledge of ruby, my attempts to try this out have failed.

vzabawski commented 7 years ago

Looks like module is not working anymore on Puppet 4.