def oo_pods_match_component(pods, deployment_type, component):
 if (not isinstance(pods, list)):
  raise errors.AnsibleFilterError('failed expects to filter on a list')
 if (not isinstance(deployment_type, string_types)):
  raise errors.AnsibleFilterError('failed expects deployment_type to be a string')
 if (not isinstance(component, string_types)):
  raise errors.AnsibleFilterError('failed expects component to be a string')
 image_prefix = 'openshift/origin-'
 if (deployment_type in ['enterprise', 'online', 'openshift-enterprise']):
  image_prefix = 'openshift3/ose-'
 elif (deployment_type == 'atomic-enterprise'):
  image_prefix = 'aep3_beta/aep-'
 matching_pods = []
 image_regex = ((image_prefix + component) + '.*')
 for pod in pods:
  for container in pod['spec']['containers']:
   if re.search(image_regex, container['image']):
    matching_pods.append(pod)
    break
 return matching_pods

def oo_pods_match_component ( pods , deployment_type , component ) : if ( not isinstance ( pods , list ) ) : raise errors . AnsibleFilterError ( 'failed expects to filter on a list' ) if ( not isinstance ( deployment_type , string_types ) ) : raise errors . AnsibleFilterError ( 'failed expects deployment_type to be a string' ) if ( not isinstance ( component , string_types ) ) : raise errors . AnsibleFilterError ( 'failed expects component to be a string' ) image_prefix = 'openshift/origin-' if ( deployment_type in [ 'enterprise' , 'online' , 'openshift-enterprise' ] ) : image_prefix = 'openshift3/ose-' elif ( deployment_type == 'atomic-enterprise' ) : image_prefix = 'aep3_beta/aep-' matching_pods = [ ] image_regex = ( ( image_prefix + component ) + '.*' ) for pod in pods : for container in pod [ 'spec' ] [ 'containers' ] : if re . search ( image_regex , container [ 'image' ] ) : matching_pods . append ( pod ) break return matching_pods
filters a list of pods and returns the ones matching the deployment_type and component .