From: Deepika Upadhyay Date: Tue, 17 Nov 2020 08:40:56 +0000 (+0530) Subject: qa/tasks/cephadm: update_info_yaml() only if ctx.archive is valid X-Git-Tag: v16.1.0~319^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2f0209ae433a591981c65b6e7fc1dba663f4305f;p=ceph.git qa/tasks/cephadm: update_info_yaml() only if ctx.archive is valid related to: 6cd8e4b55883b2d282f101f11521a2759b3db564 Signed-off-by: Deepika Upadhyay --- diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 34f09001c06d..daee1aa8ee51 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -66,6 +66,19 @@ def build_initial_config(ctx, config): return conf +def update_info_yaml(archive_dir, key, value): + """ + Add logs directory to job's info log file + """ + 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: + info_yaml['archive'][key] = value + else: + info_yaml['archive'] = {key: value} + yaml.safe_dump(info_yaml, info_file, default_flow_style=False) + @contextlib.contextmanager def normalize_hostnames(ctx): """