]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephadm: refactor
authorDeepika Upadhyay <dupadhya@redhat.com>
Tue, 17 Nov 2020 08:45:30 +0000 (14:15 +0530)
committerDeepika Upadhyay <dupadhya@redhat.com>
Thu, 3 Dec 2020 15:53:12 +0000 (21:23 +0530)
Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
qa/tasks/cephadm.py

index daee1aa8ee5107a985fd2ce1868a916af1284e76..1b8a3c658a44fbe72c9a941e15e37f00d4e80050 100644 (file)
@@ -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