4 1. Connects to the current model
6 3. Deploys a charm and prints its config and constraints
12 from juju
.model
import Model
14 log
= logging
.getLogger(__name__
)
20 await model
.connect_current()
21 await model
.reset(force
=True)
23 ubuntu_app
= await model
.deploy(
29 'tuning-level': 'safest',
36 # update and check app config
37 await ubuntu_app
.set_config({'tuning-level': 'fast'})
38 config
= await ubuntu_app
.get_config()
39 assert(config
['tuning-level']['value'] == 'fast')
41 # update and check app constraints
42 await ubuntu_app
.set_constraints({'mem': 512 * MB
})
43 constraints
= await ubuntu_app
.get_constraints()
44 assert(constraints
['mem'] == 512 * MB
)
46 await model
.disconnect()
49 logging
.basicConfig(level
=logging
.DEBUG
)
50 ws_logger
= logging
.getLogger('websockets.protocol')
51 ws_logger
.setLevel(logging
.INFO
)
52 loop
= asyncio
.get_event_loop()
54 loop
.create_task(run())