Skip to content
Browse files

Rename :no_password_prompt option to :password_prompt, reverse polarity

  • Loading branch information...
1 parent f674380 commit b0a188bc2cf7f5e0c06bfd4854ef64f17db7b11b @drichert committed Aug 15, 2012
Showing with 7 additions and 7 deletions.
  1. +2 −2 README.rdoc
  2. +4 −4 lib/rye/box.rb
  3. +1 −1 try/14_auth_methods_tryouts.rb
View
4 README.rdoc
@@ -167,9 +167,9 @@ So, the hostname 'filibuster' is used from 'firewall.lan'
== Example 9 -- Disable password prompt
-If you're running in a terminal but you want <tt>Net::SSH::AuthenticationFailed</tt> to be raised instead of getting a password prompt when authentication fails, use the <tt>:no_password_prompt</tt> option:
+If you're running in a terminal but you want <tt>Net::SSH::AuthenticationFailed</tt> to be raised instead of getting a password prompt when authentication fails, set <tt>:password_prompt</tt> option to false:
- rbox = Rye::Box.new("foo.com", :user => "dan", :password => "inkorrect", :no_password_prompt => true)
+ rbox = Rye::Box.new("foo.com", :user => "dan", :password => "inkorrect", :password_prompt => false)
rbox.uptime # => raises Net::SSH::AuthenticationFailed
== About Safe-Mode
View
8 lib/rye/box.rb
@@ -106,7 +106,7 @@ def exception_hook=(val); @rye_exception_hook = val; end
# * :password => the user's password (ignored if there's a valid private key)
# * :templates => the template engine to use for uploaded files. One of: :erb (default)
# * :sudo => Run all commands via sudo (default: false)
- # * :no_password_prompt => Never show a password prompt on auth failure (default: false)
+ # * :password_prompt => Never show a password prompt on auth failure (default: true)
#
# NOTE: +opts+ can also contain any parameter supported by
# Net::SSH.start that is not already mentioned above.
@@ -134,7 +134,7 @@ def initialize(host='localhost', opts={})
:getenv => true,
:templates => :erb,
:quiet => false,
- :no_password_prompt => false
+ :password_prompt => true
}.merge(opts)
# Close the SSH session before Ruby exits. This will do nothing
@@ -152,7 +152,7 @@ def initialize(host='localhost', opts={})
@rye_ostype, @rye_impltype = @rye_opts.delete(:ostype), @rye_opts.delete(:impltype)
@rye_quiet, @rye_sudo = @rye_opts.delete(:quiet), @rye_opts.delete(:sudo)
@rye_templates = @rye_opts.delete(:templates)
- @rye_no_password_prompt = @rye_opts.delete(:no_password_prompt)
+ @rye_password_prompt = @rye_opts.delete(:password_prompt)
# Store the state of the terminal
@rye_stty_save = `stty -g`.chomp rescue nil
@@ -687,7 +687,7 @@ def connect(reconnect=true)
# only auth method
if @rye_opts[:auth_methods] == ["publickey"]
raise Net::SSH::AuthenticationFailed
- elsif !@rye_no_password_prompt && (STDIN.tty? && retried <= 3)
+ elsif @rye_password_prompt && (STDIN.tty? && retried <= 3)
STDERR.puts "Passwordless login failed for #{@rye_user}"
@rye_opts[:password] = highline.ask("Password: ") { |q| q.echo = '' }.strip
@rye_opts[:auth_methods].push *['keyboard-interactive', 'password']
View
2 try/14_auth_methods_tryouts.rb
@@ -18,7 +18,7 @@
#=> Net::SSH::AuthenticationFailed
## Never prompt for password if :no_password_prompt option is true
-box = Rye::Box.new(@hostname, :no_password_prompt => true)
+box = Rye::Box.new(@hostname, :password_prompt => false)
begin
box.connect

0 comments on commit b0a188b

Please sign in to comment.
Something went wrong with that request. Please try again.