From: Peter Palfrader Date: Fri, 23 Feb 2018 23:11:22 +0000 (+0100) Subject: bacula: remove obsolete pools X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=194096396ce22744e79f307ed2723034b97a5ecb;p=mirror%2Fdsa-puppet.git bacula: remove obsolete pools --- diff --git a/modules/bacula/files/volumes-delete-old b/modules/bacula/files/volumes-delete-old index e533e71b8..cc0f92e9f 100755 --- a/modules/bacula/files/volumes-delete-old +++ b/modules/bacula/files/volumes-delete-old @@ -107,6 +107,21 @@ for r in cursor.fetchall(): c = "delete volume=%s yes"%(r['volumename'],) cmd.append(c) +# find obsolete pools +cursor.execute(""" + SELECT name + FROM pool + WHERE + name != 'Scratch' AND + numvols = 0 AND + poolid NOT IN (SELECT recyclepoolid FROM media) +""", {}) + +for r in cursor.fetchall(): + c = "delete pool=%s"%(r['name'],) + cmd.append(c) + cmd.append("yes") + if args.nodo: print("\n".join(cmd)) sys.exit(0)