Project

General

Profile

Bug #15814

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"

Added by Brad Buckingham about 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parameters
Target version:
Difficulty:
Triaged:
Bugzilla link:

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

Related issues

Blocks Katello - Tracker #15825: Sprint 1 : Content-FocusedNew2016-07-24

Associated revisions

Revision e21a3a47 (diff)
Added by David Davis almost 4 years ago

Fixes #15814 - Reset override params when override is off

Revision d7f8cc79 (diff)
Added by Ori Rabin almost 4 years ago

Refs #15814 - Reset override params only for PuppetclassLookupKey

History

#1 Updated by Brad Buckingham about 4 years ago

#2 Updated by Justin Sherrill about 4 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"
  • Legacy Backlogs Release (now unused) set to 162

#3 Updated by David Davis almost 4 years ago

  • Is duplicate of deleted (Tracker #15825: Sprint 1 : Content-Focused)

#4 Updated by David Davis almost 4 years ago

#5 Updated by David Davis almost 4 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

#6 Updated by David Davis almost 4 years ago

  • Category set to Parameters

#7 Updated by The Foreman Bot almost 4 years ago

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

#8 Updated by Brad Buckingham almost 4 years ago

  • Target version set to 123

#9 Updated by David Davis almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#10 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) changed from 162 to 160

#11 Updated by The Foreman Bot almost 4 years ago

  • Pull request https://github.com/theforeman/foreman/pull/3800 added

Also available in: Atom PDF