Skip to content

Instantly share code, notes, and snippets.

test Mash.new unless attribute? :test
test[:frontend] = {} unless test.attribute? :frontend
test[:frontend][:message] = "message from Xenu"
test[:frontend][:per_node] = "default value" unless test[:frontend].attribute? :per_node
test
[ "libnet-stomp-perl", "libjson-perl", "libxml-parser-perl", "perl-lib", "chef-turnup"].each { |p| package p }
%{ libnet-stomp-perl libjson-perl libxml-parser-perl perl-lib chef-turnup}.each do |pkg|
package pkg
end
class Disk
class Collector
include Enumerable
def initialize(args)
@platform = args[:platform]
puts "#{self} platform #{@platform}"
# how do I include Disk::Collector::Linux ???
end
sort_func = Proc.new { |a,b|
b[1] <=> a[1]
}
h = {
'foo' => 5,
'bar' => 50,
'baz' => 500,
}
---- Begin output of /etc/init.d/apache2 start ----
STDOUT: Starting web server: apache2 failed!STDERR: Syntax error on line 4 of /etc/apache2/sites-enabled/chef_server.conf:
DocumentRoot takes one argument, Root directory of the document tree---- End output of /etc/init.d/apache2 start ----
/usr/lib/ruby/1.8/chef/mixin/command.rb:175:in `handle_command_failures'/usr/lib/ruby/1.8/chef/mixin/command.rb:118:in `run_command'/usr/lib/ruby/1.8/chef/provider/service/init.rb:37:in `start_service'/usr/lib/ruby/1.8/chef/provider/service.rb:62:in `action_start'/usr/lib/ruby/1.8/chef/runner.rb:61:in `send'/usr/lib/ruby/1.8/chef/runner.rb:61:in `run_action'/usr/lib/ruby/1.8/chef/runner.rb:111:in `converge'/usr/lib/ruby/1.8/chef/runner.rb:110:in `each'/usr/lib/ruby/1.8/chef/runner.rb:110:in `converge'/usr/lib/ruby/1.8/chef/resource_collection.rb:86:in `execute_each_resource'/usr/lib/ruby/1.8/chef/mixin/from_file.rb:30:in `each_with_index'/usr/lib/ruby/1.8/chef/resource_collection.rb:84:in `each'/usr/lib/ruby/1.8/chef/res
#
# Author:: Joshua Timberman <joshua@opscode.com>
# Author:: Joshua Sierles <joshua@37signals.com>
# Cookbook Name:: chef
# Recipe:: server
#
# Copyright 2008-2009, Opscode, Inc
# Copyright 2009, 37signals
#
# Licensed under the Apache License, Version 2.0 (the "License");
#
# Author:: Joshua Timberman <joshua@opscode.com>
# Cookbook Name:: chef
# Recipe:: server_proxy
#
# Copyright 2009, Opscode, Inc
#
# 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
/usr/lib/ruby/1.8/net/http.rb:2097:in `error!': 500 "Internal Server Error" (Net::HTTPFatalError)
from /usr/lib/ruby/1.8/chef/rest.rb:233:in `run_request'
from /usr/lib/ruby/1.8/chef/rest.rb:100:in `put_rest'
from /usr/lib/ruby/1.8/chef/client.rb:384:in `save_node'
from /usr/lib/ruby/1.8/chef/client.rb:88:in `run'
from /usr/lib/ruby/1.8/chef/application/client.rb:186:in `run_application'
from /usr/lib/ruby/1.8/chef/application/client.rb:178:in `loop'
from /usr/lib/ruby/1.8/chef/application/client.rb:178:in `run_application'
from /usr/lib/ruby/1.8/chef/application.rb:57:in `run'
from /usr/bin/chef-client:25
y$ cat pass-by-ref.rb
def pbr_int(i)
i = 5
end
def pbr_str(s)
s = "another value"
end