X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Fplugins%2Frwpkgmgr%2Frift%2Ftasklets%2Frwpkgmgr%2Fsubscriber%2Fdownload_status.py;h=b4acb5f5523760e5e81f0bc4921be79091f9e53f;hb=refs%2Fchanges%2F87%2F1287%2F1;hp=8fd041ecac9b3730226ab852e1fd531b3ec26895;hpb=a35d1e79b39ecc0475e39a2920fdcddab18c3b6b;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwpkgmgr/rift/tasklets/rwpkgmgr/subscriber/download_status.py b/rwlaunchpad/plugins/rwpkgmgr/rift/tasklets/rwpkgmgr/subscriber/download_status.py index 8fd041ec..b4acb5f5 100644 --- a/rwlaunchpad/plugins/rwpkgmgr/rift/tasklets/rwpkgmgr/subscriber/download_status.py +++ b/rwlaunchpad/plugins/rwpkgmgr/rift/tasklets/rwpkgmgr/subscriber/download_status.py @@ -57,9 +57,9 @@ class VnfdStatusSubscriber(DownloadStatusSubscriber): self.log.debug(log_msg) if action == RwDts.QueryAction.UPDATE: actionCreate(self, msg) - - elif action == RwDts.QueryAction.DELETE: - actionDelete(self, msg) + else: + self.log.debug("VnfdStatusSubscriber: No action for ", action) + pass def get_xpath(self): return self.subscriber.get_xpath() @@ -79,9 +79,9 @@ class NsdStatusSubscriber(DownloadStatusSubscriber): self.log.debug(log_msg) if action == RwDts.QueryAction.UPDATE: actionCreate(self, msg) - - elif action == RwDts.QueryAction.DELETE: - actionDelete(self, msg) + else: + self.log.debug("NsdStatusSubscriber: No action for ", action) + pass def get_xpath(self): return self.subscriber.get_xpath() @@ -92,8 +92,9 @@ def actionCreate(descriptor, msg): Serialize the Vnfd/Nsd object to yaml and store yaml file in the created folder. ''' - download_dir = os.path.join(descriptor.DOWNLOAD_DIR, msg.id, msg.name) - + desc_name = msg.name if msg.name else "" + download_dir = os.path.join(descriptor.DOWNLOAD_DIR, msg.id, desc_name) + if not os.path.exists(download_dir): os.makedirs(download_dir) descriptor.log.debug("Created directory {}".format(download_dir)) @@ -105,12 +106,3 @@ def actionCreate(descriptor, msg): with open(yaml_path,"w") as fh: fh.write(msg.to_yaml(model)) -def actionDelete(descriptor, msg): - ''' Delete folder structure created above. - ''' - - download_dir = os.path.join(descriptor.DOWNLOAD_DIR, msg.id) - if os.path.exists(download_dir): - descriptor.log.debug("Removing directory {}".format(download_dir)) - shutil.rmtree(download_dir) -