Skip to content

Instantly share code, notes, and snippets.

# robin at Robins-MacBook-Pro in ~/tmp
cat test.pp
$test = 1
case $test {
/^\d+$/: {
fail('MATCH')
}
default: {
fail('Not MATCH')
require 'spec_helper'
describe 'cxtool' do
context 'supported operating systems' do
['Debian', 'RedHat'].each do |osfamily|
describe "cxtool class without any parameters on #{osfamily}" do
let(:params) {{ }}
let(:facts) {{
:osfamily => osfamily,
}}
@robinbowes
robinbowes / config.pp
Created July 31, 2014 09:59
example puppet module
# Class documentation goes here
class example::config(
$listen_port,
$username,
$password,
) {
include ::example::params
file{$::example::params::config_file:
content => template('example/example.conf.erb'),
@robinbowes
robinbowes / gist:5b62914abf1fa765c22e
Created July 10, 2014 12:06
Set intersection in bash
# - - - - - - - - - - -
intersection() {
# - - - - - - - - - - -
#
# Considers each file in a directory as being a set
# and each line in the file is a member of that set.
# Returns the intersection of all sets, ie. the
# items that are present in *all* sets
#
# Use it like this:
yum install perl m4 zlib-devel git
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/autoconf26x-2.63-4.ius.el5.noarch.rpm
cd /tmp
git clone https://github.com/sstephenson/ruby-build
cd ruby-build
RUBY_CONFIGURE_OPTS="--without-gdbm --without-dbm" ./bin/ruby-build 1.9.3-p484 /opt/ruby
cd /opt/ruby
rm -rf /tmp/ruby-build
echo 'export PATH=/opt/ruby/bin:$PATH' > /etc/profile.d/ruby_path.sh
chmod +x /etc/profile.d/ruby_path.sh
@robinbowes
robinbowes / gist:3e4d82023732fc886dda
Created July 8, 2014 15:42
Error cloning repo when running bundle exec rake spec
bundle exec rake spec
Cloning into 'spec/fixtures/modules/stdlib'...
remote: Reusing existing pack: 5462, done.
remote: Total 5462 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (5462/5462), 1.07 MiB | 796.00 KiB/s, done.
Resolving deltas: 100% (2257/2257), done.
Checking connectivity... done.
Cloning into 'spec/fixtures/modules/cxtool'...
remote: Counting objects: 67, done.
remote: Compressing objects: 100% (57/57), done.
#!/usr/bin/env ruby
require 'trollop'
require 'fpm'
# used to ensure versions extracted from gems are converted to
# semantic versioning-compliant strings before being used
# in RPM requires
require 'semverly'
def command(command, payload, version)
path = '/commands'
form_payload = {
'command' => command,
'version' => version,
'payload' => payload
}.to_json
def _create_resources(class_names)
resources = [
{
'exported' => false,
'parameters' => {},
'tags' => [],
'title' => 'main',
'type' => 'Stage'
}
]
# install katello client
# ensure node is registered with katello
class katello::client(
$candlepin_package_name,
$candlepin_package_ensure,
$org,
$activationkey,
$pools = []
) {