From c90bd1bf16df17aef5e042edb4b770136626a256 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Mon, 27 Apr 2020 16:44:48 +0200 Subject: [PATCH] Small improvement --- zfs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zfs.py b/zfs.py index bb327e9..48eb03e 100644 --- a/zfs.py +++ b/zfs.py @@ -22,8 +22,9 @@ def zfs_get_type(name): return lst[0][1] -def zfs_snapshot_by_tag_or_sha256(s): - lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:sha256,focker:tags,type,name', '-H', '-t', 'snapshot']) +def zfs_snapshot_by_tag_or_sha256(s, focker_type='image'): + lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:sha256,focker:tags,type,name', + '-H', '-t', 'snapshot', '-r', poolname + '/focker/' + focker_type + 's']) lst = list(filter(lambda a: (a[0] == s or s in a[1].split(' ')) and a[2] == 'snapshot', lst)) if len(lst) == 0: raise ValueError('Reference not found: ' + s)