From 9b1c58640b3634c964cbbf7c186aff1d2f3e4dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristia=CC=81n=20Feldsam?= Date: Wed, 23 Oct 2019 18:11:12 +0200 Subject: [PATCH] Show borg info on backup end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristián Feldsam --- backup.py | 7 +++++++ functions.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/backup.py b/backup.py index 6e2a355..bf5ceb5 100755 --- a/backup.py +++ b/backup.py @@ -136,5 +136,12 @@ for image_key in images: if args.verbose: print '#============================================================' +# show borgbackup info +if args.verbose: + try: + print functions.borgbackup_info() + except Exception as ex: + print ex + # disconnect form 3PAR _3par.logout() diff --git a/functions.py b/functions.py index d6ba10e..2f7611f 100644 --- a/functions.py +++ b/functions.py @@ -1,3 +1,7 @@ +import subprocess +import config + + def bool_arg(string): if string != True and string != '1' and string != 'YES': return False @@ -122,3 +126,10 @@ def filter_images(all_images, datastores, args): return images return all_images + + +def borgbackup_info(): + try: + return subprocess.check_output('borg info %s' % (config.BACKUP_REPO), shell=True) + except subprocess.CalledProcessError as ex: + raise Exception('Can not issue borg info command on repo %s!' % (config.BACKUP_REPO), ex) \ No newline at end of file -- GitLab