# shlex quote takes str or byte object, not int
await self._check_execute_command(host, ['chown', '-R', str(uid) + ':' + str(gid), tmp_path], addr=addr)
await self._check_execute_command(host, ['chmod', oct(mode)[2:], tmp_path], addr=addr)
- await self._check_execute_command(host, ['tee', '-', tmp_path], stdin=content, addr=addr)
+ with NamedTemporaryFile(prefix='cephadm-write-remote-file-') as f:
+ os.fchmod(f.fileno(), 0o600)
+ f.write(content)
+ f.flush()
+ conn = await self._remote_connection(host, addr)
+ await asyncssh.scp(f.name, (conn, tmp_path))
await self._check_execute_command(host, ['mv', tmp_path, path], addr=addr)
except Exception as e:
msg = f"Unable to write {host}:{path}: {e}"