Project

General

Profile

Actions

Bug #8997

open

^M in multi line parameter

Added by Jure Pecar over 9 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Parameters
Target version:
-
Difficulty:
Triaged:
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 1 (1 open0 closed)

Related to Foreman - Bug #19472: Smart Class Parameter adding \r to strings and issues with ""sNewActions
Actions #1

Updated by Dominic Cleal over 9 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.

Actions #2

Updated by Jure Pecar over 9 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.

Actions #3

Updated by Dominic Cleal over 9 years ago

Try using val.chomp to remove trailing whitespace?

Actions #4

Updated by Jure Pecar over 9 years ago

Ok, this workaround wokrs, thanks.

Actions #5

Updated by Dominic Cleal almost 7 years ago

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

Also available in: Atom PDF