lib/kontena/cli/nodes/ssh_command.rb in kontena-cli-1.3.5 vs lib/kontena/cli/nodes/ssh_command.rb in kontena-cli-1.4.0.pre1
- old
+ new
@@ -1,11 +1,11 @@
module Kontena::Cli::Nodes
class SshCommand < Kontena::Command
include Kontena::Cli::Common
include Kontena::Cli::GridOptions
- parameter "[NODE_ID]", "SSH to Grid node. Use --any to connect to the first available node"
+ parameter "[NODE]", "SSH to Grid node. Use --any to connect to the first available node"
parameter "[COMMANDS] ...", "Run command on host"
option ["-a", "--any"], :flag, "Connect to first available node"
option ["-i", "--identity-file"], "IDENTITY_FILE", "Path to ssh private key"
option ["-u", "--user"], "USER", "Login as a user", default: "core"
option "--private-ip", :flag, "Connect to node's private IP address"
@@ -13,13 +13,13 @@
requires_current_master
requires_current_grid
def execute
- exit_with_error "Cannot combine --any with a node name" if node_id && any?
+ exit_with_error "Cannot combine --any with a node name" if self.node && any?
- if node_id
- node = client.get("nodes/#{current_grid}/#{node_id}")
+ if self.node
+ node = client.get("nodes/#{current_grid}/#{self.node}")
elsif any?
nodes = client.get("grids/#{current_grid}/nodes")['nodes']
node = nodes.select{ |node| node['connected'] }.first
else
exit_with_error "No node name given. Use --any to connect to the first available node"