Skip to content

Commit

Permalink
merged master 0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Brown committed Feb 25, 2009
2 parents 6f5042c + 409ffd2 commit f79a738
Show file tree
Hide file tree
Showing 49 changed files with 1,557 additions and 42 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -10,4 +10,8 @@ chef/pkg
chef-server/pkg
chef/log
chef-server/log
log
couchdb.stderr
couchdb.stdout
features/data/tmp/**
*.swp
39 changes: 39 additions & 0 deletions CHANGELOG
@@ -1,3 +1,42 @@
Fri Feb 13 12:26:07 PST 2009
Release Notes - Chef - Version 0.5.4
http://tickets.opscode.com/

** Bug
* [CHEF-48] - Invalid default recipe causes merb 500 error
* [CHEF-64] - chef-server pukes if you type an invalid url in the openid login
* [CHEF-72] - Templates used in definitions searched for only the cookbook they are used in
* [CHEF-76] - Search queries return empty results occationally
* [CHEF-77] - Indexer broken - theoretically creates index, but cannot read them
* [CHEF-82] - user provider doesn't handle 'shadow' not being installed correctly
* [CHEF-87] - File specificity (preferred file) is broken by dotfiles
* [CHEF-89] - remote_file doesn't support being passed a URL as a source, but the documentation argues otherwise - solo only
* [CHEF-90] - Search in recipes does not allow for attribute selection, even though the REST API does.
* [CHEF-92] - When loading the prior resource we should never load its action
* [CHEF-94] - Definitions should allow access to the node object within the parameter setting block
* [CHEF-95] - not_if's string behaviour is broken, closed stream
* [CHEF-96] - group resource doesn't if members is empty so it always tried to add them
* [CHEF-97] - not_if and only_if cause exceptions in popen4
* [CHEF-108] - @@seen_recipes is a class variable, this makes chef-client and chef-solo *not* run any recipes after the first run in daemon mode
* [CHEF-110] - interval / splay needs to be supported outside of daemonized mode for chef-client
* [CHEF-111] - user provider mistakenly attempts to modify the user even if no changes are required
* [CHEF-114] - when not given an interval on the command line, chef-client runs in a tight loop driving server load up
* [CHEF-117] - Can't setgid if you have already setuid-ed
* [CHEF-123] - User provider fails to correctly compare a numeric GID to a string GID
* [CHEF-124] - Chef-server should set reload_classes false
* [CHEF-125] - chef-server init.rb should set Merb log_stream to the location supplied by chef/server.rb

** Improvement
* [CHEF-71] - service resource :supports attribute too rubyish and unlike :action
* [CHEF-73] - When specifying a custom gem source for a gem_package, also include rubyforge in the list of sources so gem dependencies can be installed
* [CHEF-106] - refactor search, move attributes to search function : chef/chef-server/lib/chef/search.rb, chef/chef-server/lib/controllers/search.rb
* [CHEF-107] - more informative message for info log on package upgrade
* [CHEF-127] - cron resource should log to info for update/add instead of debug

** New Feature
* [CHEF-59] - Package resource need Redhat provider
* [CHEF-91] - Chef Client should reload the configuration on SIGHUP

Sat Jan 31 18:52:41 PST 2009
Release Notes - Chef - Version 0.5.2
http://tickets.opscode.com/
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Expand Up @@ -9,7 +9,7 @@ Contributors and Copyright holders:
* Copyright 2008, Arjuna Christensen <aj@hjksolutions.com>
* Copyright 2008, Bryan McLellan <btm@loftninjas.org>
* Copyright 2008, Ezra Zygmuntowicz <ezra@engineyard.com>
* Copyright 2008, Sean Cribbs <seancribbs@gmail.com>
* Copyright 2009, Sean Cribbs <seancribbs@gmail.com>
* Copyright 2009, Christopher Brown <cb@opscode.com>

Chef incorporates code modified from Open4 (http://www.codeforpeople.com/lib/ruby/open4/), which was written by Ara T. Howard.
Expand Down
101 changes: 100 additions & 1 deletion Rakefile
@@ -1,4 +1,6 @@
gems = %w[chef chefserverslice chef-server]
require 'rubygems'
require 'cucumber/rake/task'

desc "Build the chef gems"
task :gem do
Expand Down Expand Up @@ -28,12 +30,109 @@ task :spec do
end
end

namespace :dev do
def start_dev_environment(type="normal")
@couchdb_server_pid = nil
@chef_server_pid = nil
@chef_indexer_pid = nil
@stompserver_pid = nil

ccid = fork
if ccid
@couchdb_server_pid = ccid
else
exec("couchdb")
end

scid = fork
if scid
@stompserver_pid = scid
else
exec("stompserver")
end

mcid = fork
if mcid # parent
@chef_indexer_pid = mcid
else # child
case type
when "normal"
exec("chef-indexer -l debug")
when "features"
exec("chef-indexer -c #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug")
end
end

mcid = fork
if mcid # parent
@chef_server_pid = mcid
else # child
case type
when "normal"
exec("chef-server -l debug -N -c 2")
when "features"
exec("chef-server -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -N -c 2")

end
end

puts "Running Chef at #{@chef_server_pid}"
puts "Running Chef Indexer at #{@chef_indexer_pid}"
puts "Running CouchDB at #{@couchdb_server_pid}"
puts "Running Stompserver at #{@stompserver_pid}"
end

def stop_dev_environment
puts "Stopping CouchDB"
Process.kill("KILL", @couchdb_server_pid)
puts "Stopping Stomp server"
Process.kill("KILL", @stompserver_pid)
puts "Stopping Chef Server"
Process.kill("INT", @chef_server_pid)
puts "Stopping Chef Indexer"
Process.kill("INT", @chef_indexer_pid)
puts "\nCouchDB, Stomp, Chef Server and Chef Indexer killed - have a nice day!"
end

def wait_for_ctrlc
puts "Hit CTRL-C to destroy development environment"
trap("CHLD", "IGNORE")
trap("INT") do
stop_dev_environment
exit 1
end
while true
sleep 10
end
end

desc "Run a Devel instance of Chef"
task :dev => "dev:install" do
start_dev_environment
wait_for_ctrlc
end

namespace :dev do
desc "Install a Devel instance of Chef with the example-repository"
task :install do
gems.each do |dir|
Dir.chdir(dir) { sh "rake install" }
end
Dir.chdir("example-repository") { sh("rake install") }
end


desc "Install a test instance of Chef for doing features against"
task :features do
gems.each do |dir|
Dir.chdir(dir) { sh "rake install" }
end
start_dev_environment("features")
wait_for_ctrlc
end
end

Cucumber::Rake::Task.new(:features) do |t|
t.step_pattern = 'features/steps/**/*.rb'
supportdir = 'features/support'
t.cucumber_opts = "--format pretty -r #{supportdir}"
end
2 changes: 1 addition & 1 deletion chef-server/Rakefile
Expand Up @@ -10,7 +10,7 @@ require 'chef'
include FileUtils

