From 9491ae856f097b909298e24538ff5837165ae3cb Mon Sep 17 00:00:00 2001 From: Dominik Fleischmann Date: Thu, 21 May 2020 13:55:19 +0200 Subject: [PATCH] Ommit public_key argument if None With newer Juju versions the authorized-keys argument is expected to not be None, therefore it now has to be ommited as an argument if thats the case. Change-Id: I0adeda2ce71df5505cfaaab98ec237611918d9e7 Signed-off-by: Dominik Fleischmann --- n2vc/k8s_juju_conn.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/n2vc/k8s_juju_conn.py b/n2vc/k8s_juju_conn.py index 06ef7d9..1f9c896 100644 --- a/n2vc/k8s_juju_conn.py +++ b/n2vc/k8s_juju_conn.py @@ -745,9 +745,12 @@ class K8sJujuConnector(K8sConnector): "Adding model '{}' to cluster_uuid '{}'".format(model_name, cluster_uuid) ) try: - model = await self.controller.add_model( - model_name, config={"authorized-keys": self.juju_public_key} - ) + if self.juju_public_key is not None: + model = await self.controller.add_model( + model_name, config={"authorized-keys": self.juju_public_key} + ) + else: + model = await self.controller.add_model(model_name) except Exception as ex: self.log.debug(ex) self.log.debug("Caught exception: {}".format(ex)) -- 2.25.1