whoops, did that in the wrong place

This commit is contained in:
brent s 2019-06-02 03:49:00 -04:00
parent 6d6d1e20b1
commit e4b7bf85e9

View File

@ -530,10 +530,13 @@ class Backup(object):
_stdout = '\n'.join([i.strip() for i in _out.stdout.decode('utf-8').splitlines()]) _stdout = '\n'.join([i.strip() for i in _out.stdout.decode('utf-8').splitlines()])
_stderr = _out.stderr.decode('utf-8').strip() _stderr = _out.stderr.decode('utf-8').strip()
_returncode = _out.returncode _returncode = _out.returncode
try:
if self.args['archive']: if self.args['archive']:
output[server][repo['name']] = [json.loads(i) for i in _stdout.splitlines()] output[server][repo['name']] = [json.loads(i) for i in _stdout.splitlines()]
else: else:
output[repo['name']] = json.loads(_stdout)['archives'] output[server][repo['name']] = json.loads(_stdout)['archives']
except json.decoder.JSONDecodeError:
output[server][repo['name']] = []
self.logger.debug('[{0}]: (RESULT) {1}'.format(repo['name'], self.logger.debug('[{0}]: (RESULT) {1}'.format(repo['name'],
'\n'.join(_stdout))) '\n'.join(_stdout)))
self.logger.debug('[{0}]: STDERR: ({2}) ({1})'.format(repo['name'], self.logger.debug('[{0}]: STDERR: ({2}) ({1})'.format(repo['name'],
@ -544,15 +547,12 @@ class Backup(object):
_stderr)) _stderr))
if not self.args['archive']: if not self.args['archive']:
if self.args['numlimit'] > 0: if self.args['numlimit'] > 0:
try:
if self.args['old']: if self.args['old']:
output[server][repo['name']] = output[server][repo['name']][:self.args['numlimit']] output[server][repo['name']] = output[server][repo['name']][:self.args['numlimit']]
else: else:
output[server][repo['name']] = list( output[server][repo['name']] = list(
reversed( reversed(
output[server][repo['name']]))[:self.args['numlimit']] output[server][repo['name']]))[:self.args['numlimit']]
except KeyError:
print('(No archives/snapshots found)')
if self.args['invert']: if self.args['invert']:
output[server][repo['name']] = reversed(output[server][repo['name']]) output[server][repo['name']] = reversed(output[server][repo['name']])
self.logger.debug('END: lister') self.logger.debug('END: lister')