Concatanating result of custom function to a string

93 views
Skip to first unread message

Amos Shapira

unread,
Oct 6, 2012, 6:41:08 AM10/6/12
to puppet...@googlegroups.com
Hello,

I'm working on execution of puppet's "puppet cert generate ...--dns_alt_names=name1,name2,name2" using Puppet 2.7.19 and didn't find a way to figure out the following:

I'd prefer to keep the list of "dns_alt_names" in a puppet array and join() them when I build the command string.

E.g.
$dns_alt_names = [ 'name1', 'name2', ...]
$command = "puppet cert generate ... --dns_alt_names=" <what goes here?> join($dns_alt_names, ',').

But I didn't find a way to concatenate the output of the join() call to the string before it.

A couple of ways I though that might allow this are:
  1. Set a temporary variable with the output of join() and interpolate it into the command with "...${temp_var}"
  2. Use inline_template()

Are these the only viable ways to achieve that?

For now I keep the names in a single string, but I think this is less maintainable than using an array.

Thanks,

--Amos

Krzysztof Wilczynski

unread,
Oct 6, 2012, 3:03:12 PM10/6/12
to puppet...@googlegroups.com
Hey,

I think, you might be over-thinking this a little :)

KW

jcbollinger

unread,
Oct 8, 2012, 9:19:57 AM10/8/12
to puppet...@googlegroups.com

On Saturday, October 6, 2012 5:41:09 AM UTC-5, Amos Shapira wrote:
Hello,

I'm working on execution of puppet's "puppet cert generate ...--dns_alt_names=name1,name2,name2" using Puppet 2.7.19 and didn't find a way to figure out the following:

I'd prefer to keep the list of "dns_alt_names" in a puppet array and join() them when I build the command string.

E.g.
$dns_alt_names = [ 'name1', 'name2', ...]
$command = "puppet cert generate ... --dns_alt_names=" <what goes here?> join($dns_alt_names, ',').


So, this sort of one-time provisioning task is not the sort of thing I would normally look to automate via Puppet.

 

But I didn't find a way to concatenate the output of the join() call to the string before it.

A couple of ways I though that might allow this are:
  1. Set a temporary variable with the output of join() and interpolate it into the command with "...${temp_var}"
  2. Use inline_template()

Are these the only viable ways to achieve that?


No, but they're probably the easiest and best.
 

John

Reply all
Reply to author
Forward
0 new messages