New N2VC interface + updated libjuju
This commit introduces the Python3 N2VC module, which acts as a standard
interface to the VCA.
The goal of this is to provide a common way for modules to interface
with the VCA.
- Updated libjuju from 0.6.1 to 0.7.3
Signed-off-by: Adam Israel <adam.israel@canonical.com>
Change-Id: Ide70fb5ae5797eb6486de24653dc09a23f9c009e
diff --git a/modules/libjuju/docs/readme.rst b/modules/libjuju/docs/readme.rst
index ecfbc5a..886550d 100644
--- a/modules/libjuju/docs/readme.rst
+++ b/modules/libjuju/docs/readme.rst
@@ -46,10 +46,10 @@
.. code:: python
- #!/usr/bin/python3.5
+ #!/usr/bin/python3
- import asyncio
import logging
+ import sys
from juju import loop
from juju.model import Model
@@ -63,26 +63,28 @@
# Connect to the currently active Juju model
await model.connect_current()
- # Deploy a single unit of the ubuntu charm, using revision 0 from the
- # stable channel of the Charm Store.
- ubuntu_app = await model.deploy(
- 'ubuntu-0',
- application_name='ubuntu',
- series='xenial',
- channel='stable',
- )
+ try:
+ # Deploy a single unit of the ubuntu charm, using the latest revision
+ # from the stable channel of the Charm Store.
+ ubuntu_app = await model.deploy(
+ 'ubuntu',
+ application_name='ubuntu',
+ series='xenial',
+ channel='stable',
+ )
- # Disconnect from the api server and cleanup.
- model.disconnect()
+ if '--wait' in sys.argv:
+ # optionally block until the application is ready
+ await model.block_until(lambda: ubuntu_app.status == 'active')
+ finally:
+ # Disconnect from the api server and cleanup.
+ await model.disconnect()
def main():
- # Set logging level to debug so we can see verbose output from the
- # juju library.
- logging.basicConfig(level=logging.DEBUG)
+ logging.basicConfig(level=logging.INFO)
- # Quiet logging from the websocket library. If you want to see
- # everything sent over the wire, set this to DEBUG.
+ # If you want to see everything sent over the wire, set this to DEBUG.
ws_logger = logging.getLogger('websockets.protocol')
ws_logger.setLevel(logging.INFO)