Please provide machine parsable output
| 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>
with status=
Related branches
- Ubuntu System Image team: Pending requested 2015-02-27
-
Diff: 73 lines (+17/-2)3 files modifiedsystemimage/config.py (+2/-0)
systemimage/download.py (+6/-1)
systemimage/main.py (+9/-1)
- Michael Vogt: Pending requested 2015-03-04
-
Diff: 369 lines (+201/-34)6 files modifiedsystemimage/api.py (+5/-2)
systemimage/curl.py (+3/-1)
systemimage/download.py (+9/-5)
systemimage/main.py (+54/-24)
systemimage/tests/test_main.py (+127/-1)
systemimage/udm.py (+3/-1)
- Ubuntu CI managed package branches: Pending requested 2015-05-20
-
Diff: 15774 lines (+8086/-2651)138 files modifiedMANIFEST.in (+1/-1)
NEWS.rst (+72/-1)
PKG-INFO (+1/-1)
cli-manpage.rst (+31/-18)
coverage-curl.ini (+21/-0)
coverage-udm.ini (+21/-0)
coverage.ini (+0/-15)
dbus-manpage.rst (+50/-28)
debian/changelog (+77/-0)
debian/control (+3/-2)
debian/rules (+15/-10)
debian/tests/control (+7/-7)
debian/tests/dryrun (+1/-1)
debian/tests/prep.py (+9/-2)
debian/tests/smoketest (+2/-2)
debian/tests/smoketest-noreboot (+2/-2)
debian/tests/unittests (+1/-1)
ini-manpage.rst (+33/-30)
setup.cfg (+1/-1)
setup.py (+1/-1)
system_image.egg-info/PKG-INFO (+1/-1)
system_image.egg-info/SOURCES.txt (+105/-59)
systemimage/api.py (+20/-10)
systemimage/apply.py (+32/-9)
systemimage/bag.py (+7/-1)
systemimage/candidates.py (+1/-1)
systemimage/channel.py (+1/-1)
systemimage/config.py (+174/-108)
systemimage/curl.py (+275/-0)
systemimage/data/client.ini (+0/-35)
systemimage/dbus.py (+100/-95)
systemimage/device.py (+1/-1)
systemimage/docs/conf.py (+1/-1)
systemimage/download.py (+119/-208)
systemimage/gpg.py (+6/-1)
systemimage/helpers.py (+53/-43)
systemimage/image.py (+5/-1)
systemimage/index.py (+2/-5)
systemimage/keyring.py (+5/-5)
systemimage/logging.py (+4/-2)
systemimage/main.py (+117/-47)
systemimage/reactor.py (+7/-4)
systemimage/scores.py (+32/-15)
systemimage/service.py (+15/-18)
systemimage/settings.py (+1/-1)
systemimage/state.py (+32/-23)
systemimage/testing/controller.py (+95/-45)
systemimage/testing/dbus.py (+22/-10)
systemimage/testing/demo.py (+6/-6)
systemimage/testing/helpers.py (+174/-62)
systemimage/testing/nose.py (+7/-2)
systemimage/testing/service.py (+0/-50)
systemimage/tests/data/00.ini (+1/-2)
systemimage/tests/data/01.ini (+2/-3)
systemimage/tests/data/api.channels_01.json (+13/-0)
systemimage/tests/data/api.index_01.json (+36/-0)
systemimage/tests/data/api.index_02.json (+251/-0)
systemimage/tests/data/api.index_03.json (+37/-0)
systemimage/tests/data/candidates.index_01.json (+6/-0)
systemimage/tests/data/candidates.index_02.json (+23/-0)
systemimage/tests/data/candidates.index_08.json (+244/-0)
systemimage/tests/data/candidates.index_10.json (+36/-0)
systemimage/tests/data/candidates.index_11.json (+37/-0)
systemimage/tests/data/candidates.index_13.json (+244/-0)
systemimage/tests/data/channel.channels_01.json (+23/-0)
systemimage/tests/data/channel.channels_02.json (+38/-0)
systemimage/tests/data/channel.channels_03.json (+70/-0)
systemimage/tests/data/channel.channels_04.json (+56/-0)
systemimage/tests/data/channel.channels_05.json (+23/-0)
systemimage/tests/data/channel_06.ini (+0/-8)
systemimage/tests/data/channel_07.ini (+0/-8)
systemimage/tests/data/config.config_01.ini (+34/-0)
systemimage/tests/data/config.config_02.ini (+34/-0)
systemimage/tests/data/config.config_03.ini (+3/-4)
systemimage/tests/data/config.config_04.ini (+36/-0)
systemimage/tests/data/config.config_05.ini (+3/-4)
systemimage/tests/data/config.config_06.ini (+3/-4)
systemimage/tests/data/config.config_07.ini (+1/-2)
systemimage/tests/data/config.config_08.ini (+1/-2)
systemimage/tests/data/config.config_09.ini (+0/-3)
systemimage/tests/data/config.config_10.ini (+27/-0)
systemimage/tests/data/config.config_11.ini (+2/-0)
systemimage/tests/data/config_04.ini (+0/-36)
systemimage/tests/data/config_09.ini (+0/-27)
systemimage/tests/data/config_10.ini (+0/-35)
systemimage/tests/data/dbus.index_03.json (+36/-0)
systemimage/tests/data/dbus.index_06.json (+37/-0)
systemimage/tests/data/download.index_01.json (+6/-0)
systemimage/tests/data/gpg.channels_01.json (+23/-0)
systemimage/tests/data/helpers.config_01.ini (+7/-0)
systemimage/tests/data/helpers.config_02.ini (+6/-0)
systemimage/tests/data/index.channels_01.json (+9/-0)
systemimage/tests/data/index.channels_02.json (+13/-0)
systemimage/tests/data/index.channels_05.json (+9/-0)
systemimage/tests/data/index.index_01.json (+251/-0)
systemimage/tests/data/index.index_04.json (+244/-0)
systemimage/tests/data/main.channels_01.json (+13/-0)
systemimage/tests/data/main.channels_03.json (+13/-0)
systemimage/tests/data/main.config_01.ini (+5/-6)
systemimage/tests/data/main.config_05.ini (+7/-0)
systemimage/tests/data/main.config_07.ini (+1/-1)
systemimage/tests/data/main.index_04.json (+36/-0)
systemimage/tests/data/main.index_05.json (+36/-0)
systemimage/tests/data/scores.index_01.json (+245/-0)
systemimage/tests/data/scores.index_05.json (+245/-0)
systemimage/tests/data/scores.index_06.json (+253/-0)
systemimage/tests/data/scores.index_07.json (+252/-0)
systemimage/tests/data/state.channels_01.json (+64/-0)
systemimage/tests/data/state.channels_02.json (+13/-0)
systemimage/tests/data/state.config_01.ini (+2/-0)
systemimage/tests/data/state.config_02.ini (+6/-0)
systemimage/tests/data/state.index_01.json (+244/-0)
systemimage/tests/data/state.index_02.json (+245/-0)
systemimage/tests/data/state.index_03.json (+36/-0)
systemimage/tests/data/state.index_04.json (+37/-0)
systemimage/tests/data/state.index_07.json (+2/-3)
systemimage/tests/test_api.py (+71/-93)
systemimage/tests/test_bag.py (+1/-1)
systemimage/tests/test_candidates.py (+37/-45)
systemimage/tests/test_channel.py (+19/-19)
systemimage/tests/test_config.py (+202/-178)
systemimage/tests/test_dbus.py (+365/-167)
systemimage/tests/test_download.py (+229/-115)
systemimage/tests/test_gpg.py (+129/-19)
systemimage/tests/test_helpers.py (+183/-171)
systemimage/tests/test_image.py (+1/-1)
systemimage/tests/test_index.py (+32/-68)
systemimage/tests/test_keyring.py (+1/-1)
systemimage/tests/test_main.py (+725/-432)
systemimage/tests/test_scores.py (+127/-15)
systemimage/tests/test_settings.py (+4/-6)
systemimage/tests/test_state.py (+244/-142)
systemimage/tests/test_winner.py (+23/-19)
systemimage/udm.py (+212/-0)
systemimage/version.txt (+1/-1)
tools/demo.ini (+0/-1)
tools/runme.sh (+10/-0)
tox.ini (+21/-16)
| tags: | added: mailman3 |
| tags: |
added: client removed: mailman3 |
| Changed in ubuntu-system-image: | |
| status: | New → Triaged |
| Michael Vogt (mvo) wrote : | #1 |
| Barry Warsaw (barry) wrote : | #2 |
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 : | #3 |
Yeah, I agree --progress=json and proper json is it then.
| Michael Vogt (mvo) wrote : | #4 |
A better version of this has landed in the PPA now: http://
| Changed in ubuntu-system-image: | |
| milestone: | 3.1 → 3.0 |
| Changed in ubuntu-system-image: | |
| assignee: | nobody → Barry Warsaw (barry) |
| importance: | Undecided → High |
| status: | Triaged → In Progress |
| Changed in ubuntu-system-image: | |
| status: | In Progress → Fix Committed |
| Changed in ubuntu-system-image: | |
| status: | Fix Committed → Fix Released |

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: dumps(error_ string) json.dumps( {"now": now, "total":total})
ERROR:json.
PROGRESS:
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.