Please provide machine parsable output

Bug #1423622 reported by Michael Vogt on 2015-02-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu system image
High
Barry Warsaw

Bug Description

For snappy I would like to drive system-image by calling "system-image-cli --config-dir /something/ --parsable-output" (or something). It would then download the update and show parsable progress/errors on stdout. I don't mind what format, could be json, could be as simple as:
"<status>:<percent>:<human-readable-message>"
with status={progress,error,warning}

Related branches

Barry Warsaw (barry) on 2015-02-19
tags: added: mailman3
tags: added: client
removed: mailman3
Changed in ubuntu-system-image:
status: New → Triaged
Michael Vogt (mvo) wrote :

I added a very crude version of this for experimenting into http://bazaar.launchpad.net/~snappy-dev/ubuntu-system-image/ppa-upload/revision/305

Its essentially:
<thing>:json_data

Right now:
ERROR:json.dumps(error_string)
PROGRESS:json.dumps({"now": now, "total":total})
SPINNER:{}

Its this strange mix between "string:json_data" because of idiosyncrasies in the golang json parser, it likes to know a struct that it can unpack the json into (and because the payload of the types is different golang is a bit unhappy). This is not the final format, I think I will just fight the json parser a bit more (and unpack only the type and then unpack into the right type). But I wanted something to experiment with in the image. Happy to hear your opinions too, does not have to be json, but my initial "type:string" is too simple as errors are multi-line of course.

Barry Warsaw (barry) wrote :

Outputing JSON records seems reasonable. Maybe the switch name should reflect that, something like --json-progress or --progress=json. I'm not sure I really like the mix of type:string though, so keep fighting! :) Putting out something like straight up JSON seems fairly future proof, but then we'd probably also have to define the structure of the JSON so that we're careful not to break it in the future (e.g. only add keys, with a deprecation phase for old keys). Very similar (if informal) policy to the .Information() dictionary.

Changed in ubuntu-system-image:
milestone: none → 3.1
Michael Vogt (mvo) wrote :

Yeah, I agree --progress=json and proper json is it then.

Michael Vogt (mvo) wrote :

A better version of this has landed in the PPA now: http://bazaar.launchpad.net/~snappy-dev/ubuntu-system-image/ppa-upload/revision/308 which is proper json.

Barry Warsaw (barry) on 2015-02-26
Changed in ubuntu-system-image:
milestone: 3.1 → 3.0
Barry Warsaw (barry) on 2015-03-04
Changed in ubuntu-system-image:
assignee: nobody → Barry Warsaw (barry)
importance: Undecided → High
status: Triaged → In Progress
Barry Warsaw (barry) on 2015-03-04
Changed in ubuntu-system-image:
status: In Progress → Fix Committed
Barry Warsaw (barry) on 2015-05-08
Changed in ubuntu-system-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers