summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/mysql_user
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2015-06-05 15:53:26 -0300
committerdrebs <drebs@riseup.net>2015-06-05 15:53:26 -0300
commit494241a212d7db9cf576adf9b06c01458e65ecb5 (patch)
treed7fb652f7332ca277a439518cd293aa38ba06e50 /lib/puppet/provider/mysql_user
parent59fe3f1d51aa0ac1c5fd7029ecce7da7e1c6aafd (diff)
downloadpuppet-mysql-494241a212d7db9cf576adf9b06c01458e65ecb5.tar.gz
puppet-mysql-494241a212d7db9cf576adf9b06c01458e65ecb5.tar.bz2
add conf file to provider commandsadapt-to-jessie
Diffstat (limited to 'lib/puppet/provider/mysql_user')
-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