4 Commits

Author SHA1 Message Date
1290623456 fixed check of weed_enable 2020-12-21 19:07:15 +01:00
2a91a41ede second try 2020-12-21 18:41:13 +01:00
46eed410f0 fixed regex matching of stderr 2020-12-21 18:36:20 +01:00
2340a2f601 fixed configuration parser 2020-12-21 17:57:18 +01:00
3 changed files with 4 additions and 4 deletions

View File

@ -259,7 +259,7 @@ def weed_snapshots(fslist, snapshots, config, failed_snapshots):
continue continue
if source_fs not in snapshots: if source_fs not in snapshots:
continue continue
if not conf['weed_enable']: if not conf['weed_enable'] or conf['weed_enable'].lower() in ('false', 'no'):
continue continue
kwargs = {k: int(v) for k, v in conf.items() if k in [ kwargs = {k: int(v) for k, v in conf.items() if k in [
@ -289,7 +289,7 @@ def weed_snapshots(fslist, snapshots, config, failed_snapshots):
def main(): def main():
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('/usr/local/etc/zsnapper.ini', '/etc/zsnapper.ini') config.read(['/usr/local/etc/zsnapper.ini', '/etc/zsnapper.ini'])
ret = RET_CODES['SUCCESS'] ret = RET_CODES['SUCCESS']
log = logging.getLogger(LOGGER) log = logging.getLogger(LOGGER)

View File

@ -6,7 +6,7 @@ try:
except ImportError: except ImportError:
from distutils import setup from distutils import setup
version = '0.3.2' version = '0.3.4'
setup( setup(
name='zsnapper', name='zsnapper',

View File

@ -37,7 +37,7 @@ def do_zfs_command(args, zfs_cmd, pipecmd=None):
# check if we try to create a snapshot that already exists. This can happen # 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 # if the script is run every minute and it takes more time than that to
# create all snapshots # create all snapshots
if ctrl_proc.returncode == 1 and re_match(re_err_ok, err): if ctrl_proc.returncode == 1 and re.match(re_err_ok, err.decode('utf-8')):
pass pass
elif ctrl_proc.returncode != 0: elif ctrl_proc.returncode != 0:
raise ZFSSnapshotError('Failed to execute {}: {}'.format(cmd, err)) raise ZFSSnapshotError('Failed to execute {}: {}'.format(cmd, err))