efa325b56fa544701ca0ea001ab82b6f6e6e8001
4 1. Creates a model on the current controller
5 2. Deploys a charm to it.
6 3. Attempts to ssh into the charm
10 from juju
import utils
11 from juju
.controller
import Controller
13 from logging
import getLogger
15 LOG
= getLogger(__name__
)
19 controller
= Controller()
20 print("Connecting to controller")
21 await controller
.connect_current()
25 model
= await controller
.add_model(model_name
)
27 print('Deploying ubuntu')
28 application
= await model
.deploy(
30 application_name
='ubuntu',
35 print('Waiting for active')
36 await asyncio
.sleep(10)
37 await model
.block_until(
38 lambda: all(unit
.workload_status
== 'active'
39 for unit
in application
.units
))
41 print("Verifying that we can ssh into the created model")
42 ret
= await utils
.execute_process(
43 'juju', 'ssh', '-m', model_name
, 'ubuntu/0', 'ls /', log
=LOG
)
46 print('Removing ubuntu')
47 await application
.remove()
49 print("Destroying model")
50 await controller
.destroy_model(model
.info
.uuid
)
53 print('Disconnecting from controller')
54 await model
.disconnect()
55 await controller
.disconnect()