AttributeError: 'ContentBad' object has no attribute 'message'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-repository-cache (Juju Charms Collection) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This Traceback is being seen with the is-mojo-ci testing [1]:
2017-02-25 12:38:05 INFO juju-log Starting repository mirror verification.
2017-02-25 12:38:05 INFO juju-log Verifying distribution zesty-updates
2017-02-25 12:38:06 INFO juju-log Verifying distribution zesty-security
2017-02-25 12:38:07 INFO juju-log Verifying distribution zesty-proposed
2017-02-25 12:38:31 INFO juju-log Verifying distribution zesty-backports
2017-02-25 12:38:32 INFO juju-log Verifying distribution zesty
2017-02-25 12:38:38 INFO start Traceback (most recent call last):
2017-02-25 12:38:38 INFO start File "/var/lib/
2017-02-25 12:38:38 INFO start _verify_
2017-02-25 12:38:38 INFO start File "/var/lib/
2017-02-25 12:38:38 INFO start _verify_
2017-02-25 12:38:38 INFO start File "/var/lib/
2017-02-25 12:38:38 INFO start raise ContentBad(msg)
2017-02-25 12:38:38 INFO start ubuntu_
2017-02-25 12:38:38 INFO start
2017-02-25 12:38:38 INFO start During handling of the above exception, another exception occurred:
2017-02-25 12:38:38 INFO start
2017-02-25 12:38:38 INFO start Traceback (most recent call last):
2017-02-25 12:38:38 INFO start File "/var/lib/
2017-02-25 12:38:38 INFO start HOOKS.execute(
2017-02-25 12:38:38 INFO start File "/var/lib/
2017-02-25 12:38:38 INFO start self._hooks[
2017-02-25 12:38:38 INFO start File "/var/lib/
2017-02-25 12:38:38 INFO start LOG)
2017-02-25 12:38:38 INFO start File "/var/lib/
2017-02-25 12:38:38 INFO start log('Verification failed: %s' % excp.message)
2017-02-25 12:38:38 INFO start AttributeError: 'ContentBad' object has no attribute 'message'
2017-02-25 12:38:39 ERROR juju.worker.
The problem is due to trying to reference the 'message' attribute. The Exception base class 'message' attribute existed in python2, but does not in python3. And this code is being run with python3. This can be demonstrated by:
fginther@
class ContentBad(
'''Mirror content is inconsistent'''
pass
try:
print(
raise ContentBad('It\'s very bad, the absolute worse')
print(
except ContentBad as excp:
print('Content bad: {}'.format(
fginther@
Entering
Content bad: It's very bad, the absolute worse
fginther@
Entering
Traceback (most recent call last):
File "content-bad.py", line 9, in <module>
raise ContentBad('It\'s very bad, the absolute worse')
__main_
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "content-bad.py", line 12, in <module>
print('Content bad: {}'.format(
AttributeError: 'ContentBad' object has no attribute 'message'
The fix is to just drop the '.message' from the format 'excp'. I'll have an MP up shortly.
[1] https:/
Changed in ubuntu-repository-cache (Juju Charms Collection): | |
status: | New → Fix Committed |
status: | Fix Committed → Fix Released |