kapitan
kapitan copied to clipboard
Fix #491
Fixes issue #491
Proposed Changes
- check that the generated content is a dictionary
for JSON to be valid, the content of output_obj
needs to be:
{ "key": "value"}
or even just:
{}
which in both cases would be a "dict", which would make it ignore the
if not isinstance(output_obj, dict)
check.
This means that the only moment that check is evaluated is when, with prune: true
, {}
becomes NoneType.
Test
adding the following code
56 print("output_obj is of type: ", type(output_obj))
57 return
Without prune
enabled:
output_obj is of type: <class 'dict'> <- because it is {}
With prune
enabled:
output_obj is of type: <class 'NoneType'> <- prune makes it NoneType, and this triggers the "single file" mode
BTW even with this patch, with prune: false
Kapitan crashed quite badly. This PR does not address that issue, which I will re-open in another bug report
Crashed for which use case? We can't merge a crashing PR. :P
The crash is unrelated to this PR. It already exists in the current codebase. Will open another bug report :)
@ademariag can we add tests to cover what this fix?