def main(self, argv, opts_etc=None): if threading.currentThread().getName() == "MainThread": threading.currentThread().setName("mt") err, opts, source, sink = self.opt_parse(argv) if err: return err if opts_etc: opts.etc = opts_etc # Used for unit tests, etc. logging.info(self.name + "...") logging.info(" source : %s", source) logging.info(" sink : %s", sink) logging.info(" opts : %s", opts.safe) source_class, sink_class = self.find_handlers(opts, source, sink) if not source_class: return "error: unknown type of source: " + source if not sink_class: return "error: unknown type of sink: " + sink err = sink_class.check_source(opts, source_class, source, sink_class, sink) if err: return err try: pumpStation = pump.PumpingStation(opts, source_class, source, sink_class, sink) rv = pumpStation.run() self.aggregate_stats(pumpStation.cur) return rv except KeyboardInterrupt: return "interrupted."
def main(self, argv, opts_etc=None): if threading.currentThread().getName() == "MainThread": threading.currentThread().setName("mt") if self.name in ['cbbackup', 'cbbackupwrapper', 'cbrestore', 'cbrestorewrapper', 'cbtransfer']: new_executable = 'cbbackupmgr' if self.name != "cbtransfer" else 'cbdatarecovery' print(f'WARN: {self.name} is deprecated please use {new_executable} instead') err, opts, source, sink = self.opt_parse(argv) if err: return err if opts_etc: opts.etc = opts_etc # Used for unit tests, etc. process_name = f'{os.path.basename(argv[0])}-{"".join(random.sample(string.ascii_letters, 16))}' setattr(opts, "process_name", process_name) logging.info(f'{self.name}...') logging.info(f' source : {source}') logging.info(f' sink : {sink}') logging.info(f' opts : {opts.safe}') source_class, sink_class = self.find_handlers(opts, source, sink) if not source_class: return f'error: unknown type of source: {source}' if not sink_class: return f'error: unknown type of sink: {sink}' err = sink_class.check_source(opts, source_class, source, sink_class, sink) if err: return err try: pumpStation = pump.PumpingStation(opts, source_class, source, sink_class, sink) rv = pumpStation.run() self.aggregate_stats(pumpStation.cur) return rv except KeyboardInterrupt: return "interrupted."