def get_service_info(self): """Gets the meta info of service from cached data. This method is used by :class:`.ClusterResolver`. """ data = self.get_data(self.type_name, self.application_name) return ServiceInfo.make_dummy(data=data, type_name=self.type_name, application_name=self.application_name)
def resolve_via_default(self, cluster_name, intent=None): ezone = try_to_extract_ezone(cluster_name) try: service_info = self.get_service_info() except MalformedDataError as e: logger.warning('Failed to parse default route "%s"', e.info.path) return ServiceInfo.find_global_default_route(ezone, intent) else: return service_info.find_default_route(ezone, intent)
def _make_service_info(self): return ServiceInfo(self.huskar_client.client, type_name=self.type_name, application_name=self.application_name)
def check_settings(): for intent in settings.ROUTE_INTENT_LIST: cluster_name = settings.ROUTE_DEFAULT_POLICY.get(intent) assert cluster_name, 'Incomplete ROUTE_DEFAULT_POLICY: %s' % intent ServiceInfo.check_default_route_args(OVERALL, intent, cluster_name)
def make_service_info(self): info = ServiceInfo( self.huskar_client.client, type_name=SERVICE_SUBDOMAIN, application_name=self.application_name) info.load() return info
def test_find_global_default_route(_ezone, _intent, _result): cluster_name = ServiceInfo.find_global_default_route(_ezone, _intent) assert cluster_name == _result
def service_info(zk, application_name): return ServiceInfo(zk, type_name=SERVICE_SUBDOMAIN, application_name=application_name)