Bug 1764625 - Parameters get converted from type string to boolean including the value
Summary: Parameters get converted from type string to boolean including the value
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Parameters
Version: 6.6.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: 6.7.0
Assignee: Kavita
QA Contact: Lucie Vrtelova
URL:
Whiteboard:
: 1767443 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-10-23 13:27 UTC by Kenny Tordeurs
Modified: 2020-04-14 13:26 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1769897 (view as bug list)
Environment:
Last Closed: 2020-04-14 13:26:02 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 28129 Normal Closed Parameters get converted from type string to boolean including the value 2020-11-23 02:23:59 UTC
Red Hat Product Errata RHSA-2020:1454 None None None 2020-04-14 13:26:12 UTC

Description Kenny Tordeurs 2019-10-23 13:27:26 UTC
Description of problem:
Satellite upgrade from 6.5.x to 6.6 causes strings being converted in booleans which in turn causes puppet failures. 

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

How reproducible:
100%

Steps to Reproduce:
1. Parameter String with value yes
2. Upgrade Satellite 6.5 to 6.6
3. Parameter becomes Boolean with value true

Actual results:
Parameter becomes Boolean with value true


https://github.com/theforeman/foreman/pull/5241/files#diff-b3682057e8f9486a9c336512544e9ee8R48
~~~
 def override_key_type_and_value(param)
    key_type_name = 'string'
    value = YAML.load param.value                    <<<<==============      IF THE VALUE IS "no" it returns "false"
    key_type_name = value.is_a?(Hash) ? 'yaml' : find_key_type(value)     <<==== find_key_type function call. 
rescue Psych::SyntaxError
~~~

Foreman-rake console output 
~~~
irb(main):031:0> Parameter.unscoped[3].value
=> "no"
irb(main):032:0> value = YAML.load Parameter.unscoped[3].value
=> false
irb(main):033:0> 
~~~

And then we have the function return the value as boolean

~~~
 def find_key_type(param_value)
    return 'boolean' if [true, false].include?(param_value)
    param_value.class.name.underscore.humanize.downcase
  end
end
~~~

Expected results:
Parameter stays String with value true

Additional info:
This change was introduced because of an RFE to have more types supported for parameters.
~~~
Currently "string" is the only parameter type supported in hostgroup parameters on foreman 1.3. Our customers desperately need to put Array and Boolean type of parameters (possibly other types as well) into the hostgroup for better puppet parameter management of they application clusters. Since multiple parameter types are supported in Smart Variables, why the hostgroup parameters (as well host parameter) have to stuck with just one type (string).
~~~

https://projects.theforeman.org/issues/4127
https://bugzilla.redhat.com/show_bug.cgi?id=1402136

Comment 4 Kavita 2019-10-25 05:24:15 UTC
Created redmine issue https://projects.theforeman.org/issues/28129 from this bug

Comment 7 Bryan Kearney 2019-10-27 14:06:19 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28129 has been resolved.

Comment 8 Hao Chang Yu 2019-11-15 04:58:08 UTC
*** Bug 1767443 has been marked as a duplicate of this bug. ***

Comment 9 Jaskaran Singh Narula 2019-11-25 14:50:17 UTC
Hello all, 

Is there any work-around for the satellites who are already upgraded to satellite 6.6? 


Thanks,
Jaskaran Singh Narula

Comment 12 Lucie Vrtelova 2019-11-28 16:57:16 UTC
Upgrade from:
- satellite-6.6.1-1.el7sat.noarch
- rubygem-foreman_maintain-0.5.0-1.el7sat.noarch
- foreman-1.22.0.33-1.el7sat.noarch

Steps:
- create org
- add global params (true/false, on/off, yes/no string value)
- register host
- add host params (true/false, on/off, yes/no string value)

After upgrade check:
- satellite-6.7.0-4.beta.el7sat.noarch
- rubygem-foreman_maintain-0.5.0-1.el7sat.noarch
- foreman-1.24.0-0.14.RC2.el7sat.noarch

- upgrade end up successfully

- global params - all remain string type
- host params - all remain string type
 -> conversion didn't run.

Comment 16 errata-xmlrpc 2020-04-14 13:26:02 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/RHSA-2020:1454


Note You need to log in before you can comment on or make changes to this bug.