Module: Bcome::InstanceCommand

Included in:
Stack::Instance
Defined in:
lib/helpers/instance_command.rb

Instance Method Summary collapse

Instance Method Details

#execute_command(commands) ⇒ Object



8
9
10
# File 'lib/helpers/instance_command.rb', line 8

def execute_command(commands)
  @environment.execute_command(commands, self)
end

#rsync(local_path, remote_path) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/helpers/instance_command.rb', line 12

def rsync(local_path, remote_path)
  puts "rsync> #{self.identifier}".informational
  if @environment.ssh_mode_type == ::SSH_DIRECT_MODE_IDENTIFIER
    rsync_command = "rsync -av #{local_path} #{self.ssh_user}@#{self.ip_address}:#{remote_path}"
  else
    rsync_command = "rsync -av -e \"ssh -A #{self.ssh_user}@#{@environment.bastion_ip_address} ssh -o StrictHostKeyChecking=no\" #{local_path} #{self.ssh_user}@#{self.ip_address}:#{remote_path}"
  end
  run_local(rsync_command)
end

#run(raw_commands) ⇒ Object



3
4
5
6
# File 'lib/helpers/instance_command.rb', line 3

def run(raw_commands)
  commands = raw_commands.is_a?(String) ? [raw_commands] : raw_commands
  execute_command(commands)
end

#scp(files, remote_path) ⇒ Object



22
23
24
25
# File 'lib/helpers/instance_command.rb', line 22

def scp(files, remote_path)
  @environment.execute_scp_upload(files, remote_path, self)
  return
end