summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2020-03-12 14:27:02 +0530
committerTim Smith <tsmith84@gmail.com>2020-09-02 13:57:52 -0700
commit327997a13b5f273f34a319e2e7b6aa2abd877f11 (patch)
tree5ef46fa62241bfa1cb973311257804be380057d7
parent39d0d96a129b710f6a4fae466d72962bb16ee185 (diff)
downloadchef-327997a13b5f273f34a319e2e7b6aa2abd877f11.tar.gz
Fix knife ssh freeze on windows
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r--lib/chef/knife/ssh.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 6a8e10267d..41d002cbd6 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -134,6 +134,12 @@ class Chef
boolean: true,
default: false
+ option :ssh_pty,
+ long: "--ssh-pty",
+ description: "PTY flag. Provide this option if PTY is configured on node.",
+ boolean: true,
+ default: false
+
def session
ssh_error_handler = Proc.new do |server|
if config[:on_error]
@@ -366,7 +372,11 @@ class Chef
if config[:on_error] && exit_status != 0
chan.close
else
- chan.request_pty
+ if config[:ssh_pty]
+ chan.request_pty do |ch, success|
+ raise Train::Transports::SSHPTYFailed, "Requesting PTY failed" unless success
+ end
+ end
chan.exec command do |ch, success|
raise ArgumentError, "Cannot execute #{command}" unless success