Re: [Puppet Users] puppet 2.7, template, keys of hash

51 views
Skip to first unread message

Felix Frank

unread,
Dec 4, 2013, 10:10:03 AM12/4/13
to puppet...@googlegroups.com
Works for me.

$ cat /tmp/test.pp
$config = {
host1 => {
port => 1111,
msg => 'dfdasfas'
},
host2 => {
port => 2222,
msg => 'dfdasfas'
},
}

notify { 'test':
message => inline_template("keys: <%= @config.keys %>")
}

$ puppet --version
2.7.21
$ puppet apply /tmp/test.pp
notice: keys: host1host2
notice: /Stage[main]//Notify[test]/message: defined 'message' as 'keys:
host1host2'
notice: Finished catalog run in 0.01 seconds

Something's odd.

Cheers,
Felix

On 12/04/2013 02:32 PM, David Portabella wrote:
> $ puppet apply --templatedir=templates/ test.pp
>
> this works on puppet 3.2, but it fails on puppet 2.7 with:
> Unknown function keys at /home/vagrant/test.pp:12
>
> why?
>
> I guess that this depends on the version of ruby used for handling
> templates. why ruby version does puppet 2.7 and puppet 3 use?
>
> what is a workaround to make this work on puppet 2.7?
>
Reply all
Reply to author
Forward
0 new messages