def build_pathqueue(self): """ Build a queue of paths that needs to be rsynced """ self.log.debug('removing old queue and building new queue') if self.exists(self.path_queue.path): self.delete(self.path_queue.path, recursive=True) if self.netcat: paths = [str(i) for i in range(self.NC_RANGE)] time.sleep(self.SLEEPTIME) else: tuplpaths = get_pathlist(self.rsyncpath, self.rsyncdepth, exclude_re=self.excludere, exclude_usr='******') # Don't exclude user files paths = encode_paths(tuplpaths) self.paths_total = len(paths) for path in paths: self.path_queue.put(path) # Put_all can issue a zookeeper connection error with big lists self.log.debug('pathqueue building finished') return self.paths_total
def build_pathqueue(self): """ Build a queue of paths that needs to be rsynced """ self.log.info('removing old queue and building new queue') if self.exists(self.path_queue.path): self.delete(self.path_queue.path, recursive=True) if self.netcat: paths = [str(i) for i in range(self.NC_RANGE)] time.sleep(self.SLEEPTIME) else: tuplpaths = get_pathlist( self.rsyncpath, self.rsyncdepth, exclude_re=self.excludere, # By default don't exclude user files exclude_usr=self.excl_usr, rsubpaths=self.rsubpaths) paths = encode_paths(tuplpaths) self.paths_total = len(paths) for path in paths: self.path_queue.put(path.encode( )) # Put_all can issue a zookeeper connection error with big lists self.log.info('pathqueue building finished') return self.paths_total
def test_encode_paths(self): """ Test the encoding of a pathlist """ arrin = [('/tree/c1', 0), ('/tree/b1/bb2/.snapshots', 1)] self.assertListEqual(dw.encode_paths(arrin), ['0_/tree/c1', '1_/tree/b1/bb2/.snapshots'])
def test_encode_paths(self): """ Test the encoding of a pathlist """ arrin = [('/tree/c1', 0), ('/tree/b1/bb2/.snapshots', 1)] self.assertEqual(dw.encode_paths(arrin), ['0_/tree/c1', '1_/tree/b1/bb2/.snapshots'])