About | FAQ | Help
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ok, we had Tom from Puppetlabs in for an on-site training class and he gave me the correct Ruby syntax for this using the map function.

cassandrasvr=<%= cassandrasvr.map{ |srv| "#{srv}:#{@cassandraport}" }.join(',') %>

Which now results in the correct syntax with the port on the last entry and no trailing comma.


NOTE: my original YAML file contained this:

cassandraport: '9160'
- cass1.abc.com
- cass2.abc.com
- cass3.abc.com
- cass4.abc.com
- cass1.xyz.com
- cass2.xyz.com

Thanks again to Tom for both the answer and a great training class!