コード例 #1
0
 def _update_from_file(self, obj, file_name=None, create=False, **kwargs):
     """`create` parameter is not used in this implementation."""
     preserve_symlinks = kwargs.pop('preserve_symlinks', False)
     # FIXME: symlinks and the object store model may not play well together
     # these should be handled better, e.g. registering the symlink'd file
     # as an object
     if create:
         self._create(obj, **kwargs)
     if file_name and self._exists(obj, **kwargs):
         try:
             if preserve_symlinks and os.path.islink(file_name):
                 force_symlink(os.readlink(file_name),
                               self._get_filename(obj, **kwargs))
             else:
                 path = self._get_filename(obj, **kwargs)
                 shutil.copy(file_name, path)
                 umask_fix_perms(path, self.config.umask, 0o666)
         except shutil.SameFileError:
             # That's ok, we need to ignore this so that remote object stores can update
             # the remote object from the cache file path
             pass
         except OSError as ex:
             log.critical(
                 f'Error copying {file_name} to {self.__get_filename(obj, **kwargs)}: {ex}'
             )
             raise ex
コード例 #2
0
ファイル: __init__.py プロジェクト: ValentinaPeona/galaxy
 def update_from_file(self, obj, file_name=None, create=False, **kwargs):
     """ `create` parameter is not used in this implementation """
     preserve_symlinks = kwargs.pop( 'preserve_symlinks', False )
     # FIXME: symlinks and the object store model may not play well together
     # these should be handled better, e.g. registering the symlink'd file as an object
     if create:
         self.create(obj, **kwargs)
     if file_name and self.exists(obj, **kwargs):
         try:
             if preserve_symlinks and os.path.islink( file_name ):
                 force_symlink( os.readlink( file_name ), self.get_filename( obj, **kwargs ) )
             else:
                 shutil.copy( file_name, self.get_filename( obj, **kwargs ) )
         except IOError, ex:
             log.critical('Error copying %s to %s: %s' % (file_name, self._get_filename(obj, **kwargs), ex))
             raise ex
コード例 #3
0
 def update_from_file(self, obj, file_name=None, create=False, **kwargs):
     """ `create` parameter is not used in this implementation """
     preserve_symlinks = kwargs.pop( 'preserve_symlinks', False )
     #FIXME: symlinks and the object store model may not play well together 
     #these should be handled better, e.g. registering the symlink'd file as an object
     if create:
         self.create(obj, **kwargs)
     if file_name and self.exists(obj, **kwargs):
         try:
             if preserve_symlinks and os.path.islink( file_name ):
                 util.force_symlink( os.readlink( file_name ), self.get_filename( obj, **kwargs ) )
             else:
                 shutil.copy( file_name, self.get_filename( obj, **kwargs ) )
         except IOError, ex:
             log.critical('Error copying %s to %s: %s' % (file_name,
                 self._get_filename(obj, **kwargs), ex))
コード例 #4
0
ファイル: __init__.py プロジェクト: vincenzopennone/galaxy
 def _update_from_file(self, obj, file_name=None, create=False, **kwargs):
     """`create` parameter is not used in this implementation."""
     preserve_symlinks = kwargs.pop('preserve_symlinks', False)
     # FIXME: symlinks and the object store model may not play well together
     # these should be handled better, e.g. registering the symlink'd file
     # as an object
     if create:
         self._create(obj, **kwargs)
     if file_name and self._exists(obj, **kwargs):
         try:
             if preserve_symlinks and os.path.islink(file_name):
                 force_symlink(os.readlink(file_name), self._get_filename(obj, **kwargs))
             else:
                 path = self._get_filename(obj, **kwargs)
                 shutil.copy(file_name, path)
                 umask_fix_perms(path, self.config.umask, 0o666)
         except OSError as ex:
             log.critical('Error copying {} to {}: {}'.format(file_name, self.__get_filename(obj, **kwargs), ex))
             raise ex