Hammer command (or other means) to get channelid

Latest response

I'm familiar with the command:

myorg="org name goes here"
 hammer --csv repository list  --organization "$myorg"

And it returns output such as...

57,Red Hat Satellite Tools 6.2 for RHEL 7 Workstation RPMs x86_64,Red Hat Enterprise Linux Workstation,yum,https://cdn.redhat.com/content/dist/rhel/workstation/7/7Workstation/x86_64/sat-tools/6.2/os
29,Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64,Red Hat Enterprise Linux Server,yum,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-tools/6.2/os
108,Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs x86_64,Red Hat Enterprise Linux Server,yum,https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/sat-tools/6.2/os
109,Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs i386,Red Hat Enterprise Linux Server,yum,https://cdn.redhat.com/content/dist/rhel/server/6/6Server/i386/sat-tools/6.2/os
60,Red Hat Satellite Capsule 6.2 for RHEL 7 Server RPMs x86_64,Red Hat Satellite Capsule,yum,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-capsule/6.2/os
61,Red Hat Satellite Capsule 6.2 for RHEL 6 Server RPMs x86_64,Red Hat Satellite Capsule,yum,https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/sat-capsule/6.2/os
389,Red Hat Satellite 6.3 - Puppet 4 for RHEL 7 Server RPMs x86_64,Red Hat Satellite,yum,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/satellite/6.3-puppet4/os
388,Red Hat Satellite 6.3 for RHEL 7 Server RPMs x86_64,Red Hat Satellite,yum,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/satellite/6.3/os
59,Red Hat Satellite 6.2 for RHEL 7 Server RPMs x86_64,Red Hat Satellite,yum,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/satellite/6.2/os
58,Red Hat Satellite 6.2 for RHEL 6 Server RPMs x86_64,Red Hat Satellite,yum,https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/satellite/6.2/os

However, if I want to do a reposync, I need the channel id such as:

 reposync --gpgcheck -l --repoid=rhel-server-rhscl-7-rpms --download_path=/path/to/the/download/

The repoid in question in this case is "rhel-server-rhscl-7-rpms"

So on one side, I can get most of the information with the hammer --csv repository list --organization "$myorg" command, however, the output doesn't have the repoid name in the second block I have above.

What command can I use to get the name such as "rhel-server-rhscl-7-rpms" (for example).

Where this is more useful is when a new channel is released, because I know I can get some of the channel names from things my satellite has synchronized, but if I've never synchronized a new channel (such as satellite 6.3), then I wouldn't just be able to fish in my own filesystem for the name since I hadn't downloaded it yet.

My question is how to get repoids such as " "rhel-server-rhscl-7-rpms" for all the channels.

Appreciate any assistance.

-RJ

Responses

I've been spending some time in the hammer cli guide, haven't found anything ... yet

update, so I found something that partially works...

First of all, I refreshed my public facing satellite server's manifest, and today I can see the satellite 6.3 (for rhel7) iso channel after selecting it in the WEB-UI. As I mentioned in my original post, I can then see the red hat satellite 6.3 channel (but as mentioned previously), with hammer --csv repository list --organization "$myorg" that doesn't produce the name such as

I tried using subscription-manager repos --list which gives the repoid name, but even though my Red Hat Satellite can "see" the Satellite 6.3 for RHEL 7 channel, (in the aforementioned hammer command) using the subscription-manager repos --list

I did a yum clean all and subscription-manager refresh and the new repo for 6.3 became visible as rhel-7-server-satellite-6.3-rpms using

 subscription-manager repos --list | egrep -i satellite | egrep -i satellite | egrep ID | egrep -v 'optional|source|beta|debug|6.0|6.1'

Does anyone know of a cleaner/better method than what I put in the last post?

Thanks,

-RJ

I dont know if there is an easy way to get those repoIDs from Satellite short of maybe digging into the database, which we advise against. However, your manifest does have that info.

A couple of patches to the rct command can enable this.

First, make a backup of /usr/lib/python2.7/site-packages/rct/manifest_commands.py

cp /usr/lib/python2.7/site-packages/rct/manifest_commands.py{,-old}

