Bug 1353968

Summary: Satellite 6: Smart Variables still removing newlines (http://projects.theforeman.org/issues/15534)
Product: Red Hat Satellite Reporter: Calvin Hartwell <chartwel>
Component: ProvisioningAssignee: Tomer Brisker <tbrisker>
Status: CLOSED ERRATA QA Contact: Bruno Rocha <rochacbruno>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.9CC: bbuckingham, bkearney, chartwel, cwelton, inecas, jcallaha, mburgerh, tbrisker, zhunting
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: foreman-1.11.0.72-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1426384 (view as bug list) Environment:
Last Closed: 2017-05-01 13:53:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1415680, 1426384    

Description Calvin Hartwell 2016-07-08 14:43:24 UTC
Description of problem:

The smart variables/parameters remove new lines (and white space) which causes issues with the motd module (discussed and fixed here: http://projects.theforeman.org/issues/15534). 

I've seen multiple customers with this issue. I've also seen multiple red hat employees describe this issue in the #satellite6 channel. 

We need a backward port of this fix fr 6.1.9. We also need this fix in 6.2.0. 

Version-Release number of selected component (if applicable):

6.1.X
6.1.9
6.2.X

How reproducible:

Easy to reproduce. 

Steps to Reproduce:
1. Install and setup sat6. 
2. Add the motd module from the puppet forge (by puppet labs). 
3. Publish CV with Puppet module.
4. Add the puppet module to a hostgroup/host and configure the content parameter for the module. Try to add a newline character (either \n or "\n") but it will be removed from the parameter. 

Actual results:

motd from puppet forge (by puppet labs) puppet module does not work well with sat6. 

Expected results:

motd puppet module should work as expected. 
Smart variables/parameters should be able to handle new line characters.  

Additional info:

External bug: http://projects.theforeman.org/issues/15534

Comment 1 Bryan Kearney 2016-07-08 15:37:29 UTC
Connecting redmine issue http://projects.theforeman.org/issues/15534 from this bug

Comment 2 Calvin Hartwell 2016-07-08 16:09:52 UTC
(In reply to Bryan Kearney from comment #1)
> Connecting redmine issue http://projects.theforeman.org/issues/15534 from
> this bug

Thanks!

Comment 3 Bryan Kearney 2016-07-08 16:14:59 UTC
Upstream bug component is Provisioning

Comment 4 Bryan Kearney 2016-07-08 16:15:01 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15534 has been closed

Comment 12 Satellite Program 2017-02-23 21:08:45 UTC
Please add verifications steps for this bug to help QE verify

Comment 13 Tomer Brisker 2017-02-26 08:06:01 UTC
Verification steps:

1. Create a smart variable of type string on a puppet class, or use an existing smart parameter.
2. Set default value to something like:
"


Testing


"
3. Add a matcher that overrides the default value with a different value, e.g.:
"

Overridden

"
4. Save and reopen the parameter.
5. Observe that leading and trailing white space has not been removed in neither default value nor override value.

Comment 14 Bruno Rocha 2017-04-20 23:28:36 UTC
Verified in:



Results:

Work as expected, `content` parameter and `variable` accepting and keeping line breaks and trailing whitespaces

[root@cloud-qe-09 ~]# hammer sc-param info --id=22 
[Foreman] Password for admin: 
Id:              22
Parameter:       content
Default Value:   this should 
work with \n or "\n"
also with tabs
    this is a tab
\t should also work.
Override:        true
Puppet class:    motd
Description:     
Type:            string
Hidden Value?:   false
Required:        false
Validator:       
    Type: 
    Rule:
Override values: 
    Merge overrides:     no
    Merge default value: no
    Avoid duplicates:    no
    Order:               fqdn, hostgroup, os, domain
    Values:
Environments:    
    example_env
    KT_Default_Organization_Library_puppettest_125
Created at:      2017/04/20 17:14:13
Updated at:      2017/04/20 19:20:48



[root@cloud-qe-09 ~]# hammer smart-variable info --id=23
[Foreman] Password for admin: 
Id:              23
Name:            content
Default Value:   this should 
work with \n or "\n"
also with tabs
    this is a tab
\t should also work.
Type:            string
Puppet class:    motd
Description:     
Hidden Value?:   false
Validator:       
    Type: 
    Rule:
Override values: 
    Merge overrides:     no
    Merge default value: no
    Avoid duplicates:    no
    Order:               fqdn, hostgroup, os, domain
    Values:
Created at:      2017/04/20 19:13:59
Updated at:      2017/04/20 19:21:14

Comment 15 Bruno Rocha 2017-04-20 23:28:56 UTC
verified in: satellite-6.2.9-4.0.el7sat.noarch

Comment 16 Bruno Rocha 2017-04-20 23:33:53 UTC
Adding verification for comment 13



[root@cloud-qe-09 ~]# hammer smart-variable info --id=23
[Foreman] Password for admin: 
Id:              23
Name:            content
Default Value:   "


Testing


"
Type:            string
Puppet class:    motd
Description:     
Hidden Value?:   false
Validator:       
    Type: 
    Rule:
Override values: 
    Merge overrides:     no
    Merge default value: no
    Avoid duplicates:    no
    Order:               fqdn, hostgroup, os, domain
    Values:              
     1) Id:    1
        Match: domain=FQDN.com
        Value: "
        
        Overridden
        
        "
Created at:      2017/04/20 19:13:59
Updated at:      2017/04/20 19:32:41

Comment 18 errata-xmlrpc 2017-05-01 13:53:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1191