Bug #8997
open^M in multi line parameter
Description
I have a class that takes $custom_routes parameter that is fed to a template:
<% custom_routes.each_line do |val| ->
<= val >
< end -%>
I enter some lines for parameter in foreman:
192.168.0.0/24 via 192.168.128.1
192.168.10.0/24 via 192.168.128.1
192.168.2.0/24 via 192.168.128.1
I get this in the resulting file on the client:
192.168.0.0/24 via 192.168.128.1^M
192.168.10.0/24 via 192.168.128.1^M
192.168.2.0/24 via 192.168.128.1
As a result system init script fails to set up static routes correctly.
First I tought this to be a browser issue (opera), but the same happens in firefox. So it must happen further down the stack, likely somewhere in foreman or maybe in rubys handling of .each_line.
Puppetmaster has ruby 2.0.0 and puppet 3.6.3, client has ruby 1.8.7 and puppet 3.7.1.
Any hints on how to fix / work around this?
Updated by Dominic Cleal about 10 years ago
- Category set to Parameters
.each_line splits on the new line character(s) for the OS it's running on. You could do .each_line("\r\n") to split on CRLF instead.
I guess your browser is running on Windows? We munge CRLF in other places in Foreman, parameters could do the same.
Updated by Jure Pecar about 10 years ago
No, my workstation is linux.
With .each_line("\r\n") the resulting static route file is the same, so it doesn't fix the problem.
Updated by Dominic Cleal about 10 years ago
Try using val.chomp to remove trailing whitespace?
Updated by Dominic Cleal over 7 years ago
- Related to Bug #19472: Smart Class Parameter adding \r to strings and issues with ""s added