qa/tasks/ceph: rename s/update_archive_setting/update_info_yaml

Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
This commit is contained in:
Deepika Upadhyay 2020-11-17 14:39:17 +05:30
parent 6d7ba1180e
commit 4da3b23b89
2 changed files with 12 additions and 13 deletions

View File

@ -74,8 +74,11 @@ def generate_caps(type_):
yield capability
def update_archive_setting(archive_dir, key, value):
with open(os.path.join(archive_dir, 'info.yaml'), 'r+') as info_file:
def update_archive_setting(ctx, key, value):
"""
Add logs directory to job's info log file
"""
with open(os.path.join(ctx.archive, 'info.yaml'), 'r+') as info_file:
info_yaml = yaml.safe_load(info_file)
info_file.seek(0)
if 'archive' in info_yaml:
@ -91,9 +94,8 @@ def ceph_crash(ctx, config):
Gather crash dumps from /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')
# Add crash directory to job's archive
update_archive_setting(ctx, 'crash', '/var/lib/ceph/crash')
try:
yield
@ -165,8 +167,7 @@ def ceph_log(ctx, config):
)
# Add logs directory to job's info log file
if ctx.archive is not None:
update_archive_setting(ctx.archive, 'log', '/var/log/ceph')
update_archive_setting(ctx, 'log', '/var/log/ceph')
class Rotater(object):
stop_event = gevent.event.Event()

View File

@ -66,11 +66,11 @@ def build_initial_config(ctx, config):
return conf
def update_info_yaml(archive_dir, key, value):
def update_archive_setting(ctx, key, value):
"""
Add logs directory to job's info log file
"""
with open(os.path.join(archive_dir, 'info.yaml'), 'r+') as info_file:
with open(os.path.join(ctx.archive, 'info.yaml'), 'r+') as info_file:
info_yaml = yaml.safe_load(info_file)
info_file.seek(0)
if 'archive' in info_yaml:
@ -168,8 +168,7 @@ def ceph_log(ctx, config):
cluster_name = config['cluster']
fsid = ctx.ceph[cluster_name].fsid
if ctx.archive is not None:
update_info_yaml(ctx.archive, 'log', '/var/log/ceph')
update_archive_setting(ctx, 'log', '/var/log/ceph')
try:
@ -262,8 +261,7 @@ def ceph_crash(ctx, config):
cluster_name = config['cluster']
fsid = ctx.ceph[cluster_name].fsid
if ctx.archive is not None:
update_info_yaml(ctx.archive, 'crash', '/var/lib/ceph/crash')
update_archive_setting(ctx, 'crash', '/var/lib/ceph/crash')
try:
yield