blob: b61a6f6d19d6a49df8a0c1886c38bf8d22d7b83a [file] [log] [blame]
israelade2051cc2019-11-21 16:46:28 +01001"""
2This example:
3
41. Connects to current controller.
52. Creates a new model.
63. Deploys an application on the new model.
74. Disconnects from the model
85. Destroys the model
9
10"""
11import logging
12
13from juju.controller import Controller
14from juju import loop
15
16
17async def main():
18 controller = Controller()
19 # connect to current controller with current user, per Juju CLI
20 await controller.connect()
21 model = await controller.add_model(
22 'my-test-model',
23 'aws',
24 'aws-tim',
25 )
26 await model.deploy(
27 'ubuntu-0',
28 application_name='ubuntu',
29 series='trusty',
30 channel='stable',
31 )
32 await model.disconnect()
33 await controller.destroy_model(model.info.uuid)
34 await controller.disconnect()
35
36
37if __name__ == '__main__':
38 logging.basicConfig(level=logging.DEBUG)
39 ws_logger = logging.getLogger('websockets.protocol')
40 ws_logger.setLevel(logging.INFO)
41 loop.run(main())