Пример #1
0
 def test_destroy_zun_service(self, mock_delete, mock_write, mock_read):
     mock_read.side_effect = etcd.EtcdKeyNotFound
     zun_service = utils.create_test_zun_service()
     mock_read.side_effect = lambda *args: FakeEtcdResult(zun_service.
                                                          as_dict())
     dbapi.destroy_zun_service(zun_service.host, zun_service.binary)
     mock_delete.assert_called_once_with('/zun_services/%s' %
                                         zun_service.host + '_' +
                                         zun_service.binary)
Пример #2
0
    def destroy(self, context=None):
        """Delete the ZunService from the DB.

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: ZunService(context)
        """
        dbapi.destroy_zun_service(self.host, self.binary)
        self.obj_reset_changes()
Пример #3
0
    def destroy(self, context=None):
        """Delete the ZunService from the DB.

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: ZunService(context)
        """
        dbapi.destroy_zun_service(self.host, self.binary)
        self.obj_reset_changes()