dnf module commands

Parsers provided in this module includes:

DnfModuleList - command dnf module list

DnfModuleInfo - command dnf module info *

class insights.parsers.dnf_module.DnfModuleBrief(data=None, cmd='list')[source]

Bases: object

An object for the dnf modules listed by dnf module list command

name

Name of the dnf module

Type:

str

streams

List of streams of the dnf module

Type:

list

class insights.parsers.dnf_module.DnfModuleInfo(*args, **kwargs)[source]

Bases: CommandParser, dict

Class to parse the output of command dnf module info XX, YY

Typical output of the command is:

Updating Subscription Management repositories.
Last metadata expiration check: 0:31:25 ago on Thu 25 Jul 2019 12:19:22 PM CST.
Name        : 389-ds
Stream      : 1.4
Version     : 8000020190424152135
Context     : ab753183
Repo        : rhel-8-for-x86_64-appstream-rpms
Summary     : 389 Directory Server (base)
Description : 389 Directory Server is an LDAPv3 compliant server.  The base package includes the LDAP server and command line utilities for server administration.
Artifacts   : 389-ds-base-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.src
            : 389-ds-base-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-debuginfo-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-debugsource-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-devel-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-legacy-tools-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-legacy-tools-debuginfo-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-libs-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-libs-debuginfo-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-snmp-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : 389-ds-base-snmp-debuginfo-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.x86_64
            : python3-lib389-0:1.4.0.20-10.module+el8.0.0+3096+101825d5.noarch

Name        : 389-ds
Stream      : 1.4
Version     : 820190201170147
Context     : 1fc8b219
Repo        : rhel-8-for-x86_64-appstream-rpms
Summary     : 389 Directory Server (base)
Description : 389 Directory Server is an LDAPv3 compliant server.  The base package includes the LDAP server and command line utilities for server administration.
Artifacts   : 389-ds-base-0:1.4.0.20-7.module+el8+2750+1f4079fb.x86_64
            : 389-ds-base-devel-0:1.4.0.20-7.module+el8+2750+1f4079fb.x86_64
            : 389-ds-base-legacy-tools-0:1.4.0.20-7.module+el8+2750+1f4079fb.x86_64
            : 389-ds-base-libs-0:1.4.0.20-7.module+el8+2750+1f4079fb.x86_64
            : 389-ds-base-snmp-0:1.4.0.20-7.module+el8+2750+1f4079fb.x86_64
            : python3-lib389-0:1.4.0.20-7.module+el8+2750+1f4079fb.noarch

Name             : ant
Stream           : 1.10 [d][a]
Version          : 820181213135032
Context          : 5ea3b708
Profiles         : common [d]
Default profiles : common
Repo             : rhel-8-for-x86_64-appstream-rpms
Summary          : Java build tool
Description      : Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
Artifacts        : ant-0:1.10.5-1.module+el8+2438+c99a8a1e.noarch
                 : ant-lib-0:1.10.5-1.module+el8+2438+c99a8a1e.noarch

Name             : httpd
Stream           : 2.4 [d][e][a]
Version          : 820190206142837
Context          : 9edba152
Profiles         : common [d] [i], devel, minimal
Default profiles : common
Repo             : rhel-8-for-x86_64-appstream-rpms
Summary          : Apache HTTP Server
Description      : Apache httpd is a powerful, efficient, and extensible HTTP server.
Artifacts        : httpd-0:2.4.37-10.module+el8+2764+7127e69e.x86_64
                 : httpd-devel-0:2.4.37-10.module+el8+2764+7127e69e.x86_64
                 : httpd-filesystem-0:2.4.37-10.module+el8+2764+7127e69e.noarch
                 : httpd-manual-0:2.4.37-10.module+el8+2764+7127e69e.noarch
                 : httpd-tools-0:2.4.37-10.module+el8+2764+7127e69e.x86_64
                 : mod_http2-0:1.11.3-1.module+el8+2443+605475b7.x86_64
                 : mod_ldap-0:2.4.37-10.module+el8+2764+7127e69e.x86_64
                 : mod_md-0:2.4.37-10.module+el8+2764+7127e69e.x86_64
                 : mod_proxy_html-1:2.4.37-10.module+el8+2764+7127e69e.x86_64
                 : mod_session-0:2.4.37-10.module+el8+2764+7127e69e.x86_64
                 : mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive]

The modules information is wrapped in this object like a dictionary, with the module name as the key and the list of the DnfModuleStreamDetail as the value.

Examples

