From cc5f94e4cee468937e76f9385f39835ea7837667 Mon Sep 17 00:00:00 2001 From: Nils Stein <31704359+mietzen@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:35:32 +0100 Subject: [PATCH] use quote again --- plugins/connection/pct_remote.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/connection/pct_remote.py b/plugins/connection/pct_remote.py index a5b11d8bb46..17cb54ac5de 100644 --- a/plugins/connection/pct_remote.py +++ b/plugins/connection/pct_remote.py @@ -384,6 +384,10 @@ def become_command(): return os.getenv('ANSIBLE_BECOME_METHOD', default=C.DEFAULT_BECOME_METHOD) +def shell(): + return os.getenv('ANSIBLE_EXECUTABLE', default=C.DEFAULT_EXECUTABLE) + + class Connection(ConnectionBase): ''' SSH based connections (paramiko) to Proxmox pct ''' @@ -527,7 +531,7 @@ def _connect_uncached(self) -> paramiko.SSHClient: def exec_command(self, cmd: str, in_data: bytes | None = None, sudoable: bool = True) -> tuple[int, bytes, bytes]: ''' execute a command inside the proxmox container ''' cmd = ['/usr/sbin/pct', 'exec', - str(self.get_option('vmid')), '--', cmd] + str(self.get_option('vmid')), '--', shell(), '-c', quote(cmd)] if self.get_option('remote_user') != 'root': cmd = [become_command()] + cmd return self._ssh_exec_command(' '.join(cmd), in_data=in_data, sudoable=sudoable)