Skip to content

Instantly share code, notes, and snippets.

input {
log4j {
port => 4560
type => "log4j"
codec => plain { charset => "ISO-8859-1" }
}
tcp {
codec => oldlogstashjson
port => 4561
@antaflos
antaflos / logstash.conf
Created March 6, 2014 10:12
Logstash parse failure with TCP input and JSON codec. LS 1.3.3.
input {
log4j {
port => 4560
type => "log4j"
codec => plain { charset => "ISO-8859-1" }
}
tcp {
codec => oldlogstashjson
port => 4561
@antaflos
antaflos / db01.example.com.yaml
Created March 20, 2014 20:45
is it possible to call a Puppet function like postgresql_password() when looking up data from Hiera (and using create_resources())?
---
profile::postgresql::server::dbs:
redmine:
user: redmine
password: "postgresql_password('redmine', 'xxx')"
# The above results in puppetlabs-postgresql's Postgresql::Server::Role class
# passing the string "postgresql_password('redmine', 'xxx')" verbatim as
# ENCRYPTED PASSWORD to the ALTER ROLE statement postgresql_psql creates, which of course fails.
@antaflos
antaflos / spec.rb
Created March 21, 2014 16:18
how to test for the default value of [] for `some_array_parameter`?
...
describe '#some_array_parameter' do
it 'should default to []' do
# ???
end
context 'the array parameter does something' do
let(:params) { { :some_array_parameter => [ 'foo', 'bar' ] } }
...
end
@antaflos
antaflos / puppet agent -t
Created April 2, 2014 09:44
Facter 2.0.1, Puppet 3.4.3, Ubuntu 12.04 x86-64, environment=production_redux
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve local facts: undefined method `puppetversion' for Facter:Module
Error: Failed to apply catalog: Could not retrieve local facts: undefined method `puppetversion' for Facter:Module
$foo = undef
validate_string($foo)
node default {
$role = hiera('role')
include "role::${role}"
}
profile::iptables_default::rules_manage: true
profile::iptables_default::rule_file: /etc/sysconfig/iptables.TEST
profile::iptables_default::filter_chain_defaults:
table: filter
policy: ACCEPT
require: Iptables::Add_table['iptables_filter']
profile::iptables_default::filter_chains:
mydefaultfilterchains:
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'

Test with External Function

When

You want to test a resource definition (class, defined type) that uses a function provided by a third-party module your module depends upon. It's supposed that you're implementing your tests with rspec-puppet.

How