GEM = "chef-server"
CHEF_SERVER_VERSION = "0.5.3"
CHEF_SERVER_VERSION = "0.5.5"
AUTHOR = "Opscode"
EMAIL = "chef@opscode.com"
HOMEPAGE = "http://wiki.opscode.com/display/chef"
Expand Down
58 changes: 58 additions & 0 deletions chef-server/chef-server.gemspec
@@ -0,0 +1,58 @@
Gem::Specification.new do |s|
s.name = %q{chef-server}
s.version = "0.5.5"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Adam Jacob"]
s.date = %q{2009-01-15}
s.description = %q{A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.}
s.email = %q{adam@opscode.com}
s.executables = ["chef-indexer", "chef-server"]
s.extra_rdoc_files = ["README.txt", "LICENSE", "NOTICE"]
s.files = ["LICENSE", "README.txt", "Rakefile", "lib/chef", "lib/chef/search.rb", "lib/chef/search_index.rb", "lib/controllers", "lib/controllers/application.rb", "lib/controllers/cookbook_attributes.rb", "lib/controllers/cookbook_definitions.rb", "lib/controllers/cookbook_files.rb", "lib/controllers/cookbook_libraries.rb", "lib/controllers/cookbook_recipes.rb", "lib/controllers/cookbook_templates.rb", "lib/controllers/cookbooks.rb", "lib/controllers/exceptions.rb", "lib/controllers/nodes.rb", "lib/controllers/openid_consumer.rb", "lib/controllers/openid_register.rb", "lib/controllers/openid_server.rb", "lib/controllers/search.rb", "lib/controllers/search_entries.rb", "lib/helpers", "lib/helpers/cookbooks_helper.rb", "lib/helpers/global_helpers.rb", "lib/helpers/nodes_helper.rb", "lib/helpers/openid_server_helpers.rb", "lib/init.rb", "lib/public", "lib/public/images", "lib/public/images/indicator.gif", "lib/public/images/merb.jpg", "lib/public/javascript", "lib/public/javascript/chef.js", "lib/public/jquery", "lib/public/jquery/jquery-1.2.6.min.js", "lib/public/jquery/jquery.jeditable.mini.js", "lib/public/stylesheets", "lib/public/stylesheets/master.css", "lib/views", "lib/views/cookbook_templates", "lib/views/cookbook_templates/index.html.haml", "lib/views/cookbooks", "lib/views/cookbooks/_attribute_file.html.haml", "lib/views/cookbooks/_syntax_highlight.html.haml", "lib/views/cookbooks/attribute_files.html.haml", "lib/views/cookbooks/index.html.haml", "lib/views/cookbooks/show.html.haml", "lib/views/exceptions", "lib/views/exceptions/bad_request.json.erb", "lib/views/exceptions/internal_server_error.html.erb", "lib/views/exceptions/not_acceptable.html.erb", "lib/views/exceptions/not_found.html.erb", "lib/views/layout", "lib/views/layout/application.html.haml", "lib/views/nodes", "lib/views/nodes/_action.html.haml", "lib/views/nodes/_node.html.haml", "lib/views/nodes/_resource.html.haml", "lib/views/nodes/compile.html.haml", "lib/views/nodes/index.html.haml", "lib/views/nodes/show.html.haml", "lib/views/openid_consumer", "lib/views/openid_consumer/index.html.haml", "lib/views/openid_consumer/start.html.haml", "lib/views/openid_login", "lib/views/openid_login/index.html.haml", "lib/views/openid_register", "lib/views/openid_register/index.html.haml", "lib/views/openid_register/show.html.haml", "lib/views/openid_server", "lib/views/openid_server/decide.html.haml", "lib/views/search", "lib/views/search/_search_form.html.haml", "lib/views/search/index.html.haml", "lib/views/search/show.html.haml", "lib/views/search_entries", "lib/views/search_entries/index.html.haml", "lib/views/search_entries/show.html.haml", "bin/chef-indexer", "bin/chef-server", "NOTICE"]
s.has_rdoc = true
s.homepage = %q{http://wiki.opscode.com/display/chef}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.2.0}
s.summary = %q{A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2

if current_version >= 3 then
s.add_runtime_dependency(%q<stomp>, [">= 0"])
s.add_runtime_dependency(%q<stompserver>, [">= 0"])
s.add_runtime_dependency(%q<ferret>, [">= 0"])
s.add_runtime_dependency(%q<merb-core>, [">= 0"])
s.add_runtime_dependency(%q<merb-haml>, [">= 0"])
s.add_runtime_dependency(%q<mongrel>, [">= 0"])
s.add_runtime_dependency(%q<haml>, [">= 0"])
s.add_runtime_dependency(%q<ruby-openid>, [">= 0"])
s.add_runtime_dependency(%q<json>, [">= 0"])
s.add_runtime_dependency(%q<syntax>, [">= 0"])
else
s.add_dependency(%q<stomp>, [">= 0"])
s.add_dependency(%q<stompserver>, [">= 0"])
s.add_dependency(%q<ferret>, [">= 0"])
s.add_dependency(%q<merb-core>, [">= 0"])
s.add_dependency(%q<merb-haml>, [">= 0"])
s.add_dependency(%q<mongrel>, [">= 0"])
s.add_dependency(%q<haml>, [">= 0"])
s.add_dependency(%q<ruby-openid>, [">= 0"])
s.add_dependency(%q<json>, [">= 0"])
s.add_dependency(%q<syntax>, [">= 0"])
end
else
s.add_dependency(%q<stomp>, [">= 0"])
s.add_dependency(%q<stompserver>, [">= 0"])
s.add_dependency(%q<ferret>, [">= 0"])
s.add_dependency(%q<merb-core>, [">= 0"])
s.add_dependency(%q<merb-haml>, [">= 0"])
s.add_dependency(%q<mongrel>, [">= 0"])
s.add_dependency(%q<haml>, [">= 0"])
s.add_dependency(%q<ruby-openid>, [">= 0"])
s.add_dependency(%q<json>, [">= 0"])
s.add_dependency(%q<syntax>, [">= 0"])
end
end
2 changes: 2 additions & 0 deletions chef-server/lib/views/exceptions/bad_request.html.haml
@@ -0,0 +1,2 @@
- request.exceptions.each do |exception|
= exception.message
2 changes: 1 addition & 1 deletion chef/Rakefile
Expand Up @@ -4,7 +4,7 @@ require 'rake/rdoctask'
require './tasks/rspec.rb'

GEM = "chef"
CHEF_VERSION = "0.5.3"
CHEF_VERSION = "0.5.5"
AUTHOR = "Adam Jacob"
EMAIL = "adam@opscode.com"
HOMEPAGE = "http://wiki.opscode.com/display/chef"
Expand Down
7 changes: 7 additions & 0 deletions chef/bin/chef-client
Expand Up @@ -57,6 +57,13 @@ opts = OptionParser.new do |opts|
end
opts.parse!(ARGV)

trap("INT") { Chef.fatal!("SIGINT received, stopping", 2) }
trap("HUP") {
Chef::Log.info("SIGHUP received, reloading configuration")
Chef::Config.from_file(config[:config_file])
Chef::Config.configure { |c| c.merge!(config) }
}

unless File.exists?(config[:config_file]) and File.readable?(config[:config_file])
Chef.fatal!("I cannot find or read the config file: #{config[:config_file]}", 1)
end
Expand Down
2 changes: 1 addition & 1 deletion chef/chef.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{chef}
s.version = "0.5.3"
s.version = "0.5.5"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Adam Jacob"]
Expand Down
2 changes: 1 addition & 1 deletion chef/lib/chef.rb
Expand Up @@ -27,7 +27,7 @@
Dir[File.join(File.dirname(__FILE__), 'chef/mixin/**/*.rb')].sort.each { |lib| require lib }

class Chef
VERSION = '0.5.3'
VERSION = '0.5.5'

class << self
def fatal!(msg, err = -1)
Expand Down
2 changes: 2 additions & 0 deletions chef/lib/chef/config.rb
Expand Up @@ -53,6 +53,8 @@ class Config
:log_location => STDOUT,
:openid_providers => nil,
:ssl_verify_mode => :verify_none,
:ssl_client_cert => "",
:ssl_client_key => "",
:rest_timeout => 60,
:couchdb_url => "http://localhost:5984",
:registration_url => "http://localhost:4000",
Expand Down
2 changes: 1 addition & 1 deletion chef/lib/chef/mixin/generate_url.rb
Expand Up @@ -24,7 +24,7 @@ module GenerateURL

def generate_cookbook_url(url, cookbook, type, node, args=nil)
new_url = nil
if url =~ /^http/
if url =~ /^(http|https):\/\//
new_url = url
else
new_url = "cookbooks/#{cookbook}/#{type}?"
Expand Down
49 changes: 47 additions & 2 deletions chef/lib/chef/mixin/template.rb
Expand Up @@ -26,14 +26,59 @@ module Template
# Render a template with Erubis. Takes a template as a string, and a
# context hash.
def render_template(template, context)
eruby = Erubis::Eruby.new(template)
output = eruby.evaluate(context)
begin
eruby = Erubis::Eruby.new(template)
output = eruby.evaluate(context)
rescue Object => e
raise TemplateError.new(e, template, context)
end
final_tempfile = Tempfile.new("chef-rendered-template")
final_tempfile.print(output)
final_tempfile.close
final_tempfile
end

class TemplateError < RuntimeError
attr_reader :original_exception, :context
SOURCE_CONTEXT_WINDOW = 2 unless defined? SOURCE_CONTEXT_WINDOW

def initialize(original_exception, template, context)
@original_exception, @template, @context = original_exception, template, context
end

def message
@original_exception.message
end

def line_number
@line_number ||= $1.to_i if original_exception.backtrace.find {|line| line =~ /\(erubis\):(\d+)/ }
end

def source_location
"on line ##{line_number}"
end

def source_listing
@source_listing ||= begin
line_index = line_number - 1
beginning_line = line_index <= SOURCE_CONTEXT_WINDOW ? 0 : line_index - SOURCE_CONTEXT_WINDOW
source_size = SOURCE_CONTEXT_WINDOW * 2 + 1
lines = @template.split(/\n/)
contextual_lines = lines[beginning_line, source_size]
output = []
contextual_lines.each_with_index do |line, index|
line_number = (index+beginning_line+1).to_s.rjust(3)
output << "#{line_number}: #{line}"
end
output.join("\n")
end
end

def to_s
"\n\n#{self.class} (#{message}) #{source_location}:\n\n" +
"#{source_listing}\n\n #{original_exception.backtrace.join("\n ")}\n\n"
end
end
end
end
end
3 changes: 2 additions & 1 deletion chef/lib/chef/provider/package.rb
Expand Up @@ -71,7 +71,8 @@ def action_install

def action_upgrade
if @current_resource.version != @candidate_version
Chef::Log.info("Upgrading #{@new_resource} version from #{@current_resource.version} to #{@candidate_version}")
orig_version = @current_resource.version || "uninstalled"
Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{@candidate_version}")
status = upgrade_package(@new_resource.package_name, @candidate_version)
if status
@new_resource.updated = true
Expand Down

0 comments on commit f79a738

Please sign in to comment.