Exceptions raised if UA_CONFIG_FILE is bad

Bug #2066920 reported by Nathan Teodosio
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-advantage-tools (Ubuntu)
In Progress
Undecided
Grant Orndorff

Bug Description

The documentation[1] says that current_news and updates() raise no exceptions, but:

--->
% UA_CONFIG_FILE=/ python3 -c "from uaclient.api.u.pro.packages.updates.v1 import updates; updates()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/uaclient/api/u/pro/packages/updates/v1.py", line 84, in updates
    return _updates(UAConfig())
                    ^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/uaclient/config.py", line 110, in __init__
    self.cfg, self.invalid_keys = parse_config(self.cfg_path)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/uaclient/config.py", line 627, in parse_config
    cfg.update(safe_load(system.load_file(config_path)))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/uaclient/system.py", line 516, in load_file
    with open(filename, "rb") as stream:
         ^^^^^^^^^^^^^^^^^^^^
<---

[1] https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/references/api/

Revision history for this message
Renan Rodrigo (renanrodrigo) wrote :

Hello Nathan, thanks for raising this issue.

tl;dr yes docs are wrong.

The thing it should express is that this endpoint raises no *specific* exceptions, but at any time unexpected exceptions may happen and will be raised as UbuntuProError instances.

There is ongoing work to update this on the docs as part of [1]. More specifically, there will be a message like [2] for all endpoints, which reflects the truth.

[1] https://github.com/canonical/ubuntu-pro-client/pull/3085

[2] https://github.com/canonical/ubuntu-pro-client/pull/3085/files#diff-e0d846a2fce3599317d4f913c5c9257ec46228952bfc3a16b8bb7e8074160a99R102-R109

Changed in ubuntu-advantage-tools (Ubuntu):
status: New → In Progress
assignee: nobody → Grant Orndorff (orndorffgrant)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.