Class: Commands::SSHCommand

Inherits:
AbstractSSHCommand show all
Defined in:
lib/commands.rb

Constant Summary

Constants inherited from AbstractSSHCommand

AbstractSSHCommand::CLOSED_DOWN_STATES, AbstractSSHCommand::WAITING_OR_RUNNING_STATES

Instance Attribute Summary collapse

Attributes inherited from AbstractSSHCommand

#dest, #hostname, #jobflow_detail, #jobflow_id, #key_pair_file, #no_wait

Attributes inherited from Command

#arg, #commands, #description, #logger, #name

Instance Method Summary collapse

Methods inherited from AbstractSSHCommand

#exec, #get_scp_opts, #get_ssh_opts, #opts, #wait_for_jobflow

Methods inherited from Command

#get_field, #has_value, #have, #option, #require, #require_single_jobflow, #resolve, #validate

Constructor Details

#initialize(*args) ⇒ SSHCommand

Returns a new instance of SSHCommand.



633
634
635
636
637
638
639
640
# File 'lib/commands.rb', line 633

def initialize(*args)
  super(*args)
  if @arg =~ /j-[A-Z0-9]{8,20}/ then
    commands.global_options[:jobflow] << @arg
  else
    self.cmd = @arg
  end
end

Instance Attribute Details

#cmdObject

Returns the value of attribute cmd.



631
632
633
# File 'lib/commands.rb', line 631

def cmd
  @cmd
end

#scp_optsObject

Returns the value of attribute scp_opts.



631
632
633
# File 'lib/commands.rb', line 631

def scp_opts
  @scp_opts
end

#ssh_optsObject

Returns the value of attribute ssh_opts.



631
632
633
# File 'lib/commands.rb', line 631

def ssh_opts
  @ssh_opts
end

Instance Method Details

#enact(client) ⇒ Object



642
643
644
645
# File 'lib/commands.rb', line 642

def enact(client)
  super(client)
  exec "ssh #{get_ssh_opts} -i #{key_pair_file} hadoop@#{hostname} #{get_field(:cmd, "")}"
end