Skip to content

Instantly share code, notes, and snippets.

View Atalanta's full-sized avatar

Stephen Nelson-Smith Atalanta

  • Ticketmaster
  • Hampshire, UK
View GitHub Profile

Hello fellow chefs!

I'm delighted that you're going to join us on Monday for Chef Fundamentals training. This email should tell you all you need to know:

Location

Training takes place at the Raddison Edwardian Hotel in Leciester Square (http://www.radissonedwardian.com/london-hotel-gb-wc2h-7hl/gbpastor). The hotel is situated at the South West corner of the square, and is easily walkable from Leicester Square tube station (Northern and Piccadilly Lines) or Piccadilly Circus tube station (Piccadilly and Bakerloo lines).

Schedule

master ✗ % cat short_monsters
baku
bugbear
curst
dryad
floater
goblyn
hobgoblin
khargra
magen
ree-1.8.7-2010.02 > REGION = "eu-west-1"
=> "eu-west-1"
ree-1.8.7-2010.02 > SIZE = "small"
=> "m1.small"
ree-1.8.7-2010.02 > EBS = nil
=> nil
ree-1.8.7-2010.02 > RELEASE="lucid"
=> "lucid"
ree-1.8.7-2010.02 > def select_ami
ree-1.8.7-2010.02 ?> ami_generator = UbuntuAmi.new(RELEASE)
require 'fog'
require 'ubuntu_ami'
require 'chef/knife/ec2_server_create'
# Here are some defaults
# TODO: accept command line options
REGION = "eu-west-1"
RELEASE = "lucid"
SECURITY_GROUP = "default"
# Way to parse knife exec options....
# knife exec example.rb option:value option:value
# Gets converted to --option value --option value
require 'awesome_print'
require 'trollop'
def convert_input(arguments)
arguments.reject do |option|
option !~ /^[a-z]+:[a-z]{2,}-*[a-z]*-*\d*$/
require 'ubuntu_ami'
require 'awesome_print'
require 'chef/knife/ec2_server_create'
require 'trollop'
def convert_input(arguments)
arguments.reject do |option|
option !~ /^[a-z]+:[a-z]{2,}-*[a-z]*-*\d*$/
end.map do |option|
opt, value = option.split(':')

Anatomy of a Cucumber test suite

features/                  # Base directory for all your features
features/step_definitions/ # Generic steps used across multiple features
features/support/          # Cucumber bootstrapping directory

On boot, Cucumber will load up features/support/env.rb. This is where you should include all the libraries you want to use. So features/support/env.rb doesn't get cluttered, it's suggested you split out your customisations into

require 'fog'
require 'net/ssh/multi'
managed_ec2_nodes = []
nodes.all.each do |n|
if n.attribute?("ec2")
managed_ec2_nodes << n["ec2"]["instance_id"]
end
end
sh -c '
mkdir -p /etc/chef
(
cat <<'EOP'
<%= IO.read(Chef::Config[:validation_key]) %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
import json, socket, struct
s = socket.socket()
evil_todo_list = []
def do_cmd(data):
cmd = data[0]
if cmd == "push":
evil_todo_list.append(data[1])
return len(evil_todo_list)