Skip to content

Instantly share code, notes, and snippets.

View gist:9142098
diff --git a/app.rb b/app.rb
index ae74307..75f43f2 100644
--- a/app.rb
+++ b/app.rb
@@ -505,6 +505,21 @@ class Razor::App < Sinatra::Base
command :create_repo do |data|
check_permissions! "commands:create-repo:#{data['name']}"
+
+ unless data['name'].is_a? String
View view.yaml
nodes:
short:
layout: table
columns:
name:
dhcp_mac:
format: mac
tags:
format: tag_names
policy:
@lutter
lutter / README.md
Created Jun 25, 2014
Hook design document
View README.md

Hooks

Hooks provide a way to be notified of certain events during the operation of the Razor server; the behavior of a hook is defined by a hook type.

File layout for a hook type

Similar to brokers and tasks, hook types are defined through a .hook directory and files within that directory:

View script.sh
> gem install pe-razor-client
> export RAZOR_API=http://razor-server:8080/api
# Use any mirror listed here: http://isoredirect.centos.org/centos/6/isos/x86_64/
# This will take a while, since it will download the ISO and unpack it. The response
# will mention a command, which you can use to check the progress/errors of the
# download via 'razor commands NNN'
> razor create-repo --name centos-6.5 --task centos \
--iso-url http://mirror.anl.gov/pub/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso
# A tag that will match any machine
> razor create-tag --name any --rule '["=", 1, 1]'
@lutter
lutter / deps.pp
Created Sep 17, 2014
Collection-based dependencies
View deps.pp
define echo {
exec { "echo-$name":
command => "/usr/bin/echo $name"
}
}
Foo <| color == 'green' |> -> echo { "yo": } -> Foo <| color == 'red' |>
define foo($color) {
notice("foo[$name]: $color")
View nc-match-no-override.clj
(defn is-in-env?
"Return true if node N is in the desired environment according to the
subtree rooted at G. The following helpers are used:
(good? g) - true if g sets the environment to the desired one
(bad? g) - (not (good? g)) Note that this includes groups that do
not set the environment at all
(matches? n g) - true if the node N matches G's rule
(children g) - a list of G's child groups
Ignores environment trumps/override"
View pe-helpers.clj
(ns user
(:require [puppetlabs.http.client.sync :as http]
[clojure.java.io :as io]
[cheshire.core :as json]))
(def dir "/home/lutter/code/deployer/LOCAL/puppet-master/ssl")
(def config
{
:ssl-config
View lamp.pp
application lamp (
$parameter = 'default',
){
$names = [ 'one', 'two' 'three' ]
$names.each |name| {
site::apache { $name:
export => Http[$name],
}
@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
View keybase.md

Keybase proof

I hereby claim:

  • I am lutter on github.
  • I am lutter (https://keybase.io/lutter) on keybase.
  • I have a public key ASAMdYOKJIvnSEUJQf8C8NeUA6UwsXyEw_DgOMYhgzUr9go

To claim this, I am signing this object: