keep 'return' line in comware config
This commit is contained in:
parent
62f6891024
commit
a22fe6f1e4
@ -397,10 +397,10 @@ class ComwareConfig(ConfigWithShell):
|
|||||||
channel = self.ssh.invoke_shell()
|
channel = self.ssh.invoke_shell()
|
||||||
self._shell_command(channel, 'screen-length disable', waitfor='>\s*$', waitmax=1)
|
self._shell_command(channel, 'screen-length disable', waitfor='>\s*$', waitmax=1)
|
||||||
dicur = self._shell_command(channel, 'display current-configuration', waitfor='(?m:^return\s*$)')
|
dicur = self._shell_command(channel, 'display current-configuration', waitfor='(?m:^return\s*$)')
|
||||||
# strip garbage after 'return' if return appears *before* last line
|
# strip garbage after 'return' line
|
||||||
for i in range(-2, -6, -1):
|
for i in range(-2, -6, -1): # -2! (-1 would delete all if return is on last line)
|
||||||
if re.search('^\s*return\s*$', dicur[i]):
|
if re.search('^\s*return\s*$', dicur[i]):
|
||||||
del dicur[i:]
|
del dicur[i+1:]
|
||||||
self.config = '\n'.join(dicur)
|
self.config = '\n'.join(dicur)
|
||||||
|
|
||||||
def is_bad_config(self):
|
def is_bad_config(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user