AttributeError: 'Report' object has no attribute 'add_tags'

Bug #2076233 reported by Olivier Gayot
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subiquity (Ubuntu)
In Progress
High
Olivier Gayot

Bug Description

When testing things on oracular, I ran into this exception after a late-commands failed:

ERROR: hook /usr/share/apport/general-hooks/ubuntu.py crashed
Traceback (most recent call last):
  File "/snap/subiquity/5988/usr/lib/python3/lib/python3/dist-packages/apport/report.py", line 228, in _run_hook
    symb['add_info'](report, ui)
  File "/usr/share/apport/general-hook/ubuntu.py", line 34, in add_info
    _add_release_info(report)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 472, in _add_release_info
    report.add_tags([release_codename])
AttributeError: 'Report' object has no attribute 'add_tags'.

This seems to happen because the Report class in core22 (/snap/subiquity/.../report.py) does not define an add_tags method ; but the hooks in oracular expect the method to exist.

This might not be limited to oracular ; and could be a thing in noble too?

Dan Bungert (dbungert)
tags: added: foundations-todo
Changed in subiquity:
status: New → Triaged
importance: Undecided → High
affects: subiquity → subiquity (Ubuntu)
Revision history for this message
Dan Bungert (dbungert) wrote (last edit ):

originally reproduced with late-command `snap run subiquity.curtin in-target --target /target -- apt -y install dracut`

Revision history for this message
Olivier Gayot (ogayot) wrote :

After investigating more (see below for details), I confirm that noble is _not_ currently affected. Only the development version of Subiquity (i.e., oracular) is.

When Subiquity creates a crash report, we expect apport to execute hooks from /snap/subiquity/current/usr/share/apport/general-hooks ; not /usr/share/apport/general-hooks/

Apport reads the APPORT_DATA_DIR variable to determine where to find the hooks and Subiquity sets it. However, the variable is read as soon as `import apport` is run ; whereas Subiquity sets the variable in the `setup_environment()` function.

On oracular, because of some refactoring (possibly to add some type hints), the `apport` module gets loaded _before_ the `setup_environment()` function gets called. Therefore, Apport sets the hooks directory as /usr/share/apport/general-hooks.

Here's a chunk that shows the difference between Oracular and Noble (run it with `make dryrun-server`).

https://paste.ubuntu.com/p/BWFqNwnRVr/

Changed in subiquity (Ubuntu):
assignee: nobody → Olivier Gayot (ogayot)
Revision history for this message
Olivier Gayot (ogayot) wrote :
Changed in subiquity (Ubuntu):
status: Triaged → In Progress
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.