stdout, stderr = proc.communicate()
if proc.wait() != 0:
if stdouts is not None:
- stdouts.append(stdout.decode('UTF-8'))
+ stdouts.append(stdout.decode("UTF-8"))
raise VtyshException(
'vtysh returned status %d for command "%s"' % (proc.returncode, command)
)
if line.startswith("!") or line.startswith("#"):
continue
- if (len(ctx_keys) == 2
- and ctx_keys[0].startswith('bfd')
- and ctx_keys[1].startswith('profile ')
- and line == 'end'):
- log.debug('LINE %-50s: popping from sub context, %-50s', line, ctx_keys)
+ if (
+ len(ctx_keys) == 2
+ and ctx_keys[0].startswith("bfd")
+ and ctx_keys[1].startswith("profile ")
+ and line == "end"
+ ):
+ log.debug("LINE %-50s: popping from sub context, %-50s", line, ctx_keys)
if main_ctx_key:
self.save_contexts(ctx_keys, current_context_lines)
ctx_keys.append(line)
elif (
- line.startswith('profile ')
+ line.startswith("profile ")
and len(ctx_keys) == 1
- and ctx_keys[0].startswith('bfd')
+ and ctx_keys[0].startswith("bfd")
):
# Save old context first
main_ctx_key = copy.deepcopy(ctx_keys)
log.debug(
"LINE %-50s: entering BFD profile sub-context, append to ctx_keys",
- line
+ line,
)
ctx_keys.append(line)