From 22b832e94ed1d950d449fe157fcdd535c0ced9aa Mon Sep 17 00:00:00 2001 From: Deepika Upadhyay Date: Tue, 17 Nov 2020 14:15:30 +0530 Subject: [PATCH] qa/tasks/cephadm: refactor Signed-off-by: Deepika Upadhyay --- qa/tasks/cephadm.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index daee1aa8ee51..1b8a3c658a44 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -172,15 +172,9 @@ def ceph_log(ctx, config): cluster_name = config['cluster'] fsid = ctx.ceph[cluster_name].fsid - # 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' not in info_yaml: - info_yaml['archive'] = {'log': '/var/log/ceph'} - else: - info_yaml['archive']['log'] = '/var/log/ceph' - yaml.safe_dump(info_yaml, info_file, default_flow_style=False) + if ctx.archive is not None: + update_info_yaml(ctx.archive, 'log', '/var/log/ceph') + try: yield @@ -290,15 +284,8 @@ def ceph_crash(ctx, config): cluster_name = config['cluster'] fsid = ctx.ceph[cluster_name].fsid - # 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' not in info_yaml: - info_yaml['archive'] = {'crash': '/var/lib/ceph/%s/crash' % fsid} - else: - info_yaml['archive']['crash'] = '/var/lib/ceph/%s/crash' % fsid - yaml.safe_dump(info_yaml, info_file, default_flow_style=False) + if ctx.archive is not None: + update_info_yaml(ctx.archive, 'crash', '/var/lib/ceph/crash') try: yield -- 2.47.3