From: Dominik Fleischmann Date: Thu, 21 May 2020 11:55:19 +0000 (+0200) Subject: Ommit public_key argument if None X-Git-Tag: release-v8.0-start~6 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=commitdiff_plain;h=refs%2Fchanges%2F47%2F9047%2F2 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 --- 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))