If deploying a single app, return the App instead of a list
[osm/N2VC.git] / examples / relate.py
index 241d1a6..aeb320d 100644 (file)
@@ -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',
         series='trusty',
         channel='stable',
-        num_units=0,
+        num_units=1,
     )
     my_relation = await model.add_relation(
         'ubuntu',