Exemple #1
0
    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)
Exemple #2
0
 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)
Exemple #3
0
 def _make_service_info(self):
     return ServiceInfo(self.huskar_client.client,
                        type_name=self.type_name,
                        application_name=self.application_name)
Exemple #4
0
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)
Exemple #5
0
 def make_service_info(self):
     info = ServiceInfo(
         self.huskar_client.client, type_name=SERVICE_SUBDOMAIN,
         application_name=self.application_name)
     info.load()
     return info
Exemple #6
0
def test_find_global_default_route(_ezone, _intent, _result):
    cluster_name = ServiceInfo.find_global_default_route(_ezone, _intent)
    assert cluster_name == _result
Exemple #7
0
def service_info(zk, application_name):
    return ServiceInfo(zk,
                       type_name=SERVICE_SUBDOMAIN,
                       application_name=application_name)