mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
qa/tasks/ceph: update_archive_setting() only if ctx.archive is valid
When running teuthology interactively, ctx.archive might not be set. If it's not set, there is no point trying to access files there. Fixes: https://tracker.ceph.com/issues/48058 Signed-off-by: Marcus Watts <mwatts@redhat.com> Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
a0e1a8f173
commit
de71f6b0a3
@ -73,8 +73,8 @@ def generate_caps(type_):
|
||||
yield capability
|
||||
|
||||
|
||||
def update_archive_setting(ctx, key, value):
|
||||
with open(os.path.join(ctx.archive, 'info.yaml'), 'r+') as info_file:
|
||||
def update_archive_setting(archive_dir, key, value):
|
||||
with open(os.path.join(archive_dir, 'info.yaml'), 'r+') as info_file:
|
||||
info_yaml = yaml.safe_load(info_file)
|
||||
info_file.seek(0)
|
||||
if 'archive' in info_yaml:
|
||||
@ -90,8 +90,9 @@ def ceph_crash(ctx, config):
|
||||
Gather crash dumps from /var/lib/ceph/crash
|
||||
"""
|
||||
|
||||
# Add crash directory to job's archive
|
||||
update_archive_setting(ctx, 'crash', '/var/lib/ceph/crash')
|
||||
if ctx.archive is not None:
|
||||
# Add crash directory to job's archive
|
||||
update_archive_setting(ctx.archive, 'crash', '/var/lib/ceph/crash')
|
||||
|
||||
try:
|
||||
yield
|
||||
@ -163,7 +164,8 @@ def ceph_log(ctx, config):
|
||||
)
|
||||
|
||||
# Add logs directory to job's info log file
|
||||
update_archive_setting(ctx, 'log', '/var/log/ceph')
|
||||
if ctx.archive is not None:
|
||||
update_archive_setting(ctx.archive, 'log', '/var/log/ceph')
|
||||
|
||||
class Rotater(object):
|
||||
stop_event = gevent.event.Event()
|
||||
|
Loading…
Reference in New Issue
Block a user