playbooks/roles/jenkins/files/opt/lifecycle-poller/worker.rb
#------------------------------------------------------------------------------
# 
# FUNCTION: deleteAgent
#
# DESCRIPTION: This will delete the given agent
#
#------------------------------------------------------------------------------
deleteAgent
DESCRIPTION: This will delete the given agent
deleteAgent DESCRIPTION : This will delete the given agent
def deleteAgent(agent)
  out=`java -jar #{$jenkins_cli} -s http://localhost:8080 -auth 'admin:#{$conf['masterAdminPassword']}' delete-node #{agent} 2>&1`
  if $?.exitstatus == 0
    $log.info "agent #{agent} is deleted"
    return true
  else
    if out.include? "ERROR: No such node"
      $log.info "agent #{agent} could not be deleted, it already is deleted: #{out}"
      return true
    else
      $log.error "agent #{agent} could not be deleted: #{out}"
      return false
    end
  end
end
def deleteAgent ( agent ) out = ` java -jar  #{ $jenkins_cli }  -s http://localhost:8080 -auth 'admin: #{ $conf [ 'masterAdminPassword' ] } ' delete-node  #{ agent }  2>&1 ` if $? . exitstatus == 0 $log . info "agent #{agent} is deleted" return true else if out . include? "ERROR: No such node" $log . info "agent #{agent} could not be deleted, it already is deleted: #{out}" return true else $log . error "agent #{agent} could not be deleted: #{out}" return false end end end
FUNCTION: deleteAgent
DESCRIPTION: This will delete the given agent
FUNCTION : deleteAgent DESCRIPTION : This will delete the given agent
# sterr is forwarded to sdout to get the information in ruby
agent
<not_specific>