X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Fplugins%2Frwstagingmgr%2Frift%2Ftasklets%2Frwstagingmgr%2Fpublisher%2Fstaging_status.py;h=a2ab8fcf41c0c64a97bcc69fecd2858d0cc266b2;hb=f314b4af9744068a7ed7a6a6314220c3aa857523;hp=82e2da571750172c01c7cb8d970a380a49f03ee1;hpb=6f1a3fe149e4a6b9803382cb299c902f4cf58ec9;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/publisher/staging_status.py b/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/publisher/staging_status.py index 82e2da57..a2ab8fcf 100644 --- a/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/publisher/staging_status.py +++ b/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/publisher/staging_status.py @@ -18,23 +18,26 @@ # import asyncio +import gi import uuid from gi.repository import (RwDts as rwdts) import rift.mano.dts as mano_dts import rift.tasklets +gi.require_version('RwKeyspec', '1.0') +from gi.repository.RwKeyspec import quoted_key from ..protocol import StagingStoreProtocol class StagingStorePublisher(mano_dts.DtsHandler, StagingStoreProtocol): - def __init__(self, log, dts, loop): - super().__init__(log, dts, loop) + def __init__(self, project): + super().__init__(project.log, project.dts, project.loop, project) self.delegate = None def xpath(self, area_id=None): - return ("D,/rw-staging-mgmt:staging-areas/rw-staging-mgmt:staging-area" + - ("[area-id='{}']".format(area_id) if area_id else "")) + return self.project.add_project("D,/rw-staging-mgmt:staging-areas/rw-staging-mgmt:staging-area" + + ("[area-id={}]".format(quoted_key(area_id)) if area_id else "")) @asyncio.coroutine def register(self): @@ -59,6 +62,12 @@ class StagingStorePublisher(mano_dts.DtsHandler, StagingStoreProtocol): assert self.reg is not None + def deregister(self): + self._log.debug("Project {}: de-register staging store handler". + format(self._project.name)) + if self.reg: + self.reg.deregister() + def on_staging_area_create(self, store): self.reg.update_element(self.xpath(store.area_id), store)