4 1. Connects to the current model
5 2. Watches the model and prints all changes
6 3. Runs forever (kill with Ctrl-C)
9 from juju
.model
import Model
13 async def on_model_change(delta
, old
, new
, model
):
14 print(delta
.entity
, delta
.type, delta
.data
)
20 async def watch_model():
22 # connect to current model with current user, per Juju CLI
25 model
.add_observer(on_model_change
)
28 if __name__
== '__main__':
29 # Run loop until the process is manually stopped (watch_model will loop
31 loop
.run(watch_model())