Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/+ctl-transform-return-string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allows the `infrahubctl transform` to return a regular string that does not get converted to a JSON string.
6 changes: 5 additions & 1 deletion infrahub_sdk/ctl/cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@
# Run Transform
result = asyncio.run(transform.run(data=data))

json_string = ujson.dumps(result, indent=2, sort_keys=True)
if isinstance(result, str):
json_string = result

Check warning on line 356 in infrahub_sdk/ctl/cli_commands.py

View check run for this annotation

Codecov / codecov/patch

infrahub_sdk/ctl/cli_commands.py#L356

Added line #L356 was not covered by tests
else:
json_string = ujson.dumps(result, indent=2, sort_keys=True)

if out:
write_to_file(Path(out), json_string)
else:
Expand Down