turbinia icon indicating copy to clipboard operation
turbinia copied to clipboard

Fix dump_json command

Open hacktobeer opened this issue 4 years ago • 2 comments

The dump_json command for both the request and status command are not clean making parsing error prone. dump_json position also seems to differ between status and create request command.

$ turbiniactl -a status --dump_json -r 1234456
<cut>'last_update': datetime.datetime(2021, 2, 4, 9, 37, 32, 357199)<cut>

$ turbiniactl --dump_json compresseddirectory -l /evidence/history.tgz
b'{"request_id": "9dcb333fae34432aa8560ff7c612e42c", <cut> "type": "TurbiniaRequest"}'

hacktobeer avatar Feb 04 '21 10:02 hacktobeer

Looked at the code:

  • dump_json in the create request context only dumps the json of the request but not actually creates the request
  • dump_json in the context of the status context will output json status information as expected (but malformed)

I think we should rewrite this so that --dump_json is only on the main level (so $ turbiniactl --dump_json [the rest]) and will output json for commands that support it). Remove the option to only dump json and exit -> or is this used somewhere?

hacktobeer avatar Feb 04 '21 11:02 hacktobeer

Draft PR -> https://github.com/google/turbinia/pull/714

hacktobeer avatar Feb 04 '21 14:02 hacktobeer

Going to close this since the new client handles json output differently and we'll be deprecating this part of turbiniactl.

aarontp avatar Dec 14 '22 06:12 aarontp