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 <michael.hudson@canonical.com>
This commit is contained in:
Dan Bungert 2022-03-14 14:35:18 -06:00
parent 6f89bcb64c
commit 4b1277ae2d
2 changed files with 2 additions and 2 deletions

View File

@ -405,4 +405,4 @@ class NetworkController(BaseNetworkController, SubiquityController):
self.delete_link(dev_name) self.delete_link(dev_name)
async def info_GET(self, dev_name: str) -> str: 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)

View File

@ -434,7 +434,7 @@ class BaseNetworkController(BaseController):
self.update_link(dev) self.update_link(dev)
self.apply_config() 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) device = self.model.get_netdev_by_name(dev_name)
if device.info is not None: if device.info is not None:
return yaml.dump( return yaml.dump(