aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/util.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-10-29 13:17:34 -0700
committerelijah <elijah@riseup.net>2012-10-29 13:17:34 -0700
commit7d78ba9f3a684b1227f362d923ca536bab487d91 (patch)
treeb821e5852a12bd8206213d49afb76deda82257e9 /lib/leap_cli/commands/util.rb
parentcd7a9e75064947ec6ea426623b4774cce63f4b5e (diff)
downloadleap_cli-7d78ba9f3a684b1227f362d923ca536bab487d91.tar.gz
leap_cli-7d78ba9f3a684b1227f362d923ca536bab487d91.tar.bz2
make typed passwords invisible again (use --echo to make them visible)
Diffstat (limited to 'lib/leap_cli/commands/util.rb')
-rw-r--r--lib/leap_cli/commands/util.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/leap_cli/commands/util.rb b/lib/leap_cli/commands/util.rb
index aa888e0..d9e6923 100644
--- a/lib/leap_cli/commands/util.rb
+++ b/lib/leap_cli/commands/util.rb
@@ -67,8 +67,13 @@ module LeapCli; module Commands
#
if options[:bootstrap] && node_list.size == 1
hostname = node_list.values.first.name
- cap.set(:password) { ask("SSH password for #{user}@#{hostname}> ") } # only called if needed
- # this can be used instead to hide echo -- Capistrano::CLI.password_prompt
+
+ # the 'password' block is only called if key auth fails
+ if options[:echo]
+ cap.set(:password) { ask "Root SSH password for #{user}@#{hostname}> " }
+ else
+ cap.set(:password) { Capistrano::CLI.password_prompt " * Typed password will be hidden (use --echo to make it visible)\nRoot SSH password for #{user}@#{hostname}> " }
+ end
end
node_list.each do |name, node|
@@ -98,9 +103,9 @@ module LeapCli; module Commands
# http://railsware.com/blog/2011/11/02/advanced-server-definitions-in-capistrano/
#
def node_options(node)
- password_proc = Proc.new {Capistrano::CLI.password_prompt "Root SSH password for #{node.name}"} # only called if needed
+ #password_proc = Proc.new {Capistrano::CLI.password_prompt "Root SSH password for #{node.name}"} # only called if needed
{
- :password => password_proc,
+ #:password => password_proc,
:ssh_options => {
:host_key_alias => node.name,
:host_name => node.ip_address,
@@ -113,7 +118,7 @@ module LeapCli; module Commands
# load once the library files
@capistrano_enabled ||= begin
require 'capistrano'
- #require 'capistrano/cli'
+ require 'capistrano/cli'
require 'leap_cli/remote/plugin'
Capistrano.plugin :leap, LeapCli::Remote::Plugin
true