projects
/
mirror
/
dsa-puppet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cf77710
)
bacula: remove obsolete pools
author
Peter Palfrader
<peter@palfrader.org>
Fri, 23 Feb 2018 23:11:22 +0000
(
00:11
+0100)
committer
Peter Palfrader
<peter@palfrader.org>
Fri, 23 Feb 2018 23:11:22 +0000
(
00:11
+0100)
modules/bacula/files/volumes-delete-old
patch
|
blob
|
history
diff --git
a/modules/bacula/files/volumes-delete-old
b/modules/bacula/files/volumes-delete-old
index
e533e71
..
cc0f92e
100755
(executable)
--- 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)