X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fclient%2Foverrides.py;h=e7e6d34143bac41c14c7cbeec69b9e1b356951d2;hb=054805953c7c8ed11ce341adf55bf6e19e589fbe;hp=2a6923b39517f0a8b9b30379fa1fd77091378b7f;hpb=6637bf37c99d012ccd51823501dd7325ba3d6840;p=osm%2FN2VC.git diff --git a/juju/client/overrides.py b/juju/client/overrides.py index 2a6923b..e7e6d34 100644 --- a/juju/client/overrides.py +++ b/juju/client/overrides.py @@ -1,14 +1,16 @@ from collections import namedtuple -from .facade import ReturnMapping, Type +from .facade import ReturnMapping, Type, TypeEncoder from .import _client + __all__ = [ 'Delta', ] __patches__ = [ 'ResourcesFacade', + 'AllWatcherFacade' ] @@ -80,3 +82,19 @@ class ResourcesFacade(Type): _params['resources'] = resources reply = await self.rpc(msg) return reply + +class AllWatcherFacade(Type): + """ + Patch rpc method of allwatcher to add in 'id' stuff. + + """ + async def rpc(self, msg): + if not hasattr(self, 'Id'): + client = _client.ClientFacade.from_connection(self.connection) + + result = await client.WatchAll() + self.Id = result.watcher_id + + msg['Id'] = self.Id + result = await self.connection.rpc(msg, encoder=TypeEncoder) + return result