X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fcontroller.py;h=113325e902225b02d807fb09426d088c051e04ad;hb=e2a3f01e7bb983ac3cd8eb24117e0d4208b40cc9;hp=cf7c2ce781fce7eb50b6138a2260b7166278ae1b;hpb=761ff6c67d071f499e947d59dcbbe1c0348481ef;p=osm%2FN2VC.git diff --git a/juju/controller.py b/juju/controller.py index cf7c2ce..113325e 100644 --- a/juju/controller.py +++ b/juju/controller.py @@ -2,6 +2,7 @@ import asyncio import logging from . import tag +from . import utils from .client import client from .client import connection from .client import watcher @@ -98,6 +99,19 @@ class Controller(object): region, ) + # Add our ssh key to the model, to work around + # https://bugs.launchpad.net/juju/+bug/1643076 + try: + ssh_key = await utils.read_ssh_key(loop=self.loop) + await utils.execute_process( + 'juju', 'add-ssh-key', '-m', model_name, ssh_key, log=log) + except Exception as e: + 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 " + "may fix this problem.") + model = Model() await model.connect( self.connection.endpoint,