aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-07-29 21:06:36 -0700
committerelijah <elijah@riseup.net>2013-07-29 21:06:36 -0700
commit0108ea577ed833f40866789e34af00c5e526224b (patch)
treedbb5c0ea5af13efea8a7e6410f967e2003108273
parente00e5d2b501a0d2727ea84fb1ea3e597e1e37ee4 (diff)
downloadleap_cli-0108ea577ed833f40866789e34af00c5e526224b.tar.gz
leap_cli-0108ea577ed833f40866789e34af00c5e526224b.tar.bz2
allow ssh to disabled nodes
-rw-r--r--lib/leap_cli/commands/node.rb5
-rw-r--r--lib/leap_cli/commands/shell.rb2
-rw-r--r--lib/leap_cli/config/manager.rb9
3 files changed, 13 insertions, 3 deletions
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb
index b700a90..0d33071 100644
--- a/lib/leap_cli/commands/node.rb
+++ b/lib/leap_cli/commands/node.rb
@@ -139,9 +139,12 @@ module LeapCli; module Commands
write_file!(:known_hosts, buffer.string)
end
- def get_node_from_args(args)
+ def get_node_from_args(args, options={})
node_name = args.first
node = manager.node(node_name)
+ if node.nil? && options[:include_disabled]
+ node = manager.disabled_node(node_name)
+ end
assert!(node, "Node '#{node_name}' not found.")
node
end
diff --git a/lib/leap_cli/commands/shell.rb b/lib/leap_cli/commands/shell.rb
index e87e810..40990e9 100644
--- a/lib/leap_cli/commands/shell.rb
+++ b/lib/leap_cli/commands/shell.rb
@@ -35,7 +35,7 @@ module LeapCli; module Commands
private
def exec_ssh(cmd, args)
- node = get_node_from_args(args)
+ node = get_node_from_args(args, :include_disabled => true)
options = [
"-o 'HostName=#{node.ip_address}'",
# "-o 'HostKeyAlias=#{node.name}'", << oddly incompatible with ports in known_hosts file, so we must not use this or non-standard ports break.
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb
index f34566c..9f05713 100644
--- a/lib/leap_cli/config/manager.rb
+++ b/lib/leap_cli/config/manager.rb
@@ -184,7 +184,14 @@ module LeapCli
# returns a single Config::Object that corresponds to a Node.
#
def node(name)
- nodes[name]
+ @nodes[name]
+ end
+
+ #
+ # returns a single node that is disabled
+ #
+ def disabled_node(name)
+ @disabled_nodes[name]
end
#