Bug #6748

ndefined method `<<' for {}:Hash when combining resource chaining, metaparameters, and autorequire

Added by Jeff McCune about 1 year ago. Updated 2 months ago.

Status:Duplicate Start date:03/17/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:parser
Target version:-
Affected Puppet version: Branch:
Keywords:hash error unhandled exception
Votes: 2

Description

Overview

Getting a difficult to diagnose error. No idea what’s failing in the parsing of the manifest since I don’t have a line number or manifest file to reference.

Error message:

undefined method `<<' for {}:Hash on node rhel6_64.vagrant.internal

Steps to reproduce

I’ve attached a small vagrant project with everything required to reproduce this error. The base box will automatically be downloaded if you run “vagrant up” after unpacking the tarball it should just fail.

Trace

debug: Adding relationship from Group[mockbuild] to User[mockbuild] with 'before'
/usr/local/src/puppet/lib/puppet/resource.rb:107:in `send'
/usr/local/src/puppet/lib/puppet/resource.rb:107:in `<<'
/usr/local/src/puppet/lib/puppet/parser/relationship.rb:41:in `mk_relationship'
/usr/local/src/puppet/lib/puppet/parser/relationship.rb:19:in `evaluate'
/usr/local/src/puppet/lib/puppet/parser/relationship.rb:18:in `each'
/usr/local/src/puppet/lib/puppet/parser/relationship.rb:18:in `evaluate'
/usr/local/src/puppet/lib/puppet/parser/relationship.rb:17:in `each'
/usr/local/src/puppet/lib/puppet/parser/relationship.rb:17:in `evaluate'
/usr/local/src/puppet/lib/puppet/parser/compiler.rb:173:in `evaluate_relationships'
/usr/local/src/puppet/lib/puppet/parser/compiler.rb:173:in `each'
/usr/local/src/puppet/lib/puppet/parser/compiler.rb:173:in `evaluate_relationships'
/usr/local/src/puppet/lib/puppet/parser/compiler.rb:352:in `finish'
/usr/local/src/puppet/lib/puppet/parser/compiler.rb:109:in `compile'
/usr/local/src/puppet/lib/puppet/parser/compiler.rb:18:in `compile'
/usr/local/src/puppet/lib/puppet/indirector/catalog/compiler.rb:77:in `compile'
/usr/local/src/puppet/lib/puppet/util.rb:197:in `benchmark'
/usr/local/src/puppet/lib/puppet/indirector/catalog/compiler.rb:75:in `compile'
/usr/local/src/puppet/lib/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/local/src/puppet/lib/puppet/indirector/indirection.rb:188:in `find'
/usr/local/src/puppet/lib/puppet/indirector.rb:50:in `find'
/usr/local/src/puppet/lib/puppet/application/apply.rb:115:in `main'
/usr/local/src/puppet/lib/puppet/application/apply.rb:35:in `run_command'
/usr/local/src/puppet/lib/puppet/application.rb:304:in `run'
/usr/local/src/puppet/lib/puppet/application.rb:410:in `exit_on_fail'
/usr/local/src/puppet/lib/puppet/application.rb:304:in `run'
/usr/local/src/puppet/lib/puppet/util/command_line.rb:59:in `execute'
/usr/local/src/puppet/bin/puppet:4
/usr/local/src/puppet/lib/puppet/parser/compiler.rb:21:in `compile'
/usr/local/src/puppet/lib/puppet/indirector/catalog/compiler.rb:77:in `compile'
/usr/local/src/puppet/lib/puppet/util.rb:197:in `benchmark'
/usr/local/src/puppet/lib/puppet/indirector/catalog/compiler.rb:75:in `compile'
/usr/local/src/puppet/lib/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/local/src/puppet/lib/puppet/indirector/indirection.rb:188:in `find'
/usr/local/src/puppet/lib/puppet/indirector.rb:50:in `find'
/usr/local/src/puppet/lib/puppet/application/apply.rb:115:in `main'
/usr/local/src/puppet/lib/puppet/application/apply.rb:35:in `run_command'
/usr/local/src/puppet/lib/puppet/application.rb:304:in `run'
/usr/local/src/puppet/lib/puppet/application.rb:410:in `exit_on_fail'
/usr/local/src/puppet/lib/puppet/application.rb:304:in `run'
/usr/local/src/puppet/lib/puppet/util/command_line.rb:59:in `execute'
/usr/local/src/puppet/bin/puppet:4

el6pe.bug.tar.gz (8.9 kB) Jeff McCune, 03/17/2011 10:10 pm


Related issues

duplicates Puppet - Bug #7422: undefined method `<<' for {}:Hash when combining resource... Accepted 05/05/2011

