From 4da3b23b89cf6cfed6b5c107f087c4aa2ff60906 Mon Sep 17 00:00:00 2001 From: Deepika Upadhyay Date: Tue, 17 Nov 2020 14:39:17 +0530 Subject: [PATCH] qa/tasks/ceph: rename s/update_archive_setting/update_info_yaml Signed-off-by: Deepika Upadhyay --- qa/tasks/ceph.py | 15 ++++++++------- qa/tasks/cephadm.py | 10 ++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index 1d5dcc24759..7685a132f10 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -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() diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 5a2ded82a1b..027b8dc7b3b 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -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 -- 2.39.5