def test_notify_of_fault(self): self.config(notify_api_faults=True) rpc.init(cfg.CONF) app = middleware.FaultWrapperMiddleware({}) class RaisingRequest(FakeRequest): def get_response(self, request): raise exceptions.DuplicateDomain() request = RaisingRequest() ctxt = context.DesignateContext() ctxt.request_id = 'one' request.environ['context'] = ctxt # Process the request app(request) notifications = self.get_notifications() self.assertEqual(1, len(notifications)) ctxt, message, priority = notifications.pop() self.assertEqual('ERROR', message['priority']) self.assertEqual('dns.api.fault', message['event_type']) self.assertIn('timestamp', message) self.assertIn('publisher_id', message)
def __init__(self, *args, **kwargs): super(Service, self).__init__(*args, **kwargs) rpc.init(cfg.CONF) # Initialize extensions self.handlers = self._init_extensions() self.subscribers = self._get_subscribers()
def main(): utils.read_config('designate', sys.argv) logging.setup('designate') rpc.init(CONF) launcher = service.launch(api_service.Service(), CONF['service:api'].workers) launcher.wait()
def __init__(self, threads=1000): super(Service, self).__init__(threads) policy.init() # NOTE(kiall): All services need RPC initialized, as this is used # for clients AND servers. Hence, this is common to # all Designate services. if not rpc.initialized(): rpc.init(CONF)
def __init__(self, name, threads=None): threads = threads or 1000 super(Service, self).__init__(threads) self.name = name self.host = CONF.host policy.init() if not rpc.initialized(): rpc.init(CONF)
def __init__(self, *args, **kwargs): # NOTE: Central api needs a transport if not it fails. This is # normally done by the service init method. rpc.init(cfg.CONF) central_api = central_rpcapi.CentralAPI() manager = backend.get_backend( cfg.CONF['service:agent'].backend_driver, central_service=central_api) kwargs['manager'] = manager super(Service, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): # NOTE: Central api needs a transport if not it fails. This is # normally done by the service init method. rpc.init(cfg.CONF) central_api = central_rpcapi.CentralAPI() endpoint = backend.get_backend( cfg.CONF['service:agent'].backend_driver, central_service=central_api) kwargs['endpoints'] = [endpoint] super(Service, self).__init__(*args, **kwargs)
def __init__(self, host, binary, topic, service_name=None, endpoints=None): super(Service, self).__init__() if not rpc.initialized(): rpc.init(CONF) self.host = host self.binary = binary self.topic = topic self.service_name = service_name # TODO(ekarlso): change this to be loadable via mod import or # stevedore? self.endpoints = endpoints or [self]
def __init__(self, host, binary, topic, service_name=None, endpoints=None, *args, **kwargs): # Central api needs a transport if not it fails. This is normally done # by the service init method. rpc.init(cfg.CONF) central_api = central_rpcapi.CentralAPI() manager = backend.get_backend( cfg.CONF['service:agent'].backend_driver, central_service=central_api) super(Service, self).__init__(host, binary, topic, endpoints=[manager], *args, **kwargs)
def __init__(self, threads=None): threads = threads or 1000 super(Service, self).__init__(threads) self._host = CONF.host self._service_config = CONF['service:%s' % self.service_name] policy.init() # NOTE(kiall): All services need RPC initialized, as this is used # for clients AND servers. Hence, this is common to # all Designate services. if not rpc.initialized(): rpc.init(CONF)
def init_application(): conf_files = _get_config_files() logging.register_options(cfg.CONF) cfg.CONF([], project='designate', default_config_files=conf_files) config.set_defaults() logging.setup(cfg.CONF, 'designate') policy.init() if not rpc.initialized(): rpc.init(CONF) heartbeat = heartbeat_emitter.get_heartbeat_emitter('api') heartbeat.start() conf = conf_files[0] return deploy.loadapp('config:%s' % conf, name='osapi_dns')
def init_application(): conf_files = _get_config_files() logging.register_options(cfg.CONF) cfg.CONF([], project='designate', default_config_files=conf_files) config.set_defaults() logging.setup(cfg.CONF, 'designate') policy.init() if not rpc.initialized(): rpc.init(CONF) heartbeat = service.Heartbeat('api', threadgroup.ThreadGroup(thread_pool_size=1)) heartbeat.start() conf = conf_files[0] return deploy.loadapp('config:%s' % conf, name='osapi_dns')
def main(): args = parse_args() logging.setup('cirrus_floatingip') LOG.logger.setLevel('DEBUG') load_config(args.config_file) kc = keystone_c.Client(username=args.username, password=args.password, tenant_name=args.tenantname, auth_url=args.authurl, endpoint_type=args.endpoint_type, region_name=args.regionname) policy.init() rpc.init(cfg.CONF) context = DesignateContext.get_admin_context(tenant=kc.auth_tenant_id) handler = cirrus.CirrusFloatingIPHandler() args.func(kc, handler, context, args)
def main(): args = parse_args() logging.setup('cirrus_floatingip') LOG.logger.setLevel('DEBUG') load_config(args.config_file) kc = keystone_c.Client( username=args.username, password=args.password, tenant_name=args.tenantname, auth_url=args.authurl, endpoint_type=args.endpoint_type, region_name=args.regionname) policy.init() rpc.init(cfg.CONF) context = DesignateContext.get_admin_context(tenant=kc.auth_tenant_id) handler = cirrus.CirrusFloatingIPHandler() args.func(kc, handler, context, args)
def test_notify_of_fault(self, mock_notifier): self.config(notify_api_faults=True) rpc.init(cfg.CONF) app = middleware.FaultWrapperMiddleware({}) class RaisingRequest(FakeRequest): def get_response(self, request): raise exceptions.DuplicateDomain() request = RaisingRequest() ctxt = context.DesignateContext() ctxt.request_id = 'one' request.environ['context'] = ctxt # Process the request app(request) self.assertEqual(mock_notifier.call_count, 1) mock_notifier.call_args( ctxt, 'dns.api.fault', {"url": None, "status": 409, "exception": ""})
def test_notify_of_fault(self, mock_notifier): self.config(notify_api_faults=True) rpc.init(cfg.CONF) app = middleware.FaultWrapperMiddleware({}) class RaisingRequest(FakeRequest): def get_response(self, request): raise exceptions.DuplicateZone() request = RaisingRequest() ctxt = context.DesignateContext() ctxt.request_id = 'one' request.environ['context'] = ctxt # Process the request app(request) self.assertEqual(1, mock_notifier.call_count) mock_notifier.call_args( ctxt, 'dns.api.fault', {"url": None, "status": 409, "exception": ""})
def setUp(self): super(RPCFixture, self).setUp() rpc.init(self.conf) self.addCleanup(self.deinit)
def __init__(self): super(PoolCommands, self).__init__() rpc.init(cfg.CONF) self.central_api = central_rpcapi.CentralAPI()
def _startup(self): rpc.init(cfg.CONF) self.central_api = central_rpcapi.CentralAPI()
def __init__(self): super(AkamaiCommands, self).__init__() rpc.init(cfg.CONF) self.central_api = central_rpcapi.CentralAPI() self.context.all_tenants = True
def __init__(self): super(DatabaseCommands, self).__init__() rpc.init(cfg.CONF) self.central_api = central_rpcapi.CentralAPI()