Skip to content

Instantly share code, notes, and snippets.

View fujin's full-sized avatar

AJ Christensen fujin

  • Rotorua, New Zealand
View GitHub Profile
@fujin
fujin / Error
Created February 6, 2012 20:20
Passing args to a handler
[Mon, 06 Feb 2012 19:59:35 +0000] INFO: Processing chef_handler[Medidata::RunLoggerHandler] action enable (mdsol_oq::default line 60)
[Mon, 06 Feb 2012 19:59:35 +0000] ERROR: chef_handler[Medidata::RunLoggerHandler] (mdsol_oq::default line 60) has had an error
[Mon, 06 Feb 2012 19:59:35 +0000] ERROR: chef_handler[Medidata::RunLoggerHandler] (/var/cache/chef/cookbooks/mdsol_oq/recipes/default.rb:60:in `from_file') had an error:
chef_handler[Medidata::RunLoggerHandler] (mdsol_oq::default line 60) had an error: wrong number of arguments (1 for 0)
/var/chef/handlers/runlogger.rb:7:in `initialize'
/var/cache/chef/cookbooks/chef_handler/providers/default.rb:24:in `new'
/var/cache/chef/cookbooks/chef_handler/providers/default.rb:24:in `block in class_from_file'
@fujin
fujin / provider.rb
Created February 2, 2012 01:29 — forked from till/provider.rb
def initialize(*args)
super(*args)
@command = 'foo'
end
action :create do
Chef::Log.debug("Command: #{@command}")
end
@fujin
fujin / gist:1685125
Created January 26, 2012 21:11 — forked from pguth66/gist:1685108
KIDS
module Scoreable
attr_accessor :score
def increment
@score += 1
end
def decrement
@score -= 1
end
@fujin
fujin / graphdeps.rb
Created November 29, 2011 02:41 — forked from rottenbytes/graphdeps.rb
Graph your cookbooks deps
#!/usr/bin/env ruby
cbdir=ARGV[0]
output = "./deps.dot"
puts "Running on #{cbdir}..."
cb_meta = Dir.glob("#{cbdir}/*/metadata.rb")
fp=File.open(output,"w")
@fujin
fujin / Broken NagiosLibraryMachine.rb
Created November 2, 2011 02:01 — forked from josephreynolds/Broken NagiosLibraryMachine.rb
This is now throwing an error when we run chef-client -i
class Machine < Struct.new(:name,:ipaddress,:role,:env)
def print_machine_csv
name.length==0 ? printf(",") : printf("\"%s\",", name)
address.length==0 ? printf(",") : printf("\"%s\",", address)
role.length==0 ? printf(",") : printf("\"%s\",", role)
env.length==0 ? printf(",") : printf("\"%s\",", env)
printf("\n")
end
end unless defined? Machine
Vagrant::Config.run do |global_config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.76.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027076")
fixed = (ENV['FIXED'] or "10.0.76.0/24")
global_config.vm.define :chef do |config|
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
@fujin
fujin / http-twiddle.el
Created May 19, 2011 21:52 — forked from skeptomai/http-twiddle.el
Sending signed requests to the Opscode Platform with Emacs and http-twiddle-mode
;;; http-twiddle.el -- send & twiddle & resend HTTP requests
;; This program belongs to the public domain.
;; Author: Luke Gorrie <[email protected]>
;; Maintainer: Hasan Veldstra <[email protected]>
;; Created: 1 Feb 2006
;; Adapted-By: Hasan Veldstra
;; Adapted-By: Christopher Brown <[email protected]>
;; Version: 1.0
#!/usr/bin/env ruby
require 'rubygems'
require 'chef'
require 'chef/client'
require 'chef/run_context'
Chef::Config[:solo] = true
Chef::Config[:log_level] = :info
Chef::Log.level(:info)
@fujin
fujin / diskreport.rb
Created September 23, 2010 19:55 — forked from mikehale/gist:594216
require 'time'
start_time = Time.parse("2010-09-22T18:50 -0700")
end_time = Time.parse("2010-09-22T18:50 -0930")
search_vols = mailbegs01_meatdisk_vols = %w[
vol-f4e1999d
vol-c2e199ab
vol-5435763d
vol-5235763b
define :email_alias, :recipients => [] do
execute "newaliases" do
action :nothing
end
t = nil
begin
t = resources(:template => "/etc/aliases")
rescue ArgumentError
t = template "/etc/aliases" do