subscription-manager commands

Parsers for parsing output of the subscription-manager commands.

SubscriptionManagerID - command subscription-manager identity

SubscriptionManagerFacts - command subscription-manager facts

SubscriptionManagerStatus - command subscription-manager status

SubscriptionManagerSyspurpose - command subscription-manager syspurpose

class insights.parsers.subscription_manager.SubscriptionManagerFacts(context, extra_bad_lines=None)[source]

Bases: CommandParser, dict

Class for parsing the output of subscription-manager facts command.

Typical output of the command is:

aws_instance_id: 567890567890
network.ipv6_address: ::1
uname.sysname: Linux
uname.version: #1 SMP PREEMPT Fri Sep 2 16:07:40 EDT 2022
virt.host_type: rhev, kvm
virt.is_guest: True

Examples

>>> type(rhsm_facts)
<class 'insights.parsers.subscription_manager.SubscriptionManagerFacts'>
>>> rhsm_facts['aws_instance_id']
'567890567890'
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.subscription_manager.SubscriptionManagerID(context, extra_bad_lines=None)[source]

Bases: CommandParser, dict

Reads the output of subscription-manager identity and retrieves the UUID

Example output:

system identity: 6655c27c-f561-4c99-a23f-111111111111
name: rhel7.localdomain
org name: 1234567
org ID: 1234567
Examples::
>>> type(subman_id)
<class 'insights.parsers.subscription_manager.SubscriptionManagerID'>
>>> subman_id.identity == '6655c27c-f561-4c99-a23f-111111111111'
True
>>> subman_id.get('org ID') == '1234567'
True
>>> subman_id.uuid == '6655c27c-f561-4c99-a23f-111111111111'
True
property identity

Returns the value of ‘system identity’. Multiple language support is from: - https://github.com/candlepin/subscription-manager/tree/main/po

parse_content(content)[source]

This method must be implemented by classes based on this class.

property uuid

Returns the UUID of ‘system identity’ in standard format (32 digits separated by hyphens).

class insights.parsers.subscription_manager.SubscriptionManagerStatus(context, extra_bad_lines=None)[source]

Bases: CommandParser, dict

Reads the output of subscription-manager status

Example output:

+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Disabled
Content Access Mode is set to Simple Content Access. This host has access to content, regardless of subscription status.

System Purpose Status: Disabled
Examples::
>>> type(subman_status)
<class 'insights.parsers.subscription_manager.SubscriptionManagerStatus'>
>>> subman_status['Overall Status'] == 'Disabled'
True
>>> subman_status['Content Access Mode'] == 'Simple Content Access'
True
>>> subman_status['System Purpose Status'] == 'Disabled'
True
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.subscription_manager.SubscriptionManagerSyspurpose(context, extra_bad_lines=None)[source]

Bases: CommandParser, JSONParser

Reads the output of subscription-manager syspurpose

Example output:

{
  "addons": [],
  "role": "Red Hat Enterprise Linux Server",
  "service_level_agreement": "Standard",
  "usage": "Development/Test"
}
Examples::
>>> type(subman_syspurpose)
<class 'insights.parsers.subscription_manager.SubscriptionManagerSyspurpose'>
>>> subman_syspurpose.get('role') == 'Red Hat Enterprise Linux Server'
True
>>> subman_syspurpose['service_level_agreement'] == 'Standard'
True
>>> subman_syspurpose['usage'] == 'Development/Test'
True