Client Metadata Files

Parsers for files that are generated by the insights-client.

AnsibleHost - File ansible_host

BlacklistedSpecs - File blacklisted_specs

BranchInfo - File branch_info

DisplayName - File display_name

MachineID - File machine_id

Tags - file tags.json

VersionInfo - file version_info

class insights.parsers.client_metadata.AnsibleHost(context, extra_bad_lines=None)[source]

Bases: HostnameBase

Class for parsing the content of ansible_host.

Typical content:

host1
hostname

Ansible Hostname.

Type:

str

raw

RAW content of this file.

Type:

str

Examples

>>> type(ansible_host)
<class 'insights.parsers.client_metadata.AnsibleHost'>
>>> ansible_host.hostname == "host1"
True
>>> ansible_host.raw == "host1"
True
class insights.parsers.client_metadata.BlacklistedSpecs(context)[source]

Bases: JSONParser

Class for parsing the content of blacklisted_specs or blacklisted_specs.txt

Typical content:

{"specs": ["dmesg", "fstab"]}
specs

List of blacklisted specs.

Type:

list

Examples

>>> type(specs)
<class 'insights.parsers.client_metadata.BlacklistedSpecs'>
>>> result = ['dmesg', 'fstab']
>>> specs.specs == result
True
class insights.parsers.client_metadata.BranchInfo(context)[source]

Bases: JSONParser

Class for parsing the content of branch_info as a dictionary.

Typical content:

{"remote_branch": -1, "remote_leaf": -1}

Examples

>>> type(branch_info)
<class 'insights.parsers.client_metadata.BranchInfo'>
>>> branch_info['remote_branch'] == -1
True
class insights.parsers.client_metadata.DisplayName(context, extra_bad_lines=None)[source]

Bases: HostnameBase

Class for parsing the content of display_name.

Typical content:

host1
hostname

Display Hostname.

Type:

str

raw

RAW content of this file.

Type:

str

Examples

>>> type(display_name)
<class 'insights.parsers.client_metadata.DisplayName'>
>>> display_name.hostname == "host1"
True
>>> display_name.raw == "host1"
True
class insights.parsers.client_metadata.MachineID(context)[source]

Bases: Parser

Class for parsing the content of display_name.

Typical content:

176843d1-90fa-499b-9f94-111111111111
id

Machine ID

Type:

str

Examples

>>> type(machine_id)
<class 'insights.parsers.client_metadata.MachineID'>
>>> machine_id.id== "176843d1-90fa-499b-9f94-111111111111"
True
Raises:

SkipComponent -- Nothing collected

parse_content(content)[source]

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

class insights.parsers.client_metadata.Tags(context)[source]

Bases: JSONParser

Class for parsing the content of tags.json.

Typical content:

[{"key": "group", "value": "_group-name-value_", "namespace": "insights-client"}]
data

List of parsed dictionaries.

Type:

list

Examples

>>> type(tags)
<class 'insights.parsers.client_metadata.Tags'>
>>> tags.data[0]['key'] == "group"
True
>>> tags.data[0]['value'] == "_group-name-value_"
True
>>> tags.data[0]['namespace'] == "insights-client"
True
class insights.parsers.client_metadata.VersionInfo(context)[source]

Bases: JSONParser

Class for parsing the content of version_info.

Typical content of this file is:

{"core_version": "3.0.203-1", "client_version": "3.1.1"}

Note

The client_version provided by this Parser is a short version only, to get the full version of the insights-client package, please use the insights.parsers.installed_rpms.InstalledRpms Parser instead.

Examples

>>> type(ver)
<class 'insights.parsers.client_metadata.VersionInfo'>
>>> ver.core_version == '3.0.203-1'
True
>>> ver.client_version == '3.1.1'
True
property client_version
Returns:

The version of the insights client.

Return type:

(str)

Note

This attribute returns a short version of the insights client only, to get the full version of the insights-client package, please use the insights.parsers.installed_rpms.InstalledRpms Parser instead.

property core_version

Returns: (str): The version of the insights core.