Skip to content

Instantly share code, notes, and snippets.

View danielsdeleo's full-sized avatar

Dan DeLeo danielsdeleo

View GitHub Profile
# Idempotent deploy strategy #
/deploy/root/releases/<SCM-revision-id>/CODE
! git revision id's are not sequential, so the order must be stored in cache dir as JSON
Then, for
* deploy
- do nothing if trying to deploy the same rev as current
- deploy as usual with above modification otherwise
* force_deploy
require "rubygems"
require "spec/mocks"
require "chef"
require "chef/client"
Object.send(:include, Spec::Mocks::Methods)
Object.send(:include, Spec::Mocks::ExampleMethods)
@client = Chef::Client.new
to_stub = [
1)
NoMethodError in 'Chef::Client when building a node and sucessfully getting node data from the server should add any json attributes to the node'
undefined method `has_key?' for "two":String
/Users/danielsdeleo/ruby/chef/chef/spec/../lib/chef/node/attribute.rb:354:in `auto_vivifiy'
/Users/danielsdeleo/ruby/chef/chef/spec/../lib/chef/node/attribute.rb:260:in `get_value'
/Users/danielsdeleo/ruby/chef/chef/spec/../lib/chef/node/attribute.rb:247:in `upto'
/Users/danielsdeleo/ruby/chef/chef/spec/../lib/chef/node/attribute.rb:247:in `get_value'
/Users/danielsdeleo/ruby/chef/chef/spec/../lib/chef/node/attribute.rb:84:in `attribute?'
/Users/danielsdeleo/ruby/chef/chef/spec/../lib/chef/node/attribute.rb:91:in `has_key?'
/Users/danielsdeleo/ruby/chef/chef/spec/../lib/chef/node/attribute.rb:379:in `value_or_descend'
ME:/tmp/dirglob$ touch 2004 2005 2006 2007 2008 2009
ME:/tmp/dirglob$ ls
2004 2005 2006 2007 2008 2009
ME:/tmp/dirglob$ irb
irb(main):001:0> Dir.glob("./*")
=> ["./2005", "./2008", "./2004", "./2007", "./2009", "./2006"]
irb(main):003:0> Dir.glob("#{`pwd`.strip}/*")
=> ["/tmp/dirglob/2005", "/tmp/dirglob/2008", "/tmp/dirglob/2004", "/tmp/dirglob/2007", "/tmp/dirglob/2009", "/tmp/dirglob/2006"]
irb(main):004:0> Dir.glob("#{`pwd`.strip}/**")
=> ["/tmp/dirglob/2005", "/tmp/dirglob/2008", "/tmp/dirglob/2004", "/tmp/dirglob/2007", "/tmp/dirglob/2009", "/tmp/dirglob/2006"]
diff --git a/chef/lib/chef/mixin/command.rb b/chef/lib/chef/mixin/command.rb
index 946c16d..606d52d 100644
--- a/chef/lib/chef/mixin/command.rb
+++ b/chef/lib/chef/mixin/command.rb
@@ -341,8 +341,10 @@ class Chef
channels_to_watch << stderr if !stderr_finished
ready = IO.select(channels_to_watch, nil, nil, 1.0)
rescue Errno::EAGAIN
+ ensure
results = Process.waitpid2(cid, Process::WNOHANG)
$ sudo rake features:client
(in /Users/danielsdeleo/ruby/chef)
/opt/local/bin/ruby -I "/opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.100/lib:lib" "/opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.100/bin/cucumber" --profile client
Using the client profile...
[Sun, 25 Oct 2009 23:00:05 -0600] INFO: Compiling routes... (totally normal to see 'Cannot find resource model')
[Sun, 25 Oct 2009 23:00:05 -0600] INFO: [setup] setting log level to ERROR
@client
Feature: Synchronize cookbooks from the server
In order to configure a system according to a centralized repository
As an Administrator
index 95b48a0..7dd897c 100644
--- a/chef/lib/chef/provider/subversion.rb
+++ b/chef/lib/chef/provider/subversion.rb
@@ -122,7 +122,7 @@ class Chef
# YAML doesn't appreciate input like "svn: '/tmp/deploydir' is not a working copy\n"
return nil
end
- raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless repo_attrs.kind_of?(Hash)
+ raise "Attempted to parse SVN info but could not. SVN info was:\n#{svn_info}" unless repo_attrs.kind_of?(Hash)
rev = (repo_attrs['Last Changed Rev'] || repo_attrs['Revision']).to_s
describe "being compatible with previous implementations" do
it "correctly maps method names to all resource classes" do
@dsl_user.cron("cron").should be_an_instance_of(R::Cron)
@dsl_user.deploy("deploy").should be_an_instance_of(R::Deploy)
@dsl_user.timestamped_deploy("t").should be_an_instance_of(R::TimestampedDeploy)
@dsl_user.deploy_revision("r").should be_an_instance_of(R::DeployRevision)
@dsl_user.deploy_branch("b").should be_an_instance_of(R::DeployBranch)
@dsl_user.directory("foo").should be_an_instance_of(R::Directory)
@dsl_user.execute("bar").should be_an_instance_of(R::Execute)
@dsl_user.file("f").should be_an_instance_of(R::File)
# beat rabbit into submission for chef 0.8 feachuz
rabbitmqctl set_permissions -p /nanite nanite ".*" ".*" ".*"
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
# Please see the readme for overview documentation.
#