In the case where we stamp out a config for all roles, don't take
a shortcut and stamp it out once per remote. Instead, do it for each
role, so that the number of items in the resulting dict in this case is
equal to the number of roles and not to the number of remotes. This is
a necessary prerequisite for override support - otherwise something
like
kernel:
client:
branch: testing
override:
kernel:
branch: wip-foobar
won't be deep_merged()'ed correctly if the role:remote mapping looks
like
remote1: mon.a, osd.0, osd.1, osd2
remote2: mds.a, client.0
because we'd have
mon.a: branch: wip-foobar
mds.a: branch: wip-foobar
on the override side and
client.0: branch: testing
on the original config side. Since those three keys don't overlap,
we'd end up with testing kernel on client.0, which is incorrect.
This doesn't result in any functional changes - validate_config()
will reduce such config as usual.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
new_config = {}
if config is None:
config = CONFIG_DEFAULT
- for _, roles_for_host in ctx.cluster.remotes.iteritems():
- new_config[roles_for_host[0]] = config
+ for role in teuthology.all_roles(ctx.cluster):
+ new_config[role] = config
return new_config
new_config = {}