summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]