Browse files

Make adding mysql user action idempotent. Fixes ymainier/vagrant-lamp#4.

  • Loading branch information...
1 parent 9e075fd commit 3df6dfdd3b6b3348452b955e6162f9017cc23618 @ciastek ciastek committed with Jun 1, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 cookbooks/vagrant_main/recipes/default.rb
View
1 cookbooks/vagrant_main/recipes/default.rb
@@ -54,5 +54,6 @@
"GRANT ALL PRIVILEGES ON *.* TO 'myadmin'@'%' WITH GRANT OPTION;\" " +
"mysql"
action :run
+ only_if { `/usr/bin/mysql -u root -p#{node[:mysql][:server_root_password]} -D mysql -r -N -e \"SELECT COUNT(*) FROM user where user='myadmin' and host='localhost'"`.to_i == 0 }
ignore_failure true
end

0 comments on commit 3df6dfd

Please sign in to comment.