def find_file(path, saltenv='base', **kwargs):
 if ('env' in kwargs):
  salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list.  This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0.  This warning will be removed in Salt Oxygen.")
  kwargs.pop('env')
 path = os.path.normpath(path)
 fnd = {'path': '', 'rel': ''}
 if os.path.isabs(path):
  return fnd
 if (saltenv not in __opts__['file_roots']):
  return fnd
 def _add_file_stat(fnd):
  '\n        Stat the file and, assuming no errors were found, convert the stat\n        result to a list of values and add to the return dict.\n\n        Converting the stat result to a list, the elements of the list\n        correspond to the following stat_result params:\n\n        0 => st_mode=33188\n        1 => st_ino=10227377\n        2 => st_dev=65026\n        3 => st_nlink=1\n        4 => st_uid=1000\n        5 => st_gid=1000\n        6 => st_size=1056233\n        7 => st_atime=1468284229\n        8 => st_mtime=1456338235\n        9 => st_ctime=1456338235\n        '
  try:
   fnd['stat'] = list(os.stat(fnd['path']))
  except Exception:
   pass
  return fnd
 if ('index' in kwargs):
  try:
   root = __opts__['file_roots'][saltenv][int(kwargs['index'])]
  except IndexError:
   return fnd
  except ValueError:
   return fnd
  full = os.path.join(root, path)
  if (os.path.isfile(full) and (not salt.fileserver.is_file_ignored(__opts__, full))):
   fnd['path'] = full
   fnd['rel'] = path
   return _add_file_stat(fnd)
  return fnd
 for root in __opts__['file_roots'][saltenv]:
  full = os.path.join(root, path)
  if (os.path.isfile(full) and (not salt.fileserver.is_file_ignored(__opts__, full))):
   fnd['path'] = full
   fnd['rel'] = path
   return _add_file_stat(fnd)
 return fnd

def find_file ( path , saltenv = 'base' , ** kwargs ) : if ( 'env' in kwargs ) : salt . utils . warn_until ( 'Oxygen' , "Parameter 'env' has been detected in the argument list.  This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0.  This warning will be removed in Salt Oxygen." ) kwargs . pop ( 'env' ) path = os . path . normpath ( path ) fnd = { 'path' : '' , 'rel' : '' } if os . path . isabs ( path ) : return fnd if ( saltenv not in __opts__ [ 'file_roots' ] ) : return fnd def _add_file_stat ( fnd ) : try : fnd [ 'stat' ] = list ( os . stat ( fnd [ 'path' ] ) ) except Exception : pass return fnd if ( 'index' in kwargs ) : try : root = __opts__ [ 'file_roots' ] [ saltenv ] [ int ( kwargs [ 'index' ] ) ] except IndexError : return fnd except ValueError : return fnd full = os . path . join ( root , path ) if ( os . path . isfile ( full ) and ( not salt . fileserver . is_file_ignored ( __opts__ , full ) ) ) : fnd [ 'path' ] = full fnd [ 'rel' ] = path return _add_file_stat ( fnd ) return fnd for root in __opts__ [ 'file_roots' ] [ saltenv ] : full = os . path . join ( root , path ) if ( os . path . isfile ( full ) and ( not salt . fileserver . is_file_ignored ( __opts__ , full ) ) ) : fnd [ 'path' ] = full fnd [ 'rel' ] = path return _add_file_stat ( fnd ) return fnd
recursively find matching file from the current working path .