Bug 1940473 - Satellite 6.8 upgrade fails with error "Validation failed: Lookup values is invalid" at db:migrate stage
Summary: Satellite 6.8 upgrade fails with error "Validation failed: Lookup values is i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: SCAP Plugin
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: 6.8.5
Assignee: Ondřej Pražák
QA Contact: Jameer Pathan
URL:
Whiteboard:
Depends On: 1942073
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-18 13:58 UTC by James Jeffers
Modified: 2024-03-25 18:14 UTC (History)
11 users (show)

Fixed In Version: tfm-rubygem-foreman_openscap-4.0.6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1935786
Environment:
Last Closed: 2021-03-31 19:48:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 31986 0 Normal Closed Update puppet port param without override 2021-03-18 13:58:48 UTC
Red Hat Product Errata RHBA-2021:1057 0 None None None 2021-03-31 19:48:26 UTC

Description James Jeffers 2021-03-18 13:58:35 UTC
+++ This bug was initially created as a clone of Bug #1935786 +++

Red Hat Satellite 6.8 upgrade fails with the error "Validation failed: Lookup values is invalid" at db:migrate stage.

~~~~~
[ WARN 2021-03-02T15:55:59 main]  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: 
[ WARN 2021-03-02T15:55:59 main]  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: Caused by:
[ WARN 2021-03-02T15:55:59 main]  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: ActiveRecord::RecordInvalid: Validation failed: Lookup values is invalid
[ WARN 2021-03-02T15:55:59 main]  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/validations.rb:80:in `raise_validation_error'
[ WARN 2021-03-02T15:55:59 main]  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/validations.rb:53:in `save!'
.....
[ WARN 2021-03-02T15:55:59 main]  /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-4.0.5/db/migrate/20
201202110213_update_puppet_port_param_type.rb:26:in `update_port_type'
~~~~~


Version-Release number of selected component (if applicable):
Red Hat Satellite 6.4

Steps to Reproduce:
Make sure you have some invalid Matchers in foreman_scap_client --> port
Configure --> Smart Class Parameters --> click on foreman_scap_client --> click on "Smart Class Parameter" tab --> click on port

Run the upgrade on Red Hat Satellite 6.8.x -> 6.8.4-1 or 6.7 --> 6.8
Actual results:
- The upgrade fails with the error.

Expected results:
- The upgrade should be completed.

--- Additional comment from  on 2021-03-05T14:34:10Z 

// Workaround

Go to Configure --> Smart Class Parameters --> click on foreman_scap_client --> click on "Smart Class Parameter" tab --> click on port

Scroll down and submit.

After submitting you will get an error "The class could not be saved because of an error in one of the class parameters."

Scroll down to "Specify Matchers" and correct all the fields marked in Red color. Or you can delete Incorrect matchers.

And submit again Once you get a "Successfully updated foreman_scap_client." message 

Re-run the migration 

#foreman-rake db:migrate

--- Additional comment from  on 2021-03-09T10:48:06Z 

I think this is a duplicate of BZ#1900737

--- Additional comment from  on 2021-03-09T11:16:38Z 

@oprazak, This bug is about invalid matchers. Incase cu have deleted a host but that invalid host used in matchers. The migration complains about "invalid lookup values" and fails.

--- Additional comment from  on 2021-03-17T15:31:42Z 

Connecting redmine issue https://projects.theforeman.org/issues/31986 from this bug

--- Additional comment from  on 2021-03-17T16:03:41Z 

Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/31986 has been resolved.

Comment 1 Mike McCune 2021-03-23 16:21:38 UTC
// Workaround

Go to Configure --> Smart Class Parameters --> click on foreman_scap_client --> click on "Smart Class Parameter" tab --> click on port

Scroll down and submit.

After submitting you will get an error "The class could not be saved because of an error in one of the class parameters."

Scroll down to "Specify Matchers" and correct all the fields marked in Red color. Or you can delete Incorrect matchers.

And submit again Once you get a "Successfully updated foreman_scap_client." message 

Re-run the migration 

#foreman-rake db:migrate

Comment 3 Jameer Pathan 2021-03-30 03:19:03 UTC
Verified

Verified with:
- Satellite 6.8.5 snap 3
- tfm-rubygem-foreman_openscap-4.0.6-1.el7sat.noarch

Test steps:
1. Install Satellite 6.7.5
2. Import puppet_foreman_scap_client
3. Do not set up any policies or make sure port param has override: false
4. Upgrade Satellite 6.7.5 to Satellite 6.8.5 snap 3

Observations:
- Upgrade completed successfully.
- No migration failures.

Comment 7 errata-xmlrpc 2021-03-31 19:48:19 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 (Satellite 6.8.5 Async Bug Fix Update), 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/RHBA-2021:1057


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