error print, backup_check fix
This commit is contained in:
parent
4936a2088f
commit
7961bb6ce7
@ -51,7 +51,7 @@ def main():
|
||||
else:
|
||||
agetext = f'{age:.1f}h'
|
||||
backuptimestamp = datetime.datetime.fromtimestamp(backuptime).strftime('%F %H:%M:%S')
|
||||
if age > args.maxage:
|
||||
if age > maxage:
|
||||
print(f'WARNING: {args.host}: last backup {backuptimestamp}, {agetext} ago (>{maxage}h)')
|
||||
exit(1)
|
||||
if args.verbose:
|
||||
|
||||
@ -259,8 +259,9 @@ class RouterosConfig(Config):
|
||||
iproute.append(line)
|
||||
|
||||
stdin, stdout, stderr = self.ssh.exec_command('/system backup save dont-encrypt=yes name=autobck')
|
||||
if not re.search('Configuration backup saved', str(stdout.read(), 'utf8')):
|
||||
raise RuntimeError('"/system backup" failed')
|
||||
output = str(stdout.read(), 'utf8')
|
||||
if not re.search('Configuration backup saved', output):
|
||||
raise RuntimeError(f'"/system backup" failed: {output.strip()}')
|
||||
|
||||
sftp = self.ssh.open_sftp()
|
||||
with sftp.open('autobck.backup', 'r') as sf:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user