31 lines
1.0 KiB
Diff
31 lines
1.0 KiB
Diff
From 76ca28dc5ce222d24086b387a448ceeb53055e4b Mon Sep 17 00:00:00 2001
|
|
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
Date: Wed, 15 May 2019 16:21:01 -0400
|
|
Subject: [PATCH] [sosnode] Properly quote commands that need a pty
|
|
|
|
When we run locally and need a pty, we need to quote the command and
|
|
launch it in a bash shell to function correctly with pexpect.spawn().
|
|
|
|
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
---
|
|
soscollector/sosnode.py | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/soscollector/sosnode.py b/soscollector/sosnode.py
|
|
index 6c01471..fc42b94 100644
|
|
--- a/soscollector/sosnode.py
|
|
+++ b/soscollector/sosnode.py
|
|
@@ -366,6 +366,9 @@ class SosNode():
|
|
get_pty = True
|
|
if not self.local and not force_local:
|
|
cmd = "%s %s" % (self.ssh_cmd, quote(cmd))
|
|
+ else:
|
|
+ if get_pty:
|
|
+ cmd = "/bin/bash -c %s" % quote(cmd)
|
|
res = pexpect.spawn(cmd, encoding='utf-8')
|
|
if need_root:
|
|
if self.config['need_sudo']:
|
|
--
|
|
2.17.2
|
|
|