s/service_name/application_name/g
[osm/N2VC.git] / examples / relate.py
index 241d1a6..01cee37 100644 (file)
@@ -48,7 +48,7 @@ async def run():
 
     ubuntu_app = await model.deploy(
         'ubuntu',
-        service_name='ubuntu',
+        application_name='ubuntu',
         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))
     ))
+    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',
@@ -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()
-loop.set_debug(False)
+loop.set_debug(True)
 loop.create_task(run())
 loop.run_forever()