Last active
May 6, 2020 12:02
-
-
Save frimik/4482463 to your computer and use it in GitHub Desktop.
Puppet Template Patterns to remember.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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