def Populate(): from os import access, remove, F_OK localdir=os.path.join(options.directory,str('%s_recovery' % lhostname)) if DEBUGON: o2tf.printlog('recovery_load: localdir [%s]' % localdir, logfile, 0, '') if access(localdir, F_OK) == 1: os.system('rm -fr '+localdir) o2tf.CreateDir(DEBUGON, localdir, logfile) o2tf.untar(DEBUGON, localdir, tarfile, logfile,'1')
if DEBUGON: o2tf.printlog('crdel_gen_files: dirlist = (%s)' % dirlist, logfile, 0, '') o2tf.printlog('crdel_gen_files: stagedir = (%s)' % stagedir, logfile, 0, '') o2tf.printlog('crdel_gen_files: dirlen = (%s)' % dirlen, logfile, 0, '') o2tf.printlog('crdel_gen_files: logfile = (%s)' % logfile, logfile, 0, '') o2tf.printlog('crdel_gen_files: tarfile = (%s)' % tarfile, logfile, 0, '') # o2tf.CreateDir(DEBUGON, string.join(dirlist,','), logfile) # for i in range(dirlen): o2tf.untar(DEBUGON, dirlist[i], tarfile, logfile, '1') # # Remove the workfile after it is done. # sys.exit()
else: dirlen = 0 # logfile = options.logfile stagedir = options.stagedir # # First thing. Check if the dirlist is actually a directory or a file # containing the directory list. # if dirlen == 0: fd = open(os.path.join(stagedir, socket.gethostname() + '_C.dat'), 'r', 0) dirlist = string.split(fd.read(), ',') fd.close() dirlen = len(dirlist) if DEBUGON: o2tf.printlog('crdel_gen_files: dirlist = (%s)' % dirlist, logfile, 0, '') o2tf.printlog('crdel_gen_files: stagedir = (%s)' % stagedir, logfile, 0, '') o2tf.printlog('crdel_gen_files: dirlen = (%s)' % dirlen, logfile, 0, '') o2tf.printlog('crdel_gen_files: logfile = (%s)' % logfile, logfile, 0, '') o2tf.printlog('crdel_gen_files: tarfile = (%s)' % tarfile, logfile, 0, '') # o2tf.CreateDir(DEBUGON, string.join(dirlist, ','), logfile) # for i in range(dirlen): o2tf.untar(DEBUGON, dirlist[i], tarfile, logfile, '1') # # Remove the workfile after it is done. # sys.exit()