Next, deploy the patched manifest_commands.py. Available as a gist here if you want to download it, inspect it, and/or diff it against your existing version before running the command below.

wget https://gist.githubusercontent.com/sideangleside/d1ce75e0a776073868d9e31793cd6920/raw/6c0238d322f69062c0db3da2815c5887fc10d354/manifest_commands.py -O /usr/lib/python2.7/site-packages/rct/manifest_commands.py

Next, run rct against your manifest.

rct cat-manifest /path/to/manifest.zip
+-------------------------------------------+
        Manifest
+-------------------------------------------+

General:
        Server: 
        Server Version: 2.0.43-1
        Date Created: 2017-12-20T03:01:45.981+0000
        Creator:[REDACTED]

Consumer:
        Name: [REDACTED]
        UUID: [REDACTED]
        Content Access Mode: entitlement
        Type: satellite

Subscription:
        Name: Red Hat Enterprise Linux Developer Support, Enterprise
        Quantity: 625
        Created: 2017-10-05T10:33:21.000+0000
        Start Date: 2017-09-15T04:00:00.000+0000
        End Date: 2018-09-15T03:59:59.000+0000
        Service Level: Dev-Enterprise
        Service Type: L1-L3
        Architectures: ia64,ppc,ppc64,ppc64le,s390,s390x,x86,x86_64
        SKU: RH2264664
        Contract: [REDACTED]
        Order: [REDACTED]
        Account: [REDACTED]
        Virt Limit: unlimited
        Requires Virt-who: True
        Sockets: 8
        Stackable: False
        Cores: Not Applicable
        Instance Multipler: Not Applicable
        Cloud Access: Not Applicable
        Entitlement File: export/entitlements/8a99f9845ee8b387015eec18c9ef1416.json
        Certificate File: export/entitlement_certificates/3119701997280027621.pem
        Certificate Version: 3.3
        Provided Products:
                69: Red Hat Enterprise Linux Server
                70: Red Hat Enterprise Linux Server - Extended Update Support
                83: Red Hat Enterprise Linux High Availability (for RHEL Server)
                84: Red Hat Enterprise Linux High Availability (for RHEL Server) - Extended Update Support
                85: Red Hat Enterprise Linux Load Balancer (for RHEL Server)
                86: Red Hat Enterprise Linux Load Balancer (for RHEL Server) - Extended Update Support
                90: Red Hat Enterprise Linux Resilient Storage (for RHEL Server)
                91: Red Hat Enterprise Linux Resilient Storage (for RHEL Server) - Extended Update Support
                92: Red Hat Enterprise Linux Scalable File System (for RHEL Server)
                93: Red Hat Enterprise Linux Scalable File System (for RHEL Server) - Extended Update Support
                132: Red Hat Enterprise Linux High Performance Networking (for RHEL Server)
                133: Red Hat Enterprise Linux High Performance Networking (for RHEL Server) - Extended Update Support
                172: MRG Realtime
                176: Red Hat Developer Toolset (for RHEL Server)
                180: Red Hat Beta
                190: Red Hat Developer Toolset (for RHEL Server EUS)
                201: Red Hat Software Collections (for RHEL Server)
                205: Red Hat Software Collections Beta (for RHEL Server)
                240: Oracle Java (for RHEL Server)
                246: Oracle Java (for RHEL Server) - Extended Update Support
                271: Red Hat Enterprise Linux Atomic Host
                272: Red Hat Enterprise Linux Atomic Host Beta
                273: Red Hat Container Images
                274: Red Hat Container Images Beta
                287: Red Hat Enterprise Linux for Real Time
                293: Red Hat Container Development Kit
                317: dotNET on RHEL (for RHEL Server)
                318: dotNET on RHEL Beta (for RHEL Server)
                394: Red Hat Developer Tools (for RHEL Server)
                395: Red Hat Developer Tools Beta (for RHEL Server)
        Derived Products:
        Facts:
                VIRT_LIMIT: This subscription supports up to unlimited guests
                SOCKETS: This subscription supports systems with up to 8 sockets
                STACKABLE: This subscription is not stackable 
        Content Sets & Labels:
                Name: Red Hat Software Collections RPMs for Red Hat Enterprise Linux 6 RHEL 6 Server EUS
                        Label: rhel-server-rhscl-6-eus-rpms
                        URL: /content/eus/rhel/server/6/$releasever/$basearch/rhscl/1/os
                Name: Red Hat Software Collections Source RPMs for Red Hat Enterprise Linux 7 RHEL 7 Server EUS
                        Label: rhel-server-rhscl-7-eus-source-rpms
                        URL: /content/eus/rhel/server/7/$releasever/$basearch/rhscl/1/source/SRPMS
                Name: Red Hat Software Collections RPMs for Red Hat Enterprise Linux 6 Server
                        Label: rhel-server-rhscl-6-rpms
                        URL: /content/dist/rhel/server/6/$releasever/$basearch/rhscl/1/os
                Name: Red Hat Software Collections (Source ISOs) for Red Hat Enterprise Linux 7 Server
                        Label: rhel-7-server-rhscl-source-isos
                        URL: /content/dist/rhel/server/7/$releasever/$basearch/rhscl/1/source/iso
                Name: Red Hat Software Collections Source RPMs for Red Hat Enterprise Linux 6 RHEL 6 Server EUS

