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 content and stores data in the dict self.parsed
.
The version info can also be get via obj.major
and obj.minor
.
Property is_rhel
and is_hypervisor
specifies the host type.
Examples
>>> rh_rls_content = '''
... Red Hat Enterprise Linux Server release 7.2 (Maipo)
... '''.strip()
>>> from insights.tests import context_wrap
>>> shared = {RedhatRelease: RedhatRelease(context_wrap(rh_rls_content))}
>>> release = shared[RedhatRelease]
>>> assert release.raw == rh_rls_content
>>> assert release.major == 7
>>> assert release.minor == 2
>>> assert release.version == "7.2"
>>> assert release.is_rhel
>>> assert 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
.-
property
is_rhel
¶ True if this OS belong to RHEL, else False.
- Type
bool
-
property
major
¶ the major version of this OS.
- Type
int
-
property
minor
¶ the minor version of this OS.
- Type
int
-
property
product
¶ product of this OS.
- Type
string
-
property
version
¶ version of this OS.
- Type
string
-
property