Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
3d6997b3be
|
|||
ac712da881
|
|||
89a19edd6d
|
2
setup.py
2
setup.py
@ -6,7 +6,7 @@ try:
|
||||
except ImportError:
|
||||
from distutils import setup
|
||||
|
||||
version = '0.3'
|
||||
version = '0.3.1'
|
||||
|
||||
setup(
|
||||
name='zsnapper',
|
||||
|
@ -6,6 +6,7 @@ import sys
|
||||
|
||||
time_format='%Y-%m-%d_%H%M'
|
||||
re_snapshot = re.compile(r'^(.*)@([0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{4})$')
|
||||
re_err_ok = re.compile(r"cannot create snapshot '[^']+': dataset already exists")
|
||||
logger = 'zsnapper'
|
||||
|
||||
class ZFSSnapshotError(Exception):
|
||||
@ -33,7 +34,12 @@ def do_zfs_command(args, zfs_cmd, pipecmd=None):
|
||||
|
||||
(out, err) = ctrl_proc.communicate()
|
||||
|
||||
if ctrl_proc.returncode != 0:
|
||||
# check if we try to create a snapshot that already exists. This can happen
|
||||
# if the script is run every minute and it takes more time than that to
|
||||
# create all snapshots
|
||||
if ctrl_proc.returncode == 1 and re_match(re_err_ok, err):
|
||||
pass
|
||||
elif ctrl_proc.returncode != 0:
|
||||
raise ZFSSnapshotError('Failed to execute {}: {}'.format(cmd, err))
|
||||
return out
|
||||
|
||||
|
Reference in New Issue
Block a user