I tested this on 2.9 and it *seems* to be doing the right thing.
Making the WatchAllModels call, I got a watcher delta whenever any model config attribute was changed, including the "agent-version" attribute which is incremented when a model is upgraded.
I whipped up a small libjuju script to test with. Note, there appears to be a bug in libjuju where the watcher id is not being properly set for the AllModelWatcherFacade facade, so the Next() call fails, so I had to monkey patch that (in juju/client/overrides.y). But nonetheless, the script showed that things were doing the right thing on the controller, ie
juju model-config foo-bar
on any model would fire the watcher. As would juju upgrade-model
I'll mark as Incomplete - if it's still an issue on juju 2.9, we can reopen.
#!/usr/bin/python3
import asyncio
import logging
from juju.client import client
from juju.model import Controller
I tested this on 2.9 and it *seems* to be doing the right thing.
Making the WatchAllModels call, I got a watcher delta whenever any model config attribute was changed, including the "agent-version" attribute which is incremented when a model is upgraded.
I whipped up a small libjuju script to test with. Note, there appears to be a bug in libjuju where the watcher id is not being properly set for the AllModelWatcher Facade facade, so the Next() call fails, so I had to monkey patch that (in juju/client/ overrides. y). But nonetheless, the script showed that things were doing the right thing on the controller, ie
juju model-config foo-bar
on any model would fire the watcher. As would juju upgrade-model
I'll mark as Incomplete - if it's still an issue on juju 2.9, we can reopen.
#!/usr/bin/python3
import asyncio
import logging
from juju.client import client
from juju.model import Controller
async def watch(): connect( )
controller = Controller()
await controller.
api = client. ControllerFacad e.from_ connection( controller. connection( )) AllModelWatcher Facade. from_connection (
controller. connection( )) els()
watcher = client.
result = await api.WatchAllMod
watcher.Id = result.watcher_id
while True:
print( "-- change --\n{}\ n".format( delta))
change = await watcher.Next()
for delta in change.deltas:
if __name__ == '__main__': basicConfig( level=logging. INFO) getLogger( 'websockets. protocol' ) logger. setLevel( logging. INFO) run(watch( ))
logging.
ws_logger = logging.
ws_
asyncio.