certified.layout — Config Directory Layout
Manages the on-disk layout of the certified configuration directory. See Configuration / Keyfile Layout for the directory structure.
config
Lookup and return the location of the certified-apis configuration directory.
Priority order is
- certified_config (if not None)
- $CERTIFIED_CONFIG (if CERTIFIED_CONFIG defined)
- $VIRTUAL_ENV/etc/certified (if VIRTUAL_ENV defined)
- /etc/certified
The return value of this function is cached,
so changes to environment variables have no effect after the first return from this function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
certified_config
|
Optional[Pstr]
|
if defined, this value is returned. |
None
|
should_exist
|
bool
|
require that the directory exist? |
True
|
Raises:
| Type | Description |
|---|---|
NotADirectoryError
|
Raised if the config does not point to a directory. If exists == False, this is only raised when the config exists, but is not a non-directory. |
Source code in certified/layout.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
check_config
Scans the base configuration directory and returns a list of warnings and error messages.
>>> cfg = certified.config()
>>> warn, err = certified.check(cfg)
>>> if len(err) > 0:
>>> print(f"{len(err)} errors:")
>>> print("
".join(err))
Source code in certified/layout.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |