From: Deepika Upadhyay Date: Tue, 17 Nov 2020 08:45:30 +0000 (+0530) Subject: qa/tasks/cephadm: refactor X-Git-Tag: v16.1.0~319^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=22b832e94ed1d950d449fe157fcdd535c0ced9aa;p=ceph.git qa/tasks/cephadm: refactor Signed-off-by: Deepika Upadhyay --- 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