Merge pull request #59 from juju/issues/58
[osm/N2VC.git] / juju / utils.py
index b9a9b67..c3d7f23 100644 (file)
@@ -24,10 +24,10 @@ async def execute_process(*cmd, log=None):
     return p.returncode == 0
 
 
-def read_ssh_key():
+def _read_ssh_key():
     '''
-    Attempt to read the local juju admin's public ssh key, so that it
-    can be passed on to a model.
+    Inner function for read_ssh_key, suitable for passing to our
+    Executor.
 
     '''
     default_data_dir = Path(Path.home(), ".local", "share", "juju")
@@ -37,3 +37,11 @@ def read_ssh_key():
         ssh_key = ssh_key_file.readlines()[0].strip()
     return ssh_key
 
+
+async def read_ssh_key(loop):
+    '''
+    Attempt to read the local juju admin's public ssh key, so that it
+    can be passed on to a model.
+
+    '''
+    return await loop.run_in_executor(None, _read_ssh_key)