From 2f0209ae433a591981c65b6e7fc1dba663f4305f Mon Sep 17 00:00:00 2001 From: Deepika Upadhyay Date: Tue, 17 Nov 2020 14:10:56 +0530 Subject: [PATCH] qa/tasks/cephadm: update_info_yaml() only if ctx.archive is valid related to: 6cd8e4b55883b2d282f101f11521a2759b3db564 Signed-off-by: Deepika Upadhyay --- qa/tasks/cephadm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 34f09001c06..daee1aa8ee5 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): """ -- 2.47.3