>>> type(dnf_module_info)
<class 'insights.parsers.dnf_module.DnfModuleInfo'>
>>> len(dnf_module_info)
3
>>> dnf_module_info.modules
['389-ds', 'ant', 'httpd']
>>> "389-ds" in dnf_module_info
True
>>> len(dnf_module_info.get("389-ds"))
2
>>> type(dnf_module_info.get("389-ds")[0])
<class 'insights.parsers.dnf_module.DnfModuleStreamDetail'>
>>> dnf_module_info['389-ds'][0].name
'389-ds'
>>> type(dnf_module_info['389-ds'][0].streams[0])
<class 'insights.parsers.dnf_module.DnfModuleStream'>
>>> dnf_module_info["389-ds"][0].streams[0].profiles
[]
>>> dnf_module_info["389-ds"][0].default_profiles
''
>>> dnf_module_info['389-ds'][1].name
'389-ds'
>>> dnf_module_info['389-ds'][1].context
'1fc8b219'
>>> "ant" in dnf_module_info
True
>>> len(dnf_module_info.get("ant"))
1
>>> type(dnf_module_info.get("ant")[0])
<class 'insights.parsers.dnf_module.DnfModuleStreamDetail'>
>>> dnf_module_info['ant'][0].name
'ant'
>>> dnf_module_info['ant'][0].context
'5ea3b708'
>>> dnf_module_info["ant"][0].version
'820181213135032'
>>> len(dnf_module_info["ant"][0].streams[0].profiles)
1
>>> type(dnf_module_info["ant"][0].streams[0].profiles[0])
<class 'insights.parsers.dnf_module.Profile'>
>>> dnf_module_info["ant"][0].streams[0].profiles[0].profile
'common'
>>> dnf_module_info["ant"][0].streams[0].profiles[0].default
True
>>> dnf_module_info['ant'][0].default_profiles
'common'
>>> len(dnf_module_info["httpd"][0].streams[0].profiles)
3
>>> dnf_module_info["httpd"][0].streams[0].profiles[0].profile
'common'
>>> dnf_module_info["httpd"][0].streams[0].profiles[0].default
True
>>> dnf_module_info["httpd"][0].streams[0].profiles[0].installed
True
>>> dnf_module_info["httpd"][0].streams[0].profiles[1].profile
'devel'
>>> dnf_module_info["httpd"][0].streams[0].profiles[2].profile
'minimal'
>>> dnf_module_info["httpd"][0].default_profiles
'common'
property modules

Returns a list of modules name

parse_content(content)[source]

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

class insights.parsers.dnf_module.DnfModuleList(*args, **kwargs)[source]

Bases: CommandParser, dict

Class to parse the output of command dnf module list Typical output of the command is:

Updating Subscription Management repositories.
Name                Stream      Profiles                                  Summary
389-ds              1.4                                                   389 Directory Server (base)
ant                 1.10 [d]    common [d]                                Java build tool
ant                 1.20        common [d]                                Java build tool

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Examples

>>> len(dnf_module_list)
2
>>> len(dnf_module_list.get("389-ds").streams)
1
>>> type(dnf_module_list.get("389-ds").streams[0])
<class 'insights.parsers.dnf_module.DnfModuleStream'>
>>> dnf_module_list.get("389-ds").streams[0].profiles
[]
>>> len(dnf_module_list.get("ant").streams)
2
>>> dnf_module_list.get("ant").streams[0].stream
'1.10'
>>> dnf_module_list.get("ant").streams[0].default
True
>>> dnf_module_list.get("ant").streams[0].active
True
>>> dnf_module_list.get("ant").streams[1].stream
'1.20'
>>> dnf_module_list.get("ant").streams[1].active
False
property modules

Returns a list of modules name

parse_content(content)[source]

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

class insights.parsers.dnf_module.DnfModuleStream(data=None, cmd='list')[source]

Bases: object

An object for the dnf module:stream

stream

Name of the module stream

Type:

str

profiles

List of profiles of the dnf module:stream

Type:

list

summary

Summary of the dnf module:stream

Type:

str

default

Default flag of the dnf module:stream

Type:

bool

enabled

Enabled flag of the dnf module:stream

Type:

bool

disabled

Disabled flag of the dnf module:stream

Type:

bool

installed

Installed flag of the dnf module:stream

Type:

bool

active

Active flag of the dnf module:stream

Type:

Optional[bool]

class insights.parsers.dnf_module.DnfModuleStreamDetail(data=None)[source]

Bases: DnfModuleBrief

An object for the dnf module:stream

name

Name of the dnf module

Type:

str

streams

List of streams of the dnf module

Type:

list

version

Version of the dnf module:stream

Type:

str

context

Context of the dnf module:stream

Type:

str

default_profiles

Default profile of the dnf module:stream

Type:

str

repo

Repo of the dnf module:stream

Type:

str

description

Description of the dnf module:stream

Type:

str

artifacts

List of the artifacts of the dnf module:stream

Type:

list

class insights.parsers.dnf_module.Profile(profile)[source]

Bases: object

An object for the dnf module:stream profile

profile

Profile of the dnf module:stream

Type:

Optional[str]

default

Default flag of the dnf module:stream profile

Type:

bool

installed

Installed flag of the dnf module:stream profile

Type:

bool