kapitan
kapitan copied to clipboard
Allow kadet inventory function to return a lazy inventory
Since the move to the external kadet package, the default inventory function is now strict e.g. if an attribute key is not found the root, it will raise KeyError.
This brings back the original 'lazy' behavior by allowing to call inventory(lazy=True)
in the kadet input type
Using 0.31.0rc0 I now get
My adoption can be found here: https://github.com/Moep90/kapitan-reference/commit/0fb8bab95a61777dae265786c1d8fc00d5d7b47f
$ kapitan compile
Rendered inventory (0.25s)
Unknown (Non-Kapitan) Error occurred
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/home/danny/.env3_kapitan/lib/python3.7/site-packages/kapitan-0.31.0rc0-py3.7.egg/kapitan/targets.py", line 466, in compile_target
input_compiler.compile_obj(comp_obj, ext_vars, **kwargs)
File "/home/danny/.env3_kapitan/lib/python3.7/site-packages/kapitan-0.31.0rc0-py3.7.egg/kapitan/inputs/base.py", line 56, in compile_obj
self.compile_input_path(input_path, comp_obj, ext_vars, **kwargs)
File "/home/danny/.env3_kapitan/lib/python3.7/site-packages/kapitan-0.31.0rc0-py3.7.egg/kapitan/inputs/base.py", line 78, in compile_input_path
**kwargs,
File "/home/danny/.env3_kapitan/lib/python3.7/site-packages/kapitan-0.31.0rc0-py3.7.egg/kapitan/inputs/kadet.py", line 129, in compile_file
output_obj = kadet_module.main(input_params)
File "/home/danny/github-repos/kapitan-reference/components/generators/kubernetes/__init__.py", line 1402, in main
return globals()[function](input_params)
File "/home/danny/github-repos/kapitan-reference/components/generators/kubernetes/__init__.py", line 1386, in generate_manifests
component_manifests = generate_component_manifests(input_params)
File "/home/danny/github-repos/kapitan-reference/components/generators/kubernetes/__init__.py", line 1267, in generate_component_manifests
workload = Workload(name=name, component=component)
File "/home/danny/.env3_kapitan/lib/python3.7/site-packages/kadet/__init__.py", line 44, in __init__
self.body()
File "/home/danny/github-repos/kapitan-reference/components/generators/kubernetes/__init__.py", line 755, in body
workload.add_volume_claims(component.volume_claims)
File "/home/danny/github-repos/kapitan-reference/components/generators/kubernetes/__init__.py", line 54, in add_volume_claims
self.root.spec.volumeClaimTemplates += [value]
File "box/box.py", line 286, in box.box.Box.__iadd__
box.exceptions.BoxTypeError: Box can only merge two boxes or a box and a dictionary.
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/danny/.env3_kapitan/lib/python3.7/site-packages/kapitan-0.31.0rc0-py3.7.egg/kapitan/targets.py", line 134, in compile_targets
[p.get() for p in pool.imap_unordered(worker, target_objs) if p]
File "/home/danny/.env3_kapitan/lib/python3.7/site-packages/kapitan-0.31.0rc0-py3.7.egg/kapitan/targets.py", line 134, in <listcomp>
[p.get() for p in pool.imap_unordered(worker, target_objs) if p]
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.7/multiprocessing/pool.py", line 748, in next
raise value
box.exceptions.BoxTypeError: Box can only merge two boxes or a box and a dictionary.
Box can only merge two boxes or a box and a dictionary.
@Moep90 is this using a particular version of generators?
From my perspective it can be resolved.
Inventory is still more strict. But in a fair amount I guess.
Actions for kapitan-reference
can be found here:
https://github.com/kapicorp/kapitan-reference/pull/127 --> Still not finished but this is just an effort question.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.