blob: 3f029ab4d21ac9851aa8fb582eb7871727c1eedc [file] [log] [blame]
Adam Israeldcdf82b2017-08-15 15:26:43 -04001"""
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 asyncio
12import logging
13
14from juju.controller import Controller
15from juju import loop
16
17
18async def main():
19 controller = Controller()
Adam Israelc3e6c2e2018-03-01 09:31:50 -050020 await controller.connect()
Adam Israeldcdf82b2017-08-15 15:26:43 -040021 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())