Skip to content

Instantly share code, notes, and snippets.

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
nodes:
short:
layout: table
columns:
name:
dhcp_mac:
format: mac
tags:
format: tag_names
policy:
@lutter
lutter / README.md
Created June 25, 2014 12:17
Hook design document

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:

> 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 September 17, 2014 22:18
Collection-based dependencies
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")
(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"
(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
@lutter
lutter / lamp.pp
Last active September 25, 2015 18:42
application lamp (
$parameter = 'default',
){
$names = [ 'one', 'two' 'three' ]
$names.each |name| {
site::apache { $name:
export => Http[$name],
}
@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 / keybase.md
Created November 28, 2015 00:51
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: