From 1fe93c75b7c01a4a3c978406bc06127d8a2bf3b4 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 3 Aug 2009 16:09:28 +0100
Subject: [PATCH] SimpleConfigReader.Reload()

Rather than initializing the config statically at class creation time,
we load it every time Reload() is called.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/ssconf.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/ssconf.py b/lib/ssconf.py
index 74874f6c5..630a3f64b 100644
--- a/lib/ssconf.py
+++ b/lib/ssconf.py
@@ -52,14 +52,20 @@ class SimpleConfigReader(object):
 
     """
     self._file_name = file_name
+    self.Reload()
+
+  def Reload(self):
+    """Reloads the config file.
+
+    """
     try:
-      self._config_data = serializer.Load(utils.ReadFile(file_name))
+      self._config_data = serializer.Load(utils.ReadFile(self._file_name))
     except IOError, err:
       raise errors.ConfigurationError("Cannot read config file %s: %s" %
-                                      (file_name, err))
+                                      (self._file_name, err))
     except ValueError, err:
       raise errors.ConfigurationError("Cannot load config file %s: %s" %
-                                      (file_name, err))
+                                      (self._file_name, err))
 
   def GetClusterName(self):
     return self._config_data["cluster"]["cluster_name"]
-- 
GitLab