Ommit public_key argument if None 48/8948/1
authorDominik Fleischmann <dominik.fleischmann@canonical.com>
Thu, 21 May 2020 11:55:19 +0000 (13:55 +0200)
committerDominik Fleischmann <dominik.fleischmann@canonical.com>
Thu, 21 May 2020 11:55:19 +0000 (13:55 +0200)
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>
n2vc/k8s_juju_conn.py

index 06ef7d9..1f9c896 100644 (file)
@@ -745,9 +745,12 @@ class K8sJujuConnector(K8sConnector):
             "Adding model '{}' to cluster_uuid '{}'".format(model_name, cluster_uuid)
         )
         try:
             "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))
         except Exception as ex:
             self.log.debug(ex)
             self.log.debug("Caught exception: {}".format(ex))