Project

General

Profile

Bug #28129

Parameters get converted from type string to boolean including the value

Added by Kavita Gaikwad about 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1764625

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.unscoped3.value
=> "no"
irb(main):032:0> value = YAML.load Parameter.unscoped3.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


Related issues

Related to Foreman - Feature #4127: Array, Boolean and other types support in "hostgroup parameters"Closed

Associated revisions

Revision c8ba2c05 (diff)
Added by Kavita Gaikwad about 2 months ago

Fixes #28129 - revert param migration of type casting

With this commit, reverting parameter migration. Instead of
this migration, added rake task to cast type and update value
to formatted value.

History

#1 Updated by Kavita Gaikwad about 2 months ago

  • Assignee set to Kavita Gaikwad

#2 Updated by The Foreman Bot about 2 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7129 added

#3 Updated by Tomer Brisker about 2 months ago

  • Related to Feature #4127: Array, Boolean and other types support in "hostgroup parameters" added

#4 Updated by The Foreman Bot about 2 months ago

  • Fixed in Releases 2.0.0 added

#5 Updated by Tomer Brisker about 2 months ago

  • Fixed in Releases 1.22.2, 1.23.1, 1.24.0 added
  • Fixed in Releases deleted (2.0.0)

#6 Updated by Kavita Gaikwad about 2 months ago

  • Status changed from Ready For Testing to Closed

#7 Updated by Tomer Brisker about 2 months ago

  • Category set to DB migrations

Also available in: Atom PDF