Comment 8 for bug 2058133

Revision history for this message
Nathan Teodosio (nteodosio) wrote : Re: update-manager applet does exit successfully

Giacomo or anyone else getting "Unexpected error(s) occurred." from 'ua security-status --format=json', can you please also attach the output of

  python3 -c 'import uaclient.api.u.pro.packages.updates.v1 as ua;print(ua.updates().updates)'

> The output of `pro security-status --format=json` and the internal error look correct, so I'm going to mark the ubuntu-advantage-tools bit as invalid.

I don't understand this bit. I wouldn't say that "Unexpected error(s) occurred." looks correct, quite on the contrary, so I'm reverting the task but please let me know if you disagree.

In any case, update-manager is also "to blame" insofar as it doesn't validate the output of that command and just directly tries to parse it as a JSON. For it, there are two possible ways forward:

1. If the output of the command is not a JSON, just skip all the Pro logic.
   Positive: Keep changes to a minimal for a backport to the LTS series.
   Negative: Buries the error and so we will not realize that the Pro logic was disabled, which is unintended behavior.
2. Use the API[1] as shown above.
   Positive: No exception is raised by the end point, and possibly it also gives the correct output even when the pro command would fail reported. This looks quite probable by the way, as from the log the command failed because of Livepatch, which update-manager has no interest in, but let's see if the affected users come back with that information.
   Negative: Changes are more encompassing as to see in [2].

[1] https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/references/api/#u-pro-packages-updates-v1
[2] https://code.launchpad.net/~nteodosio/update-manager/+git/update-manager/+merge/459172