Can't publish new version of the content view
Environment
- Red Hat Satellite 6.
Issue
-
Content view publishing task fails with the following error:
Actions::Katello::ContentView::Publish Validation failed: Minor, must be unique to major and version id version. (ActiveRecord::RecordInvalid)
Resolution
-
Create a file named
increment-cv-next-version.inwith the contents below - replaceCVNAMEby the affected CV name:cv = Katello::ContentView.find_by_name('CVNAME') before=cv.next_version cv[:next_version] = before+1 cv.save! -
Pass the file to the foreman-rake console:
foreman-rake console < increment-cv-next-version.in -
If the script returns an exception, provide the output to Red Hat Support, as an update of the CV fails on some pre-save check. One possible scenario is the CV is a Composite CV and it contains a docker repo which is present in multiple compontent CVs.
-
If the script worked well, publish a new version of the CV.
For more KB articles/solutions related to Red Hat Satellite 6.x Content View Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Content View Issues
Root Cause
katello_content_viewstable'snext_versionfield is not updated.- It could be the connection between Satellite and this Postgres was dropped at some point.
- Or some pre-save validation of CV object failed.
Diagnostic Steps
-
Find the content view version with
hammer.# hammer content-view version list --content-view TestCV --organization org_name
ID | NAME | VERSION | LIFECYCLE ENVIRONMENTS
-|-|-|-
8 | TestCV 3.0 | 3.0 | Library
7 | TestCV 2.0 | 2.0 |
4 | TestCV 1.0 | 1.0 |
-|-|-
- Query the content view details & find the next version of the content view in `foreman` database.
# sudo su - postgres -c "psql -d foreman -c \"select id,name,next_version from katello_content_views where name = 'TestCV';\""
id | name | next_version
----+-------+--------------
2 | TestCV| 3
(1 row)
- In the above example, the `hammer` command shows that the latest published version of TestCV is 3.0. Hence the `next_version` should be 4. But in the database still holds the `next_version` as 3.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.