ubuntu_app = await model.deploy(
'ubuntu',
- service_name='ubuntu',
+ application_name='ubuntu',
series='trusty',
channel='stable',
)
lambda delta, old_unit, new_unit, model:
print('Unit removed: {}'.format(old_unit.entity_id))
))
+ unit_a, unit_b = await ubuntu_app.add_units(count=2)
+ unit_a.on_change(asyncio.coroutine(
+ lambda delta, old_unit, new_unit, model:
+ print('Unit changed: {}'.format(new_unit.entity_id))
+ ))
await model.deploy(
'nrpe',
- service_name='nrpe',
+ application_name='nrpe',
series='trusty',
channel='stable',
- num_units=0,
+ num_units=1,
)
my_relation = await model.add_relation(
'ubuntu',
ws_logger = logging.getLogger('websockets.protocol')
ws_logger.setLevel(logging.INFO)
loop = asyncio.get_event_loop()
-loop.set_debug(False)
+loop.set_debug(True)
loop.create_task(run())
loop.run_forever()