Optional flag makes us suck down the archive (mostly, the logs, which
might be huge for some debugging tests) unless the test has failed.
Signed-off-by: Sage Weil <sage@inktank.com>
try:
yield
+ except:
+ # we need to know this below
+ ctx.summary['success'] = False
+ raise
finally:
(mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
check_status=False,
)
- if ctx.archive is not None:
+ if ctx.archive is not None and \
+ not (ctx.config.get('archive-on-error') and ctx.summary['success']):
# archive mon data, too
log.info('Archiving mon data...')
path = os.path.join(ctx.archive, 'data')
try:
yield
+ except:
+ # we need to know this below
+ ctx.summary['success'] = False
+ raise
finally:
- if ctx.archive is not None:
+ if ctx.archive is not None and \
+ not (ctx.config.get('archive-on-error') and ctx.summary['success']):
log.info('Transferring archived files...')
logdir = os.path.join(ctx.archive, 'remote')
for remote in ctx.cluster.remotes.iterkeys():