Add credential_name in Libjuju.add_model() function 54/9854/1
authorDavid Garcia <david.garcia@canonical.com>
Fri, 16 Oct 2020 12:37:37 +0000 (14:37 +0200)
committerDavid Garcia <david.garcia@canonical.com>
Fri, 16 Oct 2020 12:37:37 +0000 (14:37 +0200)
Change-Id: Ic3ca0fce931de4b9f7d200e99feb604f21c1ab83
Signed-off-by: David Garcia <david.garcia@canonical.com>
n2vc/libjuju.py

index d2c725f..0fa42f8 100644 (file)
@@ -160,12 +160,14 @@ class Libjuju:
         """
         await controller.disconnect()
 
-    async def add_model(self, model_name: str, cloud_name: str):
+    async def add_model(self, model_name: str, cloud_name: str, credential_name=None):
         """
         Create model
 
         :param: model_name: Model name
         :param: cloud_name: Cloud name
+        :param: credential_name: Credential name to use for adding the model
+                                 If not specified, same name as the cloud will be used.
         """
 
         # Get controller
@@ -193,7 +195,7 @@ class Libjuju:
                     model_name,
                     config=self.model_config,
                     cloud_name=cloud_name,
-                    credential_name=cloud_name,
+                    credential_name=credential_name or cloud_name,
                 )
                 self.models.add(model_name)
         finally: