def init_wato(self): if not self._missing_but_required_wato_files(): print("WATO is already initialized -> Skipping initializiation") return web = CMKWebSession(self) web.login() web.set_language("en") # Call WATO once for creating the default WATO configuration response = web.get("wato.py").text assert "<title>WATO" in response assert "<div class=\"title\">Manual Checks</div>" in response, \ "WATO does not seem to be initialized: %r" % response wait_time = 20 while self._missing_but_required_wato_files() and wait_time >= 0: time.sleep(0.5) wait_time -= 0.5 missing_files = self._missing_but_required_wato_files() assert not missing_files, \ "Failed to initialize WATO data structures " \ "(Still missing: %s)" % missing_files self._add_wato_test_config(web)
def init_wato(self): if not self._missing_but_required_wato_files(): logger.info("WATO is already initialized -> Skipping initializiation") return logger.debug("Initializing WATO...") web = CMKWebSession(self) web.login() web.set_language("en") # Call WATO once for creating the default WATO configuration logger.debug("Requesting wato.py (which creates the WATO factory settings)...") response = web.get("wato.py?mode=sites").text #logger.debug("Debug: %r" % response) assert "<title>Distributed Monitoring</title>" in response assert "replication_status_%s" % web.site.id in response, \ "WATO does not seem to be initialized: %r" % response logger.debug("Waiting for WATO files to be created...") wait_time = 20.0 while self._missing_but_required_wato_files() and wait_time >= 0: time.sleep(0.5) wait_time -= 0.5 missing_files = self._missing_but_required_wato_files() assert not missing_files, \ "Failed to initialize WATO data structures " \ "(Still missing: %s)" % missing_files self._add_wato_test_config(web)
def init_wato(self): if not self._missing_but_required_wato_files(): logger.info( "WATO is already initialized -> Skipping initializiation") return logger.debug("Initializing WATO...") web = CMKWebSession(self) web.login() # Call WATO once for creating the default WATO configuration logger.debug( "Requesting wato.py (which creates the WATO factory settings)...") response = web.get("wato.py?mode=sites").text #logger.debug("Debug: %r" % response) assert "site=%s" % web.site.id in response logger.debug("Waiting for WATO files to be created...") wait_time = 20.0 while self._missing_but_required_wato_files() and wait_time >= 0: time.sleep(0.5) wait_time -= 0.5 missing_files = self._missing_but_required_wato_files() assert not missing_files, \ "Failed to initialize WATO data structures " \ "(Still missing: %s)" % missing_files web.enforce_non_localized_gui() self._add_wato_test_config(web)
def __init__(self, num, crawler): super(Worker, self).__init__() self.name = "worker-%d" % num self.crawler = crawler self.daemon = True self.terminate = False self.idle = True self.client = CMKWebSession(self.crawler.site) self.client.login() self.client.set_language("en")
def __init__(self, num, crawler): super(Worker, self).__init__() self.name = "worker-%d" % num self.crawler = crawler self.daemon = True self.terminate = False self.idle = True self.client = CMKWebSession(self.crawler.site) self.client.login() self.client.enforce_non_localized_gui()
def _new_site(self, name): site = self._site_obj(name) site.create() site.open_livestatus_tcp(encrypted=False) site.start() site.prepare_for_tests() # There seem to be still some changes that want to be activated CMKWebSession(site).activate_changes() logger.debug("Created site %s", site.id) self._sites[site.id] = site return site
def _new_site(self, name): site_id = "%s%s" % (self._base_ident, name) site = Site(site_id=site_id, reuse=False, version=self._version, edition=self._edition, branch=self._branch) site.create() site.open_livestatus_tcp() # No TLS for testing site.set_config("LIVESTATUS_TCP_TLS", "off") site.start() site.prepare_for_tests() # There seem to be still some changes that want to be activated CMKWebSession(site).activate_changes() print("Created site %s" % site_id) self._sites[site_id] = site return site
def __init__(self, site): super(CMKEventConsole, self).__init__() self.site = site self.status = CMKEventConsoleStatus("%s/tmp/run/mkeventd/status" % site.root) self.web_session = CMKWebSession(site)
def web(site): web = CMKWebSession(site) web.login() web.set_language("en") return web
def web(site): web = CMKWebSession(site) web.login() web.enforce_non_localized_gui() return web