Issue #4350 has been reported by Alan Harder.

----------------------------------------
Bug #4350: Cannot reference variable in class containing dash/hyphen
http://projects.puppetlabs.com/issues/4350

Author: Alan Harder
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: parser
Target version: 
Affected version: 2.6.0
Keywords: 
Branch: 


<pre>class test-class {
  $var = 'foo'
}
node default {
  include test-class
  notify { "value is ${test-class::var}": }
}</pre>

Running above test case on 2.6.0 / ruby 1.8.7 / Solaris 10 results in:

<pre>/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/parser_support.rb:172:in 
`on_error'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util/autoload.rb:79:in `_racc_yyparse_c'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/lexer.rb:483:in `scan'
/opt/csw/lib/ruby/1.8/racc/parser.rb:152:in `_racc_yyparse_c'
/opt/csw/lib/ruby/1.8/racc/parser.rb:152:in `__send__'
/opt/csw/lib/ruby/1.8/racc/parser.rb:152:in `yyparse'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/parser_support.rb:181:in `parse'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/resource/type_collection.rb:164:in 
`perform_initial_import'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/node/environment.rb:75:in 
`known_resource_types'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/resource/type_collection_helper.rb:5:in 
`known_resource_types'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:425:in `initvars'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:180:in `initialize'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:18:in `new'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:18:in `compile'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util.rb:180:in `benchmark'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in 
`find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:112:in `main'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:301:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:398:in `exit_on_fail'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:301:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/opt/csw/bin/puppet:4
/opt/csw/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:21:in `compile'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util.rb:180:in `benchmark'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in 
`find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:112:in `main'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:301:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:398:in `exit_on_fail'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:301:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/opt/csw/bin/puppet:4
Could not parse for environment production: Syntax error at 'class::var'; 
expected '}' at foo.pp:6 on node ...</pre>

Workaround of course is to not use dash/hyphen in class names...



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