pytest_mh.utils.hostname

Manage the system hostname using the ‘hostname’ utility.

Classes

HostnameUtils(*args, **kwargs)

Provides a Python wrapper for the 'hostname' command.

class pytest_mh.utils.hostname.HostnameUtils(*args, **kwargs)

Bases: MultihostReentrantUtility[MultihostHost]

Provides a Python wrapper for the ‘hostname’ command.

This is a reentrant utility. When used as a context manager, it will automatically save the original hostname on entry and restore it on exit.

Initialize the HostnameUtils.

Parameters:

host (MultihostHost object.) – Remote host instance.

property name: str

Gets hostname.

Returns:

Current hostname.

Return type:

str

property shortname: str

Gets shortname.

Returns:

Short hostname.

Return type:

str

property fqdn: str

Gets FQDN.

Returns:

FQDN.

Return type:

str