diff options
author | dheerajd-msys <dheeraj.dubey@msystechnologies.com> | 2020-03-12 14:27:02 +0530 |
---|---|---|
committer | dheerajd-msys <dheeraj.dubey@msystechnologies.com> | 2020-08-19 18:52:37 +0530 |
commit | 506876bf5b3cafb015ad9e22a62b76af5021b6e9 (patch) | |
tree | 6ef31b47231b83cf7624b2316c3cfc8791e5572d /lib | |
parent | 61086ef5aa015fd59d7841959b887e798f5bffba (diff) | |
download | chef-506876bf5b3cafb015ad9e22a62b76af5021b6e9.tar.gz |
Fix knife ssh freeze on windows
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/knife/ssh.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 5e856ec011..b40f845dbd 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] @@ -362,7 +368,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 |