|
Mercury2 Hardware Manager
1.0dev
The hardware manager component of the Mercury2 ground station suite.
|
Provides access to the hardware manager application configuration. More...
Public Member Functions | |
| def | __init__ |
| Initializes the Config class with some initial static configuration. | |
| def | read_configuration |
| Loads and parses the specified configuration file. More... | |
| def | set |
| Sets the indicated configuration option to the provided value. More... | |
| def | get |
| Retrieves the specified configuration option. More... | |
| def | delete |
| Removes the specified configuration option from the user options dictionary. More... | |
| def | validate_configuration |
| Verifies that the loaded configuration conforms to the schema. More... | |
Public Attributes | |
| version | |
| verbose_startup | |
| options | |
| user_options | |
| config_directory | |
| data_directory | |
| log_directory | |
Private Member Functions | |
| def | _process_defaults |
| Copies the default values from the configuration schema to the options dictionary. More... | |
| def | _set_hwm_directories |
| Sets the location of the Mercury2 HWM configuration and data directories. More... | |
Provides access to the hardware manager application configuration.
This class stores and provides access to the configuration and various shared state used by the hardware manager. In addition, it allows users to store their own configuration options as needed. To use this class, import this module (configuration) and assign a local variable to 'Configuration' (makes code easier to test).
|
private |
Copies the default values from the configuration schema to the options dictionary.
This method copies the default values for unspecified options from the defined configuration schema to the options dictionary.
| configuration_schema | A dictionary containing the configuration schema to use when copying default values. |
|
private |
Sets the location of the Mercury2 HWM configuration and data directories.
This method sets the locations of the various Mercury2 configuration and data directories, which contain the HWM configuration files, logs, and telemetry dumps, among other things.
| def hwm.core.configuration.Config.delete | ( | self, | |
| option_key | |||
| ) |
Removes the specified configuration option from the user options dictionary.
| OptionProtected | thrown if the user tries to delete a protected option (originally defined in a YAML configuration file). |
| OptionNotFound | thrown if the requested option can't be located. |
| option_key | The key of the option to remove. |
| def hwm.core.configuration.Config.get | ( | self, | |
| option_key | |||
| ) |
Retrieves the specified configuration option.
This method returns the value of the specified option whether it is a user defined option or an option loaded from a YAML configuration file.
| OptionNotFound | Thrown if the specified option can't be located. |
| option_key | The key of the option to query for. |
| def hwm.core.configuration.Config.read_configuration | ( | self, | |
| configuration_file | |||
| ) |
Loads and parses the specified configuration file.
Reads in all configuration settings from the specified YAML file and stores them in the 'options' dictionary.
| IOError | Thrown if the specified file can't be loaded. |
| ConfigFileMalformed | Thrown if the specified file can't be parsed by the YAML parser. |
| configuration_file | The YAML configuration file to load. This is an absolute path. |
| def hwm.core.configuration.Config.set | ( | self, | |
| option_key, | |||
| option_value | |||
| ) |
Sets the indicated configuration option to the provided value.
| OptionProtected | thrown if the user tries to modify or set a protected run-time option. |
| option_key | The key (name) of the option to set. |
| option_value | The value to assign to the indicated option. |
| def hwm.core.configuration.Config.validate_configuration | ( | self) |
Verifies that the loaded configuration conforms to the schema.
This method compares the currently loaded configuration settings against the defined configuration schema. This ensures that all required options have been set and that they meet formatting requirements.
| May | throw ConfigInvalid if the loaded configuration set does not conform to the schema. |