Skip to content

Instantly share code, notes, and snippets.

Brian K. Jones bkjones

Block or report user

Report or block bkjones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bkjones / patcher
Created Jul 27, 2012
my context manager was worse off than I thought :(
View patcher
Original version ('pre' prints the patched callable before entering the 'with' block, and 'post' does the same inside the 'with' block):
.....pre: <unbound method Client.build_url>
post: <MagicMock name='build_url' id='4321796496'>
.pre: <MagicMock name='build_url' id='4321796496'>
post: <MagicMock name='build_url' id='4321825552'>
.pre: <MagicMock name='build_url' id='4321825552'>
post: <MagicMock name='build_url' id='4321871248'>
.pre: <MagicMock name='build_url' id='4321871248'>
post: <MagicMock name='build_url' id='4321904656'>
bkjones /
Created Feb 24, 2012
A script I wrote to allow nagios to send an alert with an attached graphite graph via email.
#!/usr/bin/env python
This takes a recipient email address and a graphite URL and sends a
POST to <graphite host>/dashboard/email with a body that looks like
...which will cause the graphite installation to send an email.
View gist:1140132 [Thu, 11 Aug 2011 12:41:21 -0400] INFO: Processing package[git] action install (git::default line 23) /usr/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/provider/package/yum.rb:69: [BUG] Segmentation fault
View gist:1139947
DEBUG: Using configuration from /Users/bjones/.chef/knife.rb
Bootstrapping Chef on
DEBUG: Looking for bootstrap template in /Library/Ruby/Gems/1.8/gems/chef-0.10.2/lib/chef/knife/bootstrap
DEBUG: Found bootstrap template in /Library/Ruby/Gems/1.8/gems/chef-0.10.2/lib/chef/knife/bootstrap
/Library/Ruby/Gems/1.8/gems/chef-0.10.2/lib/chef/knife/core/bootstrap_context.rb:51:in `read': No such file or directory - ~/.chef/client.pem (Errno::ENOENT)
from /Library/Ruby/Gems/1.8/gems/chef-0.10.2/lib/chef/knife/core/bootstrap_context.rb:51:in `validation_key'
from (erubis):24:in `evaluate'
from /Library/Ruby/Gems/1.8/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `evaluate'
from /Library/Ruby/Gems/1.8/gems/chef-0.10.2/lib/chef/knife/bootstrap.rb:132:in `render_template'
You can’t perform that action at this time.