Bug 1926836

Summary: RFE: provide an API to get integrated subscription/repository state info
Product: Red Hat Enterprise Linux 8 Reporter: Michal Reznik <mreznik>
Component: subscription-managerAssignee: candlepin-bugs
Status: NEW --- QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: pstodulk, redakkan
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Reznik 2021-02-09 14:33:58 UTC
Use case:

Leapp (RHEL in-place upgrades) is frequently using RHSM to get various info about subscriptions and repositories. In order to limit number of RHSM calls and avoid parsing the test output, it would be nice to have a one place our tool could call, to get the info in machine consumable format.

E.g.

# subcription-manager summary --json

{
  "list": [
    1,
    2,
    3
  ],
  "repos": [
    1,
    2,
    3
  ],
  "is_sca": true,
  "release": "8.2",
  “purpose”: “...”,
  ...
}

Comment 1 Rehana 2021-02-12 14:50:19 UTC
Hi Michal , 

Can you please let us know what are the subscription manager commands that leapp tool is currently using ? We would also like to know does the leapp tool preserve the consumer details after the upgrades ? 

thanks,
Rehana

Comment 3 Petr Stodulka 2021-02-17 11:12:05 UTC
Hi Rehana,
here is the list of rhsm commands we are actually using:
----- (to get some data)
  # subscription-manager list --consumed
  # subscription-manager status
  # subscription-manager repos --list-enabled
  # subscription-manager release

----- (to "configure" system as needed)
  # subscription-manager refresh
  # subscription-manager release --unset
  # subscription-manager release --set ...
  # subscription-manager repos --enable .... 

----------------

I guess you asked just about the first set of commands, which we use to get the data about system.
From that commands we get right now this info:
  - The release the subscription-manager is set to
  - SKUs the system is attached to
  - Repositories that are available to the current system through the subscription-manager
  - Repositories that are enabled on the current system through the subscription-manager
  - Whether the SCA is used or not

And separately out-of rhsm utility, we get info about the installed product certificate(s).

I am not sure what exactly are you asking about the preservation of consumer details. Can you elaborate on that a little bit? I will try to answer, that expactation is that the upgraded system is still subscribe and user can use it. If this is what you are asking about.