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 <dominik.fleischmann@canonical.com>
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 @@
"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))