Modified Jenkinsfile to disable TEST_INSTALL in branch feature7928
[osm/N2VC.git] / modules / libjuju / examples / future.py
1 """
2 This example doesn't work - it demonstrates features that don't exist yet.
3
4 """
5 import logging
6
7 from juju.model import Model
8 from juju import loop
9
10
11 async def main():
12 model = Model()
13 # connect to current model with current user, per Juju CLI
14 await model.connect()
15
16 goal_state = Model.from_yaml('bundle-like-thing')
17 ubuntu_app = await model.deploy(
18 'ubuntu-0',
19 application_name='ubuntu',
20 series='trusty',
21 channel='stable',
22 )
23 ubuntu_app.on_unit_added(callback=lambda unit: True)
24
25 await model.deploy(
26 'nrpe-11',
27 application_name='nrpe',
28 series='trusty',
29 channel='stable',
30 num_units=0,
31 )
32 await model.add_relation(
33 'ubuntu',
34 'nrpe',
35 )
36
37 result, ok = await model.block_until(
38 lambda: model.matches(goal_state),
39 timeout=600
40 )
41
42
43 if __name__ == '__main__':
44 logging.basicConfig(level=logging.DEBUG)
45 ws_logger = logging.getLogger('websockets.protocol')
46 ws_logger.setLevel(logging.INFO)
47 loop.run(main())