Compare commits
No commits in common. "4936a2088fd1b5c533483fda15fd2d2107acc1ca" and "f47f559afbffa867b99506283162edac58056e5e" have entirely different histories.
4936a2088f
...
f47f559afb
16
backup_diff
16
backup_diff
@ -4,7 +4,6 @@ import os
|
|||||||
import re
|
import re
|
||||||
import glob
|
import glob
|
||||||
import difflib
|
import difflib
|
||||||
import datetime
|
|
||||||
|
|
||||||
|
|
||||||
def get_args():
|
def get_args():
|
||||||
@ -46,18 +45,13 @@ def find_backups(backupdir, host):
|
|||||||
try:
|
try:
|
||||||
with open(f'{basepath}.lastchange', 'r') as f:
|
with open(f'{basepath}.lastchange', 'r') as f:
|
||||||
lastchange = f.readlines()[-1].rstrip()
|
lastchange = f.readlines()[-1].rstrip()
|
||||||
|
backups.insert(0, {
|
||||||
|
'since': lastchange,
|
||||||
|
'until': 'now',
|
||||||
|
'cfn': f'{basepath}.config'
|
||||||
|
})
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
|
||||||
info = os.stat(basepath +'.config')
|
|
||||||
mtime = datetime.datetime.fromtimestamp(info.st_mtime).strftime('%F %H:%M:%S (latest)')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
backups.insert(0, {
|
|
||||||
'since': lastchange or '???',
|
|
||||||
'until': mtime or '???',
|
|
||||||
'cfn': f'{basepath}.config'
|
|
||||||
})
|
|
||||||
return backups
|
return backups
|
||||||
|
|
||||||
def diff(backups, host, n1, n2):
|
def diff(backups, host, n1, n2):
|
||||||
|
|||||||
@ -369,11 +369,6 @@ class AsaConfig(ConfigWithShell):
|
|||||||
self._shell_command(channel, 'term pager 0', waitfor='#\s*$', waitmax=1)
|
self._shell_command(channel, 'term pager 0', waitfor='#\s*$', waitmax=1)
|
||||||
shrun = self._shell_command(channel, 'sh run', waitfor=': end')
|
shrun = self._shell_command(channel, 'sh run', waitfor=': end')
|
||||||
|
|
||||||
# strip late previous lines and command echo
|
|
||||||
for i in range(0, 5):
|
|
||||||
if re.search('^\s*: Saved\s*$', shrun[i]):
|
|
||||||
del shrun[0:i]
|
|
||||||
|
|
||||||
iproute = []
|
iproute = []
|
||||||
for cmd in ('sh ip address', 'sh route'):
|
for cmd in ('sh ip address', 'sh route'):
|
||||||
iproute.append('# '+ cmd.center(76, '='))
|
iproute.append('# '+ cmd.center(76, '='))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user