# os.utime(fname, None) #else: # open(fname, 'w').close() #skip the unwanted lines and get only the URI part from the object list #Wait till the object list file is in place retry_count = 0 while not os.path.exists(OBJECT_LIST_FILE): if retry_count < MAX_RETRY: time.sleep(2) syslog.syslog( syslog.LOG_NOTICE, "[OBJ Deletion] : Waiting for object list file : " + NAMESPACE) else: print "Failed to get the object list file,Please try again." if mgmt_lib.is_pid_exists(pid): os.kill(pid, 9) sys.exit(0) retry_count = retry_count + 1 f_object_list = open(OBJECT_LIST_FILE, "r") #No need for the temp file,as list file has wat we need and #slow del will cut the correct pattern to be enqueued #f_delete_list_tmp = open (DELETE_OBJECT_LIST_FILE_TMP, "w") #Wait till either of the below is true, #1)We have > 50 entries to be displayed #2)Object listing process is complete while 1: line_cnt = len(f_object_list.readlines()) if (line_cnt > 50):
#_f_list_file.readline() #_f_list_file.readline() #_f_list_file.readline() #_f_list_file.readline() #line in _f_list_file.readlines(): del_count = 0 while 1: line = _f_list_file.readline() flag_end = 0 #If list generation is still in progress,dont exit if line == "": flag_end = 1 if re.search("End of cache objects for namespace.*", line): flag_end = 1 if mgmt_lib.is_pid_exists(PID) and flag_end == 1: continue elif flag_end == 1: break _ret = 1 while not _ret == 0: #BUG 9565: Uri with space are not deleted. Passing the entire object line within quotes #to ensure that the whole object is queued. final_object = re.search( "[ \t]*[A-Za-z_0-9]+[ \t]*[A-Z]+[ \t]*[0-9]+[ \t]*[A-Z-]+[ \t]*([A-Za-z]+[ \t]*[A-Za-z]+[ \t]*[0-9]+[ \t]*[0-9]+:[0-9]+:[0-9]+[ \t]*[0-9]+)[ \t]*(.*)", line) if final_object: OBJ_PATTERN = final_object.group(2) OBJ_PATTERN = OBJ_PATTERN.replace("\\", "\\\\") query = "/opt/nkn/bin/nknfqueue -f -r " + NS_UID + "_\"" + OBJ_PATTERN + "\" -q /tmp/FMGR.queue"
#_f_list_file.readline() #_f_list_file.readline() #_f_list_file.readline() #_f_list_file.readline() #line in _f_list_file.readlines(): del_count=0 while 1: line = _f_list_file.readline() flag_end=0 #If list generation is still in progress,dont exit if line == "": flag_end=1 if re.search("End of cache objects for namespace.*",line): flag_end=1 if mgmt_lib.is_pid_exists(PID) and flag_end==1: continue elif flag_end==1: break _ret = 1 while not _ret == 0 : #BUG 9565: Uri with space are not deleted. Passing the entire object line within quotes #to ensure that the whole object is queued. final_object=re.search("[ \t]*[A-Za-z_0-9]+[ \t]*[A-Z]+[ \t]*[0-9]+[ \t]*[A-Z-]+[ \t]*([A-Za-z]+[ \t]*[A-Za-z]+[ \t]*[0-9]+[ \t]*[0-9]+:[0-9]+:[0-9]+[ \t]*[0-9]+)[ \t]*(.*)", line) if final_object: OBJ_PATTERN = final_object.group(2) OBJ_PATTERN = OBJ_PATTERN.replace("\\", "\\\\") query = "/opt/nkn/bin/nknfqueue -f -r "+NS_UID+"_\""+OBJ_PATTERN+"\" -q /tmp/FMGR.queue" #syslog.syslog(syslog.LOG_NOTICE, "query is " +query) _ret = os.system(query)
#fname=DELETE_OBJECT_LIST_FILE #if os.path.exists(fname): # os.utime(fname, None) #else: # open(fname, 'w').close() #skip the unwanted lines and get only the URI part from the object list #Wait till the object list file is in place retry_count=0 while not os.path.exists(OBJECT_LIST_FILE): if retry_count < MAX_RETRY: time.sleep(2) syslog.syslog(syslog.LOG_NOTICE,"[OBJ Deletion] : Waiting for object list file : " + NAMESPACE) else: print "Failed to get the object list file,Please try again." if mgmt_lib.is_pid_exists(pid): os.kill(pid, 9) sys.exit(0) retry_count = retry_count + 1 f_object_list = open(OBJECT_LIST_FILE, "r") #No need for the temp file,as list file has wat we need and #slow del will cut the correct pattern to be enqueued #f_delete_list_tmp = open (DELETE_OBJECT_LIST_FILE_TMP, "w") #Wait till either of the below is true, #1)We have > 50 entries to be displayed #2)Object listing process is complete while 1: line_cnt = len(f_object_list.readlines()) if(line_cnt > 50):