Skip to content

Commit

Permalink
Merge pull request #2204 from andresailer/XRootFix
Browse files Browse the repository at this point in the history
[v6r11] XRootStorage: putFile would place file in the wrong location on eos
  • Loading branch information
Andrei Tsaregorodtsev committed Dec 15, 2014
2 parents d3f8002 + f4155b5 commit cd2d4a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DataManagementSystem/Client/FTSClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from DIRAC.DataManagementSystem.Client.FTSFile import FTSFile
from DIRAC.DataManagementSystem.private.FTSHistoryView import FTSHistoryView
from DIRAC.DataManagementSystem.private.FTSValidator import FTSValidator
from DIRAC.DataManagementSystem.Client.DataManager import DataManager
from DIRAC.DataManagementSystem.Client.DataManager import DataManager
# # from Resources
from DIRAC.Resources.Storage.StorageFactory import StorageFactory

Expand Down
10 changes: 5 additions & 5 deletions Resources/Storage/XROOTStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ def __listSingleDirectory( self, path ):
self.log.debug( "XROOTStorage.__listSingleDirectory: Attempting to list directory %s." % path )

pfnDict = res['Value']
xFilePath = '/'.join( [pfnDict['Path'], pfnDict['FileName']] )
xFilePath = os.path.join( pfnDict['Path'], pfnDict['FileName'].strip( "/" ) )

status, listing = self.xrootClient.dirlist( xFilePath, DirListFlags.STAT )

Expand All @@ -1419,7 +1419,7 @@ def __listSingleDirectory( self, path ):
subDirs = {}

for entry in listing:
fullPath = "root://%s%s%s" % ( self.host, xFilePath, entry.name )
fullPath = "root://%s/%s/%s" % ( self.host, xFilePath, entry.name )
metadataDict = self.__parseStatInfoFromApiOutput( entry.statinfo )
if metadataDict['Directory']:
subDirs[fullPath] = True
Expand Down Expand Up @@ -1626,8 +1626,8 @@ def getProtocolPfn( self, pfnDict, withPort ):
pfnDict['Protocol'] = self.protocol
pfnDict['Host'] = self.host

if not pfnDict['Path'].startswith( self.rootdir ):
pfnDict['Path'] = os.path.join( self.rootdir, pfnDict['Path'].rstrip( '/' ) )
if not (pfnDict['Path'].startswith( self.rootdir ) or pfnDict['Path'].startswith( "/"+self.rootdir )):
pfnDict['Path'] = os.path.join( self.rootdir, pfnDict['Path'].strip( '/' ) )

# These lines should be checked
if withPort:
Expand All @@ -1637,7 +1637,7 @@ def getProtocolPfn( self, pfnDict, withPort ):

# pfnunparse does not take into account the double // so I have to trick it
# The problem is that I cannot take into account the port, which is always empty (it seems..)
return S_OK( 'root://%s%s/%s' % ( self.host, pfnDict['Path'], pfnDict['FileName'] ) )
return S_OK( 'root://%s/%s/%s' % ( self.host, pfnDict['Path'], pfnDict['FileName'] ) )


def getCurrentURL( self, fileName ):
Expand Down

0 comments on commit cd2d4a6

Please sign in to comment.