Commit ddd1d5c3 authored by Thomas Thrainer's avatar Thomas Thrainer
Browse files

Be paranoid about existing keys in cfgupgrade



The cfgupgrade test assumes a very minimal configuration for some of its
tests. This configuration does not contain some of the fields which were
assumed to be present in cfgupgrade. This patch tests for the existence
of those fields before trying to access them.
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent c4402c5d
......@@ -416,19 +416,24 @@ def DowngradeHVParams(hvparams):
def DowngradeCluster(config_data):
cluster = config_data["cluster"]
DowngradeNDParams(cluster["ndparams"])
DowngradeNicParams(cluster["nicparams"][constants.PP_DEFAULT])
DowngradeHVParams(cluster["hvparams"])
if "ndparams" in cluster:
DowngradeNDParams(cluster["ndparams"])
if "nicparams" in cluster:
DowngradeNicParams(cluster["nicparams"][constants.PP_DEFAULT])
if "hvparams" in cluster:
DowngradeHVParams(cluster["hvparams"])
def DowngradeNodeGroups(config_data):
for (_, ngobj) in config_data["nodegroups"].items():
DowngradeNDParams(ngobj["ndparams"])
if "ndparams" in ngobj:
DowngradeNDParams(ngobj["ndparams"])
def DowngradeNodes(config_data):
for (_, nobj) in config_data["nodes"].items():
DowngradeNDParams(nobj["ndparams"])
if "ndparams" in nobj:
DowngradeNDParams(nobj["ndparams"])
def DowngradeInstances(config_data):
......
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