Python API

Homer Python API autodoc.

Homer package.

class homer.Homer(main_config: Mapping)[source]

Bases: object

The instance to run Homer.

Initialize the instance.

Parameters:

main_config (typing.Mapping) -- the configuration dictionary.

commit(query: str, *, message: str = '-') int[source]

Commit the generated configuration asking for confirmation.

Parameters:
  • query (str) -- the query to select the devices.

  • message (str, default: '-') -- the commit message to use.

Return type:

int

Returns:

0 on success, a small positive integer on failure.

diff(query: str, *, omit_diff: bool = False) int[source]

Generate the configuration and check the diff with the current live one.

Parameters:
  • query (str) -- the query to select the devices.

  • omit_diff (bool, default: False) -- whether to not show the actual diff to avoid leak of private data.

Return type:

int

Returns:

0 on success, a small positive integer on failure.

generate(query: str) int[source]

Generate the configuration only saving it locally, no remote action is performed.

Parameters:

query (str) -- the query to select the devices.

Return type:

int

Returns:

0 on success, a small positive integer on failure.

OUT_EXTENSION = '.out'

The extension for the generated output files.

homer.DIFF_EXIT_CODE = 99

The exit code used when the diff command is executed and there is a diff.

homer.TIMEOUT_ATTEMPTS = 3

The number of attempts to try when there is a timeout.

homer.__version__ = '0.11.0'

The version of the current Homer package.

Subpackages and Submodules