Puppet Dashboard, arrays and hashes

676 views
Skip to first unread message

Peter Berghold

unread,
Mar 7, 2012, 10:53:09 AM3/7/12
to puppet...@googlegroups.com
I have been using the Dashboard facility for assigning string values to keys with great glee.  It solves a number of support issues that I was dealing with in a very neat fashion.

I did a google search on "puppet dashboard arrays" and found that there had been some discussion about this and a feature request made but I didn't get the impression that there was ever a resolution.

Is there a way of encoding

$domains = {   "domain.tld" => { users => [ "tom" , "dick" , "harry" , "sally" },
                       "otherdomain.tld" => { users=> [ "spot", "jane", "dick"] }
}

from dashboard and if so how?



--
Peter L. Berghold
Owner, Shark River Technical Solutions LLC

Nan Liu

unread,
Mar 7, 2012, 11:37:52 AM3/7/12
to puppet...@googlegroups.com

Since dashboard only handles string, the only way I can think of is to
represent the array/hash data as yaml or json in dashboard and convert
the string back using a puppet function such as parsejson/parseyaml in
stdlib. At the moment, there's also additional escape characters
that's needs to be dealt with (a bug I think), so "[\"foo\"]" is
returned as "[\\\"foo\\\"]".

Thanks,

Nan

Peter Berghold

unread,
Mar 7, 2012, 11:44:11 AM3/7/12
to puppet...@googlegroups.com
OK:  that was the impression I was under after reading everything that was posted to the feature request for this...

Nan Liu

unread,
Mar 7, 2012, 5:22:09 PM3/7/12
to puppet...@googlegroups.com
On Wed, Mar 7, 2012 at 8:44 AM, Peter Berghold <salty....@gmail.com> wrote:
> OK:  that was the impression I was under after reading everything that was
> posted to the feature request for this...

Actually, I've mistakenly filed it as a bug. If you use json, you can
parse the parameter via parsejson available in stdlib:

In dashboard set the parameter example to ["foo", "bar"]

ENC output:
parameters:
example: "[\"foo\", \"bar\"]"

In puppet manifests:
$example_array = parsejson($example)
notify { $example_array : }

notice: /Stage[main]//Node[sample]/Notify[bar]/message: current_value
absent, should be bar (noop)
notice: /Stage[main]//Node[sample]/Notify[foo]/message: current_value
absent, should be foo (noop)

Thanks,

Nan

Pablo Fernandez

unread,
Mar 14, 2012, 7:30:28 AM3/14/12
to puppet...@googlegroups.com
Hi,

I am actually interested in this... what is the actual status?

I would like to be able to have arrays and define them in the dashboard,
possibly filling parts of the array from different groups. Is it possible? How?

Thanks!
BR/Pablo

Reply all
Reply to author
Forward
0 new messages