4 1. Connects to the current model
6 3. Deploys a charm and prints its config and constraints
11 from juju
.model
import Model
14 log
= logging
.getLogger(__name__
)
21 # connect to current model with current user, per Juju CLI
24 ubuntu_app
= await model
.deploy(
26 application_name
='mysql',
30 'tuning-level': 'safest',
37 # update and check app config
38 await ubuntu_app
.set_config({'tuning-level': 'fast'})
39 config
= await ubuntu_app
.get_config()
40 assert(config
['tuning-level']['value'] == 'fast')
42 # update and check app constraints
43 await ubuntu_app
.set_constraints({'mem': 512 * MB
})
44 constraints
= await ubuntu_app
.get_constraints()
45 assert(constraints
['mem'] == 512 * MB
)
47 await model
.disconnect()
50 if __name__
== '__main__':
51 logging
.basicConfig(level
=logging
.DEBUG
)
52 ws_logger
= logging
.getLogger('websockets.protocol')
53 ws_logger
.setLevel(logging
.INFO
)