Hostname - command hostname

Parsers contained in this module are:

Hostname - command hostname -f

HostnameDefault - command hostname

HostnameShort - command hostname -s

class insights.parsers.hostname.Hostname(context, extra_bad_lines=None)[source]

Bases: HostnameBase

This parser simply reads the output of hostname -f, which is the configured fully qualified domain name of the client system. It then splits it into hostname and domain and stores these as attributes, along with the unmodified name in the fqdn attribute.

Examples

>>> hostname.raw
'rhel7.example.com'
>>> hostname.fqdn
'rhel7.example.com'
>>> hostname.hostname
'rhel7'
>>> hostname.domain
'example.com'
raw

The raw output of the hostname -f command.

fqdn

The fully qualified domain name of the host. The same to hostname when domain part is not set.

hostname

The hostname.

domain

The domain get from the fqdn.

parse_content(content)[source]

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

class insights.parsers.hostname.HostnameBase(context, extra_bad_lines=None)[source]

Bases: CommandParser

The base parser class for command hostname.

Raises:

ParseException -- When the output contains multiple non-empty lines.

parse_content(content)[source]

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

class insights.parsers.hostname.HostnameDefault(context, extra_bad_lines=None)[source]

Bases: HostnameBase

This parser simply reads the output of hostname.

Examples

>>> hostname_def.raw
'rhel7'
>>> hostname_def.hostname
'rhel7'
raw

The raw output of the hostname command.

hostname

The hostname.

class insights.parsers.hostname.HostnameShort(context, extra_bad_lines=None)[source]

Bases: HostnameBase

This parser simply reads the output of hostname -s, which is the configured short hostname of the client system.

Examples

>>> hostname_s.raw
'rhel7'
>>> hostname_s.hostname
'rhel7'
raw

The raw output of the hostname -s command.

hostname

The hostname.