summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/mysql_user/mysql.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/provider/mysql_user/mysql.rb')
-rw-r--r--lib/puppet/provider/mysql_user/mysql.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/puppet/provider/mysql_user/mysql.rb b/lib/puppet/provider/mysql_user/mysql.rb
index 3051681..52c9f0a 100644
--- a/lib/puppet/provider/mysql_user/mysql.rb
+++ b/lib/puppet/provider/mysql_user/mysql.rb
@@ -12,7 +12,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
def self.instances
users = []
- cmd = "#{command(:mysql)} mysql -NBe 'select concat(user, \"@\", host), password from user'"
+ cmd = "#{command(:mysql)} --defaults-extra-file=/root/.my.cnf mysql -NBe 'select concat(user, \"@\", host), password from user'"
execpipe(cmd) do |process|
process.each do |line|
users << new( query_line_to_hash(line) )
@@ -31,13 +31,13 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
end
def mysql_flush
- mysqladmin "flush-privileges"
+ mysqladmin "--defaults-extra-file=/root/.my.cnf", "flush-privileges"
end
def query
result = {}
- cmd = "#{command(:mysql)} mysql -NBe 'select concat(user, \"@\", host), password from user where concat(user, \"@\", host) = \"%s\"'" % @resource[:name]
+ cmd = "#{command(:mysql)} --defaults-extra-file=/root/.my.cnf mysql -NBe 'select concat(user, \"@\", host), password from user where concat(user, \"@\", host) = \"%s\"'" % @resource[:name]
execpipe(cmd) do |process|
process.each do |line|
unless result.empty?
@@ -51,17 +51,17 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
end
def create
- mysql "mysql", "-e", "create user '%s' identified by PASSWORD '%s'" % [ @resource[:name].sub("@", "'@'"), @resource.should(:password_hash) ]
+ mysql "--defaults-extra-file=/root/.my.cnf", "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 "--defaults-extra-file=/root/.my.cnf", "mysql", "-e", "drop user '%s'" % @resource[:name].sub("@", "'@'")
mysql_flush
end
def exists?
- not mysql("mysql", "-NBe", "select '1' from user where CONCAT(user, '@', host) = '%s'" % @resource[:name]).empty?
+ not mysql("--defaults-extra-file=/root/.my.cnf", "mysql", "-NBe", "select '1' from user where CONCAT(user, '@', host) = '%s'" % @resource[:name]).empty?
end
def password_hash
@@ -69,7 +69,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql,
end
def password_hash=(string)
- mysql "mysql", "-e", "SET PASSWORD FOR '%s' = '%s'" % [ @resource[:name].sub("@", "'@'"), string ]
+ mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-e", "SET PASSWORD FOR '%s' = '%s'" % [ @resource[:name].sub("@", "'@'"), string ]
mysql_flush
end
end