Skip to content

Instantly share code, notes, and snippets.

@bodepd
bodepd / gist:1369370
Created November 16, 2011 05:38
cloudformation puppet enc prototype
#!/opt/puppet/bin/ruby
require 'puppet'
require 'puppet/face'
require 'yaml'
# assumes that this credential file has been laid down
# should contain credentials with cloudformation:DescribeStackResource
# access to the resource being classified
credential_file='/var/lib/cfn-init/data/cfn-credentials'
# figure out which facts terminus to use
class ntp(
$server = 'UNSET'
) {
include ntp::params
$server\_real = $server ? {
'UNSET' => $::ntp::params::server,
default => $server,
}
it { should contain_service('glance-api').with_ensure('running') }
it { should contain_service('glance-api').with_enable('true') }
it { should contain_service('glance-api').with_hasstatus('true') }
it { should contain_service('glance-api').with_hasrestart('true') }
it { should contain_service('glance-api').with_subscribe('File[/etc/glance/glance-api.conf]') }
it { should contain_service('glance-api').with_require('Class[glance]') }
require 'spec_helper'
describe 'glance::api' do
it { should contain_class 'glance' }
it { should contain_service('glance-api',
'ensure' => 'running',
'hasstatus' => 'true',
'hasrestart' => 'true',
'subscribe' => 'File[/etc/glance/glance-api.conf]'
) }
require 'spec_helper'
describe 'glance::api' do
it { should contain_class 'glance' }
it { should contain_service('glance-api').with(
'ensure' => 'running',
'hasstatus' => 'true',
'hasrestart' => 'true',
'subscribe' => 'File[/etc/glance/glance-api.conf]'
) }
# keystone-manage tenant add adminTraceback (most recent call last):
File "/usr/bin/keystone-manage", line 13, in <module>
import keystone.manage
File "/usr/lib/python2.7/dist-packages/keystone/manage/__init__.py", line 31, in <module>
from keystone.backends.sqlalchemy import migration
File "/usr/lib/python2.7/dist-packages/keystone/backends/sqlalchemy/__init__.py", line 30, in <module>
from migrate import exceptions as versioning_exceptions
ImportError: No module named migrate
@bodepd
bodepd / gist:1673561
Created January 24, 2012 23:49
This is my example vagrant file
Vagrant::Config.run do |config|
#vagrant config file for building out multi-node with Puppet :)
box = 'natty'
remote_url_base = ENV['REMOTE_VAGRANT_STORE']
config.vm.box = "#{box}"
#config.ssh.forwarded_port_key = "ssh"
ssh_forward = 2222
@bodepd
bodepd / gist:1673654
Created January 24, 2012 23:57
shell script that gets called from vagrant
#!/bin/bash
puppet apply /vagrant/manifests/hosts.pp --modulepath /vagrant/modules --debug
puppet apply /vagrant/manifests/site.pp --modulepath /vagrant/modules --graph --certname $* --graphdir /vagrant/graphs --debug --trace
puppet.conf:
root@ip-10-252-23-9:~# vi /etc/puppetlabs/puppet/puppet.conf
[main]
...
storeconfigs = true
dbadapter = mysql
dbname = console_inventory_service
dbuser = console
def param_value(subject, type, title, param)
subject.resource(type, title).send(:parameters)[param.to_sym]
end
def verify_contents(subject, title, expected_lines)
content = subject.resource('file', title).send(:parameters)[:content]
(content.split("\n") & expected_lines).should == expected_lines
end