mirror of https://gerrit.osmocom.org/osmo-dev
fill_config.py: sort foreach items numerically, not alphabetically
Make sure that BTS 11 doesn't get sorted between BTS 1 and 2, because osmo-bsc requires the BTS to be configured in numerical order. Also makes sense as foreach loop ordering in general. Change-Id: Ib06052fd71def3d4c869ee9b3dc4d02ba06267af
This commit is contained in:
parent
fecf156c11
commit
c65901cf09
|
@ -166,19 +166,19 @@ def insert_foreach(tmpl, tmpl_dir, tmpl_src, match, local_config, arg):
|
|||
item_m = item_re.match(item)
|
||||
if not item_m:
|
||||
continue
|
||||
items.add((item_m.group(1), item_m.group(2)))
|
||||
items.add((int(item_m.group(2)), item_m.group(1)))
|
||||
|
||||
items = sorted(list(items))
|
||||
|
||||
expanded = [before_block]
|
||||
for item, nr in items:
|
||||
for nr, item in items:
|
||||
expanded_block = foreach_block
|
||||
|
||||
while True:
|
||||
expanded_block_was = expanded_block
|
||||
|
||||
expanded_block = expanded_block.replace('${%sn_' % arg, '${%s_' % item)
|
||||
expanded_block = expanded_block.replace('${%sn}' % arg, nr)
|
||||
expanded_block = expanded_block.replace('${%sn}' % arg, str(nr))
|
||||
expanded_block = replace_vars(expanded_block, tmpl_dir, tmpl_src, local_config)
|
||||
|
||||
if expanded_block_was == expanded_block:
|
||||
|
|
Loading…
Reference in New Issue