Fix #21: KeyError with auto alias level >= 2

This patch fixes an error with auto alias generation levels 2 and 3 were
we would get a KeyError exception on certain cases.

For example with `os-log-merger -a2 2/cinder/vol.log 2/vol.log` we would
be getting KeyError: 'cinder'.

The reason for this was that we were overwriting subtrees so when we
added 2/vol.log we would be destroying the subtree generated when we
added 2/cinder/vol.log.
This commit is contained in:
Gorka Eguileor 2016-03-24 22:42:39 +01:00
parent 1e3e83eb2c
commit de87c7e08a
1 changed files with 1 additions and 1 deletions

View File

@ -338,7 +338,7 @@ def generate_aliases(aliases, cfg):
for k, v in non_aliased.items():
last_tree = tree
for directory in v[0]:
last_tree[directory] = (directory, {})
last_tree.setdefault(directory, (directory, {}))
last_tree = last_tree[directory][1]
# Reduce all paths as much as possible if alias level is 3