summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Vežnaver <rveznaver@users.noreply.github.com>2020-12-10 22:29:44 +0100
committerRobert Vežnaver <rveznaver@users.noreply.github.com>2020-12-10 22:39:26 +0100
commitefa878d81c03cb2a977038ac5a0fb835af3dfc9f (patch)
treef9ea159be83ea0bf2031a126904f493272b6c98d
parent2962e7781b5ec1923f4becb22020803a559f8073 (diff)
downloadchef-efa878d81c03cb2a977038ac5a0fb835af3dfc9f.tar.gz
Raise error and retry with PTY on sudo password prompt
Signed-off-by: Robert Vežnaver <rveznaver@users.noreply.github.com>
-rw-r--r--lib/chef/knife/ssh.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 8b254c13aa..d65b1af000 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -27,6 +27,7 @@ class Chef
require "net/ssh" unless defined?(Net::SSH)
require "net/ssh/multi"
require "readline"
+ require "tty-prompt"
require_relative "../exceptions"
require_relative "../search/query"
require_relative "../util/path_helper"
@@ -385,6 +386,7 @@ class Chef
end
ch.on_extended_data do |_, _type, data|
+ raise ArgumentError if data.eql?("sudo: no tty present and no askpass program specified\n")
stderr += data
end