Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2030101 - No longer be able to import content into disconnected Satellite for existing content views
Summary: No longer be able to import content into disconnected Satellite for existing ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Inter Satellite Sync
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: 6.11.0
Assignee: Partha Aji
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-08 02:22 UTC by matt jia
Modified: 2022-07-29 09:07 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2049760 (view as bug list)
Environment:
Last Closed: 2022-07-05 14:30:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34314 0 Normal Closed Need a task to update the import_only flags in an importing server 2022-02-01 11:37:06 UTC
Red Hat Knowledge Base (Solution) 6620401 0 None None None 2022-01-04 09:40:27 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:31:02 UTC

Description matt jia 2021-12-08 02:22:17 UTC
Description of problem:

After upgrading disconnected Satellite, content view import failed on:


Validation failed: Label has already been taken, Name has already been taken (ActiveRecord::RecordInvalid)


This is because the existing content views have import_only set false. 

cat /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/content_view_version/import.rb:

 def self.find_or_create_import_view(organization:, metadata:, library: false)
          if library
            metadata = { name: ::Katello::ContentView::IMPORT_LIBRARY,
                         label: ::Katello::ContentView::IMPORT_LIBRARY,
                         description: "Content View used for importing library"
                        }
          end

          cv = ::Katello::ContentView.find_by(label: metadata[:label],
                                              organization: organization,
                                              import_only: true)
          if cv.blank?
            ::Katello::ContentView.create!(metadata.merge(organization: organization, import_only: true))
          else
            cv.update!(description: cv_metadata[:description]) if cv.description != metadata[:description]
            cv
          end
        end

As you can see, above func is trying to find CV with import_only true. However, all the existing CVs after the upgrade have import_only false. It ends up to re-create the cv.

It seems like we're missing a migration step during the 6.10 upgrade for disconnected Server. To work around the issue, I have to hack the db directly as hammer does not allow me to do with:

[root@xxx]# hammer content-view update  --import-only true --id 56
Could not update the content view:
     Validation failed: Import only Import-only can not be changed after creation

Version-Release number of selected component (if applicable):

6.10


How reproducible:

Easy


Steps to Reproduce:
1. install a disconnected 6.9 Satellite
2. import some CVs to it
3. upgrade both connected and disconnected Satellites to 6.10

4. import a new content view version

Actual results:

The content import failed with Validation failed: Label has already been taken, Name has already been taken

Expected results:

The content import should be successfully.

Additional info:

Comment 1 Partha Aji 2022-01-25 22:27:49 UTC
Connecting redmine issue https://projects.theforeman.org/issues/34314 from this bug

Comment 2 Bryan Kearney 2022-01-28 00:04:49 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34314 has been resolved.

Comment 4 wclark 2022-02-02 00:26:08 UTC
HOTFIX RPM is available for Satellite 6.10.2

OBTAINING THE HOTFIX:

The hotfix RPM is too large to be provided as an attachment on Bugzilla. Therefore please contact Red Hat Support to obtain the hotfix.

INSTALL INSTRUCTIONS:

1. Take a complete backup or snapshot of Satellite 6.10.2 server

2. Obtain the hotfix RPM from Red Hat Support and copy it to Satellite server

3. # yum install ./tfm-rubygem-katello-4.1.1.42-2.HOTFIXRHBZ2030101.el7sat.noarch.rpm --disableplugin=foreman-protector

4. # satellite-maintain service restart

Comment 5 Vedashree Deshpande 2022-02-24 14:12:04 UTC
Hello, 

One of my customers have installed the hotfix and the import is still not happening. He is not seeing any errors but import doesnt seem to have done completely. 

Can someone help here?

Comment 6 Partha Aji 2022-02-24 18:57:37 UTC
I don't see HF comment specifying this but the customer needs to run a rake task on the satellite.
"""
foreman-rake katello:set_content_view_import_only ID=<content-view-id>

"""


This will still not work. 
"""
hammer content-view update  --import-only true --id 56
"""

Comment 8 Lai 2022-04-04 20:45:23 UTC
Steps to reproduce:

1. Spin up 2 satellites: one for connected and one for disconnected.
2. On connected, import manifest, change the download policy of rhel to 'Immediate' in settings
3. Sync a few repos
4. Create a cv and add the repos from step 3
5. Run export for complete version
6. On Disconnected, import manifest and set the CDN configuration to use airgap
7. Set the download policy in 'Settings' to "Immediate"
8. scp the export from the connected satellite to /var/lib/pulp/imports and set permission to chown -R pulp:pulp /var/lib/pulp/imports/<dir>
9. Create a cv with the same name from step 4 and make sure to click "import only" checkbox when creating cv
10.  Run import command

Expected:
Import should be successful.

ActuaL
Import is successful.

note: I also published a new cv version in the connected, re-exported the new version and re-imported the new version in the disconnected.  It was updated accurately.

Verified on 6.11 snap 14

Comment 9 Vedashree Deshpande 2022-04-21 09:24:26 UTC
Hello, 

One of my customers ran below command and fixed the issue,
foreman-rake katello:set_content_view_import_only ID=<content-view-id>

But this invited a new issue it seems. 

Now, he is not able to publish and content views with import_only option. 
The error message is "import-only content views can not be published directly"

Is there a different method or option to publish these Content views?

Comment 10 Partha Aji 2022-05-11 15:43:12 UTC
Vedashree,
That is expected behavior. Import-Only content views can't be published (to ensure consistency on imports). Versions can only be "imported" into it. When you import, a new version is created in the content view. You should be able to promote that version to any environment.

Comment 14 errata-xmlrpc 2022-07-05 14:30:51 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 (Moderate: Satellite 6.11 Release), 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/RHSA-2022:5498


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