Bug #15814
closedUpdating a puppet class fails with "Validation failed: Merge overrides can only be set for array or hash, Avoid duplicates can only be set for arrays that have merge_overrides set to true"
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1332596
Description of problem:
Publishing or Promoting a Puppet Content View fails with "Validation failed: Merge overrides can only be set for array or hash, Avoid duplicates can only be set for arrays that have merge_overrides set to true"
Version-Release number of selected component (if applicable):
Satellite Server v.6.1.8
How reproducible:
Steps to Reproduce:
- Add any Puppet Module ex motd in Satellite
- Create a content view with this Puppet module
- Publish a new version of this content view
- Go to Configure - Puppet Classes, click on motd
- Click on Smart Class Parameters - content
- Click on Override, change the Parameter type to array, change the Default value to [], click on Merge overrides and Avoid duplicates, click the Submit button (note that this doesn't make sense for this particular module and parameter, but it may for other Puppet modules, and I was looking for an easy reproducer)
- Publish a new version of the content view created before
- Go back to Configure - Puppet Classes, click on motd
- Click on Smart Class Parameters - content
- Click on Override to clear it and click the Submit button
- Publish a new version of the content view created before
Actual results:
Fails with "Validation failed: Merge overrides can only be set for array or hash, Avoid duplicates can only be set for arrays that have merge_overrides set to true"
Expected results:
Content View should be Promoted or Published Successfully
Additional info:
Root cause :
When we cleared the override flag and saves a smart parameter, the merge_overrides and avoid_duplicates flags have to be cleared automatically however it is not and hence `override: false`, but `merge_overrides: true` in db and hence next content-view publish failed.
Workaround :
Can be fixed this by activating "ovreride" in the UI, clearing both merge_overrides and avoid_duplicates, saving the smart parameter, editing it again, clearing "override" and saving it again.
But Need to determine the puppet classes ( Configure --> puppet class --> smart class parameter ) where this changes in past ( enabled the override flag and change the type equals to array/hash and enabled merge_overrides and later unchecked the override flag ).
Updated by Brad Buckingham about 8 years ago
- Is duplicate of Tracker #15825: Sprint 1 : Content-Focused added
Updated by Justin Sherrill about 8 years ago
- Subject changed from Publishing or Promoting a Puppet Content View fails with "Validation failed: Merge overrides can only be set for array or hash, Avoid duplicates can only be set for arrays that have merge_overrides set to true" to Publishing or Promoting a Puppet Content View fails with "Validation failed: Merge overrides can only be set for array or hash, Avoid duplicates can only be set for arrays that have merge_overrides set to true"
- Translation missing: en.field_release set to 162
Updated by David Davis about 8 years ago
- Is duplicate of deleted (Tracker #15825: Sprint 1 : Content-Focused)
Updated by David Davis about 8 years ago
- Blocks Tracker #15825: Sprint 1 : Content-Focused added
Updated by David Davis about 8 years ago
- Project changed from Katello to Foreman
- Subject changed from Publishing or Promoting a Puppet Content View fails with "Validation failed: Merge overrides can only be set for array or hash, Avoid duplicates can only be set for arrays that have merge_overrides set to true" to Updating a puppet class fails with "Validation failed: Merge overrides can only be set for array or hash, Avoid duplicates can only be set for arrays that have merge_overrides set to true"
- Category deleted (
Web UI)
I'm not really sure what the solution is but I was able to reproduce this behavior in just Foreman with the following steps:
1. Create a puppet environment with the motd puppet module.
2. Go the Puppet Class edit screen for motd. Then go into a smart class param like content and override it.
3. Change the type to array, set the default to [], and select the merge_overrides checkbox. Then submit.
4. Go back into the smart class param screen and uncheck the override checkbox. Submit again.
5. Go to the environments page. Click on Import from Default.
6. Select the box for "Update: motd" and click update.
You'll get a validation error, "Validation failed: Merge overrides can only be set for array or hash" (https://i.imgur.com/13PO0nF.png).
Some potential solutions:
1. Have the code reset override specific params like merge_overrides when override is set to false
2. Have the code skip validating override params like merge_overrides if override is false
Updated by The Foreman Bot about 8 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3737 added
Updated by David Davis about 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset e21a3a47573306f58e43657afeed18e4b5807311.
Updated by Dominic Cleal about 8 years ago
- Translation missing: en.field_release changed from 162 to 160
Updated by The Foreman Bot about 8 years ago
- Pull request https://github.com/theforeman/foreman/pull/3800 added