]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks/cephadm: update_info_yaml() only if ctx.archive is valid
authorDeepika Upadhyay <dupadhya@redhat.com>
Tue, 17 Nov 2020 08:40:56 +0000 (14:10 +0530)
committerDeepika Upadhyay <dupadhya@redhat.com>
Thu, 3 Dec 2020 15:53:11 +0000 (21:23 +0530)
related to: 6cd8e4b55883b2d282f101f11521a2759b3db564
Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
qa/tasks/cephadm.py

index 34f09001c06d7618395142041987e6965e1fb4c2..daee1aa8ee5107a985fd2ce1868a916af1284e76 100644 (file)
@@ -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):
     """