Skip to content

Instantly share code, notes, and snippets.

@lutter
lutter / Patch
Created September 20, 2012 17:13
Deltacloud: Correct index/show routes for collections where singular and plural name are identical
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 December 21, 2012 20:58
Add another plugin to collectd config with Augeas
# 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 December 21, 2015 02:19
Sketch of Razor CLI

CLI Overview

Commands

Any command can be run with the generic command syntax

razor command :name :body

For example,

@lutter
lutter / mk
Last active December 21, 2015 07:39
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.
#!/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
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)
#!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 December 23, 2015 09:49
Sketch of what you need to do to install razor
#### 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 September 19, 2013 01:24
Razor server prerequistes on CentOS 6.4
#### 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 September 24, 2013 23:13
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
#! /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 September 25, 2013 23:02
libvirt network on my laptop
<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>