Skip to content
Browse files

COOK-820, guard applicable node.save calls with check for chef-solo

  • Loading branch information...
1 parent b69d81a commit 2ade5943ff6cdfa9ebb8e4a3072ebf56acc3311d @jtimberman jtimberman committed Nov 10, 2011
Showing with 11 additions and 8 deletions.
  1. +1 −1 drbd/recipes/default.rb
  2. +3 −2 sql_server/recipes/server.rb
  3. +7 −5 wordpress/recipes/default.rb
View
2 drbd/recipes/default.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#prime the search to avoid 2 masters
-node.save
+node.save unless Chef::Config[:solo]
package "drbd8-utils" do
action :install
View
5 sql_server/recipes/server.rb
@@ -24,7 +24,8 @@
# generate and set a password for the 'sa' super user
node.set_unless['sql_server']['server_sa_password'] = secure_password
-node.save # force a save so we don't lose our generated password on a failed chef run
+# force a save so we don't lose our generated password on a failed chef run
+node.save unless Chef::Config[:solo]
config_file_path = win_friendly_path(File.join(Chef::Config[:file_cache_path], "ConfigurationFile.ini"))
@@ -71,4 +72,4 @@
notifies :restart, "service[#{service_name}]", :immediately
end
-include_recipe 'sql_server::client'
+include_recipe 'sql_server::client'
View
12 wordpress/recipes/default.rb
@@ -80,15 +80,17 @@
m = Mysql.new("localhost", "root", node['mysql']['server_root_password'])
m.list_dbs.include?(node['wordpress']['db']['database'])
end
- notifies :create, "ruby_block[save node data]", :immediately
+ notifies :create, "ruby_block[save node data]", :immediately unless Chef::Config[:solo]
end
# save node data after writing the MYSQL root password, so that a failed chef-client run that gets this far doesn't cause an unknown password to get applied to the box without being saved in the node data.
-ruby_block "save node data" do
- block do
- node.save
+unless Chef::Config[:solo]
+ ruby_block "save node data" do
+ block do
+ node.save
+ end
+ action :create
end
- action :create
end
log "Navigate to 'http://#{server_fqdn}/wp-admin/install.php' to complete wordpress installation" do

0 comments on commit 2ade594

Please sign in to comment.
Something went wrong with that request. Please try again.