Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1618378 - 1.17 migration causes array/hash values for parameters to turn into strings with escaped quotes
Summary: 1.17 migration causes array/hash values for parameters to turn into strings w...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Smart Variables
Version: Nightly
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: 6.4.0
Assignee: Tomer Brisker
QA Contact: Jitendra Yejare
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-16 14:00 UTC by Tomer Brisker
Modified: 2019-11-05 23:32 UTC (History)
5 users (show)

Fixed In Version: foreman-1.18.0.10-1
Doc Type: Known Issue
Doc Text:
Users who have used complex values for parameters will get an error during upgrade of the beta. If this is encountered, please reach out to support for a fix.
Clone Of:
Environment:
Last Closed: 2018-10-16 18:55:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24640 0 None None None 2018-08-16 14:00:38 UTC

Description Tomer Brisker 2018-08-16 14:00:35 UTC
Looks like an issue in db/migrate/20170112175131_migrate_template_to_parameters_macros.rb causes any such lookupkeys/lookupvalues to turn their values to strings. 
Since the values are saved using update_attribute, callbacks aren't executed meaning cast_default_value is not called and the value remains a string.

For example:
<pre>
#<VariableLookupKey:0x0000000015b50738
 id: 21532,
 key: "zdcaz",
 created_at: Thu, 16 Aug 2018 13:01:56 UTC +00:00,
 updated_at: Thu, 16 Aug 2018 13:01:56 UTC +00:00,
 puppetclass_id: 5,
 default_value: ["a", "b"],
 path: nil,
 description: "",
 validator_type: "",
 validator_rule: nil,
 key_type: "array",
 override: false,
 required: false,
 merge_overrides: false,
 avoid_duplicates: false,
 omit: nil,
 type: "VariableLookupKey",
 merge_default: false,
 hidden_value: false>
[152] pry(main)> k.default_value = convert(k.default_value.to_s)
=> "[\"a\", \"b\"]"
</pre>

As a workaround, it may be possible to iterate over all Lookupkeys and values and save them all again to ensure casting is called from foreman-rake console (please take care to backup your database before running this):
<pre>
LookupKey.unscoped.find_each(&:save_without_auditing)
</pre>

Comment 1 Tomer Brisker 2018-08-16 14:00:41 UTC
Created from redmine issue http://projects.theforeman.org/issues/24640

Comment 2 Tomer Brisker 2018-08-16 14:00:46 UTC
Upstream bug assigned to tbrisker

Comment 5 Satellite Program 2018-08-20 16:06:08 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24640 has been resolved.

Comment 8 Jitendra Yejare 2018-09-02 05:19:27 UTC
Verified!

@ Satellite 6.4 snap 19

Steps:

1. Created various and all types of class parameters before the upgrade.
2. Ran upgrade from 6.3.3-2 to 6.4.

Observation:

1. Upgrade completed successfully without any errors.
2. Also, the data and types of class parameters are intact after the upgrade.

Hence, changing the bug status to Verified.

Comment 9 Bryan Kearney 2018-10-16 18:55: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/RHSA-2018:2927


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