示例#1
0
    def tearDown(self):
        ha_tools.kill_all_members()
        ha_tools.nodes.clear()
        ha_tools.routers.clear()
        time.sleep(1)  # Let members really die.

        self.knobs.disable()
    def tearDown(self):
        ha_tools.kill_all_members()
        ha_tools.nodes.clear()
        ha_tools.routers.clear()
        time.sleep(1)  # Let members really die.

        self.knobs.disable()
示例#3
0
 def tearDown(self):
     ha_tools.kill_all_members()
     ha_tools.nodes.clear()
示例#4
0
 def tearDown(self):
     Monitor._refresh_interval = MONITOR_INTERVAL
     ha_tools.kill_all_members()
示例#5
0
 def tearDown(self):
     ha_tools.kill_all_members()
     ha_tools.nodes.clear()
     ha_tools.routers.clear()
     sleep(1)  # Let members really die.
示例#6
0
 def tearDown(self):
     self.client.drop_database(self.dbname)
     ha_tools.kill_all_members()
示例#7
0
 def tearDown(self):
     ha_tools.kill_all_members()
示例#8
0
 def tearDown(self):
     ha_tools.kill_all_members()
     ha_tools.nodes.clear()
 def tearDown(self):
     self.c.close()
     ha_tools.kill_all_members()
示例#10
0
 def tearDown(self):
     Monitor._refresh_interval = MONITOR_INTERVAL
     ha_tools.kill_all_members()
示例#11
0
 def tearDown(self):
     super(MotorTestHealthMonitor, self).tearDown()
     ha_tools.kill_all_members()
示例#12
0
 def tearDown(self):
     ha_tools.kill_all_members()
     self.c.close()
     super(MotorTestPassiveAndHidden, self).tearDown()
示例#13
0
 def tearDown(self):
     ha_tools.kill_all_members()
     self.c.close()
     super(MotorTestDirectConnection, self).tearDown()
示例#14
0
 def tearDown(self):
     ha_tools.kill_all_members()
     ha_tools.nodes.clear()
     ha_tools.routers.clear()
     sleep(1)  # Let members really die.
 def tearDown(self):
     ha_tools.kill_all_members()
示例#16
0
 def tearDown(self):
     self.c.close()
     ha_tools.kill_all_members()
     self.clear_ping_times()
 def tearDown(self):
     self.c.close()
     ha_tools.kill_all_members()
     self.clear_ping_times()
示例#18
0
 def tearDown(self):
     self.c.close()
     ha_tools.kill_all_members()
 def tearDown(self):
     self.conn.drop_database(self.dbname)
     ha_tools.kill_all_members()
示例#20
0
文件: main.py 项目: trnl/mongo-rs-api
    def post(self, op):
        """ Respond to a POST
        """

        # Start RS
        if op == "start":
            request = self._parse_json(self.request.body)
            members = request["members"]

            try:
                # start RS and get its' params
                res = ha_tools.start_replica_set(members)
            except:
                raise tornado.httpserver._BadRequestException("Couldn't start RS!")

            rs_uri, rs_name = res
            rs_id = uuid.uuid4()

            self.write(self._template.load(op + self._ext).generate(rs_id=rs_id, rs_uri=rs_uri, rs_name=rs_name))

        # Stop rs
        elif op == "stop":
            try:
                ha_tools.kill_all_members()
            except:
                raise tornado.httpserver._BadRequestException("Couldn't stop RS!")

        # Get primary
        elif op == "get_primary":
            request = self._parse_json(self.request.body)
            rs_id = request["rs"]["id"]

            rs_primary_uri = ha_tools.get_primary()

            self.write(self._template.load(op + self._ext).generate(rs_id=rs_id, rs_primary_uri=rs_primary_uri))

        # Get secondaries
        elif op == "get_secondaries":
            request = self._parse_json(self.request.body)
            rs_id = request["rs"]["id"]

            rs_secondaries_uris = ha_tools.get_secondaries()

            self.write(
                self._template.load(op + self._ext).generate(rs_id=rs_id, rs_secondaries_uris=rs_secondaries_uris)
            )

        # Get arbiters
        elif op == "get_arbiters":
            request = self._parse_json(self.request.body)
            rs_id = request["rs"]["id"]

            rs_arbiters_uris = ha_tools.get_arbiters()

            self.write(self._template.load(op + self._ext).generate(rs_id=rs_id, rs_arbiters_uris=rs_arbiters_uris))

        # Kill primary
        elif op == "kill_primary":
            request = self._parse_json(self.request.body)
            rs_id = request["rs"]["id"]

            rs_killed_primary_uri = ha_tools.kill_primary()

            self.write(
                self._template.load(op + self._ext).generate(rs_id=rs_id, rs_killed_primary_uri=rs_killed_primary_uri)
            )

        # Kill secondary
        elif op == "kill_secondary":
            request = self._parse_json(self.request.body)
            rs_id = request["rs"]["id"]

            rs_killed_secondary_uri = ha_tools.kill_secondary()

            self.write(
                self._template.load(op + self._ext).generate(
                    rs_id=rs_id, rs_killed_secondary_uri=rs_killed_secondary_uri
                )
            )

        # Kill all secondaries
        elif op == "kill_all_secondaries":
            request = self._parse_json(self.request.body)
            rs_id = request["rs"]["id"]

            rs_killed_secondaries_uris = ha_tools.kill_all_secondaries()

            self.write(
                self._template.load(op + self._ext).generate(
                    rs_id=rs_id, rs_killed_secondaries_uris=rs_killed_secondaries_uris
                )
            )