def oo_persistent_volume_claims(hostvars, persistent_volume_claims=None):
 if (not issubclass(type(hostvars), dict)):
  raise errors.AnsibleFilterError('|failed expects hostvars is a dict')
 if ((persistent_volume_claims is not None) and (not issubclass(type(persistent_volume_claims), list))):
  raise errors.AnsibleFilterError('|failed expects persistent_volume_claims is a list')
 if (persistent_volume_claims is None):
  persistent_volume_claims = []
 if ('hosted' in hostvars['openshift']):
  for component in hostvars['openshift']['hosted']:
   if ('storage' in hostvars['openshift']['hosted'][component]):
    params = hostvars['openshift']['hosted'][component]['storage']
    kind = params['kind']
    create_pv = params['create_pv']
    create_pvc = params['create_pvc']
    if ((kind not in [None, 'object']) and create_pv and create_pvc):
     volume = params['volume']['name']
     size = params['volume']['size']
     access_modes = params['access']['modes']
     persistent_volume_claim = dict(name='{0}-claim'.format(volume), capacity=size, access_modes=access_modes)
     persistent_volume_claims.append(persistent_volume_claim)
 return persistent_volume_claims

def oo_persistent_volume_claims ( hostvars , persistent_volume_claims = None ) : if ( not issubclass ( type ( hostvars ) , dict ) ) : raise errors . AnsibleFilterError ( '|failed expects hostvars is a dict' ) if ( ( persistent_volume_claims is not None ) and ( not issubclass ( type ( persistent_volume_claims ) , list ) ) ) : raise errors . AnsibleFilterError ( '|failed expects persistent_volume_claims is a list' ) if ( persistent_volume_claims is None ) : persistent_volume_claims = [ ] if ( 'hosted' in hostvars [ 'openshift' ] ) : for component in hostvars [ 'openshift' ] [ 'hosted' ] : if ( 'storage' in hostvars [ 'openshift' ] [ 'hosted' ] [ component ] ) : params = hostvars [ 'openshift' ] [ 'hosted' ] [ component ] [ 'storage' ] kind = params [ 'kind' ] create_pv = params [ 'create_pv' ] create_pvc = params [ 'create_pvc' ] if ( ( kind not in [ None , 'object' ] ) and create_pv and create_pvc ) : volume = params [ 'volume' ] [ 'name' ] size = params [ 'volume' ] [ 'size' ] access_modes = params [ 'access' ] [ 'modes' ] persistent_volume_claim = dict ( name = '{0}-claim' . format ( volume ) , capacity = size , access_modes = access_modes ) persistent_volume_claims . append ( persistent_volume_claim ) return persistent_volume_claims
generate list of persistent volume claims based on oo_openshift_env storage options set in host variables .