X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rwlaunchpad%2Fplugins%2Frwlaunchpadtasklet%2Frift%2Fpackage%2Fpackage.py;h=dc31b68c1aedc22ab1075e3b0ebeae7d27b762d9;hb=7e9f843256dd78b06c882532ec5fb67e30c510d6;hp=3ce3500e032facf13e8e80dc19f12b74be1da193;hpb=df4e972f5e6581a85dd5a072ac4da8585b4c83e6;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/package.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/package.py index 3ce3500e..dc31b68c 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/package.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/package.py @@ -161,6 +161,16 @@ class DescriptorPackage(object): return self.descriptor_msg.id + @property + def descriptor_name(self): + """ The descriptor name of this descriptor in the system """ + if not self.descriptor_msg.has_field("name"): + msg = "Descriptor name not present" + self._log.error(msg) + raise PackageError(msg) + + return self.descriptor_msg.name + @classmethod def get_descriptor_patterns(cls): """ Returns a tuple of descriptor regex and Package Types """ @@ -342,9 +352,14 @@ class DescriptorPackage(object): try: # Copy the contents of the file to the correct path + # For folder creation (or nested folders), dest_file appears w/ trailing "/" like: dir1/ or dir1/dir2/ + # For regular file upload, dest_file appears as dir1/abc.txt dest_dir_path = os.path.dirname(dest_file) if not os.path.isdir(dest_dir_path): os.makedirs(dest_dir_path) + if not os.path.basename(dest_file): + self._log.debug("Created dir path, no filename to insert in {}, skipping..".format(dest_dir_path)) + return with open(dest_file, 'wb') as dst_hdl: with open(new_file, 'rb') as src_hdl: