Here are the slides from Nick Fagerlund's PuppetConf 2016 presentation called PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition. Watch the videos at https://www.youtube.com/playlist?list=PLV86BgbREluVjwwt-9UL8u2Uy8xnzpIqa
3. I’ve seen things you people wouldn’t believe
My 2013 talk: https://www.youtube.com/watch?v=aU7vjKYqMUo
My much smarter inspiration: https://www.destroyallsoftware.com/talks/wat
3
9. Relative Namespacing
include apache meant…
• <CURRENT NAMESPACE>::apache
• <PARENT OF CURRENT NAMESPACE>::apache
• etc. and so on
• Eventually, ::apache
https://projects.puppetlabs.com/issues/2053
https://tickets.puppetlabs.com/browse/PUP-121
9
14. Is Truth Beauty, and Beauty Truth?
if $::is_virtual == 'true' { ... }
# or:
if str2bool($::is_virtual) { ... }
# with the str2bool() function
from puppetlabs/stdlib
14
15. Is Truth Beauty, and Beauty Truth?
$interfaces =
lo0,gif0,stf0,en0,en1,en2,p2p0,awdl0,
bridge0,utun0
$macaddress_en0 = 72:00:04:eb:7a:93
...etc.
15
21. Interpolation Shenanigans
• Single bare word:
• ${variable}
• Bare word plus chained function call:
• ${variable.split(‘,’)}
• That’s it. Otherwise it’s an expression.
21
24. The Great Escape
$s32path = 'C:WindowsSystem32'
notice($s32path)
# Error: Unclosed quote after ''
in 'C:WindowsSystem32'
24
25. The Great Escape
$s32path = 'C:WindowsSystem32'
notice($s32path)
# Notice: Scope(Class[main]):
C:WindowsSystem32
>:c
25
26. The Great Escape
$gitconfig = @("GITCONFIG"/L)
[user]
name = ${displayname}
email = ${email}
[alias]
lg = "log —pretty=format:’%C(yellow)%h
%C(reset) %s%C(cyan)%cr%C(reset) %C(blue)%an
%C(reset) %C(green)%d%C(reset)’ --graph"
| GITCONFIG
26
27. The Great Escape
$s32path = @(MYPATH)
C:WindowsSystem32
-MYPATH
notice($s32path)
# Notice: Scope(Class[main]):
C:WindowsSystem32
27
28. Class Class
class class {
notify {'hey it worked':}
}
include class
# Error: Syntax error at 'class' at
/root/test.pp:5
28
29. Class Class
class class {
notify {'hey it worked':}
}
include "class"
# Notice: hey it worked
# Notice: /Stage[main]/Class/Notify[hey it
worked]/message: defined 'message' as 'hey it
worked'
29
30. Class Class
class class {
notify {'hey it worked':}
}
include "class"
# Error: 'class' is not a valid classname
at /Users/nick/Desktop/test.pp:1:7
30