Skip to content

Instantly share code, notes, and snippets.

View imbriaco's full-sized avatar

Mark Imbriaco imbriaco

View GitHub Profile
public static void main (String args[])
{
//Build the command line options
Options options = addCommandLineOptions ();
if (args.length <= 0)
printHelp (options);
CommandLineParser parser = new GnuParser();
try
desc "Do rolling restarts of the Mongrel servers in pairs, at 90s intervals."
task :rolling do
servers = []
roles[:app].each do |server|
next unless server.options.fetch(:listener, true)
servers << [] if servers.first.nil? || servers.last.length > 1
servers.last << server.host
end
execute "modprobe" do
command "/sbin/depmod -a"
action :run
only_if do
File.exist?("/lib/modules/#{@node[:kernel][:release]}/extra/kvm.ko") &&
( File.mtime("/lib/modules/#{@node[:kernel][:release]}/extra/kvm.ko") >
File.mtime("/lib/modules/#{@node[:kernel][:release]}/modules.dep") )
end
end
ruby timeout:
user system total real
push_head(10_000) 0.550000 0.350000 0.900000 ( 1.701019)
pop_head(10_000) 0.530000 0.320000 0.850000 ( 1.655060)
push_tail(10_000) 0.580000 0.330000 0.910000 ( 1.715845)
pop_tail(10_000) 0.580000 0.320000 0.900000 ( 1.736500)
incr(10_000) 0.540000 0.300000 0.840000 ( 1.655069)
decr(10_000) 0.570000 0.310000 0.880000 ( 1.762211)
set_add(10_000) 0.560000 0.310000 0.870000 ( 1.733475)
irb(main):009:0> Integrity::Notifier.register(Integrity::Notifier::Campfire)
ArgumentError: Unknown property 'register'
from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/model.rb:479:in `method_missing'
from (irb):9
Fetching statistics...
Statistics for devices...
device host files status
---------- ----------- ---------- ----------
dev1 mogilefs-01 30 alive
dev2 mogilefs-02 37 alive
dev3 mogilefs-03 33 alive
---------- ----------- ---------- ----------
diff --git a/chef-server/bin/chef-server b/chef-server/bin/chef-server
index b6a8277..e7dd8a2 100755
--- a/chef-server/bin/chef-server
+++ b/chef-server/bin/chef-server
@@ -27,6 +27,9 @@ require "chef"
Dir.chdir File.join(File.dirname(__FILE__),"..")
__DIR__ = Dir.getwd
+slice_source = File.join(File.dirname(__FILE__), "..", "..", "chef-server-slice", "lib", "chef-server-slice.rb")
+require slice_source if File.exists?(slice_source)
>> mark @ chef-server [ /home/mark/workspace/chef/chef-server ]
% gem list | grep chef
>> mark @ chef-server [ /home/mark/workspace/chef/chef-server ]
% ./bin/chef-server
Loading init file from /home/mark/workspace/chef/chef-server/config/init.rb
Loading /home/mark/workspace/chef/chef-server/config/environments/development.rb
~ Compiling routes... (totally normal to see 'Cannot find resource model')
~ Loaded slice 'ChefServerSlice' ...
~ Parent pid: 19182
diff --git a/chef-server-slice/app/controllers/application.rb b/chef-server-slice/app/controllers/application.rb
index de03021..7978809 100644
--- a/chef-server-slice/app/controllers/application.rb
+++ b/chef-server-slice/app/controllers/application.rb
@@ -22,6 +22,8 @@ require "chef" / "cookbook_loader"
class ChefServerSlice::Application < Merb::Controller
+ include Chef::Mixin::Checksum
+
configure "somepackage" do
source "http://foo.com/blah-1.2.3.tar.gz"
options "--prefix=/usr/local --disable-foo --enable-bar"
post_install "some_script_resource" # optional
end