On Mon, Aug 13, 2012 at 4:47 AM, Ron <ronald.vale...@gmail.com> wrote:
> All, I am trying to have a unique type name be having
> "${username}-${dotfile}" where $dotfile is an array of filenames.
> This is based on the Puppet 2.7 Cookbook to manage user dotfiles and ssh
> keys.
>
> I opened a bug here:
> http://projects.puppetlabs.com/issues/15919
>
> I have a github gist here:
> https://gist.github.com/3323851
>
> Any insight would be greatly appreciated.

Puppet notify resource converts the array to a string. It's not that
the variable isn't an array, but you are looking at the .to_s output.
The following example should demonstrate this better:

var = [1, 2]
notice("user-${var}")
$arr = inline_template("<%= var.inspect %>")
notice("user-${arr}")

notice: Scope(Class[main]): user-12
notice: Scope(Class[main]): user-["1", "2"]
notice: Finished catalog run in 0.04 seconds

A common misconception, but most people expect in puppet string+array
results in an array value with the string prefix every array element,
what you get is actually string + array.to_s. I haven't seen the
cookbook recipe, but I think what you meant is something closer to
this:

https://gist.github.com/7860c7d8c157432381e3

The crazy parsejson (from stdlib) inline_template is just getting
around inline_template returning string. That should be rewritten as a
puppet function. Anyhow the manifests should give an idea what you are
trying to do.

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to