playbooks/roles/jenkins/files/opt/lifecycle-poller/worker.rb
#------------------------------------------------------------------------------
# 
# FUNCTION: awaitFile
#
# DESCRIPTION: wait for the given file to be present. This ensures that 
#   jenkins is up and running.
#
#------------------------------------------------------------------------------
awaitFile
DESCRIPTION: wait for the given file to be present. This ensures that
jenkins is up and running.
awaitFile DESCRIPTION : wait for the given file to be present . This ensures that jenkins is up and running .
def awaitFile(file)
  endTime = Time.now.to_i + $conf['maxWaitInSeconds']
  while Time.now.to_i < endTime do
    if File.exist? file
      $log.info "file #{file} exists"
      return true
    end
    sleep 5 
  end
  $log.error "file #{file} is not available, but wait time elapsed"
  return false
end
def awaitFile ( file ) endTime = Time . now . to_i + $conf [ 'maxWaitInSeconds' ] while Time . now . to_i < endTime do if File . exist? file $log . info "file #{file} exists" return true end sleep 5 end $log . error "file #{file} is not available, but wait time elapsed" return false end
FUNCTION: awaitFile
DESCRIPTION: wait for the given file to be present.
FUNCTION : awaitFile DESCRIPTION : wait for the given file to be present .
# seconds
file
<not_specific>