Project

General

Profile

Bug #8997

^M in multi line parameter

Added by Jure Pecar almost 6 years ago. Updated almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Parameters
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

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?


Related issues

Related to Foreman - Bug #19472: Smart Class Parameter adding \r to strings and issues with ""sNew2017-05-05

History

#1 Updated by Dominic Cleal almost 6 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.

#2 Updated by Jure Pecar almost 6 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.

#3 Updated by Dominic Cleal almost 6 years ago

Try using val.chomp to remove trailing whitespace?

#4 Updated by Jure Pecar almost 6 years ago

Ok, this workaround wokrs, thanks.

#5 Updated by Dominic Cleal over 3 years ago

  • Related to Bug #19472: Smart Class Parameter adding \r to strings and issues with ""s added

Also available in: Atom PDF