Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby1.9.1
# http://gist.github.com/144861
#
# Requirements:
# * ruote-2.1.10 or later
# * ruote-amqp-2.1.10 or later
# * daemon-kit-0.1.8rc3 or later
#
require 'rubygems'
require 'bundler'
set_robust_list(0xb76babe0, 0xc) = 0
futex(0x411860a4, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x41186080, 2) = 1
gettimeofday({1276757922, 495502}, NULL) = 0
futex(0x41186080, FUTEX_WAKE_PRIVATE, 1) = 0
clock_gettime(CLOCK_REALTIME, {1276757922, 495625421}) = 0
futex(0x411860a4, FUTEX_WAIT_PRIVATE, 3, {0, 9876579}) = -1 ETIMEDOUT (Connection timed out)
gettimeofday({1276757922, 505717}, NULL) = 0
futex(0x41186080, FUTEX_WAKE_PRIVATE, 1) = 0
clock_gettime(CLOCK_REALTIME, {1276757922, 505799581}) = 0
futex(0x411860a4, FUTEX_WAIT_PRIVATE, 5, {0, 9917419}) = -1 ETIMEDOUT (Connection timed out)
david@ash:/maemo/devel/obs/boss/demo$ ruby1.9.1 -rtracer -e "Thread.new { puts 'x' }"
#0:ruby1.9.1:0:Kernel:<: ?
#0:-e:1::-: Thread.new { puts 'x' }
#0:-e:1:Thread:>: Thread.new { puts 'x' }
#0:-e:1:Thread:>: Thread.new { puts 'x' }
#0:-e:1:Thread:<: Thread.new { puts 'x' }
x#0:-e:1:Thread:<: Thread.new { puts 'x' }
kernel squeeze-installer/i386/linux
append initrd=squeeze-installer/i386/initrd.gz auto url=192.168.14.201 classes=xen3;loc/gb DEBCONF_DEBUG=5
The way this works is that:
*
if the URL is missing a protocol, http is assumed,
*
if the hostname section contains no periods, it has the domain derived from DHCP appended to it, and
*
source "http://rubygems.org"
gem 'daemon-kit', :git =>"git://github.com/kennethkalmer/daemon-kit.git"
gem 'amqp', :git =>"git://github.com/tmm1/amqp.git"
gem 'ruote', :path => "../ruote/ruote"
gem 'ruote-amqp', :path => "../ruote/ruote-amqp"
gem 'rspec'
gem 'eventmachine'
gem 'json'
class OBS < RuoteAMQP::Participant
def consume( stuff )
super stuff, :command => '/obs/build', :queue => 'obs', :reply_queue => "ruote_workitems"
end
end
ci_process = Ruote.process_definition :name => 'Ci Process' do
sequence do
developer
builder
kit :command => '/img/image', :queue => 'img', :reply_queue => "ruote_workitems"
_if '${f:build_ok} == YES' do
kit :command => '/cita/test', :queue => 'cita', :reply_queue => "ruote_workitems"
end
print_results
end
class IMG < ParticipantWrapper
def route
{ :command => '/img/image',
:queue => 'img',
}
end
end
def determine_value( workitem, value )
return @workitem['fields']['params'][value] if @workitem['fields']['params'].has_key?( value )
return @workitem['fields']['params']['participant_options']['command'] if @workitem['fields']['params'].has_key?( 'participant_options' ) and @workitem['fields']['params']['participant_options'].has_key?( value )
nil
end