]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: do not use sudo for root user 46303/head
authorRedouane Kachach <rkachach@redhat.com>
Tue, 17 May 2022 10:32:50 +0000 (12:32 +0200)
committerRedouane Kachach <rkachach@redhat.com>
Tue, 17 May 2022 10:32:50 +0000 (12:32 +0200)
Fixes: https://tracker.ceph.com/issues/55641
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
src/pybind/mgr/cephadm/ssh.py

index 56c5d771569ed2d96a06f3554b4777775d345580..475044c3945ece022dadcc1e0aed14e7074d2703 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)