Skip to content

Commit 6d9b684

Browse files
committed
Merge branch 'master' into ctennis/chef-221
2 parents 7c7946a + ea58e2e commit 6d9b684

11 files changed

Lines changed: 69 additions & 44 deletions

File tree

chef-server-slice/app/controllers/nodes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def destroy
8787
@status = 202
8888
display @node
8989
else
90-
redirect(absolute_slice_url(:nodes), {:message => { :notice => "Node #{params[:id]} deleted succesfully" }, :permanent => true})
90+
redirect(absolute_slice_url(:nodes), {:message => { :notice => "Node #{params[:id]} deleted successfully" }, :permanent => true})
9191
end
9292
end
9393

chef-server-slice/lib/chef-server-slice.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ def self.setup_router(scope)
8181

8282
scope.match("/status").to(:controller => "status", :action => "index").name(:status)
8383

84-
scope.resources :searches, :path => "search", :controller => "search" do
85-
scope.resources :entries, :controller => "search_entries"
86-
end
84+
scope.resources :searches, :path => "search", :controller => "search"
85+
scope.match("/search/:search_id/entries", :method => 'get').to(:controller => "search_entries", :action => "index")
86+
scope.match("/search/:search_id/entries", :method => 'post').to(:controller => "search_entries", :action => "create")
87+
scope.match("/search/:search_id/entries/:id", :method => 'get').to(:controller => "search_entries", :action => "show")
88+
scope.match("/search/:search_id/entries/:id", :method => 'put').to(:controller => "search_entries", :action => "create")
89+
scope.match("/search/:search_id/entries/:id", :method => 'post').to(:controller => "search_entries", :action => "update")
90+
scope.match("/search/:search_id/entries/:id", :method => 'delete').to(:controller => "search_entries", :action => "destroy")
8791

8892
scope.match("/cookbooks/_attribute_files").to(:controller => "cookbooks", :action => "attribute_files")
8993
scope.match("/cookbooks/_recipe_files").to(:controller => "cookbooks", :action => "recipe_files")

chef/lib/chef/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class Config
6262
:template_url => "http://localhost:4000",
6363
:remotefile_url => "http://localhost:4000",
6464
:search_url => "http://localhost:4000",
65-
:couchdb_database => "chef",
6665
:couchdb_version => nil,
66+
:couchdb_database => "chef",
6767
:openid_store_couchdb => false,
6868
:openid_cstore_couchdb => false,
6969
:openid_store_path => "/var/chef/openid/db",

chef/lib/chef/couchdb.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
class Chef
2626
class CouchDB
2727
include Chef::Mixin::ParamsValidate
28-
28+
2929
def initialize(url=nil)
3030
url ||= Chef::Config[:couchdb_url]
3131
@rest = Chef::REST.new(url)
32-
Chef::Config[:couchdb_version] ||= @rest.run_request(:GET, URI.parse(@rest.url + "/"), false, 10, false)["version"].gsub(/-.+/,"").to_f
3332
end
3433

3534
def create_db
@@ -145,20 +144,21 @@ def has_key?(obj_type, name)
145144
end
146145
end
147146

148-
private
149-
150-
def safe_name(name)
151-
name.gsub(/\./, "_")
152-
end
153-
154147
def view_uri(design, view)
148+
Chef::Config[:couchdb_version] ||= @rest.run_request(:GET, URI.parse(@rest.url + "/"), false, 10, false)["version"].gsub(/-.+/,"").to_f
155149
case Chef::Config[:couchdb_version]
156150
when 0.9
157151
"#{Chef::Config[:couchdb_database]}/_design/#{design}/_view/#{view}"
158152
when 0.8
159153
"#{Chef::Config[:couchdb_database]}/_view/#{design}/#{view}"
160154
end
161155
end
162-
156+
157+
private
158+
159+
def safe_name(name)
160+
name.gsub(/\./, "_")
161+
end
162+
163163
end
164164
end

chef/lib/chef/provider/mount.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def action_mount
3636
status = mount_fs()
3737
if status
3838
@new_resource.updated = true
39-
Chef::Log.info("#{@new_resource}: mounted succesfully")
39+
Chef::Log.info("#{@new_resource}: mounted successfully")
4040
end
4141
else
4242
Chef::Log.debug("#{@new_resource}: not mounting, already mounted")
@@ -49,7 +49,7 @@ def action_umount
4949
status = umount_fs()
5050
if status
5151
@new_resource.updated = true
52-
Chef::Log.info("#{@new_resource}: unmounted succesfully")
52+
Chef::Log.info("#{@new_resource}: unmounted successfully")
5353
end
5454
else
5555
Chef::Log.debug("#{@new_resource}: not unmounting, already unmounted")
@@ -65,7 +65,7 @@ def action_remount
6565
status = remount_fs()
6666
if status
6767
@new_resource.updated = true
68-
Chef::Log.info("#{@new_resource}: remounted succesfully")
68+
Chef::Log.info("#{@new_resource}: remounted successfully")
6969
end
7070
else
7171
Chef::Log.debug("#{@new_resource}: not mounted, not remounting")

