Skip to content

Instantly share code, notes, and snippets.

@jhoblitt
jhoblitt / sysctl
Created June 14, 2013 19:16
augeasprovides / puppet-sysctl conflict
Notice: /File[/var/lib/puppet/lib/puppet/type/sysctl.rb]/content:
--- /var/lib/puppet/lib/puppet/type/sysctl.rb 2013-02-26 18:58:23.383939334 -0700
+++ /tmp/puppet-file20130614-14008-1qj3tvy-0 2013-06-14 12:07:40.800470828 -0700
@@ -1,42 +1,65 @@
-module Puppet
- newtype(:sysctl) do
-
- @doc = "Manages kernel parameters in /etc/sysctl.conf. By default this will
- only edit the configuration file, and not change any of the runtime
- values. If you wish changes to be activated right away, you can do
@jhoblitt
jhoblitt / gist:5784767
Created June 14, 2013 19:56
install apache mod_cluster for torquebox
class portal::mod_cluster (
$version = '1.2.0.Final'
) {
include wget
$package_filename = "mod_cluster-${version}-linux2-x64-so.tar.gz"
$package_url = "http://downloads.jboss.org/mod_cluster/${version}/${package_filename}"
$unzip_root = '/root/mod_cluster'
$unzip_path = $unzip_root
$http_mod_path = '/usr/lib64/httpd/modules'
@jhoblitt
jhoblitt / tw.rb
Created June 18, 2013 17:03
Attempting to testing facter facts with rspec
require 'facter'
Facter.add(:tw_cli) do
confine :kernel => "Linux"
setcode do
Facter::Util::Resolution.which('tw_cli')
end
end
@jhoblitt
jhoblitt / gist:5986988
Created July 12, 2013 19:16
network_config hypervisor example
network_config { 'br13':
ensure => 'present',
family => 'inet',
method => 'static',
onboot => 'true',
options => {'DELAY' => '0', 'MTU' => '1500', 'TYPE' => 'Bridge'},
}
network_config { 'br26':
ensure => 'present',
family => 'inet',
@jhoblitt
jhoblitt / gist:6108557
Created July 29, 2013 22:44
#nil? or :undef
@@ -14,10 +14,10 @@ server {
ssl_protocols <%= @ssl_protocols %>;
ssl_ciphers <%= @ssl_ciphers %>;
ssl_prefer_server_ciphers on;
-<% if @auth_basic != :undef -%>
+<% unless @auth_basic.nil? -%>
auth_basic "<%= @auth_basic %>";
<% end -%>
-<% if @auth_basic_user_file != :undef -%>
+<% unless @auth_basic_user_file.nil? -%>
@jhoblitt
jhoblitt / which_bm.rb
Last active December 20, 2015 11:49
Facter::Util::Resolution#which memoization benchmark
#!/usr/bin/env ruby
require 'facter/util/resolution'
require 'benchmark'
@foo = {}
def wrap_which(bin)
if @foo.has_key?(bin)
return @foo[bin]
else
@jhoblitt
jhoblitt / config_ldap.pp
Last active December 20, 2015 13:59
rspec subclass Puppe::Error
class pureftpd::config_ldap (
$ldapport = undef,
$ldapbinddn = undef,
$ldapbindpw = undef,
$ldapbasedn = undef,
$ldapfilter = undef,
$ldaphomedir = undef,
$ldapversion = undef,
$ldapdefaultuid = undef,
$ldapforcedefaultuid = undef,
@jhoblitt
jhoblitt / gist:6359412
Created August 27, 2013 21:29
./load_the_world.rb --modulepath=/etc/puppet/env/production/modules/
[root@ctrl modules]# ./load_the_world.rb --modulepath=/etc/puppet/env/production/modules/
user system total real
require 0.320000 0.060000 0.380000 ( 0.392155)
init 0.020000 0.000000 0.020000 ( 0.016308)
import 5.820000 0.890000 6.710000 ( 7.736223)
Stats
Known resource classes: 357
Known resource defines: 59
Known resource nodes: 1
Manifests loaded: 389
@jhoblitt
jhoblitt / gist:6359620
Created August 27, 2013 21:48
old version of puppetlabs-postgresql that causes puppet 3.2.2 --parser future to fail but not under puppet 3.1.1
[jhoblitt@ctrl postgresql]$ git checkout 5e47aff57ab17946b624be8e8196726c9639acb0
Note: checking out '5e47aff57ab17946b624be8e8196726c9639acb0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
@jhoblitt
jhoblitt / exitstatus_test.rb
Created September 12, 2013 20:24
Testing `$?` with `open3#popen3`
#!/usr/bin/env ruby
require 'open3'
cmd = 'ls not-a-real-path'
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
end
p $?
exit_status = nil