Issue #7422 has been updated by Peter Meier.

Here is another example for a failing in 2.7.19:

<pre>
$ cat foo.pp 

user{'b':
  before => Notify['a']
}

notify{'a': }

file{'/tmp/a':

} <- User<||>
$ puppet apply foo.pp --trace
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/resource.rb:113:in
 `send'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/resource.rb:113:in
 `<<'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/relationship.rb:58:in
 `mk_relationship'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/relationship.rb:20:in
 `evaluate'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/relationship.rb:19:in
 `each'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/relationship.rb:19:in
 `evaluate'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/relationship.rb:18:in
 `each'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/relationship.rb:18:in
 `evaluate'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/compiler.rb:167:in
 `evaluate_relationships'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/compiler.rb:167:in
 `each'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/compiler.rb:167:in
 `evaluate_relationships'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/compiler.rb:338:in
 `finish'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/compiler.rb:107:in
 `compile'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/compiler.rb:24:in
 `compile'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/catalog/compiler.rb:77:in
 `compile'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/util.rb:166:in
 `benchmark'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/catalog/compiler.rb:75:in
 `compile'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/catalog/compiler.rb:35:in
 `find'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/indirection.rb:195:in
 `find'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application/apply.rb:218:in
 `main'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application/apply.rb:149:in
 `run_command'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:309:in
 `run'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:416:in
 `hook'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:309:in
 `run'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:407:in
 `exit_on_fail'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:309:in
 `run'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/util/command_line.rb:69:in
 `execute'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/bin/puppet:4
/home/duritong/.rvm/gems/ruby-1.8.7-p358/bin/puppet:19:in `load'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/bin/puppet:19
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/parser/compiler.rb:27:in
 `compile'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/catalog/compiler.rb:77:in
 `compile'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/util.rb:166:in
 `benchmark'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/catalog/compiler.rb:75:in
 `compile'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/catalog/compiler.rb:35:in
 `find'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/indirector/indirection.rb:195:in
 `find'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application/apply.rb:218:in
 `main'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application/apply.rb:149:in
 `run_command'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:309:in
 `run'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:416:in
 `hook'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:309:in
 `run'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:407:in
 `exit_on_fail'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/application.rb:309:in
 `run'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/lib/puppet/util/command_line.rb:69:in
 `execute'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/gems/puppet-2.7.19/bin/puppet:4
/home/duritong/.rvm/gems/ruby-1.8.7-p358/bin/puppet:19:in `load'
/home/duritong/.rvm/gems/ruby-1.8.7-p358/bin/puppet:19
undefined method `<<' for {}:Hash on node foo
</pre>

Works by changing things to:

<pre>
$ cat foo.pp 

user{'b':
}

notify{'a': 
  require => User['b']
}

file{'/tmp/a':

} <- User<||>
$ puppet apply foo.pp --trace --noop
notice: /Stage[main]//File[/tmp/a]: Dependency User[b] has failures: true
warning: /Stage[main]//File[/tmp/a]: Skipping because of failed dependencies
notice: /Stage[main]//Notify[a]: Dependency User[b] has failures: true
warning: /Stage[main]//Notify[a]: Skipping because of failed dependencies
err: Could not find a suitable provider for user
notice: Finished catalog run in 0.03 seconds
</pre>
----------------------------------------
Bug #7422: undefined method `<<' for {}:Hash when combining resource chaining, 
metaparameters, and autorequire
https://projects.puppetlabs.com/issues/7422#change-74037

Author: Nick Fagerlund
Status: Accepted
Priority: Normal
Assignee: 
Category: parser
Target version: 3.x
Affected Puppet version: 2.6.4
Keywords: 
Branch: 


So I was talking with Markus and Dan about some weird autorequire behavior, and 
ran into this. Assume you have the requisite files in /tmp:

    # tree /tmp
    /tmp
    |-- a
    |   `-- b
    `-- c

Then, if you run this manifest:

    # autocycle.pp 
    file { "/tmp/a": 
      ensure => absent, 
      force => true,
    }
    file { "/tmp/a/b": 
      ensure => absent, 
      content => 'foo', 
      before => File['/tmp/a'], 
    }
    file { "/tmp/c": 
      ensure => absent, 
      content => 'bar', 
    }
    File['/tmp/a/b'] -> File['/tmp/c'] -> File['/tmp/a']

...you get this:

    [root@puppet learning-manifests]# puppet apply --trace autocycle.pp 
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/resource.rb:103:in `send'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/resource.rb:103:in `<<'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/relationship.rb:41:in 
`mk_relationship'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/relationship.rb:19:in 
`evaluate'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/relationship.rb:18:in 
`each'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/relationship.rb:18:in 
`evaluate'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/relationship.rb:17:in 
`each'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/relationship.rb:17:in 
`evaluate'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:162:in 
`evaluate_relationships'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:162:in `each'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:162:in 
`evaluate_relationships'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:341:in `finish'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:109:in 
`compile'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:18:in `compile'
    
/opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util.rb:197:in `benchmark'
    
/opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
    
/opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in 
`find'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in 
`find'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in 
`run_command'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in 
`exit_on_fail'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in 
`execute'
    /usr/local/bin/puppet:4
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:21:in `compile'
    
/opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util.rb:197:in `benchmark'
    
/opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
    
/opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in 
`find'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in 
`find'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in 
`run_command'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in 
`exit_on_fail'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
    /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in 
`execute'
    /usr/local/bin/puppet:4
    undefined method `<<' for {}:Hash on node puppet.localdomain

What it SHOULD do is reverse /tmp/a/b's autorequire of /tmp/a (to avoid the 
cycle we would otherwise get), then delete /tmp/a/b, /tmp/c, and /tmp/a in that 
order. Instead, we have an exposed internal Ruby error. Any clues?



-- 
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