--- a/borgend/instance.py Mon Jan 29 14:32:27 2018 +0000 +++ b/borgend/instance.py Wed Jan 31 00:06:54 2018 +0000 @@ -19,6 +19,7 @@ 'create': ['--json'], 'info': ['--json'], 'list': ['--json'], + 'prune': ['--list'], } # Conversion of config into command line @@ -27,7 +28,19 @@ if args is None: return [] else: - return flatten([['--' + key, str(d[key])] for d in args for key in d]) + # Insert --key=str(value) for 'key: value' in the config. + # Boolean values are handled different, since borg does not take + # --key=true type of arguments. If the value is true --key is inserted, + # otherwise not. + def mkarg(key, value): + if isinstance(value, bool): + if value: + return ['--' + key] + else: + return [] + else: + return ['--' + key, str(value)] + return flatten([mkarg(key, d[key]) for d in args for key in d]) class BorgInstance: def __init__(self, operation, archive_or_repository, @@ -90,7 +103,7 @@ try: return json.loads(line.decode()) except Exception: - logger.exception('JSON parse failed on: %s' % str(line)) + logger.exception('JSON parse failed on stdout: %s' % str(line)) return None def read_log(self): @@ -117,7 +130,7 @@ res['type']='UNKNOWN' return res except: - logger.exception('JSON parse failed on: %s' % str(line)) + logger.exception('JSON parse failed on stderr: %s' % str(line)) errmsg=line for line in iter(stream.readline, b''):