From cdaa13be828af9cae8ec42818fc2f4353c4f20c2 Mon Sep 17 00:00:00 2001 From: Pete Vander Giessen Date: Fri, 27 Jan 2017 18:00:35 -0500 Subject: [PATCH] Moved execution of utils.read_ssh_key to a thread. It's a blocking operation, so into a thread it goes! --- juju/controller.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/juju/controller.py b/juju/controller.py index e3234f8..d64a2f7 100644 --- a/juju/controller.py +++ b/juju/controller.py @@ -1,4 +1,5 @@ import asyncio +import concurrent.futures import logging from . import tag @@ -102,11 +103,14 @@ class Controller(object): # Add our ssh key to the model, to work around # https://bugs.launchpad.net/juju/+bug/1643076 try: - ssh_key = utils.read_ssh_key() + ssh_key = await self.loop.run_in_executor( + concurrent.futures.ThreadPoolExecutor(), + utils.read_ssh_key + ) await utils.execute_process( 'juju', 'add-ssh-key', '-m', model_name, ssh_key, log=log) except Exception as e: - log.warning( + log.exception( "Could not add ssh key to model. You will not be able " "to ssh into machines in this model. " "Manually running `juju add-ssh-key ` in the cli " -- 2.17.1