Skip to content

Commit c9aeb04

Browse files
authored
Kapitan Release 0.34.2 (#1263)
## Proposed Changes * Fix inventory validation for OmegaConf * Refactor inventory modules * Minor refactoring
1 parent dfa5d33 commit c9aeb04

File tree

20 files changed

+302
-307
lines changed

20 files changed

+302
-307
lines changed

docs/pages/inventory/reclass-rs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ The example inventory renders to a total of 25MB of YAML.
3939
$ time kapitan inventory -v --inventory-backend=reclass > inv.yml
4040
[ ... some output omitted ... ]
4141
kapitan.resources DEBUG Using reclass as inventory backend
42-
kapitan.inventory.inv_reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
43-
kapitan.inventory.inv_reclass DEBUG Inventory rendering with reclass took 0:01:06.037057
42+
kapitan.inventory.backends.reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
43+
kapitan.inventory.backends.reclass DEBUG Inventory rendering with reclass took 0:01:06.037057
4444

4545
real 1m23.840s
4646
user 1m23.520s
@@ -56,11 +56,11 @@ The rest of the runtime (roughly 18 seconds) is spent in writing the resulting 2
5656
$ time kapitan inventory -v --inventory-backend=reclass-rs > inv-rs.yml
5757
[ ... some output omitted ... ]
5858
kapitan.resources DEBUG Using reclass-rs as inventory backend
59-
kapitan.inventory.inv_reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
59+
kapitan.inventory.backends.reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
6060
reclass-config.yml entry 'storage_type=yaml_fs' not implemented yet, ignoring...
6161
reclass-config.yml entry 'inventory_base_uri=./inventory' not implemented yet, ignoring...
6262
reclass-config.yml entry 'allow_none_override=true' not implemented yet, ignoring...
63-
kapitan.inventory.inv_reclass_rs DEBUG Inventory rendering with reclass-rs took 0:00:01.717107
63+
kapitan.inventory.backends.reclass_rs DEBUG Inventory rendering with reclass-rs took 0:00:01.717107
6464
6565
real 0m19.921s
6666
user 0m35.586s

kapitan/errors.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ class InventoryError(KapitanError):
1818
"""inventory error"""
1919

2020

21+
class InventoryValidationError(InventoryError):
22+
"""inventory validation error"""
23+
24+
25+
class InvalidTargetError(InventoryError):
26+
"""inventory validation error"""
27+
28+
2129
class SecretError(KapitanError):
2230
"""secrets error"""
2331

kapitan/inputs/external.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import subprocess
1212

1313
from kapitan.inputs.base import InputType
14-
from kapitan.utils import copy_tree
1514

1615
logger = logging.getLogger(__name__)
1716

kapitan/inventory/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from kapitan.utils import StrEnum
44

5-
from .inventory import Inventory
5+
from .inventory import Inventory, InventoryError, InventoryTarget
66

77

88
class InventoryBackends(StrEnum):
@@ -20,7 +20,7 @@ def load_reclass_backend():
2020
"""
2121
Enable the reclass inventory backend.
2222
"""
23-
from .inv_reclass import ReclassInventory
23+
from .backends.reclass import ReclassInventory
2424

2525
return ReclassInventory
2626

@@ -29,7 +29,7 @@ def load_reclass_rs_backend():
2929
"""
3030
Enable the reclass-rs inventory backend.
3131
"""
32-
from .inv_reclass_rs import ReclassRsInventory
32+
from .backends.reclass_rs import ReclassRsInventory
3333

3434
return ReclassRsInventory
3535

@@ -38,7 +38,7 @@ def load_omegaconf_backend():
3838
"""
3939
Enable the omegaconf inventory backend.
4040
"""
41-
from .inv_omegaconf.inv_omegaconf import OmegaConfInventory
41+
from .backends.omegaconf import OmegaConfInventory
4242

4343
return OmegaConfInventory
4444

kapitan/inventory/inv_omegaconf/inv_omegaconf.py renamed to kapitan/inventory/backends/omegaconf/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
from kadet import Dict
1717
from omegaconf import ListMergeMode, OmegaConf
1818

19+
from kapitan.errors import InventoryError
20+
from kapitan.inventory import Inventory, InventoryTarget
1921
from kapitan.inventory.model import KapitanInventoryMetadata, KapitanInventoryParameters
2022

21-
from ..inventory import Inventory, InventoryError, InventoryTarget
2223
from .migrate import migrate
2324
from .resolvers import register_resolvers
2425

@@ -30,6 +31,10 @@ def keys_to_strings(ob):
3031
return ob
3132

3233

34+
class OmegaConfRenderingError(InventoryError):
35+
pass
36+
37+
3338
@keys_to_strings.register
3439
def _handle_dict(ob: dict):
3540
return {str(k): keys_to_strings(v) for k, v in ob.items()}
@@ -75,6 +80,9 @@ def render_targets(
7580
)
7681
r.wait()
7782

83+
if not r.successful():
84+
raise OmegaConfRenderingError("Error while loading the OmegaConf inventory")
85+
7886
for target in shared_targets.values():
7987
self.targets[target.name] = target
8088

kapitan/inventory/inv_reclass.py renamed to kapitan/inventory/backends/reclass/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
from reclass.errors import NotFoundError, ReclassException
99

1010
from kapitan.errors import InventoryError
11-
12-
from .inventory import Inventory, InventoryTarget
11+
from kapitan.inventory import Inventory, InventoryTarget
1312

1413
logger = logging.getLogger(__name__)
1514

kapitan/inventory/inv_reclass_rs.py renamed to kapitan/inventory/backends/reclass_rs/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
import reclass_rs
55

66
from kapitan.errors import InventoryError
7-
8-
from .inv_reclass import get_reclass_config
9-
from .inventory import Inventory, InventoryTarget
7+
from kapitan.inventory import Inventory
8+
from kapitan.inventory.backends.reclass import get_reclass_config
109

1110
logger = logging.getLogger(__name__)
1211

kapitan/inventory/inv_omegaconf/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)