Skip to content

Commit 09c18c0

Browse files
committed
Merge branch 'master' into pl-master
Conflicts: chef/lib/chef/cookbook_version.rb features/chef-client/attribute_settings.feature
2 parents c10aee4 + 6839075 commit 09c18c0

196 files changed

Lines changed: 4360 additions & 2898 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ chef-expander/conf/chef-expander.rb
3434
chef-expander/spec/fixtures/expander.log
3535
features/data/cookbooks/transfer_remote_files/metadata.json
3636
features/data/cookbooks/synchronize_deps/metadata.json
37+
features/data/cookbooks_not_uploaded_at_feature_start/*/metadata.json
3738
*/tags
3839
*~

‎chef-expander/Rakefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ rescue LoadError
4141
end
4242

4343
task :install => :package do
44-
sh %{gem install pkg/chef-expander-#{Chef::Expander::VERSION} --no-rdoc --no-ri}
44+
sh %{gem install pkg/chef-expander-#{spec.version} --no-rdoc --no-ri}
4545
end
4646

4747
begin

‎chef-expander/lib/chef/expander/version.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
module Chef
2424
module Expander
2525

26-
VERSION = "0.10.0.beta.0"
26+
VERSION = "0.10.0.beta.6"
2727

2828
def self.version
2929
@rev ||= begin

‎chef-server-api/.rspec‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
-fs

‎chef-server-api/Gemfile.lock‎

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
PATH
22
remote: ../chef
33
specs:
4-
chef (0.10.0.beta.0)
4+
chef (0.10.0.beta.6)
55
bunny (>= 0.6.0)
66
erubis
77
highline
8-
json (>= 1.4.4, <= 1.4.6)
8+
json (<= 1.4.6, >= 1.4.4)
99
mixlib-authentication (>= 1.1.0)
1010
mixlib-cli (>= 1.1.0)
1111
mixlib-config (>= 1.1.2)
12-
mixlib-log (>= 1.2.0)
12+
mixlib-log (>= 1.3.0)
1313
moneta
14+
net-ssh (~> 2.1.3)
15+
net-ssh-multi (~> 1.0.1)
1416
ohai (>= 0.5.7)
15-
rest-client (>= 1.0.4, < 1.7.0)
17+
rest-client (< 1.7.0, >= 1.0.4)
1618
treetop (~> 1.4.9)
1719
uuidtools
1820

1921
PATH
2022
remote: ../chef-solr
2123
specs:
22-
chef-solr (0.10.0.beta.0)
23-
chef (= 0.10.0.beta.0)
24+
chef-solr (0.10.0.beta.6)
25+
chef (= 0.10.0.beta.6)
2426

2527
GEM
2628
remote: http://rubygems.org/
2729
specs:
2830
abstract (1.0.0)
2931
bunny (0.6.0)
30-
daemons (1.1.0)
31-
dep_selector (0.0.1)
32+
daemons (1.1.2)
33+
dep_selector (0.0.3)
3234
diff-lcs (1.1.2)
3335
erubis (2.6.6)
3436
abstract (>= 1.0.0)
3537
eventmachine (0.12.10)
3638
extlib (0.9.15)
37-
haml (3.0.21)
39+
haml (3.0.25)
3840
highline (1.6.1)
3941
json (1.4.6)
4042
merb-assets (1.1.3)
@@ -54,22 +56,28 @@ GEM
5456
merb-param-protection (1.1.3)
5557
merb-core (~> 1.1.3)
5658
mime-types (1.16)
57-
mixlib-authentication (1.1.5)
59+
mixlib-authentication (1.1.4)
5860
mixlib-log
5961
mixlib-cli (1.2.0)
60-
mixlib-config (1.1.3)
61-
mixlib-log (1.2.0)
62+
mixlib-config (1.1.2)
63+
mixlib-log (1.3.0)
6264
moneta (0.6.0)
63-
nokogiri (1.3.3)
65+
net-ssh (2.1.3)
66+
net-ssh-gateway (1.0.1)
67+
net-ssh (>= 1.99.1)
68+
net-ssh-multi (1.0.1)
69+
net-ssh (>= 1.99.2)
70+
net-ssh-gateway (>= 0.99.0)
71+
nokogiri (1.4.4)
6472
ohai (0.5.8)
6573
extlib
66-
json (>= 1.4.4, <= 1.4.6)
74+
json (<= 1.4.6, >= 1.4.4)
6775
mixlib-cli
6876
mixlib-config
6977
mixlib-log
7078
systemu
7179
polyglot (0.3.1)
72-
rack (1.1.0)
80+
rack (1.2.2)
7381
rack-test (0.5.7)
7482
rack (>= 1.0)
7583
rake (0.8.7)
@@ -84,7 +92,7 @@ GEM
8492
diff-lcs (~> 1.1.2)
8593
rspec-mocks (2.5.0)
8694
systemu (1.2.0)
87-
thin (1.2.7)
95+
thin (1.2.11)
8896
daemons (>= 1.0.9)
8997
eventmachine (>= 0.12.6)
9098
rack (>= 1.0.0)

‎chef-server-api/Rakefile‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ Rake::GemPackageTask.new(spec) do |pkg|
1818
pkg.gem_spec = spec
1919
end
2020

21+
begin
22+
require 'rspec/core/rake_task'
23+
24+
desc "Run all specs in spec directory"
25+
RSpec::Core::RakeTask.new(:spec) do |t|
26+
t.pattern = FileList['spec/unit/**/*_spec.rb']
27+
end
28+
rescue LoadError
29+
desc "Install rspec to run the specs"
30+
task :spec do
31+
abort "rspec is not available, (sudo) gem install rspec to run tests"
32+
end
33+
end
34+
35+
36+
task :default => :spec
2137
desc "Install the gem"
2238
task :install => :package do
2339
sh %{gem install pkg/#{GEM_NAME}-#{ChefServerApi::VERSION} --no-rdoc --no-ri}

‎chef-server-api/app/controllers/cookbooks.rb‎

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,22 @@ def params_helper
4141
include Chef::Mixin::Checksum
4242
include Merb::TarballHelper
4343

44+
def index
45+
if request.env['HTTP_X_CHEF_VERSION'] =~ /0\.9/
46+
index_09
47+
else
48+
index_010
49+
end
50+
end
51+
52+
# GET /cookbooks
4453
# returns data in the format of:
4554
# {"apache2" => {
4655
# :url => "http://url",
4756
# :versions => [{:url => "http://url/1.0.0", :version => "1.0.0"}, {:url => "http://url/0.0.1", :version=>"0.0.1"}]
4857
# }
4958
# }
50-
def index
59+
def index_010
5160
cookbook_list = Chef::CookbookVersion.cdb_list
5261
# cookbook_list is in the format of {"apache2" => [0.0.1, 0.0.0]} where the version numbers are DepSelector::Version objects
5362
num_versions = num_versions!
@@ -58,6 +67,22 @@ def index
5867
})
5968
end
6069

70+
# GET /cookbooks
71+
#
72+
# returns data in the format of:
73+
# {
74+
# "apache2" => "http://url/apache2",
75+
# "python" => "http://url/python"
76+
# }
77+
def index_09
78+
cookbook_list = Chef::CookbookVersion.cdb_list_latest(false).keys.sort
79+
response = Hash.new
80+
cookbook_list.map! do |cookbook_name|
81+
response[cookbook_name] = absolute_url(:cookbook, :cookbook_name => cookbook_name)
82+
end
83+
display response
84+
end
85+
6186
def index_recipes
6287
recipes_with_versions = Chef::CookbookVersion.cdb_list(true).inject({}) do|memo, f|
6388
memo[f.name] ||= {}
@@ -67,6 +92,14 @@ def index_recipes
6792
display recipes_with_versions
6893
end
6994

95+
def show_versions
96+
if request.env['HTTP_X_CHEF_VERSION'] =~ /0\.9/
97+
show_versions_09
98+
else
99+
show_versions_010
100+
end
101+
end
102+
70103
# GET /cookbooks/:cookbook_name
71104
#
72105
# returns data in the format of:
@@ -75,14 +108,25 @@ def index_recipes
75108
# :versions => [{:url => "http://url/1.0.0", :version => "1.0.0"}, {:url => "http://url/0.0.1", :version=>"0.0.1"}]
76109
# }
77110
# }
78-
def show_versions
111+
def show_versions_010
79112
versions = Chef::CookbookVersion.cdb_by_name(cookbook_name)
80113
raise NotFound, "Cannot find a cookbook named #{cookbook_name}" unless versions && versions.size > 0
81114
num_versions = num_versions!("all")
82115
cb_versions = versions[cookbook_name].map{ |x| DepSelector::Version.new(x) }.sort.reverse.map{ |x| x.to_s }
83116
display({ cookbook_name => expand_cookbook_urls(cookbook_name, cb_versions, num_versions) })
84117
end
85118

119+
# GET /cookbooks/:cookbook_name
120+
#
121+
# returns data in the format of:
122+
# {"apache2" => ["1.0.0", "0.0.1"]}
123+
def show_versions_09
124+
versions = Chef::CookbookVersion.cdb_by_name(cookbook_name)
125+
raise NotFound, "Cannot find a cookbook named #{requested_cookbook_name}" unless versions && versions.size > 0
126+
127+
display versions
128+
end
129+
86130
def show
87131
cookbook = get_cookbook_version(cookbook_name, cookbook_version)
88132
display cookbook.generate_manifest_with_urls { |opts| absolute_url(:cookbook_file, opts) }
@@ -119,6 +163,12 @@ def update
119163
cookbook = params['inflated_object']
120164
end
121165

166+
if cookbook.frozen_version? && params[:force].nil?
167+
raise Conflict, "The cookbook #{cookbook.name} at version #{cookbook.version} is frozen. Use the 'force' option to override."
168+
end
169+
170+
cookbook.freeze_version if params["inflated_object"].frozen_version?
171+
122172
# ensure that all checksums referred to by the manifest have been uploaded.
123173
Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment|
124174
next unless cookbook.manifest[segment]

‎chef-server-api/app/controllers/search.rb‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ def show
4141
end
4242
params[:type] = params.delete(:id)
4343
display(Chef::SolrQuery.from_params(params).search)
44+
rescue Chef::Exceptions::QueryParseError => e
45+
# we set status rather than raising BadRequest to avoid a
46+
# stacktrace in the server log
47+
self.status = 400
48+
e_msg = e.message.gsub(/\n/, " ")
49+
msg = "invalid search query: '#{params[:q]}' #{e_msg}"
50+
Chef::Log.warn("400 #{msg}")
51+
display({ "error" => [msg] })
4452
end
4553

4654
def reindex
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module ChefServerApi
2-
VERSION = '0.10.0.beta.0'
2+
VERSION = '0.10.0.beta.6'
33
end

‎chef-server-api/spec/spec_helper.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
Merb.push_path(:spec_helpers, "spec" / "spec_helpers", "**/*.rb")
2424
Merb.push_path(:spec_fixtures, "spec" / "fixtures", "**/*.rb")
2525

26+
$:.unshift(File.expand_path('../../app/', __FILE__))
27+
2628
Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test')
2729

2830
RSpec.configure do |config|

0 commit comments

Comments
 (0)