SlideShare una empresa de Scribd logo
1 de 71
Descargar para leer sin conexión
Nick’s DSL Quest:
WAT Safari
Nick Fagerlund
Technical Writer | Puppet Labs
@nfagerlund
Friday, August 23, 13
puppetconf.com #puppetconf
So okay,there I was.
Friday, August 23, 13
puppetconf.com #puppetconf
When I first got here,we
had this “language
tutorial.”
Friday, August 23, 13
puppetconf.com #puppetconf
It was a bit of
a mess.
(“Additional language
features…?”)
Friday, August 23, 13
puppetconf.com #puppetconf
The Puppet language
accreted over time.
Friday, August 23, 13
puppetconf.com #puppetconf
(And so did the docs.)
Friday, August 23, 13
puppetconf.com #puppetconf
So I had a good/bad idea.
Friday, August 23, 13
puppetconf.com #puppetconf
Here’s what I found.
Friday, August 23, 13
puppetconf.com #puppetconf
$subj	
  =	
  {t	
  =>	
  'r',	
  u	
  =>	
  'e'}
notice(str2bool("$subj"))
T to the R
Friday, August 23, 13
puppetconf.com #puppetconf
$subj	
  =	
  {t	
  =>	
  'r',	
  u	
  =>	
  'e'}
notice(str2bool("$subj"))
true
T to the R
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
@notify	
  {'one	
  tag':
	
  	
  tag	
  =>	
  'one',
}
@notify	
  {'two	
  tags':
	
  	
  tag	
  =>	
  ['one',	
  'two'],
	
  	
  #before	
  =>	
  Notify['three	
  tags']
}	
  
@notify	
  {'three	
  tags':
	
  	
  tag	
  =>	
  ['one',	
  'two',	
  'three'],
	
  	
  noop	
  =>	
  undef,
}	
  
Let’s talk about collectors
Friday, August 23, 13
puppetconf.com #puppetconf
Notify	
  <|	
  tag	
  ==	
  'one'	
  |>
Notice:	
  Compiled	
  catalog	
  for	
  magpie.lan	
  in	
  environment	
  
production	
  in	
  0.11	
  seconds
Notice:	
  one	
  tag
Notice:	
  /Stage[main]//Notify[one	
  tag]/message:	
  defined	
  
'message'	
  as	
  'one	
  tag'
Notice:	
  three	
  tags
Notice:	
  /Stage[main]//Notify[three	
  tags]/message:	
  defined	
  
'message'	
  as	
  'three	
  tags'
Notice:	
  two	
  tags
Notice:	
  /Stage[main]//Notify[two	
  tags]/message:	
  defined	
  
'message'	
  as	
  'two	
  tags'
Let’s talk about collectors
Friday, August 23, 13
puppetconf.com #puppetconf
Notify	
  <|	
  'one'	
  ==	
  tag	
  |>
Error:	
  Could	
  not	
  parse	
  for	
  environment	
  production:	
  Syntax	
  
error	
  at	
  'one';	
  expected	
  '|>'	
  at	
  /Users/nick/Documents/
manifests/collector-­‐search.pp:29	
  on	
  node	
  magpie.lan
Let’s talk about collectors
Friday, August 23, 13
puppetconf.com #puppetconf
Notify	
  <|	
  tag	
  ==	
  ['one',	
  'two']	
  |>
Notice:	
  Compiled	
  catalog	
  for	
  magpie.lan	
  in	
  environment	
  
production	
  in	
  0.09	
  seconds
Notice:	
  one	
  tag
Notice:	
  /Stage[main]//Notify[one	
  tag]/message:	
  defined	
  
'message'	
  as	
  'one	
  tag'
Notice:	
  three	
  tags
Notice:	
  /Stage[main]//Notify[three	
  tags]/message:	
  defined	
  
'message'	
  as	
  'three	
  tags'
Notice:	
  two	
  tags
Notice:	
  /Stage[main]//Notify[two	
  tags]/message:	
  defined	
  
'message'	
  as	
  'two	
  tags'
Notice:	
  Finished	
  catalog	
  run	
  in	
  0.17	
  seconds
Let’s talk about collectors
Friday, August 23, 13
puppetconf.com #puppetconf
Notify	
  <|	
  tag	
  !=	
  ['one',	
  'two']	
  |>
Notice:	
  Compiled	
  catalog	
  for	
  magpie.lan	
  in	
  environment	
  
production	
  in	
  0.09	
  seconds
Notice:	
  three	
  tags
Notice:	
  /Stage[main]//Notify[three	
  tags]/message:	
  defined	
  
'message'	
  as	
  'three	
  tags'
Notice:	
  two	
  tags
Notice:	
  /Stage[main]//Notify[two	
  tags]/message:	
  defined	
  
'message'	
  as	
  'two	
  tags'