The Label value is your repository name as known by subscription-manager and the product docs. The Name value is the display name of the repository as seen in the Satellite UI & CLI.

Rich, I always appreciate your input - and thank you for this viable answer!

-RJ

Based on this conversation, I've opened up the following two RFEs:

  • BZ1548370 [RFE] As a user of the 'rct' command, I'd like to see the repository Name and Label displayed as part of the cat-manifest sub-command.
  • BZ1548381 [RFE] As a user of Satellite, I'd like to see the repository label displayed on the Red Hat Repositories page

I think both capture the spirit of what you are trying to accomplish. Let me know if I missed anything. And also, open up a case with Support referencing these RFEs as it helps us with prioritization.

Rich, you rock, thanks! - will do with submitting cases for these

One question Rich, would the manifest be blind to updates to (let's say) the recent edition of Satellite 6.3? I know when I create the certificate, I generally don't change it much unless there's some entitlement shuffle for a compelling reason. But at the time of generating the manifest, I know add entitlements for the products that I have subscriptions to for whatever given satellite server.

The goal I had earlier that prompted this research was the intention of doing a reposync of satellite 6.3 channel. I kinda doubt the manifest would care about versions (and in this case the release of satellite 6.3 and it's subsequent channel availability).

Thanks,

-RJ

Remember that a manifest is a point-in-time snapshot which contains

  • a listing of repositories you can access to and can sync
  • which certificates are used to sync those repositories.
  • which subscriptions are available.

The listing of which repositories you can sync is something that we (Red Hat) have to explicitly update each release for most products. [1]. Basically, we have a backend process that is an automated part of the release process that says (for example): 'find all accounts that currently have access to Satellite content, and update them so that Satellite 6.3 repos are available'. Sometimes these take a while to complete globally. This is why sometimes you get the error of not being able to sync or enable a repo.

Thus from start to finish:

  • Red Hat pushes out Satellite 6.3, along with the aforementioned updates to accounts.
  • You (Satellite users) refresh your manifest. (Either via the Satellite UI or via the Customer Portal depending on if you are connected versus disconnected)
  • You select new repos.

[1] - Note, I said for most products. In the case of RHEL, the content sets (which repos do you have access to) are defined a little differently. See the below example (snipped from the rct content above)

Name: Red Hat Software Collections RPMs for Red Hat Enterprise Linux 6 Server
  Label: rhel-server-rhscl-6-rpms
  URL: /content/dist/rhel/server/6/$releasever/$basearch/rhscl/1/os

You can see the $releasever and $basearch values in the URL. This basically states that the manifest will allow access to all values of releasever (6.4, 6.5, 7Server, etc) or basearch (i386, x86_64). So it's a 'one size fits all' solution and for when new versions of RHEL are released, you generally dont need a manifest refresh. Not all repositories are setup that way though.

Thanks again Rich for the prompt replies and the useful detail

-RJ

Rich,

Please note case # 02040905 which I've requested Red Hat assign the 2 RFEs you graciously submitted (and thank you)

-RJ