]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: do not use sudo for root user
authorRedouane Kachach <rkachach@redhat.com>
Tue, 17 May 2022 10:32:50 +0000 (12:32 +0200)
committerAdam King <adking@redhat.com>
Sat, 21 May 2022 23:09:15 +0000 (19:09 -0400)
Fixes: https://tracker.ceph.com/issues/55641
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit 7cfcc7ef089cb3458040b9b592a7d0bafbf4c2c2)

src/pybind/mgr/cephadm/ssh.py

index fb2d001fc2ae7fe823eabf8baea95bd65c89afa3..e874ba6d78fe860b6ed969f1c6d15a7c71d13193 100644 (file)
@@ -136,7 +136,8 @@ class SSHManager:
                                addr: Optional[str] = None,
                                ) -> Tuple[str, str, int]:
         conn = await self._remote_connection(host, addr)
-        cmd = "sudo " + " ".join(quote(x) for x in cmd)
+        sudo_prefix = "sudo " if self.mgr.ssh_user != 'root' else ""
+        cmd = sudo_prefix + " ".join(quote(x) for x in cmd)
         logger.debug(f'Running command: {cmd}')
         try:
             r = await conn.run('sudo true', check=True, timeout=5)