Skip to content

Instantly share code, notes, and snippets.

@frimik
Last active May 6, 2020 12:02
Show Gist options
  • Save frimik/4482463 to your computer and use it in GitHub Desktop.
Save frimik/4482463 to your computer and use it in GitHub Desktop.
Puppet Template Patterns to remember.
## Check if variable is defined
# Replaces has_variable?(var) and if @var variations.
# include?() pattern from @Jan_vStone.
#
# scope.lookupvar return values for undefined variables:
# Puppet 3.x: nil
# Puppet 2.6.x: :undefined
# Puppet 2.7.x: :undefined
<% if ! [:undefined, nil, ''].include?(masquerade_address = scope.lookupvar('ftp::masquerade_address')) -%>
MasqueradeAddress <%= masquerade_address %>
<% end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment