Project

General

Profile

Actions

Bug #19472

open

Smart Class Parameter adding \r to strings and issues with ""s

Added by James Perry about 7 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Parameters
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

In adding Smart Parameters to some classes for saz\sudo I found an interesting, and error causing, behaviors.

1. When entering into a smart parameter for a string it shows the double quotes in the string
"# Comment
Cmnd_Alias SOMERULE = /bin/false
testuser ALL NOPASSWD: SOMERULE"

If this is overriden to be

_"# Comment
Cmnd_Alias SOMERULE = /bin/false
testuser ALL NOPASSWD: SOMERULE
  1. Another Comment"_

The puppet run fails with syntax error messages for the lines where the smart parameter was overridden. A puppet catalog run against the host on the master shows:

"mysmartvar": "\"# Comment\r\nCmnd_Alias SOMERULE = /bin/false\r\ntestuser ALL NOPASSWD: SOMERULE\r\n# Another Comment*\"*\r\n"

This of course isn't valid syntax for sudoers which wants
  1. Comment
    Cmnd_Alias SOMERULE = /bin/false
    testusers ALL NOPASSWD: SOMERULE
  2. Another Comment

IF the comments are taken off, the rule is passed mostly correctly. Unfortunately that leads to second issue.

2. Smart Parameter Strings had \r\n appended to end of line instead of only \n.

Continuing with the above example:
When the smart parameter isn't overridden the parameter in the catalog is:

"mysmartvar": "# Comment\nCmnd_Alias SOMERULE = /bin/false\ntestuser ALL NOPASSWD: SOMERULE\n# Another Comment\n"

Just clicking override and removing the quotes, to work around #1 above, the string sent to the host becomes:

"mysmartvar": "# Comment\r\nCmnd_Alias SOMERULE = /bin/false\r\ntestuser ALL NOPASSWD: SOMERULE\r\n# Another Comment\r\n"

This results in the sudoers line become Windows/Dos formatted:

_# Comment*^M*
Cmnd_Alias SOMERULE = /bin/false*^M*
testuser ALL NOPASSWD: SOMERULE*$M*
  1. Another Comment*^M*
    _

To ensure this was not a browser / OS issue. I used Firefox from my Linux Master and Chrome from my Windows desktop. The ^M was added in both cases.

As a workaround I modified the sudo::conf.pp file block from content => $content_real, to content => dos2unix($content_real),.

Unfortunately that modification may not be viable for all Puppet versions / configurations.


Related issues 1 (1 open0 closed)

Related to Foreman - Bug #8997: ^M in multi line parameterNew01/16/2015Actions
Actions #1

Updated by Dominic Cleal about 7 years ago

  • Related to Bug #8997: ^M in multi line parameter added
Actions #2

Updated by Amalia Bentley about 3 years ago

Strings can present strange errors. While I WRITE MY ESSAY I try not to use strings as they can sometimes present errors that should not exist. It's better to find alternatives like a char array.

Actions #3

Updated by Leos Stejskal almost 3 years ago

  • Triaged changed from No to Yes
Actions #4

Updated by Usa Esasy about 2 years ago

I almost completed my dissertation on time, everything was going smoothly and according to the plan but then
I had major personal problems and couldn’t finish editing. I sent my papers to
essayhub review essayhub review</a> service and they completed it splendidly.
These guys are rescued me and i will recommend this company to all my colleagues!

Actions #5

Updated by karl lager almost 2 years ago

Great post! Was interested to read it! Yet I have smth to recommend you as an editor.
It is not easy to find an essay writing service these days. There are so many platforms
that promise superb quality,
fast turnaround, and adherence to your needs yet prove to be unreliable in the long run.
So, take your time to read and to browse the web and to pick a service like custom essay writing company
you really trust and can rely on.

Actions #6

Updated by stefan sterners almost 2 years ago

Great post! Was interested to read it! Yet I have smth to recommend you as an editor.
It is not easy to find an essay writing service these days. There are so many platforms
that promise superb quality,
fast turnaround, and adherence to your needs yet prove to be unreliable in the long run.
So, take your time to read and to browse the web and to pick a service like help with writing papers
you really trust and can rely on.

Actions #7

Updated by kevin brow almost 2 years ago

I almost completed my dissertation on time, everything was going smoothly and according to the plan but then
I had major personal problems and couldn’t finish editing. I sent my papers to
college essay services service and they completed it splendidly.
These guys are rescued me and i will recommend this company to all my colleagues!

Actions

Also available in: Atom PDF