Browse code

New feature to only consider subset of pools

Lorenz Hüdepohl authored on23/11/2017 04:14:48
Showing1 changed files
... ...
@@ -100,6 +100,9 @@ parser.add_argument('-d', '--delete-only', action="store_true",
100 100
 parser.add_argument('-n', '--dry-run', action="store_true",
101 101
 		help='Only echo the commands that would be issued,\ndo not actually do anything.')
102 102
 
103
+parser.add_argument('-o', '--only', metavar='POOL', type=str,
104
+                help='Only consider filesystems below POOL.')
105
+
103 106
 args = parser.parse_args()
104 107
 
105 108
 TIME_FORMAT="%Y-%m-%d-%H:%M"
... ...
@@ -115,7 +118,12 @@ def mutative_cmd(cmdargs):
115 118
     if not args.dry_run:
116 119
         check_call(cmdargs)
117 120
 
118
-zfs_props = Popen([zfs, "get", "-t", "filesystem", "autosnapshot:{0}".format(args.tagname), "-H"],
121
+if args.only:
122
+    only = ["-r", args.only]
123
+else:
124
+    only = []
125
+
126
+zfs_props = Popen([zfs, "get", "-t", "filesystem", "autosnapshot:{0}".format(args.tagname), "-H"] + only,
119 127
         stdout=PIPE)
120 128
 
121 129
 encoding = locale.getdefaultlocale()[1]