Skip to content

Commit 990b975

Browse files
author
Dan
committed
Merged variable substitution fix
1 parent 63ecc2b commit 990b975

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

fake_server/fake_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ def check_channel_forward_agent_request(self, channel):
9595
def check_channel_exec_request(self, channel, cmd):
9696
logger.debug("Got exec request on channel %s for cmd %s" % (channel, cmd,))
9797
# Remove any 'bash -c' and/or quotes from command
98-
cmd = cmd.replace('bash -c \"', "")
98+
cmd = cmd.replace('bash -c ', "")
9999
cmd = cmd.replace('\"', "")
100+
cmd = cmd.replace('\'', "")
100101
if not cmd in self.cmd_req_response:
101102
return False
102103
self.event.set()

pssh.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ def exec_command(self, command, sudo=False, user=None, **kwargs):
240240
self._read_output_buffer(_stderr,
241241
prefix='\t[err]')
242242
if sudo and not user:
243-
command = 'sudo -S bash -c "%s"' % command.replace('"', '\\"')
243+
command = 'sudo -S bash -c \'%s\'' % command.replace('"', '\\"')
244244
elif user:
245-
command = 'sudo -u %s -S bash -c "%s"' % (
245+
command = 'sudo -u %s -S bash -c \'%s\'' % (
246246
user, command.replace('"', '\\"'),)
247247
else:
248-
command = 'bash -c "%s"' % command.replace('"', '\\"')
248+
command = 'bash -c \'%s\'' % command.replace('"', '\\"')
249249
logger.debug("Running command %s on %s", command, self.host)
250250
channel.exec_command(command, **kwargs)
251251
logger.debug("Command started")
@@ -320,7 +320,7 @@ class ParallelSSHClient(object):
320320

321321
def __init__(self, hosts,
322322
user=None, password=None, port=None, pkey=None,
323-
forward_ssh_agent=True, num_retries=DEFAULT_RETRIES, timeout=None,
323+
forward_ssh_agent=True, num_retries=DEFAULT_RETRIES, timeout=120,
324324
pool_size=10, proxy_host=None, proxy_port=22):
325325
"""
326326
:param hosts: Hosts to connect to

0 commit comments

Comments
 (0)