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 (dict) -- 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) -- the commit message to use.

Returns:

0 on success, a small positive integer on failure.

Return type:

int

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, optional) -- whether to not show the actual diff to avoid leak of private data.

Returns:

0 on success, a small positive integer on failure.

Return type:

int

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.

Returns:

0 on success, a small positive integer on failure.

Return type:

int

OUT_EXTENSION = '.out'

the extension for the generated output files.

Type:

str

homer.DIFF_EXIT_CODE = 99

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

Type:

int

homer.TIMEOUT_ATTEMPTS = 3

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

Type:

int

homer.__version__ = '0.1.dev2+g992b422'

the version of the current Homer package.

Type:

str

Subpackages and Submodules