4 1. Connects to the current model.
5 2. Prints out leadership status for all deployed units in the model.
6 3. Cleanly disconnects.
11 from juju
.model
import Model
14 async def report_leadership():
16 await model
.connect_current()
19 for app
in model
.applications
.values():
20 for unit
in app
.units
:
21 print("{}: {}".format(
22 unit
.name
, await unit
.is_leader_from_status()))
24 await model
.disconnect()
27 if __name__
== '__main__':
28 loop
.run(report_leadership())