def rfstat(filename): """Return tuple (status,output) of rfstat shell command. Output is a list of strings (one entry per line). Raises RFIOError if rfstat command is not found.""" statcmd = 'rfstat' if not envutil.find_executable(statcmd): raise RFIOError( '%s not found in PATH' % statcmd ) cmd = '%s %s' % (statcmd,_remove_prefix(filename,'rfio:')) status,output = commands.getstatusoutput( cmd ) status >>= 8 return (status, output.split(os.linesep))
def rfdir(dirname): """Return tuple (status,output) of rfdir shell command. Output in a list of strings (one entry per line). The format is the same as the unix shell command \'ls -la\' Raises RFIOError if rfdir command is not found""" dircmd = 'rfdir' if not envutil.find_executable(dircmd): raise RFIOError( '%s not found in PATH' % dircmd ) cmd = '%s %s' % (dircmd,_remove_prefix(dirname,'rfio:')) status,ls_la = commands.getstatusoutput( cmd ) status >>= 8 return (status, ls_la.split(os.linesep))