|
|
@ -214,8 +214,7 @@ class NetworkConfig(object):
|
|
|
|
ancestors = list()
|
|
|
|
ancestors = list()
|
|
|
|
config = list()
|
|
|
|
config = list()
|
|
|
|
|
|
|
|
|
|
|
|
curlevel = 0
|
|
|
|
indents = [0]
|
|
|
|
prevlevel = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for linenum, line in enumerate(to_native(lines, errors='surrogate_or_strict').split('\n')):
|
|
|
|
for linenum, line in enumerate(to_native(lines, errors='surrogate_or_strict').split('\n')):
|
|
|
|
text = entry_reg.sub('', line).strip()
|
|
|
|
text = entry_reg.sub('', line).strip()
|
|
|
@ -228,20 +227,21 @@ class NetworkConfig(object):
|
|
|
|
# handle top level commands
|
|
|
|
# handle top level commands
|
|
|
|
if toplevel.match(line):
|
|
|
|
if toplevel.match(line):
|
|
|
|
ancestors = [cfg]
|
|
|
|
ancestors = [cfg]
|
|
|
|
prevlevel = curlevel
|
|
|
|
indents = [0]
|
|
|
|
curlevel = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# handle sub level commands
|
|
|
|
# handle sub level commands
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
match = childline.match(line)
|
|
|
|
match = childline.match(line)
|
|
|
|
line_indent = match.start(1)
|
|
|
|
line_indent = match.start(1)
|
|
|
|
|
|
|
|
|
|
|
|
prevlevel = curlevel
|
|
|
|
if line_indent < indents[-1]:
|
|
|
|
curlevel = int(line_indent / self._indent)
|
|
|
|
while indents[-1] > line_indent:
|
|
|
|
|
|
|
|
indents.pop()
|
|
|
|
|
|
|
|
|
|
|
|
if (curlevel - 1) > prevlevel:
|
|
|
|
if line_indent > indents[-1]:
|
|
|
|
curlevel = prevlevel + 1
|
|
|
|
indents.append(line_indent)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curlevel = len(indents) - 1
|
|
|
|
parent_level = curlevel - 1
|
|
|
|
parent_level = curlevel - 1
|
|
|
|
|
|
|
|
|
|
|
|
cfg._parents = ancestors[:curlevel]
|
|
|
|
cfg._parents = ancestors[:curlevel]
|
|
|
|