In _ReadConfigFile, the filename should be prepared outside the
try/except block. Fixes bad code formatting, too.
---
 lib/hypervisor/hv_xen.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index 256fc5e..6098dc0 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -362,11 +362,13 @@ class XenHypervisor(hv_base.BaseHypervisor):
     """Returns the contents of the instance config file.
 
     """
+    filename = XenHypervisor._ConfigFileName(instance_name)
+
     try:
-      file_content = utils.ReadFile(
-                       XenHypervisor._ConfigFileName(instance_name))
+      file_content = utils.ReadFile(filename)
     except EnvironmentError, err:
       raise errors.HypervisorError("Failed to load Xen config file: %s" % err)
+
     return file_content
 
   @staticmethod
-- 
1.7.7.3

Reply via email to