summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2019-08-29 11:47:20 +0530
committerVivek Singh <vivek.singh@msystechnologies.com>2019-08-29 11:47:20 +0530
commitc111f1906a85fa098b0f6eb9b785ee0ca6fc9efa (patch)
treebca0a13b0f1144a03821820d4d5c5b951bea6f9c /lib/chef/knife
parent1ea61ba8bb6a7f455fb535f2b3626fcfbc53932d (diff)
downloadchef-c111f1906a85fa098b0f6eb9b785ee0ca6fc9efa.tar.gz
Replace exception text check with reason symbol
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/bootstrap.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index 612e119760..efa1515858 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -673,7 +673,7 @@ class Chef
@connection = TrainConnector.new(host_descriptor, connection_protocol, conn_options)
connection.connect!
rescue Train::UserError => e
- if !conn_options.key?(:pty) && e.message =~ /Sudo requires a TTY/
+ if !conn_options.key?(:pty) && e.reason == :sudo_no_tty
ui.warn("#{e.message} - trying with pty request")
conn_options[:pty] = true # ensure we can talk to systems with requiretty set true in sshd config
retry