summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-26 12:56:03 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-26 12:56:03 -0200
commit36df5326bf1cd3cccc52589390b0de1cc71ddd30 (patch)
tree8202cd751a5be15aa1149d653e313b853efac4f3
parent0c56fe190749cb96e152e41d9c9788c7395cfa3c (diff)
downloadpuppet-mysql-36df5326bf1cd3cccc52589390b0de1cc71ddd30.tar.gz
puppet-mysql-36df5326bf1cd3cccc52589390b0de1cc71ddd30.tar.bz2
Updating mysql_grant type with changes from the shared/riseup mysql module
-rw-r--r--lib/puppet/type/mysql_grant.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/type/mysql_grant.rb b/lib/puppet/type/mysql_grant.rb
index 29ae222..c6311e5 100644
--- a/lib/puppet/type/mysql_grant.rb
+++ b/lib/puppet/type/mysql_grant.rb
@@ -1,7 +1,19 @@
# This has to be a separate type to enable collecting
Puppet::Type.newtype(:mysql_grant) do
@doc = "Manage a database user's rights."
+
#ensurable
+ autorequire(:service) { 'mysqld' }
+
+ autorequire :mysql_table do
+ reqs = []
+ matches = self[:name].match(/^([^@]*)@([^\/]*)\/(.+)\/(.+)$/)
+ unless matches.nil?
+ reqs << matches[4]
+ end
+ # puts "Autoreq: '%s'" % reqs.join(" ")
+ reqs
+ end
autorequire :mysql_db do
# puts "Starting db autoreq for %s" % self[:name]