Class: AmiSpec::WaitForRC

Inherits:
Object
  • Object
show all
Defined in:
lib/ami_spec/wait_for_rc.rb

Class Method Summary collapse

Class Method Details

.wait(ip_address, user, key) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/ami_spec/wait_for_rc.rb', line 5

def self.wait(ip_address, user, key)
  Net::SSH.start(ip_address, user, keys: [key], paranoid: false) do |ssh|
    # Wait for SystemV to start
    # This only works for Ubuntu with upstart.
    # Detecting OS and Release will need something like this
    # https://github.com/mizzy/specinfra/blob/master/lib/specinfra/helper/detect_os/debian.rb
    ssh.exec 'while /usr/sbin/service rc status | grep -q "^rc start/running, process"; do sleep 1; done'
  end
end