yield
return
+ cluster = ctx.cluster.filter(lambda r: not r.is_container)
+ if not len(cluster.remotes.keys()):
+ yield
+ return
+
log.info('Starting syslog monitoring...')
archive_dir = misc.get_archive_dir(ctx)
log_dir = '{adir}/syslog'.format(adir=archive_dir)
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=['mkdir', '-p', '-m0755', '--', log_dir],
wait=False,
)
]
conf_fp = BytesIO('\n'.join(conf_lines).encode())
try:
- for rem in ctx.cluster.remotes.keys():
+ for rem in cluster.remotes.keys():
log_context = 'system_u:object_r:var_log_t:s0'
for log_path in (kern_log, misc_log):
rem.run(args=['install', '-m', '666', '/dev/null', log_path])
)
conf_fp.seek(0)
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=[
'sudo',
'service',
yield
finally:
+ cluster = ctx.cluster.filter(lambda r: not r.is_container)
+ if not len(cluster.remotes.keys()):
+ return
+
log.info('Shutting down syslog monitoring...')
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=[
'sudo',
'rm',
# flush the file fully. oh well.
log.info('Checking logs for errors...')
- for rem in ctx.cluster.remotes.keys():
+ for rem in cluster.remotes.keys():
log.debug('Checking %s', rem.name)
stdout = rem.sh(
[
log.info('Compressing syslogs...')
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=[
'find',
'{adir}/syslog'.format(adir=archive_dir),
log.info('Gathering journactl -b0...')
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=[
'sudo', 'journalctl', '-b0',
run.Raw('|'),