Skip to content

Instantly share code, notes, and snippets.

View deanwilson's full-sized avatar

Dean Wilson deanwilson

View GitHub Profile
package File::Find::Rule::Dpkg;
# must get back to this at some point.
use strict;
use warnings;
use vars qw/$VERSION/;
use base 'File::Find::Rule';
$VERSION = '0.01';
Feature: http://www.unixdaemon.net/ response headers
Scenario: Server header should be production quality
When I fetch http://www.unixdaemon.net/
Then the "Server" header should be "Apache"
Scenario: Response header should contain an Etag
When I fetch http://www.unixdaemon.net/
Then the response should contain the "Etag" header
@deanwilson
deanwilson / gist:758527
Created December 29, 2010 13:21
Wildcard fact listings hack
[dwilson@xeny ~]$ diff -u /usr/bin/facter facter-wildcard
--- /usr/bin/facter 2010-08-28 17:38:56.000000000 +0100
+++ facter-wildcard 2010-12-29 13:19:42.278609734 +0000
@@ -139,12 +139,15 @@
unless names.empty?
facts = {}
names.each { |name|
- begin
- facts[name] = Facter.value(name)
- rescue => error
@deanwilson
deanwilson / gist:872888
Created March 16, 2011 17:32
Simple Puppet cucumber-nagios package stub
Feature: puppetwrappers
Package Checks
Scenario: Confirming package installation
When a machine has been puppeted
Then the bash package should be installed.
Scenario: Confirm bash package is absent
When a machine has been puppeted
Then the bash package should not be installed.
@deanwilson
deanwilson / gist:948153
Created April 29, 2011 10:24
systemtap signal counter
#! /usr/bin/env stap
global signals_sent
global processes
probe signal.send {
printf("%s was sent to %s (pid:%d) by %s\n",
sig_name, pid_name, sig_pid, execname())
signals_sent++
@deanwilson
deanwilson / gist:1091702
Created July 19, 2011 08:19
Python method lister
methodList = [method for method in dir(conduit) if callable(getattr(conduit, method))]
for method in methodList:
print method
for method in methodList:
print "\n".join([ "%s %s", method, str(getattr(conduit, method).__doc__) ])
@deanwilson
deanwilson / gist:4608532
Created January 23, 2013 15:54
Only resources show lint issue - not resource defaults
$ cat foo.pp
class foo {
File {
mode => 544,
}
file { '/tmp/foo':
mode => 544,
}
@deanwilson
deanwilson / gist:5858235
Created June 25, 2013 12:58
Add a simple puppet lint check to alert on template calls to 'puppet://' uris
diff --git a/lib/puppet-lint/plugins/check_resources.rb b/lib/puppet-lint/plugins/check_resources.rb
index 3e52c04..20c1f9d 100644
--- a/lib/puppet-lint/plugins/check_resources.rb
+++ b/lib/puppet-lint/plugins/check_resources.rb
@@ -183,4 +183,41 @@ class PuppetLint::Plugins::CheckResources < PuppetLint::CheckPlugin
end
end
end
+
+ # Public: Check the content line for each File resource instance for a Puppet Module
@deanwilson
deanwilson / gist:5868103
Created June 26, 2013 15:00
puppet parser validate returns zero on nonexistent file (http://projects.puppetlabs.com/issues/15494)
# half a fix
$ git diff ./lib/puppet/face/parser.rb
diff --git a/lib/puppet/face/parser.rb b/lib/puppet/face/parser.rb
index 3242fac..93642f7 100644
--- a/lib/puppet/face/parser.rb
+++ b/lib/puppet/face/parser.rb
@@ -42,8 +42,12 @@ Puppet::Face.define(:parser, '0.0.1') do
end
end
files.each do |file|
@deanwilson
deanwilson / README.md
Created March 16, 2016 17:04 — forked from lusis/README.md
terraform template to generate serverspec properties

This uses terraform's template_file resource to generate a yaml properties file for serverspec to use.

  • create the Rakefile in your terraform project root
  • create a spec directory and put spec_helper.rb in it
  • create the templates/properties.tmpl.yml file
  • create the serverspec.tf
  • terraform apply

tests

Tests will be matched based on roles defined for a given node.