-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
network: fix crash upon accessing Help menu after creating a bond #1786
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm finding bugs in code I wrote in like 2017, rude!
Would this be better fixed in the device object, like the various _address properties should be empty in this case?
Yes, I imagine it would be a better fix for it. Actually, I am trying to debug this code (because of another crash occurring when an interface is removed) and the When creating a dev = NetworkDev(...)
dev.info = dev.netdev_info() # <-- This will crash for some types of interfaces (e.g., "eth", "wlan")
EDIT I looked more into it and figured I don't think it makes sense to manually create a |
a24dfd1
to
5fd2620
Compare
When accessing the Help menu, Subiquity looks up the IP addresses currently configured - so it knows whether to show the "Help on SSH access" option. Unfortunately, it also looks for IP addresses on devices that were "configured" through the network screen but that still do not exist in the system. When such a device exist (e.g., a bond), the Subiquity client crashes with the following exception: Traceback (most recent call last): File "subiquity/common/api/server.py", line 164, in handler result = await implementation(**args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "subiquity/server/server.py", line 117, in ssh_info_GET ips.extend(map(str, dev.actual_global_ip_addresses)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "subiquitycore/models/network.py", line 394, in actual_global_ip_addresses for _, addr in sorted(self.info.addresses.items()) ^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'addresses' A similar crash is observed when calling /network/global_addresses after creating the bond. Fixed by only checking the IP addresses of devices that have a probert.network.Link instance (i.e., they exist in the system). Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
5fd2620
to
221466a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, self.info is None for devices that exist in the UI but not yet on the system (or at least that's the idea -- like I said this is very old code!)
Steps to reproduce (works in dry-run mode too):
LP: #2039086