2 This example shows how to deploy a local charm. It:
4 1. Connects to current model.
5 2. Uploads a local charm (directory on filesystem) to the model.
6 3. Deploys the uploaded charm.
12 from juju
.model
import Model
17 await model
.connect_current()
19 # Upload local charm to the model.
20 # The returned 'local:' url can be used to deploy the charm.
21 charm_url
= await model
.add_local_charm_dir(
22 '/home/tvansteenburgh/src/charms/ubuntu', 'trusty')
24 # Deploy the charm using the 'local:' charm.
27 application_name
='ubuntu',
30 await model
.disconnect()
34 logging
.basicConfig(level
=logging
.DEBUG
)
35 ws_logger
= logging
.getLogger('websockets.protocol')
36 ws_logger
.setLevel(logging
.INFO
)
37 loop
= asyncio
.get_event_loop()
39 loop
.create_task(run())