Skip to content

Instantly share code, notes, and snippets.

@kbarber
kbarber / gist:2847520
Created June 1, 2012 00:27
module publish
# pwd
/Users/ken/Development/puppetlabs-ntp
# puppet module login
Username: ken
Password:
User ken successfully authenticated.
Token stored in file /Users/ken/.puppet/forge_credentials.yml.
# puppet module publish
Building /Users/ken/Development/puppetlabs-ntp for release
Module submitted for publishing
@kbarber
kbarber / gist:2937332
Created June 15, 2012 16:13
Message Processor - first time run
17:10:55,069 INFO [org.torquebox.core.runtime] (pool-11-thread-1) Creating ruby runtime (ruby_version: RUBY1_8, compile_mode: JIT, app: puppet-forge, context: messaging)
17:10:55,070 INFO [org.torquebox.core.runtime] (pool-11-thread-2) Creating ruby runtime (ruby_version: RUBY1_8, compile_mode: JIT, app: puppet-forge, context: messaging)
17:10:56,379 INFO [org.torquebox.core.runtime] (pool-11-thread-1) Initialize? true
17:10:56,379 INFO [org.torquebox.core.runtime] (pool-11-thread-2) Initialize? true
17:10:56,380 INFO [org.torquebox.core.runtime] (pool-11-thread-1) Initializer=org.torquebox.web.rails.RailsRuntimeInitializer@1cb95b3
17:10:56,380 INFO [org.torquebox.core.runtime] (pool-11-thread-2) Initializer=org.torquebox.web.rails.RailsRuntimeInitializer@1cb95b3
17:10:56,714 INFO [org.torquebox.core.runtime] (pool-11-thread-2) Setting up Bundler
17:10:56,714 INFO [org.torquebox.core.runtime] (pool-11-thread-1) Setting up Bundler
17:10:59,039 ERROR [stderr] (pool-11-thread-2) NOTE: Gem.source_index is
@kbarber
kbarber / gist:3033250
Created July 2, 2012 13:28
Reverse engineer modules
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'pathname'
current_dir = Pathname.new(Dir.pwd)
current_dir.children.each do |child|
md = child + 'metadata.json'
Remedy for http://projects.puppetlabs.com/issues/14376
The removal of the foreign key is temporary, so we can change the keys in both places, we put it back at the end:
alter table resource_events drop foreign key fk_resource_events_resource_status_id;
alter table resource_statuses modify id bigint unsigned auto_increment not null;
alter table resource_events modify resource_status_id bigint unsigned not null;
alter table resource_events add constraint `fk_resource_events_resource_status_id` FOREIGN KEY (`resource_status_id`) REFERENCES `resource_statuses` (`id`) on delete cascade;
Fails hard at:
# monk start
init.rb:107: /Users/ken/.rvm/gems/ruby-1.8.7-p358@to-boldy-go/gems/sinatra-support-1.2.2/lib/sinatra/support/csssupport.rb:94: syntax error, unexpected ')', expecting '=' (SyntaxError)
/Users/ken/.rvm/gems/ruby-1.8.7-p358@to-boldy-go/gems/sinatra-support-1.2.2/lib/sinatra/support/csssupport.rb:103: syntax error, unexpected kEND, expecting $end
@kbarber
kbarber / gist:3179634
Created July 26, 2012 00:51
ssl errors
#!/usr/bin/env ruby
require 'net/https'
request_path = '/'
user_agent = 'KB'
@uri = URI.parse('https://localhost:8140')
http_proxy_host = nil
http_proxy_port = nil
# puppet module search stdlib --module_repository=https://localhost:8140/ --trace
Searching https://localhost:8140/ ...
Error: Could not connect via HTTPS to https://localhost:8140/
Unable to verify the SSL certificate
Error returned by OpenSSL is 'self signed certificate in certificate chain'
Serial is '1'
Certificate subject is '/CN=Puppet CA: kb.local'
Issuer subject is '/CN=Puppet CA: kb.local'
Start date is 'Mon Jun 18 11:49:43 UTC 2012'
Expiration date is 'Sun Jun 18 11:49:43 UTC 2017'
curl -X POST http://localhost:4567/oauth/token \
-vv \
-F "grant_type=password" \
-F "client_id=75f4a0ef55b738d20d5a2568b54e718fe23756a2ce9d754c6ded7df73c125edb" \
-F "client_secret=44dbef9f65811d3a63e5f72be8511aefe405af180cdde987a70fcd057c953525" \
-F "username=bob" \
-F "password=puppet123"
@kbarber
kbarber / gist:4421164
Created December 31, 2012 16:42
Testing file content in rspec-puppet
describe 'when setting resolver params' do
# Convenience helper for returning parameters for a type from the
# catalogue.
def param(type, title, param)
catalogue.resource(type, title).send(:parameters)[param.to_sym]
end
it 'should create multiple nameserver entries when nameserver is an array' do
params['nameserver'] = ["1.1.1.1","2.2.2.2","3.3.3.3"]
content = param("file", "/etc/resolv.conf","content")
# ./bin/puppet apply -e '$foo = undef notice(inline_template("<%= foo.inspect %>"))'
/Users/ken/Development/puppet/lib/puppet/defaults.rb:127: warning: Insecure world writable dir /usr/local/share in PATH, mode 040777
Notice: Scope(Class[main]): :undef
Notice: Finished catalog run in 0.12 seconds