Skip to content

Instantly share code, notes, and snippets.

View dalen's full-sized avatar

Erik Dalén dalen

View GitHub Profile
@dalen
dalen / gist:4207160
Created December 4, 2012 18:22
puppetdb table size
relation | total_size
--------------------------------+------------
public.catalog_resources | 37 GB
public.edges | 7330 MB
public.certname_facts | 639 MB
public.tags | 179 MB
public.classes | 111 MB
public.resource_params | 83 MB
public.catalogs | 2168 kB
public.certname_catalogs | 1720 kB
@dalen
dalen / gist:4207386
Created December 4, 2012 18:49
virtualuser resources
catalog | resource | type | title | tags | exported | sourcefile | sourceline
------------------------------------------+------------------------------------------+------------------------+-------+--------------------------------------------------------------------------------------------+----------+------------+------------
fb37ec9061ca2748685ece6a2167abcab85b579b | 2a53f41382f8cced1639db43b454983f60f1635f | Ldapquery::Virtualuser | dalen | {ldapquery,ldapquery::users,users,ldapquery::virtualuser,virtualuser,dalen,class,hostbase} | f | |
42cc0c718bdfc253928bdcce1d996fe4bccc08e9 | 2a53f41382f8cced1639db43b454983f60f1635f | Ldapquery::Virtualuser | dalen | {ldapquery,ldapquery::users,users,ldapquery::virtualuser,virtualuser,dalen,class,hostbase} | f | |
f69f6b50d515d6abf92bf75c4360b
@dalen
dalen / gist:4560765
Last active December 11, 2015 06:39
Puppet Hiera node terminus
require 'hiera'
require 'puppet/node'
require 'puppet/indirector/hiera'
class Puppet::Node::Hiera < Puppet::Indirector::Hiera
desc "Get node information from Hiera. Gets classes using a array lookup on the puppet::classes key."
include Puppet::Util
# Look for external node definitions.
def find(request)
@dalen
dalen / gist:5029883
Last active December 14, 2015 04:39
Get cached puppet catalog
require 'puppet'
require 'puppet/face'
Puppet.initialize_settings
catalog = Puppet::Face[:catalog, '0.0.1'].find(Puppet[:certname], {:terminus => 'yaml'})
print catalog.inspect + "\n"
31) Puppet::Type::File#write_temporary_file? should be true if the file has specified content
Failure/Error: Unable to find matching line from backtrace
NameError:
method `rmtree' not defined in Module
# /Library/Ruby/Gems/1.8/gems/mocha-0.13.2/lib/mocha/class_method.rb:65:in `remove_method'
# /Library/Ruby/Gems/1.8/gems/mocha-0.13.2/lib/mocha/class_method.rb:65:in `send'
# /Library/Ruby/Gems/1.8/gems/mocha-0.13.2/lib/mocha/class_method.rb:65:in `remove_new_method'
# /Library/Ruby/Gems/1.8/gems/mocha-0.13.2/lib/mocha/class_method.rb:21:in `unstub'
# /Library/Ruby/Gems/1.8/gems/mocha-0.13.2/lib/mocha/central.rb:20:in `unstub'
# /Library/Ruby/Gems/1.8/gems/mocha-0.13.2/lib/mocha/central.rb:27:in `unstub_all'
diff --git a/lib/facter/util/confine.rb b/lib/facter/util/confine.rb
index 3bb504b..9c5a659 100644
--- a/lib/facter/util/confine.rb
+++ b/lib/facter/util/confine.rb
@@ -31,6 +31,13 @@ class Facter::Util::Confine
return false if value.nil?
- return @values.any? { |v| convert(v) === value }
+ return @values.any? do |v|
def initialize(fact = nil, *values, &block)
unless block_given? then
raise ArgumentError, "The fact name must be provided" unless fact
raise ArgumentError, "One or more values or a block must be provided" if values.empty?
@fact = fact
@values = values
end
@block = block
end
class foo (
$package_name = $osfamily ? {
Debian => libfoo-ruby,
Redhat => ruby-foo,
},
$param2,
$param3,
) {
....
}
class postgresql (
$version = '9.2',
$datadir = "/var/lib/postgresql/${version}/main",
) {
...
}
@dalen
dalen / gist:5950297
Last active December 19, 2015 11:49
$ curl -H "Accept: application/json" 'http://localhost:8080/v2/metrics/mbean/com.puppetlabs.puppetdb.http.server:type=v2,name=service-time'
{
"75thPercentile" : 316.5253225,
"OneMinuteRate" : 5.468794013251904,
"Max" : 385878.543307,
"StdDev" : 1153.933689578002,
"FifteenMinuteRate" : 5.882720806763954,
"Mean" : 454.27047779070443,
"Min" : 0.204288,
"MeanRate" : 5.717926515448163,