The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Bug #14677

Puppet 3.0.x variable assigned to undef returns :undef in template

Added by Anonymous almost 4 years ago. Updated over 3 years ago.

Status:DuplicateStart date:05/23/2012
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Affected Puppet version: Branch:
Keywords:scope lookupvar template undef undefined nil

We've Moved!

Ticket tracking is now hosted in JIRA:



We’ve made good progress returning nil values in ERB templates in 3.0.x but we’re not out of the wood yet.

A fairly common pattern is to assign undef to a variable in the Puppet DSL, meaning “Treat this variable as undefined.”

The expected behavior is that the variable behaves as if it were not defined. The following manifest should illustrate the problem. The expected behavior is that we receive nil.

$undefined = undef
$foo = inline_template("<% require 'pry'; binding.pry; vapid_var; %>")
[7] pry(#)> scope.lookupvar('undefined_no_really')
=> nil
[8] pry(#)> scope.lookupvar('undefined')
=> :undef

Related issues

Related to Puppet - Bug #5820: Undefined variables throw poor error Duplicate 01/10/2011
Duplicated by Puppet - Bug #15329: Puppet lacks a proper "undefined" value Accepted 07/02/2012


#1 Updated by Kelsey Hightower almost 4 years ago

  • Status changed from Unreviewed to Accepted
  • Affected Puppet version deleted (3.0.0rc2)

#2 Updated by Anonymous almost 4 years ago

  • Status changed from Accepted to Duplicate

Action Required

We have gone back and forth on this a lot. At the very best we’re wildly inconsistent in 3.x and all of our values for undef internally evaluate to truth and internally have non-empty to_s implementations.

Based on the huge number of undef related tickets in the issue tracker, I’m making a stand and saying #15329 is the real root cause of all of these issue. If you are a watcher on this ticket, please transfer your most pressing concerns to #15329.

Here is the list of related “undef” issues that I’ve found so far: #4692 #5820 #6621 #6745 #8778 #8783 #13210 #14654 #14677 #14666

I am going to close this ticket as a duplicate of #15329. Again, please transfer your most pressing concerns to #15329 in an effort to consolidate all of the issues related to undef variables in the Puppet DSL.

Thanks, -Jeff

#3 Updated by Anonymous over 3 years ago

  • Target version deleted (3.x)

Also available in: Atom PDF