Skip to content

Instantly share code, notes, and snippets.

View dalen's full-sized avatar

Erik Dalén dalen

View GitHub Profile
# Transfer files to a host in the NodeSet.
def rcp(opts)
dest = opts[:d].name
source = opts[:sp]
dest_path = opts[:dp]
fqdn = RSpec.configuration.rs_storage[:nodes][dest][:fqdn]
user = RSpec.configuration.rs_storage[:nodes][dest][:user]
# Grab a remote path for temp transfer
tmpdest = tmppath
stat("/spotify/puppetmaster/checked_out/production/modules/mysql/lib/puppet/type/ldapquery::user.rb", 0x7fff5f0a5360) = -1 ENOENT (No such file or directory)
stat("/spotify/puppetmaster/checked_out/production/modules/apollo/lib/puppet/type/ldapquery::user.rb", 0x7fff5f0a5360) = -1 ENOENT (No such file or directory)
stat("/spotify/puppetmaster/checked_out/production/modules/inifile/lib/puppet/type/ldapquery::user.rb", 0x7fff5f0a5360) = -1 ENOENT (No such file or directory)
stat("/spotify/puppetmaster/checked_out/production/modules/hostbase/lib/puppet/type/ldapquery::user.rb", 0x7fff5f0a5360) = -1 ENOENT (No such file or directory)
stat("/spotify/puppetmaster/checked_out/production/modules/zabbix/lib/puppet/type/ldapquery::user.rb", 0x7fff5f0a5360) = -1 ENOENT (No such file or directory)
stat("/spotify/puppetmaster/checked_out/production/modules/shibboleth/lib/puppet/type/ldapquery::user.rb", 0x7fff5f0a5360) = -1 ENOENT (No such file or directory)
stat("/spotify/puppetmaster/checked_out/production/modules/kafka
@dalen
dalen / gist:8419913
Last active January 3, 2016 05:59
Optimize puppet CA using apache
in puppet.conf add (not needed in recent puppet versions, 3.5+ or something):
cadir = $ssldir/ca { mode = 775 }
cacert = $cadir/ca_crt.pem { mode = 664 }
csrdir = $cadir/requests { mode = 775 }
signeddir = $cadir/signed { mode = 775 }
in apache site add (change /etc/puppet/ssl to your ssldir path):
@dalen
dalen / authproxy.erb
Created December 6, 2013 15:24
PuppetDB filtering proxy Requires jq 1.3+ and mod_ext_filter in apache
Listen 8080
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName <%= @fqdn %>:8080
SSLEngine on
SSLProtocol -ALL +SSLv3 +TLSv1
SSLCipherSuite ALL:!ADH:!RC4:+HIGH:+MEDIUM:!LOW:!SSLv2:!EXP:!RC2
SSLCertificateKeyFile /var/lib/puppet/ssl/private_keys/<%= @fqdn %>.pem
An error occurred while collecting items to be installed
session context was:(profile=epp.package.standard, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,com.google.gson,2.1.0.v201303041604.
MD5 hash is not as expected. Expected: 76afc958bfd4ba9a8c797ec66a7ef425 and found 22e7b66b0dbbbca9e940d445ee513d00.
Problems downloading artifact: osgi.bundle,com.google.guava,12.0.0.v201212092141.
MD5 hash is not as expected. Expected: 6d8e42dc0c6d3e71da8da801c4b20b9f and found 22e7b66b0dbbbca9e940d445ee513d00.
Problems downloading artifact: osgi.bundle,com.google.inject,3.0.0.v201203062045.
MD5 hash is not as expected. Expected: 40af32c6cf87b26fb3fd30ed925af898 and found 22e7b66b0dbbbca9e940d445ee513d00.
Problems downloading artifact: osgi.bundle,com.google.inject.multibindings,3.0.0.v20130529-1354.
MD5 hash is not as expected. Expected: 8894e8c151520bcd7d2e223e1bbe3839 and found 22e7b66b0dbbbca9e940d445ee513d00.
@dalen
dalen / gist:6886532
Created October 8, 2013 15:30
duplicate indices in puppetdb
puppetdb=# SELECT pg_size_pretty(sum(pg_relation_size(idx))::bigint) AS size,
(array_agg(idx))[1] AS idx1, (array_agg(idx))[2] AS idx2,
(array_agg(idx))[3] AS idx3, (array_agg(idx))[4] AS idx4
FROM (
SELECT indexrelid::regclass AS idx, (indrelid::text ||E'\n'|| indclass::text ||E'\n'|| indkey::text ||E'\n'||
coalesce(indexprs::text,'')||E'\n' || coalesce(indpred::text,'')) AS KEY
FROM pg_index) sub
GROUP BY KEY HAVING count(*)>1
ORDER BY sum(pg_relation_size(idx)) DESC;
size | idx1 | idx2 | idx3 | idx4
tablename | indexname | num_rows | table_size | index_size | unique | number_of_scans | tuples_read | tuples_fetched
-------------------------+-----------------------------------------+-------------+------------+------------+--------+-----------------+-------------+----------------
catalog_resources | catalog_resources_pkey | 1.87344e+07 | 14 GB | 8459 MB | Y | 0 | 0 | 0
catalog_resources | idx_catalog_resources_catalog | 1.87344e+07 | 14 GB | 4671 MB | Y | 4647 | 2893540 | 3646
catalog_resources | idx_catalog_resources_resource | 1.87344e+07 | 14 GB | 6749 MB | Y | 621431 | 690009 | 621053
catalog_resources | idx_catalog_resources_tags_gin | 1.87344e+07 | 14 GB | 19 GB | Y | 617 | 11255212 | 0
catalog_resources | idx_ca
@dalen
dalen / gist:6727254
Created September 27, 2013 11:32
puppetdb crash 1.4.0
/v2/facts query=["]
2013-09-27 11:31:09,132 WARN [qtp1667945037-129] [server.AbstractHttpConnection] /v2/facts
com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input: was expecting closing quote for a string value
at [Source: java.io.StringReader@3b642de4; line: 1, column: 7]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1369)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:599)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:532)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString2(ReaderBasedJsonParser.java:1517)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString(ReaderBasedJsonParser.java:1505)
@dalen
dalen / mem_cache.conf
Created September 23, 2013 15:28
puppet apache file metadata caching
<IfModule mod_mem_cache.c>
CacheEnable mem /production/file_metadata
CacheEnable mem /production/file_content
CacheDefaultExpire 300
MCacheSize 1024000
MCacheMaxObjectCount 10000
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048000
CacheIgnoreNoLastMod On
</IfModule>
"lib/puppet/indirector/facts/ohaifacter.rb" 14L, 544C
require 'puppet/node/facts'
require 'puppet/indirector/code'
class Puppet::Node::Facts::Ohaifacter < Puppet::Indirector::Code
desc "Retrieve facts from Ohai and Facter.
Merges facts from both facts terminii preferring Ohai facts if there is a conflict."
# Look up a host's facts
def find(request)