config¶
- gonto.config.CONFIG_SCHEMA = {'$defs': {'env': {'additionalProperties': False, 'patternProperties': {'^[a-zA-Z_]+[a-zA-Z0-9_]*$': {'type': 'string'}}, 'type': 'object'}, 'reg': {'items': {'additionalProperties': False, 'else': {'properties': {'data': {'type': 'integer'}}}, 'if': {'properties': {'type': {'enum': ['REG_SZ', 'REG_EXPAND_SZ', 'REG_MULTI_SZ']}}}, 'properties': {'data': {}, 'name': {'type': 'string'}, 'path': {'default': '', 'type': 'string'}, 'root': {'enum': ['HKEY_CLASSES_ROOT', 'HKEY_CURRENT_CONFIG', 'HKEY_CURRENT_USER', 'HKEY_DYN_DATA', 'HKEY_LOCAL_MACHINE', 'HKEY_PERFORMANCE_DATA', 'HKEY_USERS'], 'type': 'string'}, 'type': {'default': 'REG_SZ', 'enum': ['REG_DWORD', 'REG_DWORD_LITTLE_ENDIAN', 'REG_DWORD_BIG_ENDIAN', 'REG_QWORD', 'REG_QWORD_LITTLE_ENDIAN', 'REG_SZ', 'REG_EXPAND_SZ', 'REG_MULTI_SZ'], 'type': 'string'}}, 'required': ['root', 'name', 'data'], 'then': {'properties': {'data': {'type': 'string'}}}, 'type': 'object'}, 'type': 'array'}}, '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'properties': {'gonto': {'additionalProperties': False, 'properties': {'cache_dir': {'type': 'string'}, 'repository': {'type': 'string'}}, 'required': ['cache_dir', 'repository'], 'type': 'object'}, 'targets': {'additionalProperties': False, 'patternProperties': {'^[a-zA-Z]+([a-zA-Z0-9_-]*[a-zA-Z0-9]+)?$': {'additionalProperties': False, 'properties': {'after_script': {'type': 'string'}, 'before_script': {'type': 'string'}, 'env': {'$ref': '#/$defs/env'}, 'requires': {'items': {'additionalProperties': False, 'properties': {'env': {'$ref': '#/$defs/env'}, 'format': {'default': 'vhd', 'enum': ['vhd', 'vhdx'], 'type': 'string'}, 'mount_point': {'default': '', 'pattern': '^(|[D-Z]:\\\\)$', 'type': 'string'}, 'name': {'type': 'string'}, 'platform': {'default': 'win64', 'enum': ['win64', 'win32', 'multi'], 'type': 'string'}, 'reg': {'$ref': '#/$defs/reg'}, 'version': {'type': 'string'}}, 'required': ['name', 'version'], 'type': 'object'}, 'type': 'array'}, 'script': {'type': 'string'}}, 'required': ['script'], 'type': 'object'}}, 'type': 'object'}}, 'required': ['gonto', 'targets'], 'type': 'object'}¶
JSON schema to validate the config
- gonto.config.DEFAULT_CONFIG = {'gonto': {'cache_dir': None, 'repository': None}, 'targets': {}}¶
Default configuration
- gonto.config.list_config_files() Iterator[Path]¶
Lists available configuration files.
- Returns:
The paths of the configuration files.
- gonto.config.read_config() dict¶
Read and merge the config.
- Returns:
The final config as plain Python objects.
- gonto.config.validate_config(config: dict) tuple[bool, str]¶
Validate the given config against the schema.
- Parameters:
config – The configuration to validate.
- Returns:
(True, "")if the config is valid,(False, "error message")else.