History

Updated by Jeff McCune about 1 year ago

I found the issue.

Using the –> relationship syntax should work between this user and group resource, but does not.

The following puppet code works:

group { 'mockbuild':
  ensure => present,
  gid    => $gid_real,
  before => File[$home],
}
# ->
user { 'mockbuild':
  ensure   => present,
  uid      => $uid_real,
  gid      => $gid_real,
  comment  => 'Mock Build',
  shell    => '/bin/bash',
  home     => $home,
  password => '!!',
  require  => Group['mockbuild'],
}

The following code reproduces the error. Note, the only difference is the relationship declaration.

group { 'mockbuild':
  ensure => present,
  gid    => $gid_real,
  before => File[$home],
}
->
user { 'mockbuild':
  ensure   => present,
  uid      => $uid_real,
  gid      => $gid_real,
  comment  => 'Mock Build',
  shell    => '/bin/bash',
  home     => $home,
  password => '!!',
  require  => Group['mockbuild'],
}

Updated by Ben Hughes about 1 year ago

  • Status changed from Unreviewed to Accepted

Updated by Ben Hughes about 1 year ago

Is it worth renaming the ticket, to make it a little clearer of the issue?

Updated by Derek Yarnell about 1 year ago

I have also seemed to run into this bug.

File[cdh3_config] –> Package[jobtracker]

works but

File[cdh3_config] ~> Service[jobtracker]

does not.

/opt/UMruby/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:57:in deserialize' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:71:infind' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in find' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:infind' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/configurer.rb:229:in retrieve_new_catalog' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/util.rb:424:inthinmark' /opt/UMruby/lib/ruby/1.8/benchmark.rb:308:in realtime' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/util.rb:423:inthinmark' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/configurer.rb:228:in retrieve_new_catalog' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/configurer.rb:102:inretrieve_catalog' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/configurer.rb:143:in run' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/agent.rb:39:inrun' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in lock' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/agent.rb:39:inrun' /opt/UMruby/lib/ruby/1.8/sync.rb:229:in synchronize' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/agent.rb:39:inrun' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/agent.rb:103:in with_client' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/agent.rb:37:inrun' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/application.rb:171:in call' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/application.rb:171:incontrolled_run' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/agent.rb:35:in run' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:114:inonetime' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:88:in run_command' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/application.rb:287:inrun' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in exit_on_fail' /opt/UMruby/lib/ruby/site_ruby/1.8/puppet/application.rb:287:inrun' /usr/sbin/puppetd:4 err: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `<<‘ for {}:Hash on node hdtestnn.umiacs.umd.edu

Updated by Edward Savage 11 months ago

I’ve also come across this error trying to do a complicated relationship.

Package <| |> –> File <| |> ~> Service <| |> –> Exec[“joinNetwork”]

Where Package, File, and Service deal with several objects each. Removing the subscription between File and Service does not resolve the error. Puppet parses the manifest without error.

Note that bug #7422 is likely the same issue.

Updated by Devon Peters 4 months ago

  • Subject changed from undefined method `<<' for {}:Hash on node rhel6_64.vagrant.internal to ndefined method `<<' for {}:Hash when combining resource chaining, metaparameters, and autorequire
  • Target version set to 2.7.x
  • Affected Puppet version deleted (2.6.6)

Updated by Devon Peters 4 months ago

  • Status changed from Accepted to Duplicate

Updated by Daniel Pittman 2 months ago

  • Target version deleted (2.7.x)

Also available in: Atom PDF