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 2069306 - [RFE] Need syncable yum-format repository exports
Summary: [RFE] Need syncable yum-format repository exports
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Inter Satellite Sync
Version: 6.10.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.12.0
Assignee: Partha Aji
QA Contact: Radek Mynar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-28 16:52 UTC by Partha Aji
Modified: 2023-01-10 03:25 UTC (History)
18 users (show)

Fixed In Version: tfm-rubygem-katello-4.5.0.2-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2112396 (view as bug list)
Environment:
Last Closed: 2022-11-16 13:33:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34861 0 Normal Closed [RFE] Need syncable yum-format repository exports 2022-07-22 04:36:21 UTC
Github pulp pulpcore issues 2933 0 None closed File System Exporter needs to use the correct relative path. 2022-11-16 03:28:46 UTC
Red Hat Issue Tracker SAT-9353 0 None None None 2022-08-20 06:32:02 UTC
Red Hat Product Errata RHSA-2022:8506 0 None None None 2022-11-16 13:34:01 UTC

Description Partha Aji 2022-03-28 16:52:29 UTC
Description of problem:

The current repository export/import mechanism is optimized for 6.10/6.11 to cleanly track version changesets and apply them in a consistent way. However many customers in disconnected setup don't have control on the version of the importing satellite (it may be any 6.x). These users would like an export option which generates files in yum format so as to be able to enable and sync repositories via httpd or local file system directly in the importing satellite (similar to the way they did in satellite 6.9)

