Ejemplo n.º 1
0
 def get_listener_policies(loadbalancer, listener_policy_names):
     if not loadbalancer or not listener_policy_names:
         return []
     policies = [] 
     try:
         for policy_desc in loadbalancer.policy_descriptions: 
             if policy_desc.policy_name in listener_policy_names:
                 policy = LoadbalancerPolicy.from_policy_description(policy_desc)
                 if policy:
                     policies.append(policy)
             
     except Exception, err:
         servo.log.error('failed to create policy objects: %s' % err)
         servo.log.debug(traceback.format_exc())
Ejemplo n.º 2
0
    def get_listener_policies(loadbalancer, listener_policy_names):
        if not loadbalancer or not listener_policy_names:
            return []
        policies = []
        try:
            for policy_desc in loadbalancer.policy_descriptions:
                if policy_desc.policy_name in listener_policy_names:
                    policy = LoadbalancerPolicy.from_policy_description(
                        policy_desc)
                    if policy:
                        policies.append(policy)

        except Exception, err:
            servo.log.error('failed to create policy objects: %s' % err)
            servo.log.debug(traceback.format_exc())
Ejemplo n.º 3
0
 def get_backend_policies(self, loadbalancer, instance_port):
     if not loadbalancer or not loadbalancer.backends:
         return []
     policy_names = []
     backend_policies = []
     try:
         for backend in loadbalancer.backends:
             if backend.instance_port == instance_port:
                 for p in backend.policies:
                     policy_names.append(p.policy_name)
         for policy_name, policy_desc in self.policies.items():
             if policy_name in policy_names or policy_desc.policy_type_name == 'PublicKeyPolicyType':
                 policy = LoadbalancerPolicy.from_policy_description(policy_desc)
                 if policy:
                     backend_policies.append(policy)
     except Exception, err:
         servo.log.error('failed to create backend policy objects: %s' % err)
         servo.log.debug(traceback.format_exc())
Ejemplo n.º 4
0
 def get_listener_policies(self, listener_policy_names):
     if not listener_policy_names:
         return []
     listener_policies = [] 
     try:
         for policy_name in listener_policy_names:
             if policy_name in self.policies:
                 policy_desc = self.policies[policy_name]
                 policy = LoadbalancerPolicy.from_policy_description(policy_desc)
                 if policy:
                     listener_policies.append(policy)
                 else:
                     servo.log.error('failed to create policy object from policy %s' % policy_name)
             else:
                 servo.log.error('unable to find policy description: %s' % policy_name)
     except Exception, err:
         servo.log.error('failed to create policy objects: %s' % err)
         servo.log.debug(traceback.format_exc())