Skip to content

Commit

Permalink
Don't check for interval snapshots if keep is not > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
hkbakke committed Jan 31, 2017
1 parent c933899 commit 3b538bc
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/zfssnap.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,20 +700,25 @@ def enforce_retention(self, keep, label=None, recursive=False, reset=False,
reverse=True)[_keep['minimum']:]

if not reset:
keep_snapshots.update(
{s for s in self._get_hourly_snapshots(snapshots, _keep['hourly'])})
if _keep['hourly'] > 0:
keep_snapshots.update(
{s for s in self._get_hourly_snapshots(snapshots, _keep['hourly'])})

keep_snapshots.update(
{s for s in self._get_daily_snapshots(snapshots, _keep['daily'])})
if _keep['daily'] > 0:
keep_snapshots.update(
{s for s in self._get_daily_snapshots(snapshots, _keep['daily'])})

keep_snapshots.update(
{s for s in self._get_weekly_snapshots(snapshots, _keep['weekly'])})
if _keep['weekly'] > 0:
keep_snapshots.update(
{s for s in self._get_weekly_snapshots(snapshots, _keep['weekly'])})

keep_snapshots.update(
{s for s in self._get_monthly_snapshots(snapshots, _keep['monthly'])})
if _keep['monthly'] > 0:
keep_snapshots.update(
{s for s in self._get_monthly_snapshots(snapshots, _keep['monthly'])})

keep_snapshots.update(
{s for s in self._get_yearly_snapshots(snapshots, _keep['yearly'])})
if _keep['yearly'] > 0:
keep_snapshots.update(
{s for s in self._get_yearly_snapshots(snapshots, _keep['yearly'])})

for snapshot in snapshots:
if snapshot in keep_snapshots:
Expand Down

0 comments on commit 3b538bc

Please sign in to comment.