def _ReadNumericFile(file_name):
  """Reads a file containing a number.

  @rtype: None or int
  @return: None if file is not found, otherwise number

  """
  try:
    contents = utils.ReadFile(file_name)
  except EnvironmentError, err:
    if err.errno in (errno.ENOENT, ):
      return None
    raise

  try:
    return int(contents)
  except (__HOLE__, TypeError), err:
    # Couldn't convert to int
    raise errors.JobQueueError("Content of file '%s' is not numeric: %s" %
                               (file_name, err))
dataset/ETHPy150Open ganeti/ganeti/lib/jstore.py/_ReadNumericFile