redhat-release - File /etc/redhat-release

This module provides plugins access to file /etc/redhat-release

Typical content of file /etc/redhat-release is:

Red Hat Enterprise Linux Server release 7.2 (Maipo)

This module parses the file contents and stores data in the class attributes described below.

Examples

>>> type(rh_release)
<class 'insights.parsers.redhat_release.RedhatRelease'>
>>> rh_release.raw
'Red Hat Enterprise Linux Server release 7.2 (Maipo)'
>>> rh_release.major
7
>>> rh_release.minor
2
>>> rh_release.version
'7.2'
>>> rh_release.is_rhel
True
>>> rh_release.product
'Red Hat Enterprise Linux Server'
class insights.parsers.redhat_release.RedhatRelease(context)[source]

Bases: insights.core.Parser

Parses the content of file /etc/redhat-release

is_beta

True if this is a Beta release

Type

bool

is_centos

True if this release is CentOS

Type

bool

is_fedora

True if this release is Fedora

Type

bool

is_rhel

True if this release is Red Hat Enterprise Linux

Type

bool

major

Major release number or None

Type

int

minor

Minor release number or None

Type

int

parsed

Dictionary containing the parsed strings for product, version, and code_name

Type

dict

raw

Unparsed redhat-release string

Type

string

property code_name

code name of this OS or None.

Type

string

parse_content(content)[source]

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

property product

product of this OS.

Type

string

property version

version of this OS.

Type

string