def _config_adjust(self, contents, fn): lines = contents.splitlines() for line in lines: cleaned = line.strip() if (len(cleaned) == 0 or cleaned[0] == '#' or cleaned[0] == '['): #not useful to examine these continue pieces = cleaned.split("=", 1) if (len(pieces) != 2): continue key = pieces[0].strip() val = pieces[1].strip() if (len(key) == 0 or len(val) == 0): continue #now we take special actions if (key == 'log_file'): # Ensure that we can write to the log file dirname = os.path.dirname(val) if (len(dirname)): dirsmade = mkdirslist(dirname) # This trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) # Destroy then recreate it unlink(val) touch_file(val) self.tracewriter.file_touched(val) return contents
def _config_adjust(self, contents, fn): lines = contents.splitlines() for line in lines: cleaned = line.strip() if(len(cleaned) == 0 or cleaned[0] == '#' or cleaned[0] == '['): #not useful to examine these continue pieces = cleaned.split("=", 1) if(len(pieces) != 2): continue key = pieces[0].strip() val = pieces[1].strip() if(len(key) == 0 or len(val) == 0): continue #now we take special actions if(key == 'log_file'): # Ensure that we can write to the log file dirname = os.path.dirname(val) if(len(dirname)): dirsmade = mkdirslist(dirname) # This trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) # Destroy then recreate it unlink(val) touch_file(val) self.tracewriter.file_touched(val) return contents
def _config_adjust(self, contents, fn): lines = contents.splitlines() for line in lines: cleaned = line.strip() if (len(cleaned) == 0 or cleaned[0] == '#' or cleaned[0] == '['): #not useful to examine these continue pieces = cleaned.split("=", 1) if (len(pieces) != 2): continue key = pieces[0].strip() val = pieces[1].strip() if (len(key) == 0 or len(val) == 0): continue #now we take special actions if (key == 'filesystem_store_datadir'): #delete existing images deldir(val) #recreate the image directory dirsmade = mkdirslist(val) self.tracewriter.dir_made(*dirsmade) elif (key == 'log_file'): #ensure that we can write to the log file dirname = os.path.dirname(val) if (len(dirname)): dirsmade = mkdirslist(dirname) #this trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) #destroy then recreate it (the log file) unlink(val) touch_file(val) self.tracewriter.file_touched(val) elif (key == 'image_cache_datadir'): #destroy then recreate the image cache directory deldir(val) dirsmade = mkdirslist(val) #this trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) elif (key == 'scrubber_datadir'): #destroy then recreate the scrubber data directory deldir(val) dirsmade = mkdirslist(val) #this trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) return contents
def _config_adjust(self, contents, fn): lines = contents.splitlines() for line in lines: cleaned = line.strip() if len(cleaned) == 0 or cleaned[0] == "#" or cleaned[0] == "[": # not useful to examine these continue pieces = cleaned.split("=", 1) if len(pieces) != 2: continue key = pieces[0].strip() val = pieces[1].strip() if len(key) == 0 or len(val) == 0: continue # now we take special actions if key == "filesystem_store_datadir": # delete existing images deldir(val) # recreate the image directory dirsmade = mkdirslist(val) self.tracewriter.dir_made(*dirsmade) elif key == "log_file": # ensure that we can write to the log file dirname = os.path.dirname(val) if len(dirname): dirsmade = mkdirslist(dirname) # this trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) # destroy then recreate it (the log file) unlink(val) touch_file(val) self.tracewriter.file_touched(val) elif key == "image_cache_datadir": # destroy then recreate the image cache directory deldir(val) dirsmade = mkdirslist(val) # this trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) elif key == "scrubber_datadir": # destroy then recreate the scrubber data directory deldir(val) dirsmade = mkdirslist(val) # this trace is used to remove the dirs created self.tracewriter.dir_made(*dirsmade) return contents
def touch_trace(rootdir, name): tracefn = trace_fn(rootdir, name) touch_file(tracefn) return tracefn