Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

ERB template fails after upgrade to Puppet 4

$
0
0
Hi, we're upgrading from Puppet 3 to Puppet 4 and hit some issues with custom facts no longer working. Custom fact name: logservers.rb, it returns a string of IPs: '1.2.3.4, 5,6,7,8'. We then turn the string into an array: $logservers = split($::logservers, ', ') We use that variable in a template: rsyslog/central_logging.conf.erb that creates an rsyslog.d config file using this ERB code: <% @logservers.each_with_index do |server, index| -%><% if index == 0 -%> *.* <%= server %><% else -%>&<%= server %><% end -%><% end -%> This fails to parse with the error below. How can I recreate this config file in Puppet 4? Error: Could not retrieve catalog from remote server: Error 500 on SERVER: {"message":"Server Error: Evaluation Error: Error while evaluating a Function Call, Failed to parse template rsyslog/central_logging.conf.erb:\n Filepath: /etc/puppetlabs/code/modules/rsyslog/templates/central_logging.conf.erb\n Line: 4\n Detail: undefined method `each_with_index' for \"10.37.2.14, 10.37.2.12\":String\n at /etc/puppetlabs/code/modules/rsyslog/manifests/config.pp:7

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>