Ejemplo n.º 1
0
    def create(self):
        with SiteActionLock():
            if not self.version.is_installed():
                self.version.install()

            if self.update_with_git:
                self._copy_omd_version_for_test()

            if not self.reuse and self.exists():
                raise Exception("The site %s already exists." % self.id)

            if not self.exists():
                print("[%0.2f] Creating site '%s'" % (time.time(), self.id))
                p = subprocess.Popen([
                    "/usr/bin/sudo", "/usr/bin/omd", "-V",
                    self.version.version_directory(), "create",
                    "--admin-password", "cmk", "--apache-reload", self.id
                ])
                exit_code = p.wait()
                print("[%0.2f] Executed create command" % time.time())
                assert exit_code == 0
                assert os.path.exists("/omd/sites/%s" % self.id)

                self._set_number_of_helpers()
                #self._enabled_liveproxyd_debug_logging()
                self._enable_mkeventd_debug_logging()

            self._install_test_python_modules()

            if self.update_with_git:
                self._update_with_f12_files()
Ejemplo n.º 2
0
    def rm(self, site_id=None):
        if site_id is None:
            site_id = self.id

        with SiteActionLock():
            # TODO: LM: Temporarily disabled until "omd rm" issue is fixed.
            #assert subprocess.Popen(["/usr/bin/sudo", "/usr/bin/omd",
            subprocess.Popen(
                ["/usr/bin/sudo", "/usr/bin/omd", "-f", "rm", "--apache-reload", "--kill",
                 site_id]).wait()