configuration module

class configuration.Config(config_file)[source]

Bases: object

This class parses conquers’s configuration file, checks for errors and returns an object containing the configuration.

The path to a yaml configuration file must be passed to the constructor.

config_file

A relative or absolute path to the yaml configuration file.

Type:

str

config_object

The configuration as a python dicationary.

Type:

dict

file_handle

The file handle used for the configuration file.

Type:

file

file_extension

The file exentsion used for the configuration file.

Type:

str

valid_file_extensions

File extensions allowed to use.

Type:

list

errors

Errors are collected here.

Type:

list

required_keys

A list of keys that must be present in the configuration per group or host.

Type:

list

check() bool[source]

Checks if config_file exists and if it has a one of the valid_file_extensions.

check_required_keys() bool[source]

Todo

  • needs implementation

parse() bool[source]

Parses the configuration from config_file into config_object. Returns True if successful, False otherwise.

Todo

  • either remove .toml or implement it

return_config() dict[source]

Returns config_object.