def get_configured_policybindings(client, module): log('Getting configured policy bindigs') bindings = {} if module.params['policybindings'] is None: return bindings for binding in module.params['policybindings']: binding['name'] = module.params['name'] key = binding['policyname'] binding_proxy = ConfigProxy(actual=csvserver_cspolicy_binding(), client=client, readwrite_attrs=[ 'priority', 'bindpoint', 'policyname', 'labelname', 'gotopriorityexpression', 'targetlbvserver', 'name', 'invoke', 'labeltype', ], readonly_attrs=[], attribute_values_dict=binding) bindings[key] = binding_proxy return bindings
def get_configured_policybindings(client, module): log('Getting configured policy bindigs') bindings = {} if module.params['policybindings'] is None: return bindings for binding in module.params['policybindings']: binding['name'] = module.params['name'] key = binding['policyname'] binding_proxy = ConfigProxy( actual=csvserver_cspolicy_binding(), client=client, readwrite_attrs=[ 'priority', 'bindpoint', 'policyname', 'labelname', 'gotopriorityexpression', 'targetlbvserver', 'name', 'invoke', 'labeltype', ], readonly_attrs=[], attribute_values_dict=binding ) bindings[key] = binding_proxy return bindings
def _bind_csvserver_policy_targetlb(self, cs_name, lb_name, policy_name): try: bindings = csvserver_cspolicy_binding.get(self.ns_session, cs_name) for b in bindings: if b.name == cs_name and b.policyname == policy_name: logger.info('CS %s is already bound to policy %s' % (cs_name, policy_name)) return except nitro_exception: pass binding = csvserver_cspolicy_binding() binding.name = cs_name binding.policyname = policy_name binding.targetlbvserver = lb_name csvserver_cspolicy_binding.add(self.ns_session, binding)