configuration
drunc.utils.configuration
Configuration utilities for DRUNC.
Classes
ConfHandler
Handler for loading and parsing DRUNC configurations.
Supports multiple configuration sources via from_* classmethods. Subclasses override populate_from_dict / populate_from_pbany to handle JSON and protobuf sources, and _post_process_oks to handle OKS/pyobject sources (via self._raw_data).
Methods:
copy_oks_key()
Get a copy of the OKS key if one exists.
Returns:
| Type | Description |
|---|---|
OKSKey | None
|
OKSKey | None: The OKS key, or None if not using OKS configuration. |
populate_from_dict(data)
Populate from a dictionary (JSON source).
Override in subclasses that support JSON configuration.
Source code in drunc/utils/configuration.py
populate_from_pbany(pbany_data)
Populate from a Protobuf Any message.
Override in subclasses that support protobuf configuration.
Source code in drunc/utils/configuration.py
ConfTypeNotSupported(conf_type, class_name)
Bases: DruncSetupException
Exception raised when a configuration type is not supported.
Initialize the ConfTypeNotSupported exception.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conf_type
|
ConfTypes
|
The configuration type that is not supported. |
required |
class_name
|
str
|
The name of the class where this type is not supported. |
required |
Source code in drunc/utils/configuration.py
Methods:
ConfTypes
Bases: Enum
Enumeration of supported configuration types.
ConfigurationNotFound(requested_path)
Bases: DruncSetupException
Exception raised when configuration is not found.
Initialize the ConfigurationNotFound exception.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requested_path
|
str
|
The path to the configuration that was not found. |
required |
Source code in drunc/utils/configuration.py
Methods:
OKSKey(schema_file, class_name, obj_uid, session)
Key information for accessing OKS configuration objects.
Initialize an OKSKey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema_file
|
str
|
The OKS schema file path. |
required |
class_name
|
str
|
The class name in the OKS schema. |
required |
obj_uid
|
str
|
The unique identifier for the object. |
required |
session
|
str
|
The session name. |
required |
Source code in drunc/utils/configuration.py
Methods:
Functions:
CLI_to_ConfTypes(scheme)
Convert a CLI scheme string to a ConfTypes enum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scheme
|
str
|
The scheme string ("file", "oksconflibs", or ""). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ConfTypes |
ConfTypes
|
The corresponding configuration type. |
Raises:
| Type | Description |
|---|---|
DruncSetupException
|
If the scheme is not recognized. |
Source code in drunc/utils/configuration.py
parse_conf_url(url)
Parse a configuration URL into scheme and type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The configuration URL (format: "scheme:filename"). |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, ConfTypes]
|
tuple[str, ConfTypes]: A tuple of (url, conf_type). |