Project

General

Custom queries

Profile

Actions

Bug #24640

closed

1.17 migration causes array/hash values for parameters to turn into strings with escaped quotes

Added by Tomer Brisker almost 7 years ago. Updated over 6 years ago.


Description

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:

#<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\"]" 

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):

LookupKey.unscoped.find_each(&:save_without_auditing)


Files


Related issues 3 (0 open3 closed)

Related to Foreman - Feature #16740: Host parameters should be available in templates using some macroClosedOndřej Pražák09/29/2016Actions
Related to Foreman - Bug #23581: Upgrade to Foreman 1.17 converts YAML to JSON HashResolvedActions
Has duplicate Foreman - Bug #23809: Unable to save overridden Array class smart parametersDuplicateActions
#1

Updated by Tomer Brisker almost 7 years ago

  • Related to Feature #16740: Host parameters should be available in templates using some macro added
#2

Updated by Tomer Brisker almost 7 years ago

  • Has duplicate Bug #23809: Unable to save overridden Array class smart parameters added
#3

Updated by The Foreman Bot almost 7 years ago

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

Updated by Tomer Brisker almost 7 years ago

  • Assignee changed from Ori Rabin to Tomer Brisker
#5

Updated by Tomer Brisker almost 7 years ago

  • Bugzilla link set to 1618378
#6

Updated by Marek Hulán almost 7 years ago

  • Fixed in Releases 1.20.0 added
#7

Updated by Tomer Brisker almost 7 years ago

  • Fixed in Releases 1.19.0 added
#8

Updated by Tomer Brisker almost 7 years ago

  • Status changed from Ready For Testing to Closed
#9

Updated by The Foreman Bot almost 7 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5977 added
#10

Updated by Daniel Helgenberger almost 7 years ago

#14

Updated by The Foreman Bot almost 7 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5990 added
#15

Updated by The Foreman Bot over 6 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5995 added
#16

Updated by The Foreman Bot over 6 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5998 added
#17

Updated by Tomer Brisker over 6 years ago

  • Fixed in Releases 1.17.4, 1.18.2 added
#18

Updated by Tomer Brisker over 6 years ago

  • Related to Bug #23581: Upgrade to Foreman 1.17 converts YAML to JSON Hash added
Actions

Also available in: Atom PDF