From a2b207ced74ebc0f8b4a671940e7e4923d59be21 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Fri, 12 Jan 2024 15:58:41 +0530 Subject: [PATCH] qa/cephfs: don't strip any whitespace for get_shell_stdout Whitespace is not removed from the end of the stdout returned by the method get_ceph_cmd_stdout(). Follow the same policy here since it is better to not do so (this whitespace can be useful, when copying Ceph auth keyrings from stdout to a file) and also for sake of uniformity of interfaces. Signed-off-by: Rishabh Dave (cherry picked from commit 9582b9b13a42fae4c7f38c22f9202eb893b6f1bc) Conflicts: qa/tasks/cephfs/mount.py - Conflict occured for 2 reasons - - One, method get_shell_stdout() is absent on Reef branch but not in main so this patch which makes modification to it will obviously run in to conflict - Two, run_shell_payload() lies right next to get_shell_stdout() in main branch and its definition is quite different, leading to conflict again. --- qa/tasks/cephfs/mount.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qa/tasks/cephfs/mount.py b/qa/tasks/cephfs/mount.py index 6c4b0a8ca2b..b418f88140f 100644 --- a/qa/tasks/cephfs/mount.py +++ b/qa/tasks/cephfs/mount.py @@ -782,6 +782,10 @@ class CephFSMount(object): stdout=stdout, stderr=stderr, omit_sudo=omit_sudo, **kwargs) + def get_shell_stdout(self, args, timeout=300, **kwargs): + return self.run_shell(args=args, timeout=timeout, **kwargs).stdout.\ + getvalue() + def run_shell_payload(self, payload, **kwargs): kwargs['args'] = ["bash", "-c", Raw(f"'{payload}'")] if kwargs.pop('sudo', False): -- 2.39.5