backtrace on attach: KeyError: 'effectiveTo'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-advantage-script |
Fix Released
|
Unknown
|
|||
ubuntu-advantage-tools (Ubuntu) |
Fix Released
|
High
|
Andreas Hasenack | ||
Disco |
Won't Fix
|
High
|
Andreas Hasenack | ||
Eoan |
Fix Released
|
High
|
Andreas Hasenack |
Bug Description
[Impact]
Due to a server-side change, an expected key is no longer being sent to the client during an attach operation. This causes the client to backtrace with a KeyError exception:
Traceback (most recent call last):
File "/usr/bin/ua", line 11, in
load_entry_
File "/usr/lib/
return args.action(args, cfg)
File "/usr/lib/
action_
File "/usr/lib/
contractInfo[
KeyError: 'effectiveTo'
The client should default to a "no expiration" value in this case. Upstream already handles this, but the fix is missing for disco and eoan.
[Test Case]
Run "sudo ua attach":
$ sudo ua attach
Email: <email address hidden>
Password:
Second-factor auth: nnnnnn
This machine is now attached to '<email address hidden>'.
Traceback (most recent call last):
File "/usr/bin/ua", line 11, in <module>
load_
File "/usr/lib/
return args.action(args, cfg)
File "/usr/lib/
action_
File "/usr/lib/
contract_
AttributeError: 'str' object has no attribute 'date'
With the fixed package, you should see "n/a" for the "Valid until" header and it should not crash:
Email: <email address hidden>
Password:
Second-factor auth: pppppp
This machine is now attached to '<email address hidden>'.
Account: <email address hidden>
Subscription: <email address hidden>
Valid until: n/a
Technical support level: not included
...
[Regression Potential]
The fix is just setting a "n/a" text value to the expiration date in the case one isn't provided, and that is exactly the expected outcome, and what the (already heavily modified) upstream code does.
No existing tests were affected by the change, which means it's not covered.
Finally, the UA offerings are currently not available for non-LTS releases, so there is nothing to regress here. A crash is a bad bug, though, so we do want to get it fixed.
[Other Info]
None at this time.
Related branches
- Andreas Hasenack: Disapprove
- Canonical Server Core Reviewers: Pending requested
-
Diff: 42 lines (+13/-3)2 files modifieddebian/changelog (+7/-0)
uaclient/cli.py (+6/-3)
- Andreas Hasenack: Disapprove
- Canonical Server Core Reviewers: Pending requested
-
Diff: 42 lines (+13/-3)2 files modifieddebian/changelog (+7/-0)
uaclient/cli.py (+6/-3)
Changed in ubuntu-advantage-tools (Ubuntu Disco): | |
status: | New → In Progress |
assignee: | nobody → Andreas Hasenack (ahasenack) |
importance: | Undecided → High |
description: | updated |
description: | updated |
Changed in ubuntu-advantage-script: | |
status: | Unknown → Fix Released |
Changed in ubuntu-advantage-tools (Ubuntu Disco): | |
status: | In Progress → Won't Fix |
This is fixed in eoan