Class: Serverspec::Backend::Ssh

Inherits:
Exec
  • Object
show all
Defined in:
lib/serverspec/backend/ssh.rb

Instance Method Summary collapse

Methods inherited from Exec

#check_executable, #check_installed_by_gem, #check_mounted, #check_os, #check_readable, #check_routing_table, #check_running, #check_running_under_supervisor, #check_writable, #check_zero, #commands, #initialize, #method_missing

Constructor Details

This class inherits a constructor from Serverspec::Backend::Exec

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Serverspec::Backend::Exec

Instance Method Details

#run_command(cmd, opt = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/serverspec/backend/ssh.rb', line 6

def run_command(cmd, opt={})
  cmd = "sudo #{cmd}" if not RSpec.configuration.ssh.options[:user] == 'root'
  ret = ssh_exec!(cmd)
  if ! @example.nil?
    @example.[:command] = cmd
    @example.[:stdout]  = ret[:stdout]
  end
  ret
end