def _build_subattr_match_rule(attr_name, attr, action, target):
 validate = attr['validate']
 key = [k for k in validate.keys() if k.startswith('type:dict')]
 if (not key):
  LOG.warning(_LW('Unable to find data type descriptor for attribute %s'), attr_name)
  return
 data = validate[key[0]]
 if (not isinstance(data, dict)):
  LOG.debug('Attribute type descriptor is not a dict. Unable to generate any sub-attr policy rule for %s.', attr_name)
  return
 sub_attr_rules = [policy.RuleCheck('rule', ('%s:%s:%s' % (action, attr_name, sub_attr_name))) for sub_attr_name in data if (sub_attr_name in target[attr_name])]
 return policy.AndCheck(sub_attr_rules)

def _build_subattr_match_rule ( attr_name , attr , action , target ) : validate = attr [ 'validate' ] key = [ k for k in validate . keys ( ) if k . startswith ( 'type:dict' ) ] if ( not key ) : LOG . warning ( _LW ( 'Unable to find data type descriptor for attribute %s' ) , attr_name ) return data = validate [ key [ 0 ] ] if ( not isinstance ( data , dict ) ) : LOG . debug ( 'Attribute type descriptor is not a dict. Unable to generate any sub-attr policy rule for %s.' , attr_name ) return sub_attr_rules = [ policy . RuleCheck ( 'rule' , ( '%s:%s:%s' % ( action , attr_name , sub_attr_name ) ) ) for sub_attr_name in data if ( sub_attr_name in target [ attr_name ] ) ] return policy . AndCheck ( sub_attr_rules )
create the rule to match for sub-attribute policy checks .