Module: Unix::Exec

Includes:
Beaker::CommandFactory
Included in:
Mac::Host, Host
Defined in:
lib/beaker/host/unix/exec.rb

Instance Attribute Summary

Attributes included from Beaker::CommandFactory

#assertions

Instance Method Summary collapse

Methods included from Beaker::CommandFactory

#execute, #fail_test

Instance Method Details

#echo(msg, abs = true) ⇒ Object



12
13
14
# File 'lib/beaker/host/unix/exec.rb', line 12

def echo(msg, abs=true)
  (abs ? '/bin/echo' : 'echo') + " #{msg}"
end

#get_ipObject



24
25
26
27
28
29
30
# File 'lib/beaker/host/unix/exec.rb', line 24

def get_ip
  if self['platform'].include?('solaris') || self['platform'].include?('osx')
    execute("ifconfig -a inet| awk '/broadcast/ {print $2}' | cut -d/ -f1 | head -1").strip
  else
    execute("ip a|awk '/global/{print$2}' | cut -d/ -f1 | head -1").strip
  end
end

#pathObject



20
21
22
# File 'lib/beaker/host/unix/exec.rb', line 20

def path
  '/bin:/usr/bin'
end

#rebootObject



4
5
6
7
8
9
10
# File 'lib/beaker/host/unix/exec.rb', line 4

def reboot
  if self['platform'] =~ /solaris/
    exec(Beaker::Command.new("reboot"), :expect_connection_failure => true)
  else
    exec(Beaker::Command.new("/sbin/shutdown -r now"), :expect_connection_failure => true)
  end
end

#touch(file, abs = true) ⇒ Object



16
17
18
# File 'lib/beaker/host/unix/exec.rb', line 16

def touch(file, abs=true)
  (abs ? '/bin/touch' : 'touch') + " #{file}"
end