diff options
Diffstat (limited to 'plugins/puppet/type/mysql_grant.rb')
-rw-r--r-- | plugins/puppet/type/mysql_grant.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/puppet/type/mysql_grant.rb b/plugins/puppet/type/mysql_grant.rb index 8a858e6..0d31df3 100644 --- a/plugins/puppet/type/mysql_grant.rb +++ b/plugins/puppet/type/mysql_grant.rb @@ -3,12 +3,25 @@ Puppet::Type.newtype(:mysql_grant) do @doc = "Manage a database user's rights." #ensurable + autorequire :mysql_db do + # puts "Starting db autoreq for %s" % self[:name] + reqs = [] + matches = self[:name].match(/^([^@]+)@([^\/]+)\/(.+)$/) + unless matches.nil? + reqs << matches[3] + end + # puts "Autoreq: '%s'" % reqs.join(" ") + reqs + end + autorequire :mysql_user do + # puts "Starting user autoreq for %s" % self[:name] reqs = [] - matches = self[:name].match(/^([^@]+)@([^\/]+)$/) + matches = self[:name].match(/^([^@]+)@([^\/]+).*$/) unless matches.nil? - reqs << "%s@%s" % [ matches[0], matches[1] ] + reqs << "%s@%s" % [ matches[1], matches[2] ] end + # puts "Autoreq: '%s'" % reqs.join(" ") reqs end |