projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
v0.1.0
[osm/N2VC.git]
/
examples
/
relate.py
diff --git
a/examples/relate.py
b/examples/relate.py
index
241d1a6
..
01cee37
100644
(file)
--- a/
examples/relate.py
+++ b/
examples/relate.py
@@
-48,7
+48,7
@@
async def run():
ubuntu_app = await model.deploy(
'ubuntu',
ubuntu_app = await model.deploy(
'ubuntu',
-
service
_name='ubuntu',
+
application
_name='ubuntu',
series='trusty',
channel='stable',
)
series='trusty',
channel='stable',
)
@@
-68,12
+68,17
@@
async def run():
lambda delta, old_unit, new_unit, model:
print('Unit removed: {}'.format(old_unit.entity_id))
))
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',
await model.deploy(
'nrpe',
-
service
_name='nrpe',
+
application
_name='nrpe',
series='trusty',
channel='stable',
series='trusty',
channel='stable',
- num_units=
0
,
+ num_units=
1
,
)
my_relation = await model.add_relation(
'ubuntu',
)
my_relation = await model.add_relation(
'ubuntu',
@@
-88,6
+93,6
@@
logging.basicConfig(level=logging.DEBUG)
ws_logger = logging.getLogger('websockets.protocol')
ws_logger.setLevel(logging.INFO)
loop = asyncio.get_event_loop()
ws_logger = logging.getLogger('websockets.protocol')
ws_logger.setLevel(logging.INFO)
loop = asyncio.get_event_loop()
-loop.set_debug(
Fals
e)
+loop.set_debug(
Tru
e)
loop.create_task(run())
loop.run_forever()
loop.create_task(run())
loop.run_forever()