summaryrefslogtreecommitdiffstats
path: root/plugins/puppet/provider/mysql_user/mysql.rb
diff options
context:
space:
mode:
authorroot <root@puppetmaster.black.co.at>2007-10-18 11:54:23 +0200
committerroot <root@puppetmaster.black.co.at>2007-10-18 11:54:23 +0200
commitee94a2a56c73dc54439b34a58320c8c233ccdbd7 (patch)
tree1b3bd95539cf891c4f8e3d8fd78f1077a20b9f8a /plugins/puppet/provider/mysql_user/mysql.rb
parent813025c80066504345e72ead609075751fbc5b80 (diff)
downloadpuppet-mysql-ee94a2a56c73dc54439b34a58320c8c233ccdbd7.tar.gz
puppet-mysql-ee94a2a56c73dc54439b34a58320c8c233ccdbd7.tar.xz
puppet-mysql-ee94a2a56c73dc54439b34a58320c8c233ccdbd7.zip
mysql: flush privileges, autorequire, minor adjustments
This commit executes a mysqladmin flush-privileges after every modification of users or grants, thereby enabling mysql to actually look at the changes too. grants now autorequire the appropriate db and user adjustet my site.pp for new types
Diffstat (limited to 'plugins/puppet/provider/mysql_user/mysql.rb')
-rw-r--r--plugins/puppet/provider/mysql_user/mysql.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/puppet/provider/mysql_user/mysql.rb b/plugins/puppet/provider/mysql_user/mysql.rb
index 8238620..adc46c3 100644
--- a/plugins/puppet/provider/mysql_user/mysql.rb
+++ b/plugins/puppet/provider/mysql_user/mysql.rb
@@ -6,6 +6,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
desc "Use mysql as database."
commands :mysql => '/usr/bin/mysql'
+ commands :mysqladmin => '/usr/bin/mysqladmin'
# retrieve the current set of mysql users
def self.instances
@@ -29,6 +30,10 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
}
end
+ def mysql_flush
+ mysqladmin "flush-privileges"
+ end
+
def query
result = {}
@@ -47,10 +52,12 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
def create
mysql "mysql", "-e", "create user '%s' identified by PASSWORD '%s'" % [ @resource[:name].sub("@", "'@'"), @resource.should(:password_hash) ]
+ mysql_flush
end
def destroy
mysql "mysql", "-e", "drop user '%s'" % @resource[:name].sub("@", "'@'")
+ mysql_flush
end
def exists?
@@ -63,6 +70,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
def password_hash=(string)
mysql "mysql", "-e", "SET PASSWORD FOR '%s' = '%s'" % [ @resource[:name].sub("@", "'@'"), string ]
+ mysql_flush
end
end