This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to VietTUG.org

Puppet: Sometimes =, sometimes =>

messy stuff =))
Added by ruby 8 months ago  »  Votes: 3/3

As in Ruby, we use = for assignment, and => to specify value in a hash. But let see how Puppet is messy

In Puppet DSL resource definition

1 define my_resource($foo = "foo", $bar = "bar") {
2   # stuff
3 }

In Ruby Puppet RSL resource definition

(See also (blog) Puppet: Ruby is not Ruby (part 1))

1 define my_resource $foo => "foo", $bar => "bar" do
2   # stuff
3 end

When invoking a resource

The dollar sign will disappear :))

1 my_resource {
2  "foobar": foo => "not foo", bar => "not bar" 
3 }

When switching between Puppet DSl and Puppet Ruby DSL, I often forget = and =>. And that often causes a lot of troubles =))


Comments