Skip to content

Instantly share code, notes, and snippets.

View jeffmccune's full-sized avatar

Jeff McCune jeffmccune

View GitHub Profile
@jeffmccune
jeffmccune / console.md
Created April 18, 2012 00:25
Order dependant failures

This fails as expected:

$ rspec --format d spec/unit/application/describe_spec.rb 

TypeDoc
  (#13070) Should not explode (Will fail on Puppet 2.7.7 through 2.7.14) (FAILED - 1)

Failures:

  1) TypeDoc (#13070) Should not explode (Will fail on Puppet 2.7.7 through 2.7.14)
@jeffmccune
jeffmccune / README.markdown
Created April 19, 2012 04:30
Ruby Virtual Environment

Assumptions

  • The "system ruby" is installed from the distribution packages
  • Puppet is not anywhere in $LOAD_PATH except for the portion specified by the RUBYLIB environment variable, pointing at a VCS working copy.
  • The same for Facter, MCollective, any software produced by Puppet Labs.
  • Ruby Gems is not installed in the system paths. (We'll install it in a user path later on so we need the system to be nice and clean)
# Generated from fastthread-0.6.4.1.gem by gem2rpm -*- rpm-spec -*-
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%define gemname fastthread
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
%define ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")
%define _enable_debug_packages 0
Summary: Optimized replacement for thread.rb primitives
Name: rubygem-%{gemname}
Version: 1.0.7
@jeffmccune
jeffmccune / foo.rb
Created April 27, 2012 23:18
Ruby, I'm surprised by you, OK? You're not bash.
[jeff@maynard] (feature/master/registry_key_purge_values)(dirty)[█▆▁]1.8.7 /vagrant/modules/registry
$ cat foo.rb
#! /bin/bash
#
echo bar
[jeff@maynard] (feature/master/registry_key_purge_values)(dirty)[█▆▁]1.8.7 /vagrant/modules/registry
$ ruby foo.rb
bar
@jeffmccune
jeffmccune / (irb)
Created May 16, 2012 00:40
Alias a resource in the munge method of the namevar
1.8.7 :010 > catalog = Puppet::Resource::Catalog.new; catalog.class
=> Puppet::Resource::Catalog
1.8.7 :011 > resource = Puppet::Type.type(:registry_key).new(:name => 'HKLM\Software\Vendor\PuppetLabs', :catalog => catalog); resource.class
=> Puppet::Type::Registry_key
1.8.7 :012 > catalog.add_resource resource
=> nil
1.8.7 :013 > pp catalog.resource_keys
[["Registry_key", "hklm\\Software\\Vendor\\PuppetLabs"],
["Registry_key", "HKLM\\Software\\Vendor\\PuppetLabs"],
["Registry_key", "hklm\\software\\vendor\\puppetlabs"]]
@jeffmccune
jeffmccune / puppet_help.md
Created June 29, 2012 00:26
Puppet cannot load face

Current behavior of 3.0rc

With cloud provisioner installed puppet help is totally broken because a single face action throws an Exception.

STDERR

Error: Could not autoload puppet/face/node/classify: no such file to load -- fog
Error: Could not autoload puppet/face/node: Could not autoload puppet/face/node/classify: no such file to load -- fog
Error: Failed to load face node:
@jeffmccune
jeffmccune / puppet_multiple_ca.md
Created July 5, 2012 19:03
Puppet Multiple CA's

Standard CA Bundle

This CA bundle is located at puppet master --confdir=$PUPPET_CONFDIR --configprint localcacert and contains CA certs in the following order:

  1. Root CA
  2. Signing CA
  3. Puppet Master CA 1
  4. Puppet Master CA 2

The following error may be resolved by changing the CA certificate order in the bundle to be:

@jeffmccune
jeffmccune / gitdiffcheck.vim
Created July 12, 2012 22:53
Vim GitDiffCheck
" ~/.vim/plugin/gitdiffcheck.vim
" Open up whitespace errors in the Quickfix List
" Jeff McCune
" Shamelessly stolen from http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html
"
" Just run :GitDiffCheck 2.x
"
" this will check your current branch for against the 2.x branch
" which is useful if you want to know if you're about to merge in
" a pull request that contains a bunch of syntax errors.

Hiera voltron

(green)[jeff@maynard] 1.9.3@puppet /workspace/green/modules 
$ rake voltron   
(in /workspace/green)
 * puppet                   2.7.x  2.7.18-92-g96d7072 96d7072
 * facter                   1.6.x  1.6.10-2-ga6519b5  a6519b5
 * hiera                    master N/A                711d289
 * rspec-puppet master v0.1.3 eed11c7
@jeffmccune
jeffmccune / mocha_load_order.markdown
Created July 23, 2012 20:46
Mocha load order issue

Suite - Fails

jenkins@slave01:~/workspace/Puppet Module - stdlib (2.3.x)/facter/1.6.x/puppet/2.7.x/ruby/ruby-1.8.7/rvm/#rvm$ rspec -fd --order random:123 spec -d
/usr/lib/ruby/gems/1.8/gems/mocha-0.9.10/lib/mocha.rb:2
require 'mocha/options'
(rdb:1) e puts caller(0)
/usr/lib/ruby/gems/1.8/gems/mocha-0.9.10/lib/mocha.rb:2:in `gem_original_require'
/usr/lib/ruby/gems/1.8/gems/mocha-0.9.10/lib/mocha.rb:2:in `gem_original_require'