chef/lib/chef/provider/service.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def action_enable
3535
Chef::Log.debug("#{@new_resource}: attempting to enable")
3636
status = enable_service()
3737
if status
38-
Chef::Log.info("#{@new_resource}: enabled succesfully")
38+
Chef::Log.info("#{@new_resource}: enabled successfully")
3939
end
4040
else
4141
Chef::Log.debug("#{@new_resource}: not enabling, already enabled")
@@ -47,7 +47,7 @@ def action_disable
4747
Chef::Log.debug("#{@new_resource}: attempting to disable")
4848
status = disable_service()
4949
if status
50-
Chef::Log.info("#{@new_resource}: disabled succesfully")
50+
Chef::Log.info("#{@new_resource}: disabled successfully")
5151
end
5252
else
5353
Chef::Log.debug("#{@new_resource}: not disabling, already disabled")
@@ -59,7 +59,7 @@ def action_start
5959
Chef::Log.debug("#{@new_resource}: attempting to start")
6060
status = start_service()
6161
if status
62-
Chef::Log.info("Started service #{@new_resource} succesfully")
62+
Chef::Log.info("Started service #{@new_resource} successfully")
6363
end
6464
else
6565
Chef::Log.debug("#{@new_resource}: not starting, already running")
@@ -71,7 +71,7 @@ def action_stop
7171
Chef::Log.debug("#{@new_resource}: attempting to stop")
7272
status = stop_service()
7373
if status
74-
Chef::Log.info("#{@new_resource}: stopped succesfully")
74+
Chef::Log.info("#{@new_resource}: stopped successfully")
7575
end
7676
else
7777
Chef::Log.debug("#{@new_resource}: not stopping, already stopped")
@@ -83,7 +83,7 @@ def action_restart
8383
Chef::Log.debug("#{@new_resource}: attempting to restart")
8484
status = restart_service()
8585
if status
86-
Chef::Log.info("#{@new_resource}: restarted succesfully")
86+
Chef::Log.info("#{@new_resource}: restarted successfully")
8787
end
8888
end
8989
end
@@ -96,7 +96,7 @@ def action_reload
9696
Chef::Log.debug("#{@new_resource}: attempting to reload")
9797
status = reload_service()
9898
if status
99-
Chef::Log.info("#{@new_resource}: reloaded succesfully")
99+
Chef::Log.info("#{@new_resource}: reloaded successfully")
100100
end
101101
end
102102
end

chef/lib/chef/provider/service/freebsd.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def load_current_resource
8484
unless status.exitstatus == 0
8585
raise Chef::Exceptions::Service, "Command #{@node[:command][:ps]} failed"
8686
else
87-
Chef::Log.debug("#{@new_resource}: #{@node[:command][:ps]} exited and parsed succesfully, process running: #{@current_resource.running}")
87+
Chef::Log.debug("#{@new_resource}: #{@node[:command][:ps]} exited and parsed successfully, process running: #{@current_resource.running}")
8888
end
8989
end
9090

chef/lib/chef/provider/service/gentoo.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class Provider
2424
class Service
2525
class Gentoo < Chef::Provider::Service::Init
2626
def load_current_resource
27+
28+
@new_resource.supports[:status] = true
29+
@new_resource.supports[:restart] = true
30+
2731
super
2832

2933
raise Chef::Exceptions::Service unless ::File.exists?("/sbin/rc-update")

chef/lib/chef/provider/service/init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def load_current_resource
7777
unless status.exitstatus == 0
7878
raise Chef::Exceptions::Service, "Command #{@node[:command][:ps]} failed"
7979
else
80-
Chef::Log.debug("#{@new_resource}: #{@node[:command][:ps]} exited and parsed succesfully, process running: #{@current_resource.running}")
80+
Chef::Log.debug("#{@new_resource}: #{@node[:command][:ps]} exited and parsed successfully, process running: #{@current_resource.running}")
8181
end
8282
end
8383

chef/spec/unit/couchdb_spec.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
Chef::REST.should_receive(:new).with("http://monkeypants")
3737
Chef::CouchDB.new("http://monkeypants")
3838
end
39-
40-
it "should parse the CouchDB version number" do
41-
42-
end
4339
end
4440

4541
describe Chef::CouchDB, "create_db" do
@@ -252,23 +248,27 @@ def do_delete(rev=nil)
252248
end
253249
end
254250

255-
describe Chef::CouchDB, "safe_name" do
251+
describe Chef::CouchDB, "view_uri" do
256252
before do
257-
@couchdb = mock("Chef::CouchDB", :null_object => true)
258-
Chef::CouchDB.stub!(:new).and_return(@couchdb)
253+
@mock_rest = mock("Chef::REST", :null_object => true, :url => "http://monkeypants")
254+
Chef::REST.stub!(:new).and_return(@mock_rest)
255+
@couchdb = Chef::CouchDB.new("http://localhost")
259256
end
260257

261-
it "should convert the name to a safe name" do
262-
@couchdb.should_receive(:safe_name).with("asdf.lol.com").and_return("asdf_lol_com")
263-
@couchdb.safe_name("asdf.lol.com")
264-
end
265-
end
266-
267-
describe Chef::CouchDB, "view_uri" do
268-
before do
269-
@couchdb = mock("Chef::CouchDB", :null_object => true)
270-
Chef::CouchDB.stub!(:new).and_return(@couchdb)
271-
Chef::Config.stub!(:[]).with(:couchdb_database).and_return("chef")
258+
describe "when the couchdb version is unknown" do
259+
it "should set the couchdb version appropriately" do
260+
ov = Chef::Config[:couchdb_version]
261+
Chef::Config[:couchdb_version] = nil
262+
@mock_rest.should_receive(:run_request).with(
263+
:GET,
264+
URI.parse("http://monkeypants/"),
265+
false,
266+
10,
267+
false
268+
).and_return({ "version" => "0.9" })
269+
@couchdb.view_uri("nodes", "all")
270+
Chef::Config[:couchdb_version] = ov
271+
end
272272
end
273273

274274
describe "on couchdb 0.8" do

0 commit comments

Comments
 (0)