Commit 682f7601 authored by Guido Trotter's avatar Guido Trotter
Browse files

Convert some ReadFile calls to ReadOneLineFile

For passwords we require strict oneliners, we're a bit more lax with pid
and uid files.
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent e587b46a
......@@ -235,7 +235,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if os.path.exists(uid_file):
uid = int(utils.ReadFile(uid_file))
uid = int(utils.ReadOneLineFile(uid_file))
return uid
except EnvironmentError:
logging.warning("Can't read uid file", exc_info=True)
......@@ -634,7 +634,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
vnc_pwd = None
if vnc_pwd_file:
vnc_pwd = utils.ReadFile(vnc_pwd_file)
vnc_pwd = utils.ReadOneLineFile(vnc_pwd_file, strict=True)
except EnvironmentError, err:
raise errors.HypervisorError("Failed to open VNC password file %s: %s"
% (vnc_pwd_file, err))
......@@ -601,7 +601,7 @@ def ReadPidFile(pidfile):
raw_data = ReadFile(pidfile)
raw_data = ReadOneLineFile(pidfile)
except EnvironmentError, err:
if err.errno != errno.ENOENT:
logging.exception("Can't read pid file")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment