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.

cassandrasvr=cass1.abc.com:9160,cass2.abc.com:9160,cass3.abc.com:9160,cass4.abc.com:9160,cass1.xyz.com:9160,cass2.xyz.com:9160

NOTE: my original YAML file contained this:

---
cassandraport: '9160'
cassandrasvr:
- 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!