Skip to content

Instantly share code, notes, and snippets.

View eherot's full-sized avatar

Eric Herot eherot

View GitHub Profile
@eherot
eherot / ruby-shadow
Created June 9, 2012 20:59
post to #chef about 'ruby-shadow chef "You have to install development tools first"'
ec2-107-21-90-172.compute-1.amazonaws.com [Sat, 09 Jun 2012 20:52:56 +0000] INFO: Processing chef_gem[ruby-shadow] action install (dynamically defined)
ec2-107-21-90-172.compute-1.amazonaws.com [Sat, 09 Jun 2012 20:53:01 +0000] ERROR: chef_gem[ruby-shadow] (dynamically defined) has had an error
ec2-107-21-90-172.compute-1.amazonaws.com [Sat, 09 Jun 2012 20:53:01 +0000] ERROR: Running exception handlers
ec2-107-21-90-172.compute-1.amazonaws.com [Sat, 09 Jun 2012 20:53:01 +0000] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ec2-107-21-90-172.compute-1.amazonaws.com [Sat, 09 Jun 2012 20:53:01 +0000] ERROR: Exception handlers complete
ec2-107-21-90-172.compute-1.amazonaws.com [Sat, 09 Jun 2012 20:53:01 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
ec2-107-21-90-172.compute-1.amazonaws.com [Sat, 09 Jun 2012 20:53:01 +0000] FATAL: Mixlib::ShellOut::ShellCommandFailed: chef_gem[ruby-shadow] (dynamically defined) had an error: Mixlib::ShellOut::ShellCommandFailed: Exp
@eherot
eherot / pkg_chk_cmd
Created June 12, 2012 13:50
Run only if package installed
packagename="PACKAGE"
case node["platform"]
when "debian","ubuntu"
pkg_chk_cmd="dpkg -s #{packagename}"
when "redhat","centos","fedora","amazon","scientific"
pkg_chk_cmd="yum list installed #{packagename}"
end
if `#{pkg_chk_cmd}`
@eherot
eherot / gist:2917872
Created June 12, 2012 14:27 — forked from evan4498/gist:2917838
failure
include_recipe "chef_gem"
p = package "libxslt-dev" do
action :nothing
end
p.run_action(:install)
p = package "libxml2-dev" do
action :nothing
@eherot
eherot / gist:5918775
Created July 3, 2013 14:51
can't load gem from inside library during build
recipes/default.rb:
g = gem_package "fog" do
action :nothing
end
g.run_action(:install)
require 'fog'
@eherot
eherot / gist:6116272
Created July 30, 2013 19:47
Notification syntax
action :create do
template new_resource.path do
source "other_template.erb"
action :nothing
end
t = template "#{Chef::Config[:file_cache_path]}/#{apex}.zone" do
source "zone.erb"
notifies :create, "template[#{new_resource.path}]"
@eherot
eherot / attributes.rb
Created August 7, 2013 18:12
miah/logstash no method error
set['logstash']['service_options']['url'] = "http://ops.evertrue.com.s3.amazonaws.com/pkgs/logstash-1.1.13-flatjar.jar"
set['logstash']['service_options']['checksum'] = "5ba0639ff4da064c2a4f6a04bd7006b1997a6573859d3691e210b6855e1e47f1"
set['logstash']['service_options']['version'] = "1.1.13-flatjar"
set['logstash']['service_options']['service_type'] = "runit"
set["logstash"]["shipper"]["redis_hosts"] = [ "127.0.0.1" ]
@eherot
eherot / error.out
Created September 6, 2013 16:52
Inexplicable rsyslog failure on attribute lookup
$ sudo chef-client
Starting Chef Client, version 11.6.0
resolving cookbooks for run list: ["et_base", "logserver"]
Synchronizing Cookbooks:
- et_base
- chef-solo-search
- apt
- postfix
- chef_handler
- yum
@eherot
eherot / chef-zero ruby sigsegv
Created January 24, 2014 00:29
chef-zero ruby sigsegv
$ env GEM_HOME=~/.vagrant.d/gems /Applications/Vagrant/embedded/bin/ruby /Users/eherot/.vagrant.d/gems/gems/chef-zero-1.7.3/bin/chef-zero --host 172.16.64.3 --port 4000
/Users/eherot/.vagrant.d/gems/gems/json-1.8.1/lib/json/common.rb:67: [BUG] Segmentation fault
ruby 2.0.0p353 (2013-11-22 revision 43784) [universal.x86_64-darwin12.5.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
@eherot
eherot / haproxy-init snippet
Created March 31, 2014 21:27
Using socat as a listener for a socket file
socat_start() {
start-stop-daemon --quiet --start \
--pidfile "$SOCAT_PIDFILE" \
--background --make-pidfile \
--exec $SOCAT_DAEMON tcp-listen:$SOCAT_TCP_PORT,fork UNIX-CLIENT:$SOCAT_SOCK < /dev/null
}
@eherot
eherot / STDOUT
Created April 17, 2014 18:56
Ohai AttributeNotFound
[2014-04-17T18:50:57+00:00] ERROR: Encountered error while running plugins: #<Ohai::Exceptions::AttributeNotFound: No such attribute: 'passwd'>
================================================================================
Error executing action `reload` on resource 'ohai[reload]'
================================================================================
Ohai::Exceptions::AttributeNotFound
-----------------------------------
No such attribute: 'passwd'