summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2011-04-10 07:48:42 -0700
committerDaniel DeLeo <dan@opscode.com>2011-04-10 07:48:42 -0700
commit3f85c5e222f3e4ecdc2f4258a357e1f4a64d7612 (patch)
tree6a7d80d2e38a6cbdec48b5c8dcb4d66518acdea5
parentd96f83c8d67b903149acd0b93f1a90d6ebdd8bd0 (diff)
downloadchef-3f85c5e222f3e4ecdc2f4258a357e1f4a64d7612.tar.gz
[CHEF-2209] only try to create the db once
-rw-r--r--chef-server-api/config/init.rb1
-rw-r--r--chef/lib/chef/couchdb.rb1
-rw-r--r--chef/spec/unit/couchdb_spec.rb5
3 files changed, 1 insertions, 6 deletions
diff --git a/chef-server-api/config/init.rb b/chef-server-api/config/init.rb
index 281224d530..01114ac7c1 100644
--- a/chef-server-api/config/init.rb
+++ b/chef-server-api/config/init.rb
@@ -65,6 +65,7 @@ end
unless Merb::Config.environment == "test"
# create the couch design docs for nodes, roles, and databags
+ Chef::CouchDB.new.create_db
Chef::CouchDB.new.create_id_map
Chef::Node.create_design_document
Chef::Role.create_design_document
diff --git a/chef/lib/chef/couchdb.rb b/chef/lib/chef/couchdb.rb
index 3f269fa5f4..5788356a77 100644
--- a/chef/lib/chef/couchdb.rb
+++ b/chef/lib/chef/couchdb.rb
@@ -78,7 +78,6 @@ class Chef
end
def create_design_document(name, data)
- create_db
to_update = true
begin
old_doc = @rest.get_rest("#{couchdb_database}/_design/#{name}")
diff --git a/chef/spec/unit/couchdb_spec.rb b/chef/spec/unit/couchdb_spec.rb
index cc96a507d1..0d4d48353a 100644
--- a/chef/spec/unit/couchdb_spec.rb
+++ b/chef/spec/unit/couchdb_spec.rb
@@ -101,11 +101,6 @@ describe Chef::CouchDB do
@couchdb.create_design_document("bob", @mock_data)
end
- it "should create the database if it does not exist" do
- @couchdb.should_receive(:create_db).and_return(true)
- do_create_design_document
- end
-
it "should fetch the existing design document" do
@rest.should_receive(:get_rest).with("chef/_design/bob")
do_create_design_document