From 4b1277ae2ddfd3660af64f474b8c60cfe79810e1 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Mon, 14 Mar 2022 14:35:18 -0600 Subject: [PATCH] console-conf: fix crash on network info 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 --- subiquity/server/controllers/network.py | 2 +- subiquitycore/controllers/network.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subiquity/server/controllers/network.py b/subiquity/server/controllers/network.py index 48c432e6..6a3d3196 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) diff --git a/subiquitycore/controllers/network.py b/subiquitycore/controllers/network.py index 5b85302d..7c8875bb 100644 --- a/subiquitycore/controllers/network.py +++ b/subiquitycore/controllers/network.py @@ -434,7 +434,7 @@ class BaseNetworkController(BaseController): self.update_link(dev) self.apply_config() - def get_info_for_netdev(self, dev_name: str) -> str: + async def get_info_for_netdev(self, dev_name: str) -> str: device = self.model.get_netdev_by_name(dev_name) if device.info is not None: return yaml.dump(