Actions
Bug #24640
closed1.17 migration causes array/hash values for parameters to turn into strings with escaped quotes
Difficulty:
Triaged:
No
Bugzilla link:
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
Updated by Tomer Brisker almost 7 years ago
- Related to Feature #16740: Host parameters should be available in templates using some macro added
Updated by Tomer Brisker almost 7 years ago
- Has duplicate Bug #23809: Unable to save overridden Array class smart parameters added
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
Updated by The Foreman Bot almost 7 years ago
- Pull request https://github.com/theforeman/foreman/pull/5977 added
Updated by The Foreman Bot almost 7 years ago
- Pull request https://github.com/theforeman/foreman/pull/5990 added
Updated by The Foreman Bot over 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/5995 added
Updated by The Foreman Bot over 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/5998 added
Updated by Tomer Brisker over 6 years ago
- Related to Bug #23581: Upgrade to Foreman 1.17 converts YAML to JSON Hash added
Actions