Commit 78f66a17 authored by Guido Trotter's avatar Guido Trotter
Browse files

Xen: use utils.Readfile to read the VNC password

Also raise HypervisorError rather than OpExecError.

Reviewed-by: iustinp
parent 332d0e37
......@@ -587,14 +587,10 @@ class XenHvmHypervisor(XenHypervisor):
config.write("vncunused = 1\n")
try:
password_file = open(constants.VNC_PASSWORD_FILE, "r")
try:
password = password_file.readline()
finally:
password_file.close()
except IOError:
raise errors.OpExecError("failed to open VNC password file %s " %
constants.VNC_PASSWORD_FILE)
password = utils.ReadFile(constants.VNC_PASSWORD_FILE)
except EnvironmentError, err:
raise errors.HypervisorError("Failed to open VNC password file %s: %s" %
(constants.VNC_PASSWORD_FILE, err))
config.write("vncpasswd = '%s'\n" % password.rstrip())
......
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