diff options
author | elijah <elijah@riseup.net> | 2013-02-07 00:38:50 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-02-07 00:38:50 -0800 |
commit | 8795fe0c766e85f331084ea2580d1ad4c2890e7f (patch) | |
tree | d5b7f8b3df11c388c62eb5e501c514df3850b6f7 /lib/leap_cli/commands/node.rb | |
parent | 6bfcfb412bdee4ea413aeab4f8ce28fe775d9372 (diff) |
added global --yes option
Diffstat (limited to 'lib/leap_cli/commands/node.rb')
-rw-r--r-- | lib/leap_cli/commands/node.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb index 6a60c45..da29a02 100644 --- a/lib/leap_cli/commands/node.rb +++ b/lib/leap_cli/commands/node.rb @@ -45,12 +45,12 @@ module LeapCli; module Commands node.arg_name '<node-filter>' #, :optional => false, :multiple => false node.command :init do |init| init.switch 'echo', :desc => 'If set, passwords are visible as you type them (default is hidden)', :negatable => false - init.action do |global_options,options,args| + init.action do |global,options,args| assert! args.any?, 'You must specify a node-filter' finished = [] manager.filter(args).each_node do |node| ping_node(node) - save_public_host_key(node) + save_public_host_key(node, global) update_compiled_ssh_configs ssh_connect(node, :bootstrap => true, :echo => options[:echo]) do |ssh| ssh.install_authorized_keys @@ -133,7 +133,7 @@ module LeapCli; module Commands # # see `man sshd` for the format of known_hosts # - def save_public_host_key(node) + def save_public_host_key(node, global) log :fetching, "public SSH host key for #{node.name}" public_key = get_public_key_for_ip(node.ip_address, node.ssh.port) pub_key_path = Path.named_path([:node_ssh_pub_key, node.name]) @@ -154,7 +154,7 @@ module LeapCli; module Commands say("Type -- #{public_key.bits} bit #{public_key.type.upcase}") say("Fingerprint -- " + public_key.fingerprint) say("Public Key -- " + public_key.key) - if !agree("Is this correct? ") + if !global[:yes] && !agree("Is this correct? ") bail! else puts |