In lieu of this we need 
1. Add the ability to generate repositories in yum format.
2. Optionally add generation of listing files which may be necessary for enabling and syncing (this is presently not possible because pulp doesn't store listing files. So will need to design the mechanism.)
3. The rpms would ideally be hardlinks so that they don't 2X extra space.  


Once we have the basic mechanism we can add ability to track incremental exports in a separate bugzilla.

Additional info:

For reference check out
https://hackmd.io/@ggainey/fs_exports#Proposed-solution-from-katello-point-of-view

Comment 1 Brad Buckingham 2022-03-29 13:03:43 UTC
Reference comments on bug 2028377 and bug 2059388 for some of the discussion that led to this bugzilla.

Comment 2 Glenn Snead 2022-03-29 13:44:00 UTC
Additional background on why this is function is needed from Red Hat's Westfields Patches project:
In regulated environments, it is desirable to maintain a single disconnected CDN for multiple Red Hat customers across one or more agencies, departments, etc. By maintaining a neutral ACL, controlled access CDN, Red Hat avoids complicated legal and regulatory customer issues involving potential data exfill, need-to-know, etc. The disconnected CDN option also avoids having to duplicate every disconnected Satellite's Organization, Content View, and update schedule. 

Based on the Westfields Patches project costs, this saves customers one quarter to one half of a work week that would be spent on building, transferring, and importing multiple Content View exports, which grow every time a customer creates a disconnected Satellite Content View, or Satellite Organization with its own Content Views. The more complicated the Satellite implementation, the less likely customers are to spend thousands of personnel dollars on the CV export, transfer, CV import tasks. Often regulated environment customers are burning DVD and BluRay discs at a significant personnel time cost.

Comment 3 John G 2022-03-29 14:09:51 UTC
I concur with GlennS comments.  I too support multiple customers and disconnected satellite servers (air gapped).  The each have different manifests (some have HA/LB others just ELS. others neither) and versions (RHEL6, 7, and/or 8).  Yum format repository exports (like in 6.9.x and earlier) allow a simple 'sync' import on these servers based on manifest enabled repositories.  Please implement this ASAP.

Comment 4 Glenn Snead 2022-03-31 13:48:53 UTC
One more feature to consider - Repository metadata.  At present, the hammer repository export command with the --since flag produces incremental repository metadata, and it isn't possible to update the CDN's metadata.  Without these steps, Satellite will only show the most recent, incremental repository metadata. 

This is the current solution:
1. After the hammer repository export commands are finished, rsync each exported repository's content to a different folder i.e. /srv/export/<since-date>/. This make copying the resulting tarball content to the disconnected CDN easier.
2. Use the location of the /srv/export/<since-date>/<path>/repomd.xml path to replace the incremental repository metadata with a full copy from /var/lib/pulp/published/yum/https/Default_Organization/Library/<path-to-target-repository>/repodata/
3. Move any exported custom product content, which is in the "Library/custom" folder into "Library/content/custom." This simplifies the CDN path and makes ACL and Application Load Balancer configuration easier.
3. Create a tarball where the first folder is "content/" in /srv/export

Comment 5 Partha Aji 2022-05-03 21:52:12 UTC
Connecting redmine issue https://projects.theforeman.org/issues/34861 from this bug

Comment 6 John G 2022-05-04 00:06:29 UTC
 https://projects.theforeman.org/issues/34861 'Proposed-solution-from-katello-point-of-view' example is different that a 6.9.x and earlier export.  Need to insure 6.10.x repo export is comatable with sat6.9.x and earlier ;sync' import (with and without mirror on sync enabled).  Sat6.9x export is of the format (sat6 maint repo):
[root@satellite6-udtf os]# ls -lR *
Packages:
total 8
drwxr-xr-x. 2 foreman foreman   88 May  3 16:58 a
drwxr-xr-x. 2 foreman foreman   38 May  3 16:58 f
drwxr-xr-x. 2 foreman foreman  236 May  3 16:58 p
drwxr-xr-x. 2 foreman foreman 4096 May  3 16:58 r
drwxr-xr-x. 2 foreman foreman 4096 May  3 16:58 s

./Packages/a:
total 15520
-rw-r--r--. 1 foreman foreman 7919944 May  3 16:58 ansible-2.4.0.0-1.el7ae.noarch.rpm
-rw-r--r--. 1 foreman foreman 7969060 May  3 16:58 ansible-2.4.2.0-2.el7.noarch.rpm

./Packages/f:
total 452
-rw-r--r--. 1 foreman foreman 461720 May  3 16:58 fio-3.1-2.el7.x86_64.rpm

./Packages/p:
total 988
-rw-r--r--. 1 foreman foreman  39640 May  3 16:58 python2-jmespath-0.9.0-4.el7ae.noarch.rpm
-rw-r--r--. 1 foreman foreman  70644 May  3 16:58 python-ecdsa-0.11-4.el7.noarch.rpm
-rw-r--r--. 1 foreman foreman 118016 May  3 16:58 python-httplib2-0.9.2-1.el7.noarch.rpm
-rw-r--r--. 1 foreman foreman 273472 May  3 16:58 python-paramiko-2.1.1-2.el7ae.noarch.rpm
-rw-r--r--. 1 foreman foreman 500172 May  3 16:58 python-passlib-1.6.5-2.el7.noarch.rpm

./Packages/r:
...

repodata:
total 188
-rw-r--r--. 1 foreman foreman  12964 May  3 16:58 3fa6d41397de92dc7c668e55321ae94c2aa7182e9db5d6c3c411488efce9a115-primary.xml.gz
-rw-r--r--. 1 foreman foreman 129940 May  3 16:58 9663f898dab554381af021a81ec7447e427de6d012243ff23011f4adb3e6bbe9-filelists.xml.gz
-rw-r--r--. 1 foreman foreman    124 May  3 16:58 a27718cc28ec6d71432e0ef3e6da544b7f9d93f6bb7d0a55aacd592d03144b70-comps.xml
-rw-r--r--. 1 foreman foreman  13458 May  3 16:58 b6e068bd8c9450e03a979e6c75083cad0e2f5e4b6663eafd0872c753e78c3484-other.xml.gz
-rw-r--r--. 1 foreman foreman  19934 May  3 16:58 de12d3d246ff0abb84076aaf66866c6b6fd970d3021badc262af36886ba26f1c-updateinfo.xml.gz
-rw-r--r--. 1 foreman foreman   2166 May  3 16:58 repomd.xml

Comment 7 Bryan Kearney 2022-05-04 20:04:50 UTC
Upstream bug assigned to paji

Comment 8 Bryan Kearney 2022-05-04 20:04:51 UTC
Upstream bug assigned to paji

Comment 9 Partha Aji 2022-06-30 23:53:02 UTC
Glenn and John,
Let us know if this PR will work for you. It is in review right now, but check the description 

https://github.com/Katello/katello/pull/10183#issue-1290671021

Comment 10 John G 2022-07-01 00:21:56 UTC
Partha,

If the disconnected satellite did NOT have 'sync on mirror' enabled for the repository would this produce duplicate rpm's since it's now in a different format (not a..z format)?  
Also normally in sat6.9 and earlier we export ALL of the repositories for RHEL6 and bundle them into a single tar.gz,, then we do the same for RHEL7 and RHEL8.
Here's an example script that bundles all of RHEL7 up and configures it as a single tgz to expand and sync on the disconnected servers (with variable enabled manifest repositories)
that we currently use and is a simple way to export (on 6.9.x server)/import (all 6.x servers) - so to ally this to still function would be what I'm looking for :
#!/bin/sh
SAT6_EXPORTDIR="/var/lib/pulp/katello-export"
REL="RHEL79-`date '+%Y%m%d'`"

hammer repository list|grep 'NCL Software - 7Server' |sort -n|cut -d'|' -f1,2
#12  | NCL Software - 7Server - x86_64

hammer repository list |grep 'Extra Packages for Enterprise Linux 7 - x86_64' |sort -n|cut -d'|' -f1,2
#11  | Extra Packages for Enterprise Linux 7 - x86_64

hammer repository list |grep '7 Server'|sort -n|cut -d'|' -f1,2
#1   | Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
#2   | Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server
#3   | Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64
#4   | Red Hat Enterprise Linux 7 Server - Supplementary RPMs x86_64 7Server
#6   | Red Hat Enterprise Linux High Availability for RHEL 7 Server RPMs x86_64 7Server
#7   | Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_6...
#9   | Red Hat Ansible Engine 2 RPMs for Red Hat Enterprise Linux 7 Server x86_64
#36  | Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.9
#513 | Red Hat Satellite Tools 6.9 for RHEL 7 Server RPMs x86_64
#848 | Red Hat Satellite Tools 6.10 for RHEL 7 Server RPMs x86_64
#917 | Red Hat Satellite Maintenance 6 for RHEL 7 Server RPMs x86_64
#918 | Red Hat Satellite 6.10 for RHEL 7 Server RPMs x86_64
#919 | Red Hat Satellite 6.9 for RHEL 7 Server RPMs x86_64

for REPO in 12 11 1 2 3 4 6 7 9 36 513 848 917 918 919; do
  echo "Exporting repository ${REPO} to /var/lib/pulp/katello-export ..."
  hammer repository export --id ${REPO}
done

cd ${SAT6_EXPORTDIR}
test -d ${REL} || mkdir ${REL}
chown foreman:foreman ${REL}

for EXPORT in ????????-????-????-????-???????????? ; do
  echo "Bundling ${EXPORT} "
  cd ${EXPORT}/MYORG/Library
  tar cf - *|(cd   ${SAT6_EXPORTDIR}/${REL}; tar xf -)
  cd ${SAT6_EXPORTDIR}
  mv  ${EXPORT}  ${EXPORT}-${REL}
done

# Update listing files for multi-directories for RedHat repo sync/enable to work.
for LISTING in  `find ${SAT6_EXPORTDIR}/${REL} -type f -name 'listing' | sed -r 's|/[^/]+$||' |sort -u`; do
  echo "Updating file ${LISTING}/listing ..."
  cd ${LISTING}
  /usr/bin/ls -1d *|grep -v listing > listing
done

cd ${SAT6_EXPORTDIR}
echo "Zipping exported repo's: ${SAT6_EXPORTDIR}/${REL}"
echo " to: /net/geoint-2240a/vol/sharedrive/iso/RHEL7_SAT6_`date '+%Y%m%d'`.tgz"
echo " ... this will take hours!"
gtar cfz /net/geoint-2240a/vol/sharedrive/iso/RHEL7_SAT6_`date '+%Y%m%d'`.tgz  ${REL}
chmod 644  /net/geoint-2240a/vol/sharedrive/iso/RHEL7_SAT6_`date '+%Y%m%d'`.tgz

Comment 11 Partha Aji 2022-07-05 15:52:59 UTC
Re: If the disconnected satellite did NOT have 'sync on mirror' enabled for the repository would this produce duplicate rpm's since it's now in a different format (not a..z format)?

It should not. But that being said you are correct that it has be in the a..z format and doesn't right now. I have filed a pulp issue for this  https://github.com/pulp/pulpcore/issues/2933 and will have that looked into by the pulp guys.

Comment 12 Glenn Snead 2022-07-12 15:07:35 UTC
I just made a comment on the PR. We're getting closer to the ideal. 

Having the ability to replicate the Red Hat CDN "yum" repository format in disconnected environments will make it much easier for regulated environment customers to adopt and stick with Satellite.

I've added a request for the "--since" date flag for use with incremental repository exports, and the ability to include full repository metadata instead of incremental repository metadata with the repository exports. That full-copy repository metadata is essential when delivering disconnected Satellites to customer. 

Let me know if there are any questions.

Comment 13 Glenn Snead 2022-07-12 15:32:29 UTC
I just made a comment on the PR. We're getting closer to the ideal. 

Having the ability to replicate the Red Hat CDN "yum" repository format in disconnected environments will make it much easier for regulated environment customers to adopt and stick with Satellite.

I've added a request for the "--since" date flag for use with incremental repository exports, and the ability to include full repository metadata instead of incremental repository metadata with the repository exports. That full-copy repository metadata is essential when delivering disconnected Satellites to customer. 

Let me know if there are any questions.

Comment 14 Bryan Kearney 2022-07-21 20:04:27 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34861 has been resolved.

Comment 16 Partha Aji 2022-07-27 15:45:54 UTC
Moving it to post now that https://github.com/pulp/pulpcore/pull/2951 is merged.

Comment 18 Partha Aji 2022-07-29 20:56:35 UTC
Glenn, John,
So one issue I noticed while syncing this exported content was issues with https ca cert.
* I exported RHEL 7 Server
* Moved the exacted content to /var/www/html/pub/repos on of the satellites
* Then on the importing sat Subscriptions -> Manage Manifest -> Red Hat Cdn -> updated the CDN url to `https://<fqdn>/pub/repos`
* Tried to enable RHEL 7 (was not able to)

When communicating with RH CDN, only RH's ca_cert is issued as the only trusted cert in the request. This means if the upstream server sends a custom ca we may end up getting SSL Error.

I tried enabling repos with the CDN URL set to 'http://<other-fqdn>/repo'  and it worked ok.

I have filed this as bz here => https://bugzilla.redhat.com/show_bug.cgi?id=2112098

Question is if that is a deal breaker. Should we hold off on this until 2112098 is in?

Comment 20 John G 2022-08-03 14:52:28 UTC
Partha, I read https://bugzilla.redhat.com/show_bug.cgi?id=2112098, and not sure of the error your seeing.  In my case our 'disconnected' satellites are air gapped.
In the past we had to expand the export (RHEL7 Server) so the Packages and repo directories were available at /var/www/html/pub/repos/content/dist/rhel/server/7/7Server/x86_64/os, then the RH Product would enable and can be imported/synced.  So I don't believe we would hit this - would we?  BTW if there's electronic connections between the sat servers in your example - shouldn't they be satellite/capsule configuration?

Comment 23 Glenn Snead 2022-08-23 00:33:03 UTC
Question: Is the CA certificate the Root CA used by the disconnected Satellite to communicate with the Apache CDN server? If so, then that's an easy fix - the disconnected Satellite server must have that Root CA certificate installed to the server and the update-ca-trust export command must be run before the disconnected Satellite can pull content from Apache CDN server.

Comment 34 Radek Mynar 2022-09-22 11:34:12 UTC
By using 'hammer content-export ... --format "syncable"' it is possible to create complete export of Library, ContentView version or single repository. Incremental exports in syncable format are not available.

The exported content can be published via http, synced and consumed by hosts.

VERIFIED with Satellite 6.12 SNAP10 @ RHEL8.6

Comment 36 Glenn Snead 2022-11-16 03:20:20 UTC
My apologies for taking so long. I was sent to an engagement in Florida, and then California. I finally downloaded the Satellite 6.12 beta repositories and built a test Satellite server. 

One thing is missing from this solution: syncable format incremental exports.  Given the size of RHEL 8 Base OS and AppStream is several hundred Gigabytes, this would require the user or the assigned Red Hat consultant, to transfer all content within the target repository, library, or content view.  Right now, I'm only seeing the --format option for hammer content-export complete options (library, repository, and version) but not for the incremental options. 

Could this be added before Satellite 6.12 goes GA? I'd hate to tell disconnected customers who are supporting multiple customers (including Red Hat) that they have to keep running a Satellite 6.9 server for another year and wait for Satellite 6.13.

Comment 40 errata-xmlrpc 2022-11-16 13:33:45 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 (Important: Satellite 6.12 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:8506


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