Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Rename :no_password_prompt option to :password_prompt, reverse polarity

  • Loading branch information...
commit b0a188bc2cf7f5e0c06bfd4854ef64f17db7b11b 1 parent f674380
Dan Richert authored
4 README.rdoc
Source Rendered
@@ -167,9 +167,9 @@ So, the hostname 'filibuster' is used from 'firewall.lan'
167 167
168 168 == Example 9 -- Disable password prompt
169 169
170   -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:
  170 +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:
171 171
172   - rbox = Rye::Box.new("foo.com", :user => "dan", :password => "inkorrect", :no_password_prompt => true)
  172 + rbox = Rye::Box.new("foo.com", :user => "dan", :password => "inkorrect", :password_prompt => false)
173 173 rbox.uptime # => raises Net::SSH::AuthenticationFailed
174 174
175 175 == About Safe-Mode
8 lib/rye/box.rb
@@ -106,7 +106,7 @@ def exception_hook=(val); @rye_exception_hook = val; end
106 106 # * :password => the user's password (ignored if there's a valid private key)
107 107 # * :templates => the template engine to use for uploaded files. One of: :erb (default)
108 108 # * :sudo => Run all commands via sudo (default: false)
109   - # * :no_password_prompt => Never show a password prompt on auth failure (default: false)
  109 + # * :password_prompt => Never show a password prompt on auth failure (default: true)
110 110 #
111 111 # NOTE: +opts+ can also contain any parameter supported by
112 112 # Net::SSH.start that is not already mentioned above.
@@ -134,7 +134,7 @@ def initialize(host='localhost', opts={})
134 134 :getenv => true,
135 135 :templates => :erb,
136 136 :quiet => false,
137   - :no_password_prompt => false
  137 + :password_prompt => true
138 138 }.merge(opts)
139 139
140 140 # Close the SSH session before Ruby exits. This will do nothing
@@ -152,7 +152,7 @@ def initialize(host='localhost', opts={})
152 152 @rye_ostype, @rye_impltype = @rye_opts.delete(:ostype), @rye_opts.delete(:impltype)
153 153 @rye_quiet, @rye_sudo = @rye_opts.delete(:quiet), @rye_opts.delete(:sudo)
154 154 @rye_templates = @rye_opts.delete(:templates)
155   - @rye_no_password_prompt = @rye_opts.delete(:no_password_prompt)
  155 + @rye_password_prompt = @rye_opts.delete(:password_prompt)
156 156
157 157 # Store the state of the terminal
158 158 @rye_stty_save = `stty -g`.chomp rescue nil
@@ -687,7 +687,7 @@ def connect(reconnect=true)
687 687 # only auth method
688 688 if @rye_opts[:auth_methods] == ["publickey"]
689 689 raise Net::SSH::AuthenticationFailed
690   - elsif !@rye_no_password_prompt && (STDIN.tty? && retried <= 3)
  690 + elsif @rye_password_prompt && (STDIN.tty? && retried <= 3)
691 691 STDERR.puts "Passwordless login failed for #{@rye_user}"
692 692 @rye_opts[:password] = highline.ask("Password: ") { |q| q.echo = '' }.strip
693 693 @rye_opts[:auth_methods].push *['keyboard-interactive', 'password']
2  try/14_auth_methods_tryouts.rb
@@ -18,7 +18,7 @@
18 18 #=> Net::SSH::AuthenticationFailed
19 19
20 20 ## Never prompt for password if :no_password_prompt option is true
21   -box = Rye::Box.new(@hostname, :no_password_prompt => true)
  21 +box = Rye::Box.new(@hostname, :password_prompt => false)
22 22
23 23 begin
24 24 box.connect

0 comments on commit b0a188b

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