Skip to content

Instantly share code, notes, and snippets.

View danielsdeleo's full-sized avatar

Dan DeLeo danielsdeleo

View GitHub Profile
#
# Cookbook Name:: deploy
# Recipe:: default
#
# Copyright 2009, Opscode
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Example API For Cheffy Deploy Callbacks
deploy "some app" do
# boring stuff
before_migrate do
ruby_script "wizardry" do
# wizardry here
end
require "rubygems"
require "eventmachine"
require "fileutils"
module Handler
def file_modified
raise "iamfail, hear me roar"
puts "#{path} modified"
end
it "accepts a block for a callback (hook) attribute" do
block = lambda { p :noop }
lambda {@resource.send(:validate_callback_attribute, &block)}.should_not raise_error
end
it "accepts a proc for a callback (hook) attribute" do
proc = lambda { p :noop }
lambda {@resource.send(:validate_callback_attribute, proc)}.should_not raise_error
end
$ svccfg
svc:> select network/samba
svc:/network/samba> listprop
net-loopback dependency
net-loopback/entities fmri svc:/network/loopback
net-loopback/grouping astring require_any
net-loopback/restart_on astring none
net-loopback/type astring service
net-service dependency
net-service/entities fmri svc:/network/service
# modinfo
Id Loadaddr Size Info Rev Module Name
6 1180000 4623 1 1 specfs (filesystem for specfs)
8 1185df0 38c4 1 1 TS (time sharing sched class)
9 1188f50 8dc - 1 TS_DPTBL (Time sharing dispatch table)
10 1188fe0 3623e 2 1 ufs (filesystem for ufs)
11 11bc7ae 1ef - 1 fssnap_if (File System Snapshot Interface)
12 11bc8f6 1b3a 1 1 rootnex (sun4u root nexus 1.95)
13 11be023 210 57 1 options (options driver)
15 11be6ff 181a 12 1 sad (STREAMS Administrative Driver ')
require "rubygems"
require "chef"
require "benchmark"
Chef::Config.cookbook_path = ["/tmp/slowmoin/chef-repo/cookbooks/"]
Chef::CookbookLoader.new
# TESTS = 10
# Benchmark.bmbm do |results|
to cuke chef's deploy features, you need this:
* htmlentities
* calendar_date_select
* bluecloth ~> 2.0.5
* mislav-will_paginate ~> 2.3.11
* RedCloth ~> 4.2.2
sudo irb
irb(main):001:0> require "rubygems"
=> false
irb(main):002:0> require "chef"
=> true
irb(main):003:0> Chef::Mixin::Command.run_command(:command => "/etc/init.d/chef-client start")
require "ipaddr"
require "ip_error"
module IpAddrsHelper
def self.convert_port_string(port)
port = port.to_s
case port
when /\A\d+\s*:\s*\d+\Z/
Range.new(port.split(':').first.to_i, port.split(':').last.to_i)