Amos Shapira
2012-Oct-06 10:41 UTC
[Puppet Users] Concatanating result of custom function to a string
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 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/zXOjvdCcUj4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Krzysztof Wilczynski
2012-Oct-06 19:03 UTC
[Puppet Users] Re: Concatanating result of custom function to a string
Hey, I think, you might be over-thinking this a little :) KW On Saturday, October 6, 2012 11:41:09 AM UTC+1, 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, '',''). > > 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 >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/BQk8gDzRKmMJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2012-Oct-08 13:19 UTC
[Puppet Users] Re: Concatanating result of custom function to a string
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 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/b0-3Uv3sKxcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.