]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: use a dedicated cephadm tmp dir to copy remote files
authorRedouane Kachach <rkachach@redhat.com>
Wed, 29 Mar 2023 08:48:30 +0000 (10:48 +0200)
committerAdam King <adking@redhat.com>
Tue, 25 Apr 2023 12:36:55 +0000 (08:36 -0400)
Fixes: https://tracker.ceph.com/issues/59189
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit ef958d47b44f8e4579ae380bd9d6890c0c62e13a)

src/pybind/mgr/cephadm/ssh.py

index 8134cc0d9444b4adb9aa06007185012a2f78e39f..7ce4e463b923f4624f1385a0682485d58b7d879e 100644 (file)
@@ -223,14 +223,15 @@ class SSHManager:
                                  addr: Optional[str] = None,
                                  ) -> None:
         try:
+            cephadm_tmp_dir = f"/tmp/cephadm-{self.mgr._cluster_fsid}"
             dirname = os.path.dirname(path)
             await self._check_execute_command(host, ['mkdir', '-p', dirname], addr=addr)
-            await self._check_execute_command(host, ['mkdir', '-p', '/tmp' + dirname], addr=addr)
-            tmp_path = '/tmp' + path + '.new'
+            await self._check_execute_command(host, ['mkdir', '-p', cephadm_tmp_dir + dirname], addr=addr)
+            tmp_path = cephadm_tmp_dir + path + '.new'
             await self._check_execute_command(host, ['touch', tmp_path], addr=addr)
             if self.mgr.ssh_user != 'root':
                 assert self.mgr.ssh_user
-                await self._check_execute_command(host, ['chown', '-R', self.mgr.ssh_user, tmp_path], addr=addr)
+                await self._check_execute_command(host, ['chown', '-R', self.mgr.ssh_user, cephadm_tmp_dir], addr=addr)
                 await self._check_execute_command(host, ['chmod', str(644), tmp_path], addr=addr)
             with NamedTemporaryFile(prefix='cephadm-write-remote-file-') as f:
                 os.fchmod(f.fileno(), 0o600)