]> gitweb.fluxo.info Git - puppet-mysql.git/commitdiff
Updating mysql_grant type with changes from the shared/riseup mysql module
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 26 Jan 2013 14:56:03 +0000 (12:56 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 26 Jan 2013 14:56:03 +0000 (12:56 -0200)
lib/puppet/type/mysql_grant.rb

index 29ae22231fc9634dac605a832e70e621eed5a3e7..c6311e571ec930a5aaa3f3adbadfd31da4de3b42 100644 (file)
@@ -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]