]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephadm: use cluster.sh and remote.sh for better readibility
authorDeepika Upadhyay <dupadhya@redhat.com>
Tue, 17 Nov 2020 09:06:48 +0000 (14:36 +0530)
committerDeepika Upadhyay <dupadhya@redhat.com>
Thu, 3 Dec 2020 15:53:12 +0000 (21:23 +0530)
in extention for: 95366255584093a251f14a16746c826a46fde5b2

Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
qa/tasks/cephadm.py

index 1b8a3c658a44fbe72c9a941e15e37f00d4e80050..5a2ded82a1b36054d1925973bedbde542ba87adf 100644 (file)
@@ -86,11 +86,7 @@ def normalize_hostnames(ctx):
     remote.shortname and socket.gethostname() in cephadm.
     """
     log.info('Normalizing hostnames...')
-    ctx.cluster.run(args=[
-        'sudo',
-        'hostname',
-        run.Raw('$(hostname -s)'),
-    ])
+    ctx.cluster.sh('sudo hostname $(hostname -s)')
 
     try:
         yield
@@ -235,28 +231,10 @@ def ceph_log(ctx, config):
                 not (ctx.config.get('archive-on-error') and ctx.summary['success']):
             # and logs
             log.info('Compressing logs...')
-            run.wait(
-                ctx.cluster.run(
-                    args=[
-                        'sudo',
-                        'find',
-                        '/var/log/ceph',   # all logs, not just for the cluster
-                        '/var/log/rbd-target-api', # ceph-iscsi
-                        '-name',
-                        '*.log',
-                        '-print0',
-                        run.Raw('|'),
-                        'sudo',
-                        'xargs',
-                        '-0',
-                        '--no-run-if-empty',
-                        '--',
-                        'gzip',
-                        '--',
-                    ],
-                    wait=False,
-                ),
-            )
+            ctx.cluster.sh(
+                'sudo find /var/log/ceph -name *.log -print0 | '
+                'sudo xargs -0 --no-run-if-empty -- gzip --',
+                wait=False)
 
             log.info('Archiving logs...')
             path = os.path.join(ctx.archive, 'remote')
@@ -330,12 +308,8 @@ def ceph_bootstrap(ctx, config, registry):
     first_mon_role = ctx.ceph[cluster_name].first_mon_role
     mons = ctx.ceph[cluster_name].mons
 
-    ctx.cluster.run(args=[
-        'sudo', 'mkdir', '-p', '/etc/ceph',
-        ]);
-    ctx.cluster.run(args=[
-        'sudo', 'chmod', '777', '/etc/ceph',
-        ]);
+    ctx.cluster.sh('sudo mkdir -p /etc/ceph')
+    ctx.cluster.sh('sudo chmod 777 /etc/ceph')
     if registry:
         add_mirror_to_cluster(ctx, registry)
     try:
@@ -423,15 +397,11 @@ def ceph_bootstrap(ctx, config, registry):
             f'{testdir}/{cluster_name}.pub').decode('ascii').strip()
 
         log.info('Installing pub ssh key for root users...')
-        ctx.cluster.run(args=[
-            'sudo', 'install', '-d', '-m', '0700', '/root/.ssh',
-            run.Raw('&&'),
-            'echo', ssh_pub_key,
-            run.Raw('|'),
-            'sudo', 'tee', '-a', '/root/.ssh/authorized_keys',
-            run.Raw('&&'),
-            'sudo', 'chmod', '0600', '/root/.ssh/authorized_keys',
-        ])
+        ctx.cluster.sh(
+            'sudo install -d -m 0700 /root/.ssh &&'
+            f'echo {ssh_pub_key} |'
+            'sudo tee -a /root/.ssh/authorized_keys &&'
+            'sudo chmod 0600 /root/.ssh/authorized_keys')
 
         # set options
         _shell(ctx, cluster_name, bootstrap_remote,