Issue #16390 has been updated by Timur Batyrshin.
Thank you, it seems I've missed that section of the docs. ---------------------------------------- Bug #16390: defined?() does not work as intended in ERB templates https://projects.puppetlabs.com/issues/16390#change-71116 Author: Timur Batyrshin Status: Rejected Priority: Normal Assignee: Category: Target version: Affected Puppet version: Keywords: Branch: While trying to do search for a variable with `defined?` in ERB template we always get `nil`: <pre> $ cat test.pp $foo = 'bar' $defined = inline_template("<%= defined?(foo).inspect %>") $result = inline_template("<%= foo %>") notice( "defined: ${defined}" ) notice( "result: ${result}" ) </pre> <pre> $ puppet apply test.pp /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead. notice: Scope(Class[main]): defined: nil notice: Scope(Class[main]): result: bar notice: Finished catalog run in 0.14 seconds $ </pre> This prevents us from using constructions like `(defined?(options) && options['foo']) || "foo_default"` in ERB templates. -- 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.
