X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Fplugins%2Frwstagingmgr%2Frift%2Ftasklets%2Frwstagingmgr%2Fstore%2Ffile_store.py;h=5280fe1ca5969dc08935653b48b1cf7df9cd8787;hb=ba63fbf8a4f63b9525041a1f93fd2b6458e37933;hp=8acefe1851ddca6d22ca9de4b70fcebd6c02a8ff;hpb=1426e5b05708a920168596498000304c6bc3cd49;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/store/file_store.py b/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/store/file_store.py index 8acefe18..5280fe1c 100644 --- a/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/store/file_store.py +++ b/rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/store/file_store.py @@ -33,6 +33,7 @@ import gi gi.require_version("RwStagingMgmtYang", "1.0") from gi.repository import RwStagingMgmtYang import rift.mano.dts as mano_dts +from rift.mano.utils.project import DEFAULT_PROJECT from .. import model from ..protocol import StagingStorePublisherProtocol @@ -82,9 +83,12 @@ class StagingFileStore(StagingStorePublisherProtocol): return self._cache[area_id] - def get_delegate(self, msg): + def get_delegate(self, project_name): + if not project_name: + project_name = DEFAULT_PROJECT + try: - proj = self.tasklet.projects[msg.project_name] + proj = self.tasklet.projects[project_name] except Exception as e: err = "Project or project name not found {}: {}". \ format(msg.as_dict(), e) @@ -104,7 +108,7 @@ class StagingFileStore(StagingStorePublisherProtocol): Raises: StagingAreaExists: if the staging area already exists """ - delegate = self.get_delegate(staging_area_config) + delegate = self.get_delegate(staging_area_config.project_name) area_id = str(uuid.uuid4()) @@ -144,11 +148,11 @@ class StagingFileStore(StagingStorePublisherProtocol): staging_area (str or model.StagingArea): Staging ID or the StagingArea object """ - delegate = self.get_delegate(staging_area_config) - if type(staging_area) is str: staging_area = self.get_staging_area(staging_area) + delegate = self.get_delegate(staging_area.project_name) + if os.path.isdir(staging_area.model.path): shutil.rmtree(staging_area.model.path)