Skip to content
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

console-conf: fix crash on network info #1218

Merged
merged 1 commit into from Mar 14, 2022

Conversation

dbungert
Copy link
Collaborator

If you run dryrun for console-conf, go to the network page, go to an
interface, then info, a crash of the form
TypeError: object str can't be used in 'await' expression
can be seen. The signature for the core version of get_info_for_netdev
is not async, but a non-async method returning str.

So skip the loading dialog, which wants the awaitable.

Copy link
Collaborator

@mwhudson mwhudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks info in the subiquity case though (it's the same view in both apps). I think the core get_info_for_netdev needs to be made async.

Copy link
Collaborator

@mwhudson mwhudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we need this as well:

diff --git a/subiquity/server/controllers/network.py b/subiquity/server/controllers/network.py
index 48c432e6c..6a3d3196c 100644
--- a/subiquity/server/controllers/network.py
+++ b/subiquity/server/controllers/network.py
@@ -405,4 +405,4 @@ class NetworkController(BaseNetworkController, SubiquityController):
         self.delete_link(dev_name)
 
     async def info_GET(self, dev_name: str) -> str:
-        return self.get_info_for_netdev(dev_name)
+        return await self.get_info_for_netdev(dev_name)

If you run dryrun for console-conf, go to the network page, go to an
interface, then info, a crash of the form
TypeError: object str can't be used in 'await' expression
can be seen. The signature for the core version of get_info_for_netdev
is not async, but a non-async method returning str.

So mark the core version of the function async.

Co-authored-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
@dbungert dbungert merged commit 7fc30e8 into canonical:main Mar 14, 2022
@dbungert dbungert deleted the console-conf-await-str branch March 14, 2022 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants