Commit d26f8b9d authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Merge branch 'stable-2.10' into stable-2.11

* stable-2.10
  Verify configuration version number before parsing
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarHrvoje Ribicic <>
parents e69c93fb 2dc0acb9
......@@ -62,7 +62,7 @@ _UPGRADE_CONFIG_JID = "jid-cfg-upgrade"
def _ValidateConfig(data):
"""Verifies that a configuration objects looks valid.
"""Verifies that a configuration dict looks valid.
This only verifies the version of the configuration.
......@@ -70,8 +70,9 @@ def _ValidateConfig(data):
we expect
if data.version != constants.CONFIG_VERSION:
raise errors.ConfigVersionMismatch(constants.CONFIG_VERSION, data.version)
if data['version'] != constants.CONFIG_VERSION:
raise errors.ConfigVersionMismatch(constants.CONFIG_VERSION,
class TemporaryReservationManager:
......@@ -2347,13 +2348,15 @@ class ConfigWriter(object):
raw_data = utils.ReadFile(self._cfg_file)
data = objects.ConfigData.FromDict(serializer.Load(raw_data))
data_dict = serializer.Load(raw_data)
# Make sure the configuration has the right version
data = objects.ConfigData.FromDict(data_dict)
except errors.ConfigVersionMismatch:
except Exception, err:
raise errors.ConfigurationError(err)
# Make sure the configuration has the right version
if (not hasattr(data, "cluster") or
not hasattr(data.cluster, "rsahostkeypub")):
raise errors.ConfigurationError("Incomplete configuration"
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