Example #1
0
    def start_cassandra(self):
        """Strt the cassandra process."""
        LOGGER.debug("[start_cassandra] called last_safe_start [%s]",
                     self.last_safe_start)
        if not self.last_safe_start:
            self.last_safe_start = int(time.time())
        elif (int(time.time()) - self.last_safe_start) < 30:
            self.config = load_config()
            try:
                self.cass_error_msg = inspect_cass_log(self.config)
            except TypeError:
                LOGGER.error("[start_cassandra] can't " +
                                 "start cassandra check config.py")
                self.cass_error_msg = "cassandra doesn't start, no log error"
            else:
                self.do_tune()
            LOGGER.warn("[start_cassandra] cassandra error message [%s]",
                        self.cass_error_msg)

        LOGGER.error("%s", self.config.cassandra_start_options)
        pid_loc = os.path.join(*self.config.cassandra_start_options[1])
        handle_pid(pid_loc)
        self.last_safe_start = int(time.time())
        command = ' '.join((self.config.cassandra_startup_script,
                            self.config.cassandra_start_options[0],
                            pid_loc, ))
        output = self._run_command(command)
        if output:
            self.cassandra_running = True
            return True
Example #2
0
 def test_handle_pid(self):
     tmp_file = '/tmp/tests'
     utils.handle_pid(tmp_file)
     self.assertTrue(os.path.exists(tmp_file))