mirror of
https://github.com/ceph/ceph
synced 2024-12-18 17:37:38 +00:00
qa/tasks/ceph: use Cluster.sh() and Remote.sh() when appropriate
for better readability Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
de71f6b0a3
commit
9536625558
@ -230,24 +230,10 @@ def ceph_log(ctx, config):
|
||||
|
||||
for remote in ctx.cluster.remotes.keys():
|
||||
remote.write_file(remote_logrotate_conf, BytesIO(conf.encode()))
|
||||
remote.run(
|
||||
args=[
|
||||
'sudo',
|
||||
'mv',
|
||||
remote_logrotate_conf,
|
||||
'/etc/logrotate.d/ceph-test.conf',
|
||||
run.Raw('&&'),
|
||||
'sudo',
|
||||
'chmod',
|
||||
'0644',
|
||||
'/etc/logrotate.d/ceph-test.conf',
|
||||
run.Raw('&&'),
|
||||
'sudo',
|
||||
'chown',
|
||||
'root.root',
|
||||
'/etc/logrotate.d/ceph-test.conf'
|
||||
]
|
||||
)
|
||||
remote.sh(
|
||||
f'sudo mv {remote_logrotate_conf} /etc/logrotate.d/ceph-test.conf && '
|
||||
'sudo chmod 0644 /etc/logrotate.d/ceph-test.conf && '
|
||||
'sudo chown root.root /etc/logrotate.d/ceph-test.conf')
|
||||
remote.chcon('/etc/logrotate.d/ceph-test.conf',
|
||||
'system_u:object_r:etc_t:s0')
|
||||
|
||||
@ -264,35 +250,15 @@ def ceph_log(ctx, config):
|
||||
if ctx.config.get('log-rotate'):
|
||||
log.info('Shutting down logrotate')
|
||||
logrotater.end()
|
||||
ctx.cluster.run(
|
||||
args=['sudo', 'rm', '/etc/logrotate.d/ceph-test.conf'
|
||||
]
|
||||
)
|
||||
ctx.cluster.sh('sudo rm /etc/logrotate.d/ceph-test.conf')
|
||||
if ctx.archive is not None and \
|
||||
not (ctx.config.get('archive-on-error') and ctx.summary['success']):
|
||||
# and logs
|
||||
log.info('Compressing logs...')
|
||||
run.wait(
|
||||
ctx.cluster.run(
|
||||
args=[
|
||||
'sudo',
|
||||
'find',
|
||||
'/var/log/ceph',
|
||||
'-name',
|
||||
'*.log',
|
||||
'-print0',
|
||||
run.Raw('|'),
|
||||
'sudo',
|
||||
'xargs',
|
||||
'-0',
|
||||
'--no-run-if-empty',
|
||||
'--',
|
||||
'gzip',
|
||||
'--',
|
||||
],
|
||||
wait=False,
|
||||
),
|
||||
)
|
||||
ctx.cluster.sh(
|
||||
'sudo find /var/log/ceph -name *.log -print0 | '
|
||||
'sudo xargs -0 --no-run-if-empty -- gzip --',
|
||||
wait=False)
|
||||
|
||||
log.info('Archiving logs...')
|
||||
path = os.path.join(ctx.archive, 'remote')
|
||||
|
Loading…
Reference in New Issue
Block a user