Class: Central::Cli::Nodes::SshCommand
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- Central::Cli::Nodes::SshCommand
- Includes:
- Common, StackOptions
- Defined in:
- lib/central/cli/nodes/ssh_command.rb
Instance Method Summary collapse
Methods included from StackOptions
Methods included from Common
#access_token=, #add_master, #api_url, #api_url=, #clear_current_stack, #client, #current_master, #current_master=, #current_master_index, #current_stack, #current_stack=, #ensure_custom_ssl_ca, #require_api_url, #require_current_stack, #require_token, #reset_client, #save_settings, #settings, #settings_filename
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/central/cli/nodes/ssh_command.rb', line 12 def execute require_api_url require_current_stack token = require_token node = client(token).get("stacks/#{current_stack}/nodes/#{node_id}") cmd = ['ssh'] cmd << "-i #{identity_file}" if identity_file ip = if internal_ip? "10.81.0.#{node['node_number']}" elsif private_ip? node['private_ip'] else node['public_ip'] end cmd << "#{user}@#{ip}" exec(cmd.join(' ')) end |