Commit 1fe93c75 authored by Guido Trotter's avatar Guido Trotter
Browse files

SimpleConfigReader.Reload()



Rather than initializing the config statically at class creation time,
we load it every time Reload() is called.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 18d750b9
......@@ -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"]
......
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