def main(): """Handle the execution of sktm""" parser = setup_parser() args = parser.parse_args() setup_logging(args.verbose) cfg = load_config(args) logging.debug("cfg=%s", cfg) if args.func == cmd_report: cmd_report(cfg) else: jenkins_project = sktm.jenkins.JenkinsProject(cfg.get("jjname"), cfg.get("jurl"), cfg.get("jlogin"), cfg.get("jpass"), cfg.get("jretry")) sw = sktm.watcher(jenkins_project, cfg.get("db"), cfg.get("filter"), cfg.get("makeopts")) args.func(sw, cfg) try: sw.wait_for_pending() except KeyboardInterrupt: logging.info("Quitting...") sw.cleanup()
def setUp(self): """Test fixtures for testing __init__.""" self.database_dir = tempfile.mkdtemp() self.database_file = "{}/testdb.sqlite".format(self.database_dir) self.watcher_obj = sktm.watcher( jenkinsurl="http://example.com/jenkins", jenkinslogin="******", jenkinspassword="******", jenkinsjobname="sktm_jenkins_job", dbpath=self.database_file, filter=None, makeopts=None)
def setUp(self): """Test fixtures for testing __init__.""" self.database_dir = tempfile.mkdtemp() self.database_file = "{}/testdb.sqlite".format(self.database_dir) jenkins_project = sktm.jenkins.JenkinsProject( name="sktm_jenkins_job", url="http://example.com/jenkins", username="******", password="******") self.watcher_obj = sktm.watcher(jenkins_project, dbpath=self.database_file, patch_filter=None, makeopts=None)
def load_config(args): config = ConfigParser.ConfigParser() config.read(os.path.expanduser(args.rc)) cfg = vars(args) if config.has_section('config'): for (name, value) in config.items('config'): if name not in cfg or cfg.get(name) is None: cfg[name] = value return cfg if __name__ == '__main__': parser = setup_parser() args = parser.parse_args() setup_logging(args.verbose) cfg = load_config(args) logging.debug("cfg=%s", cfg) sw = sktm.watcher(cfg.get("jurl"), cfg.get("jlogin"), cfg.get("jpass"), cfg.get("jjname"), cfg.get("db"), cfg.get("makeopts")) args.func(sw, cfg) try: sw.wait_for_pending() except KeyboardInterrupt: logging.info("Quitting...") sw.cleanup()