Add Model.connect() for connecting to arbitrary endpoint
authorTim Van Steenburgh <tvansteenburgh@gmail.com>
Thu, 17 Nov 2016 14:56:01 +0000 (09:56 -0500)
committerTim Van Steenburgh <tvansteenburgh@gmail.com>
Thu, 17 Nov 2016 14:56:01 +0000 (09:56 -0500)
juju/model.py

index db65b7d..5ca7422 100644 (file)
@@ -349,6 +349,16 @@ class Model(object):
         self._watch_received = asyncio.Event(loop=loop)
         self._charmstore = CharmStore(self.loop)
 
+    async def connect(self, *args, **kw):
+        """Connect to an arbitrary Juju model.
+
+        args and kw are passed through to Connection.connect()
+
+        """
+        self.connection = await connection.Connection.connect(*args, **kw)
+        self._watch()
+        await self._watch_received.wait()
+
     async def connect_current(self):
         """Connect to the current Juju model.