Skip to content

Instantly share code, notes, and snippets.

@lutter
lutter / Patch
Created Sep 20, 2012
Deltacloud: Correct index/show routes for collections where singular and plural name are identical
View Patch
diff --git a/server/lib/deltacloud/helpers/rabbit_helper.rb b/server/lib/deltacloud/helpers/rabbit_helper.rb
index ef8080f..11dda20 100644
--- a/server/lib/deltacloud/helpers/rabbit_helper.rb
+++ b/server/lib/deltacloud/helpers/rabbit_helper.rb
@@ -64,18 +64,43 @@ module Sinatra::Rabbit
helper_method_name += '_url'
[Proc.new do
- define_method helper_method_name do |*args|
- if (opts = args.first).kind_of? Hash
@lutter
lutter / gist:4355772
Created Dec 21, 2012
Add another plugin to collectd config with Augeas
View gist:4355772
# Completely untested
ins LoadPlugin after /files/etc/collectd/collectd.conf/directive[. = 'LoadPlugin'][last()]
set /files/etc/collectd/collectd.conf/directive[. = 'LoadPlugin'][last()]/arg some_value
@lutter
lutter / gist:6234226
Last active Dec 21, 2015
Sketch of Razor CLI
View gist:6234226

CLI Overview

Commands

Any command can be run with the generic command syntax

razor command :name :body

For example,

@lutter
lutter / mk
Last active Dec 21, 2015
Example of a systemd unit file and the script that it runs as a daemon. The script is from https://github.com/puppetlabs/razor-el-mk though I edited it a little to make the point a little clearer.
View mk
#!/usr/bin/env ruby
# This is the /usr/local/bin/mk referenced in mk.service, with slight edits for readability
require 'mk/script'
def usage(outcome, message = nil)
...
end
View Gemfile.lock
GEM
remote: https://rubygems.org/
remote: http://torquebox.org/rubygems/
specs:
blankslate (2.1.2.4)
diff-lcs (1.2.4)
edn (1.0.0)
parslet (~> 1.4.0)
fabrication (2.7.2)
faker (1.2.0)
View boot_install
#!ipxe
echo Razor debian wheezy model boot_call
echo Installation node : http://razor:8080/api/nodes/1
echo Installation image: http://razor:8080/svc/image/wheezy
sleep 3
kernel http://razor:8080/svc/image/wheezy/install.amd/vmlinuz DEBCONF_DEBUG=5 install auto=true url=http://razor:8080/svc/file/1/preseed debian-installer=en_US locale=en_US kbd-chooser/method=us netcfg/get_hostname=wheezy netcfg/get_domain=razor.lan fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-keymaps-at/keymap=us BOOTIF=52-54-00-30-8e-45 || goto error
initrd http://razor:8080/svc/image/wheezy/install.amd/initrd.gz || goto error
boot
@lutter
lutter / Razor install
Last active Dec 23, 2015
Sketch of what you need to do to install razor
View Razor install
#### Prerequistes
#### there are known better ways to do these
## Install PostgreSQL
$ yum install postgresql-server
$ chkconfig postgresql on
$ service postgresql initdb
$ su - postgres
> vi /var/lib/pgsql/data/pg_hba.conf
Add line 'host all all 127.0.0.1/32 md5' before all others
@lutter
lutter / prereqs.txt
Created Sep 19, 2013
Razor server prerequistes on CentOS 6.4
View prereqs.txt
#### Prerequistes
#### there are known better ways to do these
## Install PostgreSQL
$ yum install postgresql-server
$ chkconfig postgresql on
$ service postgresql initdb
$ su - postgres
> vi /var/lib/pgsql/data/pg_hba.conf
Add line 'host all all 127.0.0.1/32 md5' before all others
@lutter
lutter / unpack
Created Sep 24, 2013
Little test script to try out libarchive. Run as 'bundle exec ruby unpack spec/fixtures/iso/tiny.iso /tmp/isotest' from the razor-server checkout
View unpack
#! /usr/bin/env jruby
require 'archive'
unless ARGV.size == 2
puts "Usage: unpack ISO DIRECTORY"
puts "Unbpack ISO into the DIRECTORY"
end
destination = Pathname.new(ARGV[1])
@lutter
lutter / network.xml
Created Sep 25, 2013
libvirt network on my laptop
View network.xml
<network>
<name>local</name>
<uuid>d5e4d859-721b-caf1-4842-21704dea23dd</uuid>
<forward mode='nat'/>
<bridge name='virbr2' stp='on' delay='0' />
<mac address='52:54:00:ca:8d:34'/>
<domain name='example.org'/>
<ip address='192.168.100.1' netmask='255.255.255.0'>
<tftp root='/var/lib/tftpboot' />
<dhcp>