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

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