Notice:	
  Finished	
  catalog	
  run	
  in	
  0.18	
  seconds
Let’s talk about collectors
Friday, August 23, 13
puppetconf.com #puppetconf
CONCLUSION:
“==” != “==”
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  class	
  {
	
  	
  notify	
  {'hey	
  it	
  worked':}
}
include	
  class
Results
Classy
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  class	
  {
	
  	
  notify	
  {'hey	
  it	
  worked':}
}
include	
  class
Error:	
  Could	
  not	
  parse	
  for	
  environment	
  
production:	
  Syntax	
  error	
  at	
  'class'	
  at	
  /
Users/nick/Documents/manifests/
class_class.pp:6	
  on	
  node	
  magpie.lan
Classy
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  class	
  {
	
  	
  notify	
  {'hey	
  it	
  worked':}
}
include	
  "class"
Classy
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  class	
  {
	
  	
  notify	
  {'hey	
  it	
  worked':}
}
include	
  "class"
Notice:	
  Compiled	
  catalog	
  for	
  magpie.lan	
  in	
  environment	
  
production	
  in	
  0.09	
  seconds
Notice:	
  hey	
  it	
  worked
Notice:	
  /Stage[main]/Class/Notify[hey	
  it	
  worked]/message:	
  
defined	
  'message'	
  as	
  'hey	
  it	
  worked'
Notice:	
  Finished	
  catalog	
  run	
  in	
  0.19	
  seconds
Classy
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  parent	
  {
	
  	
  	
  	
  define	
  doessomething	
  {	
  notice("parentvar	
  is	
  set,	
  in	
  the	
  
	
   	
   	
   	
   	
   	
   	
   	
   parent::doessomething	
  define")	
  }
	
  	
  	
  	
  class	
  whoa	
  {	
  notice("Okay	
  that	
  works	
  w/	
  classes	
  too")	
  }
	
  	
  	
  	
  $otherparentvar	
  =	
  "haha	
  whoa"
}
search('parent')
doessomething{'something':}
include	
  whoa
notice($otherparentvar)	
  #	
  This	
  one	
  doesn't	
  work	
  though,	
  because	
  
it	
  attaches	
  the	
  NAMESPACE,	
  not	
  the	
  scope.
Search???
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  parent	
  {
	
  	
  	
  	
  define	
  doessomething	
  {	
  notice("parentvar	
  is	
  set,	
  in	
  the	
  
	
   	
   	
   	
   	
   	
   	
   	
   parent::doessomething	
  define")	
  }
	
  	
  	
  	
  class	
  whoa	
  {	
  notice("Okay	
  that	
  works	
  w/	
  classes	
  too")	
  }
	
  	
  	
  	
  $otherparentvar	
  =	
  "haha	
  whoa"
}
search('parent')
doessomething{'something':}
include	
  whoa
notice($otherparentvar)	
  #	
  This	
  one	
  doesn't	
  work	
  though,	
  because	
  
it	
  attaches	
  the	
  NAMESPACE,	
  not	
  the	
  scope.
It	
  dumps	
  a	
  random	
  namespace	
  into	
  the	
  local	
  
namespace???
Search???
Friday, August 23, 13
puppetconf.com #puppetconf
(This is still in Puppet 3.2.)
(photo via http://
weheartit.com/entry/
68358166)
Friday, August 23, 13
puppetconf.com #puppetconf
[	
  Notify['first'],	
  Notify['second']	
  ]
It’s	
  an	
  array	
  of	
  resource	
  references,	
  right?
Have you seen this syntax?
Friday, August 23, 13
puppetconf.com #puppetconf
Notify[	
  'first',	
  'second'	
  ]
???
How about this one?
Friday, August 23, 13
puppetconf.com #puppetconf
Notify[	
  ['first',	
  'second']	
  ]
(Okay,	
  it	
  ends	
  up	
  being	
  the	
  same	
  as	
  the	
  last	
  one	
  for	
  some	
  
reason.)
How about this one?
Friday, August 23, 13
puppetconf.com #puppetconf
#	
  OK
require	
  =>	
  Notify['first',	
  'second']
require	
  =>	
  [	
  Notify['first'],	
  Notify['second']	
  ]
Notify['first',	
  'second']	
  -­‐>	
  Notify['third']
#	
  BAD
[	
  Notify['first'],	
  Notify['second']	
  ]	
  -­‐>	
  
Notify['third']
?????!!
They all look kind of similar?
Friday, August 23, 13
puppetconf.com #puppetconf
#	
  OK
Notify['first',	
  'second']	
  {
	
  	
  message	
  =>	
  'Adding	
  a	
  message	
  to	
  these.'
}
#	
  BAD
[	
  Notify['first'],	
  Notify['second']	
  ]	
  {
	
  	
  message	
  =>	
  'Adding	
  a	
  message	
  to	
  these.'
}
?????!!
They all look kind of similar?
Friday, August 23, 13
puppetconf.com #puppetconf
So,these are two
completely different
syntaxes. (I named the
non-array one “multi-
references.)
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  bar	
  {
	
  	
  notice("From	
  class	
  bar")
}
class	
  foo::bar	
  {
	
  	
  notice("From	
  class	
  foo::bar")
}
class	
  foo	
  {
	
  	
  include	
  bar
}
include	
  foo
Include bar... but only as a last
resort
Friday, August 23, 13
puppetconf.com #puppetconf
class	
  bar	
  {
	
  	
  notice("From	
  class	
  bar")
}
class	
  foo::bar	
  {
	
  	
  notice("From	
  class	
  foo::bar")
}
class	
  foo	
  {
	
  	
  include	
  bar
}
include	
  foo
Notice:	
  Scope(Class[Foo::Bar]):	
  From	
  class	
  foo::bar
(this	
  is	
  bug	
  #2053.)
Include bar... but only as a last
resort
Friday, August 23, 13
puppetconf.com #puppetconf
#	
  Is	
  the	
  ==	
  operator	
  case-­‐sensitive?	
  NO
notice(	
  'eat'	
  ==	
  'EAt'	
  )
#	
  Is	
  the	
  'in'	
  operator	
  case-­‐sensitive?	
  YES
notice(	
  'eat'	
  in	
  'EAten'	
  )
Notice:	
  Scope(Class[main]):	
  true
Notice:	
  Scope(Class[main]):	
  false
Case sensitivity training
Friday, August 23, 13
puppetconf.com #puppetconf
ANYWAY
Friday, August 23, 13
puppetconf.com #puppetconf
#	
  The	
  $is_virtual	
  fact	
  is	
  false	
  on	
  this	
  machine
if	
  $is_virtual	
  {
	
  	
  notice("Guess	
  this	
  is	
  a	
  virtual	
  machine!")
}
Falseness is truth
Friday, August 23, 13
puppetconf.com #puppetconf
#	
  The	
  $is_virtual	
  fact	
  is	
  false	
  on	
  this	
  machine
if	
  $is_virtual	
  {
	
  	
  notice("Guess	
  this	
  is	
  a	
  virtual	
  machine!")
}
Notice:	
  Scope(Class[main]):	
  Guess	
  this	
  is	
  a	
  virtual	
  
machine!
Falseness is truth
Friday, August 23, 13
puppetconf.com #puppetconf
(Use the str2bool()
function from
puppetlabs/stdlib)
Friday, August 23, 13
puppetconf.com #puppetconf
This,of course,escalated
quickly.
Friday, August 23, 13
puppetconf.com #puppetconf
Code
Results
What IS truth,anyway?
Friday, August 23, 13
puppetconf.com #puppetconf
$x	
  =	
  5
$y	
  =	
  3
notice("Value	
  of	
  x	
  is	
  ${x}")
You’ve	
  seen	
  this	
  before.
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
$x	
  =	
  5
$y	
  =	
  3
notice("Five	
  by	
  three	
  is	
  ${$x	
  *	
  $y}")
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
$x	
  =	
  5
$y	
  =	
  3
notice("Five	
  by	
  three	
  is	
  ${$x	
  *	
  $y}")
Notice:	
  Scope(Class[main]):	
  Five	
  by	
  three	
  is	
  15
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
$mystring	
  =	
  "Nothing	
  in	
  particular"
notice("But	
  it	
  was	
  ${$mystring	
  =~	
  /thing/}")
Notice:	
  Scope(Class[main]):	
  But	
  it	
  was	
  true
Express yourself
Whoa
Friday, August 23, 13
puppetconf.com #puppetconf
notice("This	
  time	
  with	
  an	
  in	
  statement:	
  Is	
  there	
  
a	
  thing	
  in	
  nothing?	
  ${"thing"	
  in	
  $mystring}	
  so	
  
yeah")
Notice:	
  Scope(Class[main]):	
  This	
  time	
  with	
  an	
  in	
  
statement:	
  Is	
  there	
  a	
  thing	
  in	
  nothing?	
  true	
  so	
  yeah
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
notice("There's	
  a	
  function	
  operand	
  in	
  here:	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ${	
  fqdn_rand(30)	
  +	
  '90'	
  }	
  so	
  yeah")
WELL,	
  at	
  least	
  THAT	
  one	
  doesn’t	
  work.
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
notice("Variable	
  with	
  doubled	
  sigil:	
  ${	
  $x}	
  so	
  
yeah")
notice("Singular	
  sigil,	
  but	
  with	
  wacky	
  spacing:	
  
${	
  	
  x}	
  so	
  yeah")
Notice:	
  Scope(Class[main]):	
  Variable	
  with	
  doubled	
  sigil:	
  
5	
  so	
  yeah
Notice:	
  Scope(Class[main]):	
  Singular	
  sigil,	
  but	
  with	
  
wacky	
  spacing:	
  5	
  so	
  yeah
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
notice("Yo	
  dawg,	
  I	
  heard	
  you	
  like	
  ${"strings,	
  so	
  
I	
  put	
  a	
  string	
  in	
  your"}	
  string")
Sorry	
  for	
  partying	
  like	
  it’s	
  200X,	
  but	
  anyway	
  yeah,	
  that	
  
totally	
  works.
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
#	
  What	
  about	
  this?	
  
notice("Twenty	
  by	
  eighty	
  is	
  ${	
  20	
  *	
  80	
  }	
  so	
  
yeah")
Error:	
  left	
  operand	
  of	
  *	
  is	
  not	
  a	
  number
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
notice("Twenty	
  by	
  eighty	
  is	
  ${	
  '20'	
  *	
  '80'	
  }	
  so	
  
yeah")
Notice:	
  Scope(Class[main]):	
  Twenty	
  by	
  eighty	
  is	
  1600	
  so	
  
yeah
Express yourself
Friday, August 23, 13
puppetconf.com #puppetconf
And at this point I was like
Friday, August 23, 13
puppetconf.com #puppetconf
(It turns out the first bareword in an
interpolation block gets silently
turned into a variable,so 20 became
$20,which would be a regex capture
variable except we weren’t inside a
conditional so it was undef???)
Friday, August 23, 13
puppetconf.com #puppetconf
So then I was like
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
yeah
Friday, August 23, 13
puppetconf.com #puppetconf
file	
  {'file1':
	
  	
  path	
  =>	
  '/tmp/file1',
	
  	
  ensure	
  =>	
  file,
	
  	
  alias	
  =>	
  ['othername',	
  'fourthname'],
}
file	
  {'file2':
	
  	
  path	
  =>	
  '/tmp/file2',
	
  	
  ensure	
  =>	
  file,
	
  	
  before	
  =>	
  File['othername'],
}
Let’s talk about aliases
Friday, August 23, 13
puppetconf.com #puppetconf
file	
  {'file1':
	
  	
  path	
  =>	
  '/tmp/file1',
	
  	
  ensure	
  =>	
  file,
	
  	
  alias	
  =>	
  ['othername',	
  'fourthname'],
}
file	
  {'file2':
	
  	
  path	
  =>	
  '/tmp/file2',
	
  	
  ensure	
  =>	
  file,
	
  	
  before	
  =>	
  File['othername'],
}
This	
  works	
  fine.
Let’s talk about aliases
Friday, August 23, 13
puppetconf.com #puppetconf
file	
  {'file1':
	
  	
  alias	
  =>	
  ['othername',	
  'fourthname'],
}
file	
  {'file2':}
File['file2']	
  -­‐>	
  File['othername']
Error:	
  Could	
  not	
  find	
  resource	
  'File[othername]'	
  for	
  
relationship	
  from	
  'File[file2]'	
  on	
  node	
  magpie.lan
So	
  it	
  works	
  in	
  metaparameters,	
  but	
  not	
  in	
  chaining	
  
statements.	
  
Okay!
Let’s talk about aliases
Friday, August 23, 13
puppetconf.com #puppetconf
@file	
  {'file1':
	
  	
  path	
  =>	
  '/tmp/file1',
	
  	
  ensure	
  =>	
  file,
	
  	
  alias	
  =>	
  ['othername',	
  'fourthname'],
}
realize	
  File['othername']
Nope!
Let’s talk about aliases
Friday, August 23, 13
puppetconf.com #puppetconf
@file	
  {'file1':
	
  	
  path	
  =>	
  '/tmp/file1',
	
  	
  ensure	
  =>	
  file,
	
  	
  alias	
  =>	
  ['othername',	
  'fourthname'],
}
realize	
  File['/tmp/file1']
Nope!
Let’s talk about aliases
Friday, August 23, 13
puppetconf.com #puppetconf
@file	
  {'file1':
	
  	
  path	
  =>	
  '/tmp/file1',
	
  	
  ensure	
  =>	
  file,
	
  	
  alias	
  =>	
  ['othername',	
  'fourthname'],
}
File	
  <|	
  alias	
  ==	
  'fourthname'	
  |>
PURRS	
  LIKE	
  A	
  KITTEN!
Let’s talk about aliases
Friday, August 23, 13
puppetconf.com #puppetconf
Anyway,what did I learn?
(In the larger sense,not in
the str2bool({t => ‘r’,u =>
‘e’}) sense.)
Friday, August 23, 13
puppetconf.com #puppetconf
Do science to it.
Friday, August 23, 13
puppetconf.com #puppetconf
Long-lived systems get
weird.
Friday, August 23, 13
puppetconf.com #puppetconf
Talk to the old-timers.
Friday, August 23, 13
puppetconf.com #puppetconf
WAT brings us together!
Friday, August 23, 13
puppetconf.com #puppetconf
(Pause here for general
theory of the social capital
of WAT in engineering
cultures.)
Friday, August 23, 13
puppetconf.com #puppetconf
And venting about WAT
can keep your morale up.
Because c’mon.
That’s pretty funny.
Friday, August 23, 13
puppetconf.com #puppetconf
https://
github.com/
nfagerlund/
evil-made-
manifest
(photo via http://
taterpie.tumblr.com/
post/56826040138/
thats-an-awesome-
shot)
Friday, August 23, 13
Thank You
Nick Fagerlund
Technical Writer | Puppet Labs
@nfagerlund
Collaborate. Automate. Ship.
Friday, August 23, 13
Follow us on Twitter @puppetlabs
youtube.com/puppetlabsinc
slideshare.net/puppetlabs
Collaborate. Automate. Ship.
Friday, August 23, 13

Más contenido relacionado

Similar a DSL Quest: A WAT Safari - PuppetConf 2013

Infrastructure as Data - PuppetConf 2013
Infrastructure as Data - PuppetConf 2013Infrastructure as Data - PuppetConf 2013
Infrastructure as Data - PuppetConf 2013Puppet
 
Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013
Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013
Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013Puppet
 
Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013
Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013
Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013Puppet
 
Openstack havana
Openstack havanaOpenstack havana
Openstack havanabodepd
 
Puppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, TooPuppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, TooPuppet
 
Puppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooPuppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooDennis Rowe
 
Scala Implicits - Not to be feared
Scala Implicits - Not to be fearedScala Implicits - Not to be feared
Scala Implicits - Not to be fearedDerek Wyatt
 
Taming Pythons with ZooKeeper
Taming Pythons with ZooKeeperTaming Pythons with ZooKeeper
Taming Pythons with ZooKeeperJyrki Pulliainen
 

Similar a DSL Quest: A WAT Safari - PuppetConf 2013 (8)

Infrastructure as Data - PuppetConf 2013
Infrastructure as Data - PuppetConf 2013Infrastructure as Data - PuppetConf 2013
Infrastructure as Data - PuppetConf 2013
 
Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013
Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013
Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013
 
Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013
Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013
Using Orchestration in Puppet Enterprise 3 - PuppetConf 2013
 
Openstack havana
Openstack havanaOpenstack havana
Openstack havana
 
Puppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, TooPuppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, Too
 
Puppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooPuppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, too
 
Scala Implicits - Not to be feared
Scala Implicits - Not to be fearedScala Implicits - Not to be feared
Scala Implicits - Not to be feared
 
Taming Pythons with ZooKeeper
Taming Pythons with ZooKeeperTaming Pythons with ZooKeeper
Taming Pythons with ZooKeeper
 

Más de Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyamlPuppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)Puppet
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscodePuppet
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twentiesPuppet
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codePuppet
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approachPuppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationPuppet
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliancePuppet
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowPuppet
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Puppet
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppetPuppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkPuppet
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping groundPuppet
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy SoftwarePuppet
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User GroupPuppet
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsPuppet
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyPuppet
 

Más de Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Último

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Último (20)

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

DSL Quest: A WAT Safari - PuppetConf 2013

  • 1. Nick’s DSL Quest: WAT Safari Nick Fagerlund Technical Writer | Puppet Labs @nfagerlund Friday, August 23, 13
  • 2. puppetconf.com #puppetconf So okay,there I was. Friday, August 23, 13
  • 3. puppetconf.com #puppetconf When I first got here,we had this “language tutorial.” Friday, August 23, 13
  • 4. puppetconf.com #puppetconf It was a bit of a mess. (“Additional language features…?”) Friday, August 23, 13
  • 5. puppetconf.com #puppetconf The Puppet language accreted over time. Friday, August 23, 13
  • 6. puppetconf.com #puppetconf (And so did the docs.) Friday, August 23, 13
  • 7. puppetconf.com #puppetconf So I had a good/bad idea. Friday, August 23, 13
  • 8. puppetconf.com #puppetconf Here’s what I found. Friday, August 23, 13
  • 9. puppetconf.com #puppetconf $subj  =  {t  =>  'r',  u  =>  'e'} notice(str2bool("$subj")) T to the R Friday, August 23, 13
  • 10. puppetconf.com #puppetconf $subj  =  {t  =>  'r',  u  =>  'e'} notice(str2bool("$subj")) true T to the R Friday, August 23, 13
  • 12. puppetconf.com #puppetconf @notify  {'one  tag':    tag  =>  'one', } @notify  {'two  tags':    tag  =>  ['one',  'two'],    #before  =>  Notify['three  tags'] }   @notify  {'three  tags':    tag  =>  ['one',  'two',  'three'],    noop  =>  undef, }   Let’s talk about collectors Friday, August 23, 13
  • 13. puppetconf.com #puppetconf Notify  <|  tag  ==  'one'  |> Notice:  Compiled  catalog  for  magpie.lan  in  environment   production  in  0.11  seconds Notice:  one  tag Notice:  /Stage[main]//Notify[one  tag]/message:  defined   'message'  as  'one  tag' Notice:  three  tags Notice:  /Stage[main]//Notify[three  tags]/message:  defined   'message'  as  'three  tags' Notice:  two  tags Notice:  /Stage[main]//Notify[two  tags]/message:  defined   'message'  as  'two  tags' Let’s talk about collectors Friday, August 23, 13
  • 14. puppetconf.com #puppetconf Notify  <|  'one'  ==  tag  |> Error:  Could  not  parse  for  environment  production:  Syntax   error  at  'one';  expected  '|>'  at  /Users/nick/Documents/ manifests/collector-­‐search.pp:29  on  node  magpie.lan Let’s talk about collectors Friday, August 23, 13
  • 15. puppetconf.com #puppetconf Notify  <|  tag  ==  ['one',  'two']  |> Notice:  Compiled  catalog  for  magpie.lan  in  environment   production  in  0.09  seconds Notice:  one  tag Notice:  /Stage[main]//Notify[one  tag]/message:  defined   'message'  as  'one  tag' Notice:  three  tags Notice:  /Stage[main]//Notify[three  tags]/message:  defined   'message'  as  'three  tags' Notice:  two  tags Notice:  /Stage[main]//Notify[two  tags]/message:  defined   'message'  as  'two  tags' Notice:  Finished  catalog  run  in  0.17  seconds Let’s talk about collectors Friday, August 23, 13
  • 16. puppetconf.com #puppetconf Notify  <|  tag  !=  ['one',  'two']  |> Notice:  Compiled  catalog  for  magpie.lan  in  environment   production  in  0.09  seconds Notice:  three  tags Notice:  /Stage[main]//Notify[three  tags]/message:  defined   'message'  as  'three  tags' Notice:  two  tags Notice:  /Stage[main]//Notify[two  tags]/message:  defined   'message'  as  'two  tags' Notice:  Finished  catalog  run  in  0.18  seconds Let’s talk about collectors Friday, August 23, 13
  • 17. puppetconf.com #puppetconf CONCLUSION: “==” != “==” Friday, August 23, 13
  • 19. puppetconf.com #puppetconf class  class  {    notify  {'hey  it  worked':} } include  class Results Classy Friday, August 23, 13
  • 20. puppetconf.com #puppetconf class  class  {    notify  {'hey  it  worked':} } include  class Error:  Could  not  parse  for  environment   production:  Syntax  error  at  'class'  at  / Users/nick/Documents/manifests/ class_class.pp:6  on  node  magpie.lan Classy Friday, August 23, 13
  • 21. puppetconf.com #puppetconf class  class  {    notify  {'hey  it  worked':} } include  "class" Classy Friday, August 23, 13
  • 22. puppetconf.com #puppetconf class  class  {    notify  {'hey  it  worked':} } include  "class" Notice:  Compiled  catalog  for  magpie.lan  in  environment   production  in  0.09  seconds Notice:  hey  it  worked Notice:  /Stage[main]/Class/Notify[hey  it  worked]/message:   defined  'message'  as  'hey  it  worked' Notice:  Finished  catalog  run  in  0.19  seconds Classy Friday, August 23, 13
  • 23. puppetconf.com #puppetconf class  parent  {        define  doessomething  {  notice("parentvar  is  set,  in  the                   parent::doessomething  define")  }        class  whoa  {  notice("Okay  that  works  w/  classes  too")  }        $otherparentvar  =  "haha  whoa" } search('parent') doessomething{'something':} include  whoa notice($otherparentvar)  #  This  one  doesn't  work  though,  because   it  attaches  the  NAMESPACE,  not  the  scope. Search??? Friday, August 23, 13
  • 24. puppetconf.com #puppetconf class  parent  {        define  doessomething  {  notice("parentvar  is  set,  in  the                   parent::doessomething  define")  }        class  whoa  {  notice("Okay  that  works  w/  classes  too")  }        $otherparentvar  =  "haha  whoa" } search('parent') doessomething{'something':} include  whoa notice($otherparentvar)  #  This  one  doesn't  work  though,  because   it  attaches  the  NAMESPACE,  not  the  scope. It  dumps  a  random  namespace  into  the  local   namespace??? Search??? Friday, August 23, 13
  • 25. puppetconf.com #puppetconf (This is still in Puppet 3.2.) (photo via http:// weheartit.com/entry/ 68358166) Friday, August 23, 13
  • 26. puppetconf.com #puppetconf [  Notify['first'],  Notify['second']  ] It’s  an  array  of  resource  references,  right? Have you seen this syntax? Friday, August 23, 13
  • 27. puppetconf.com #puppetconf Notify[  'first',  'second'  ] ??? How about this one? Friday, August 23, 13
  • 28. puppetconf.com #puppetconf Notify[  ['first',  'second']  ] (Okay,  it  ends  up  being  the  same  as  the  last  one  for  some   reason.) How about this one? Friday, August 23, 13
  • 29. puppetconf.com #puppetconf #  OK require  =>  Notify['first',  'second'] require  =>  [  Notify['first'],  Notify['second']  ] Notify['first',  'second']  -­‐>  Notify['third'] #  BAD [  Notify['first'],  Notify['second']  ]  -­‐>   Notify['third'] ?????!! They all look kind of similar? Friday, August 23, 13
  • 30. puppetconf.com #puppetconf #  OK Notify['first',  'second']  {    message  =>  'Adding  a  message  to  these.' } #  BAD [  Notify['first'],  Notify['second']  ]  {    message  =>  'Adding  a  message  to  these.' } ?????!! They all look kind of similar? Friday, August 23, 13
  • 31. puppetconf.com #puppetconf So,these are two completely different syntaxes. (I named the non-array one “multi- references.) Friday, August 23, 13
  • 32. puppetconf.com #puppetconf class  bar  {    notice("From  class  bar") } class  foo::bar  {    notice("From  class  foo::bar") } class  foo  {    include  bar } include  foo Include bar... but only as a last resort Friday, August 23, 13
  • 33. puppetconf.com #puppetconf class  bar  {    notice("From  class  bar") } class  foo::bar  {    notice("From  class  foo::bar") } class  foo  {    include  bar } include  foo Notice:  Scope(Class[Foo::Bar]):  From  class  foo::bar (this  is  bug  #2053.) Include bar... but only as a last resort Friday, August 23, 13
  • 34. puppetconf.com #puppetconf #  Is  the  ==  operator  case-­‐sensitive?  NO notice(  'eat'  ==  'EAt'  ) #  Is  the  'in'  operator  case-­‐sensitive?  YES notice(  'eat'  in  'EAten'  ) Notice:  Scope(Class[main]):  true Notice:  Scope(Class[main]):  false Case sensitivity training Friday, August 23, 13
  • 36. puppetconf.com #puppetconf #  The  $is_virtual  fact  is  false  on  this  machine if  $is_virtual  {    notice("Guess  this  is  a  virtual  machine!") } Falseness is truth Friday, August 23, 13
  • 37. puppetconf.com #puppetconf #  The  $is_virtual  fact  is  false  on  this  machine if  $is_virtual  {    notice("Guess  this  is  a  virtual  machine!") } Notice:  Scope(Class[main]):  Guess  this  is  a  virtual   machine! Falseness is truth Friday, August 23, 13
  • 38. puppetconf.com #puppetconf (Use the str2bool() function from puppetlabs/stdlib) Friday, August 23, 13
  • 40. puppetconf.com #puppetconf Code Results What IS truth,anyway? Friday, August 23, 13
  • 41. puppetconf.com #puppetconf $x  =  5 $y  =  3 notice("Value  of  x  is  ${x}") You’ve  seen  this  before. Express yourself Friday, August 23, 13
  • 42. puppetconf.com #puppetconf $x  =  5 $y  =  3 notice("Five  by  three  is  ${$x  *  $y}") Express yourself Friday, August 23, 13
  • 43. puppetconf.com #puppetconf $x  =  5 $y  =  3 notice("Five  by  three  is  ${$x  *  $y}") Notice:  Scope(Class[main]):  Five  by  three  is  15 Express yourself Friday, August 23, 13
  • 44. puppetconf.com #puppetconf $mystring  =  "Nothing  in  particular" notice("But  it  was  ${$mystring  =~  /thing/}") Notice:  Scope(Class[main]):  But  it  was  true Express yourself Whoa Friday, August 23, 13
  • 45. puppetconf.com #puppetconf notice("This  time  with  an  in  statement:  Is  there   a  thing  in  nothing?  ${"thing"  in  $mystring}  so   yeah") Notice:  Scope(Class[main]):  This  time  with  an  in   statement:  Is  there  a  thing  in  nothing?  true  so  yeah Express yourself Friday, August 23, 13
  • 46. puppetconf.com #puppetconf notice("There's  a  function  operand  in  here:                      ${  fqdn_rand(30)  +  '90'  }  so  yeah") WELL,  at  least  THAT  one  doesn’t  work. Express yourself Friday, August 23, 13
  • 47. puppetconf.com #puppetconf notice("Variable  with  doubled  sigil:  ${  $x}  so   yeah") notice("Singular  sigil,  but  with  wacky  spacing:   ${    x}  so  yeah") Notice:  Scope(Class[main]):  Variable  with  doubled  sigil:   5  so  yeah Notice:  Scope(Class[main]):  Singular  sigil,  but  with   wacky  spacing:  5  so  yeah Express yourself Friday, August 23, 13
  • 48. puppetconf.com #puppetconf notice("Yo  dawg,  I  heard  you  like  ${"strings,  so   I  put  a  string  in  your"}  string") Sorry  for  partying  like  it’s  200X,  but  anyway  yeah,  that   totally  works. Express yourself Friday, August 23, 13
  • 49. puppetconf.com #puppetconf #  What  about  this?   notice("Twenty  by  eighty  is  ${  20  *  80  }  so   yeah") Error:  left  operand  of  *  is  not  a  number Express yourself Friday, August 23, 13
  • 50. puppetconf.com #puppetconf notice("Twenty  by  eighty  is  ${  '20'  *  '80'  }  so   yeah") Notice:  Scope(Class[main]):  Twenty  by  eighty  is  1600  so   yeah Express yourself Friday, August 23, 13
  • 51. puppetconf.com #puppetconf And at this point I was like Friday, August 23, 13
  • 52. puppetconf.com #puppetconf (It turns out the first bareword in an interpolation block gets silently turned into a variable,so 20 became $20,which would be a regex capture variable except we weren’t inside a conditional so it was undef???) Friday, August 23, 13
  • 53. puppetconf.com #puppetconf So then I was like Friday, August 23, 13
  • 56. puppetconf.com #puppetconf file  {'file1':    path  =>  '/tmp/file1',    ensure  =>  file,    alias  =>  ['othername',  'fourthname'], } file  {'file2':    path  =>  '/tmp/file2',    ensure  =>  file,    before  =>  File['othername'], } Let’s talk about aliases Friday, August 23, 13
  • 57. puppetconf.com #puppetconf file  {'file1':    path  =>  '/tmp/file1',    ensure  =>  file,    alias  =>  ['othername',  'fourthname'], } file  {'file2':    path  =>  '/tmp/file2',    ensure  =>  file,    before  =>  File['othername'], } This  works  fine. Let’s talk about aliases Friday, August 23, 13
  • 58. puppetconf.com #puppetconf file  {'file1':    alias  =>  ['othername',  'fourthname'], } file  {'file2':} File['file2']  -­‐>  File['othername'] Error:  Could  not  find  resource  'File[othername]'  for   relationship  from  'File[file2]'  on  node  magpie.lan So  it  works  in  metaparameters,  but  not  in  chaining   statements.   Okay! Let’s talk about aliases Friday, August 23, 13
  • 59. puppetconf.com #puppetconf @file  {'file1':    path  =>  '/tmp/file1',    ensure  =>  file,    alias  =>  ['othername',  'fourthname'], } realize  File['othername'] Nope! Let’s talk about aliases Friday, August 23, 13
  • 60. puppetconf.com #puppetconf @file  {'file1':    path  =>  '/tmp/file1',    ensure  =>  file,    alias  =>  ['othername',  'fourthname'], } realize  File['/tmp/file1'] Nope! Let’s talk about aliases Friday, August 23, 13
  • 61. puppetconf.com #puppetconf @file  {'file1':    path  =>  '/tmp/file1',    ensure  =>  file,    alias  =>  ['othername',  'fourthname'], } File  <|  alias  ==  'fourthname'  |> PURRS  LIKE  A  KITTEN! Let’s talk about aliases Friday, August 23, 13
  • 62. puppetconf.com #puppetconf Anyway,what did I learn? (In the larger sense,not in the str2bool({t => ‘r’,u => ‘e’}) sense.) Friday, August 23, 13
  • 63. puppetconf.com #puppetconf Do science to it. Friday, August 23, 13
  • 64. puppetconf.com #puppetconf Long-lived systems get weird. Friday, August 23, 13
  • 65. puppetconf.com #puppetconf Talk to the old-timers. Friday, August 23, 13
  • 66. puppetconf.com #puppetconf WAT brings us together! Friday, August 23, 13
  • 67. puppetconf.com #puppetconf (Pause here for general theory of the social capital of WAT in engineering cultures.) Friday, August 23, 13
  • 68. puppetconf.com #puppetconf And venting about WAT can keep your morale up. Because c’mon. That’s pretty funny. Friday, August 23, 13
  • 69. puppetconf.com #puppetconf https:// github.com/ nfagerlund/ evil-made- manifest (photo via http:// taterpie.tumblr.com/ post/56826040138/ thats-an-awesome- shot) Friday, August 23, 13
  • 70. Thank You Nick Fagerlund Technical Writer | Puppet Labs @nfagerlund Collaborate. Automate. Ship. Friday, August 23, 13
  • 71. Follow us on Twitter @puppetlabs youtube.com/puppetlabsinc slideshare.net/puppetlabs Collaborate. Automate. Ship. Friday, August 23, 13