Skip to content

Instantly share code, notes, and snippets.

@bodepd
bodepd / gist:660837
Created November 3, 2010 06:12
super cool!
umm, gist is awesome!
@bodepd
bodepd / gist:674316
Created November 12, 2010 16:33
scoping example
class x{
file { '/tmp/dan':
ensure => file,
mode => $mode
}
}
class y {
include x
File { content => 'y'}
@bodepd
bodepd / Resource defaults and scope in puppet is odd
Created November 19, 2010 23:49
switch between inherits and includes and see the differences.
class a {
Notify {
message => 'a',
}
exec {'/bin/echo a':
logoutput => true,
}
}
@bodepd
bodepd / gist:734750
Created December 9, 2010 14:24
stages follow the rules of dynamic scoping.. hmm..
stage{'before':}->Stage['main']
include f
class f {
# include b
notify{'after':}
}
class b {
notify{a:}
notify{e:}
@bodepd
bodepd / gist:1026094
Created June 14, 2011 22:29
test code for params namespace with inherits
class abc(
$a = $myparams::foo
) inherits myparams {
notify{$a:}
}
class myparams {
$foo = 'blah'
}
def exists?
begin
nova_manage("network", "list").match(/^#{resource[:network]}\/[0-9]{1,2} /)
rescue Exception
return false
end
end
describe 'rabbitmq::plugins', :type => :define do
let(:module_path) { "#{File.dirname(__FILE__)}/../../../../" }
let(:title) { 'foo' }
describe 'default behaviors' do
let(:params) { {} }
let(:facts) { {'puppetversion' => '1.2.3'} }
it { should create_resource('package', 'rabbitmq-server').with_param('ensure', 'absent') }
end
end
path /
auth yes
allow *
facts = Puppet::Rails::InventoryFact.find_by_sql(["SELECT inventory_facts.value, inventory_nodes.name AS node_name
FROM inventory_facts INNER JOIN inventory_nodes
ON inventory_facts.node_id = inventory_nodes.id
WHERE inventory_facts.name = ?", name])
$rand = inline_template("<%= (0...8).map{65.+(rand(25)).chr}.join %>")
notice($rand)
file { '/tmp/foo':
replace => false,
content => $rand
}