Skip to content

Instantly share code, notes, and snippets.

View mcallaway's full-sized avatar

Matt Callaway mcallaway

  • Bayer Crop Science
  • Saint Louis
View GitHub Profile
@mcallaway
mcallaway / gist:4fe969aace75c11735ea
Created March 3, 2015 18:13
type definition for packagelock (trial)
Puppet::Type.newtype(:packagelock) do
desc <<-EOT
Lock a package to the specific version installed. This resource
type supplements the package resource type, to lock a package
to the version that is installed with the corresponding package
resource.
# DO NOT autorequire, we want the ability to lock *before* the package.
#
@mcallaway
mcallaway / gist:72db68a130fe49b02418
Created March 3, 2015 18:11
packagelock provider
Puppet::Type.type(:packagelock).provide(:yum) do
desc "YUM package locking support; uses the versionlock plugin.
This plugin should be installed and enabled for this to work.
RHEL5 and derivatives have a very sparse version of the plugin
without the 'versionlock' subcommand, requiring us to edit
the versionlock.list file directly."
LOCKCONF = '/etc/yum/pluginconf.d/versionlock.conf'
LOCKLIST = '/etc/yum/pluginconf.d/versionlock.list'
@mcallaway
mcallaway / gist:55d8b01f68db086424cc
Created February 12, 2015 17:24
storage fails to come up? race?
Feb 12 17:00:35 apipe-deis1.gsc.wustl.edu systemd[1]: deis-store-daemon.service: main process exited, code=exited, status=1/FAILURE
Feb 12 17:00:35 apipe-deis1.gsc.wustl.edu dockerd[946]: time="2015-02-12T17:00:35Z" level="info" msg="GET /v1.16/containers/e250e431cb8acf4d79b316721320832ce0df4860f4c51ada3423da02f03773d0/json"
Feb 12 17:00:35 apipe-deis1.gsc.wustl.edu dockerd[946]: time="2015-02-12T17:00:35Z" level="info" msg="+job container_inspect(e250e431cb8acf4d79b316721320832ce0df4860f4c51ada3423da02f03773d0)"
Feb 12 17:00:35 apipe-deis1.gsc.wustl.edu dockerd[946]: time="2015-02-12T17:00:35Z" level="info" msg="-job container_inspect(e250e431cb8acf4d79b316721320832ce0df4860f4c51ada3423da02f03773d0) = OK (0)"
Feb 12 17:00:35 apipe-deis1.gsc.wustl.edu dockerd[946]: time="2015-02-12T17:00:35Z" level="info" msg="DELETE /v1.16/containers/e250e431cb8acf4d79b316721320832ce0df4860f4c51ada3423da02f03773d0?v=1"
Feb 12 17:00:35 apipe-deis1.gsc.wustl.edu dockerd[946]: time="2015-02-12T17:00:35Z" level="info" msg="+job
@mcallaway
mcallaway / gist:8d10ff88c6aa0e234edb
Created February 12, 2015 17:23
etcd failing to come back up after reboot
Feb 12 16:12:49 apipe-deis1.gsc.wustl.edu systemd[1]: Started etcd.
Feb 12 16:12:49 apipe-deis1.gsc.wustl.edu etcd[1373]: [etcd] Feb 12 16:12:49.123 INFO | Discovery via https://discovery.etcd.io using prefix /62775a30e41136ff07cb712c310ba30d.
Feb 12 16:12:49 apipe-deis1.gsc.wustl.edu etcd[1373]: [etcd] Feb 12 16:12:49.509 INFO | Discovery found peers [http://10.0.28.53:7001 http://10.0.28.57:7001 http://10.0.28.54:7001 http://10.0.28.55:7001 http://10.0.28.57:7001 http://10.0.28.54:7001 http://10.0.28.55:7001 http://10.0.28.56:7001 http://10.0.28.55:7001 http://10.0.28.56:7001 http://10.0.28.57:7001 http://10.0.28.53:7001 http://10.0.28.54:7001 http://10.0.28.56:7001]
Feb 12 16:12:49 apipe-deis1.gsc.wustl.edu etcd[1373]: [etcd] Feb 12 16:12:49.509 INFO | Discovery fetched back peer list: [10.0.28.53:7001 10.0.28.57:7001 10.0.28.54:7001 10.0.28.55:7001 10.0.28.57:7001 10.0.28.54:7001 10.0.28.55:7001 10.0.28.56:7001 10.0.28.55:7001 10.0.28.56:7001 10.0.28.57:7001 10.0.28.53:7001 10.0.28.54:7001
@mcallaway
mcallaway / gist:356b72e8cae8abde0508
Last active August 29, 2015 14:07
Modifying to_yaml for hash
class Hash
# Replacing the to_yaml function so it'll serialize hashes sorted (by their keys)
# Original function is in /usr/lib/ruby/1.8/yaml/rubytypes.rb
def to_yaml( opts = {} )
YAML::quick_emit( object_id, opts ) do |out|
out.map( taguri, to_yaml_style ) do |map|
sort.each do |k, v| # <-- here's my addition (the 'sort')
map.add( k, v )
end
end
@mcallaway
mcallaway / gist:5904940
Created July 1, 2013 21:48
This is a sensu check result...
{
"level": "info",
"message": "publishing check result",
"payload": {
"check": {
"command": "PLENV_VERSION=5.14.1 /etc/sensu/plugins/elasticsearch/query-count.pl -u logstash-elasticsearch-1:9200 -p logstash-general,logstash-app -t 1m -m logstash.message_counts.permission_denied -q '@message:\"permission denied\"'",
"duration": 0.017,
"executed": 1372713467,
"handlers": [
"graphite"
@mcallaway
mcallaway / gist:5601879
Created May 17, 2013 20:50
Can't find RubyGem rubygems
[root@centosdev gems]# irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'gpfsquotad'
Gem::LoadError: Could not find RubyGem rubygems (>= 0)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
@mcallaway
mcallaway / gist:5155832
Last active December 14, 2015 22:08
development.log for sensu-admin
Started GET "/api/status" for 10.0.2.2 at Wed Mar 13 20:08:01 +0000 2013
Processing by ApiController#status as */*
User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Setting Load (0.8ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = 'use_environments' LIMIT 1
Setting Load (0.7ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = 'api_server' LIMIT 1
Setting Load (0.3ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = 'configure_server' LIMIT 1
Rendered api/_apistatus.html.haml (31.0ms)
Completed 500 Internal Server Error in 124ms
ActionView::Template::Error (undefined method `health' for #<Api:0x7f8cda368aa8>):
{ "definition": "Ruote.process_definition :name => 'lol really?' do\nconcurrence do\ngrid_submit :command => '/bin/sleep', :arg => ['20']\nend\ngrid_submit :command => '/bin/sleep', :arg => ['20']\nend\n", "variables": "", "fields":""}
1 #!/usr/bin/env ruby
2
3 require 'rubygems'
4 require 'ruote'
5 require 'ruote/storage/fs_storage'
6 require 'amqp'
7 require 'ruote-amqp'
8
9 AMQP.settings[:user] = 'guest'
10 AMQP.settings[:pass] = 'guest'