Skip to content

Commit

Permalink
use quote again
Browse files Browse the repository at this point in the history
  • Loading branch information
mietzen committed Dec 18, 2024
1 parent 14f195d commit cc5f94e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/connection/pct_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '''

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cc5f94e

Please sign in to comment.