summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/mysql_grant/mysql.rb
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_grant/mysql.rb
parent59fe3f1d51aa0ac1c5fd7029ecce7da7e1c6aafd (diff)
downloadpuppet-mysql-adapt-to-jessie.tar.gz
puppet-mysql-adapt-to-jessie.tar.bz2
add conf file to provider commandsadapt-to-jessie
Diffstat (limited to 'lib/puppet/provider/mysql_grant/mysql.rb')
-rw-r--r--lib/puppet/provider/mysql_grant/mysql.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/puppet/provider/mysql_grant/mysql.rb b/lib/puppet/provider/mysql_grant/mysql.rb
index f666788..74aa2a9 100644
--- a/lib/puppet/provider/mysql_grant/mysql.rb
+++ b/lib/puppet/provider/mysql_grant/mysql.rb
@@ -55,7 +55,7 @@ Puppet::Type.type(:mysql_grant).provide(:mysql) do
commands :mysqladmin => '/usr/bin/mysqladmin'
def mysql_flush
- mysqladmin "flush-privileges"
+ mysqladmin "--defaults-extra-file=/root/.my.cnf", "flush-privileges"
end
# this parses the
@@ -101,15 +101,15 @@ Puppet::Type.type(:mysql_grant).provide(:mysql) do
name = split_name(@resource[:name])
case name[:type]
when :user
- mysql "mysql", "-e", "INSERT INTO user (host, user) VALUES ('%s', '%s')" % [
+ mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-e", "INSERT INTO user (host, user) VALUES ('%s', '%s')" % [
name[:host], name[:user],
]
when :db
- mysql "mysql", "-e", "INSERT INTO db (host, user, db) VALUES ('%s', '%s', '%s')" % [
+ mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-e", "INSERT INTO db (host, user, db) VALUES ('%s', '%s', '%s')" % [
name[:host], name[:user], name[:db],
]
when :column
- mysql "mysql", "-e", "INSERT INTO columns_priv (host, user, db, table, column_name) VALUES ('%s', '%s', '%s', '%s', '%s')" % [
+ mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-e", "INSERT INTO columns_priv (host, user, db, table, column_name) VALUES ('%s', '%s', '%s', '%s', '%s')" % [
name[:host], name[:user], name[:db], name[:table], name[:column],
]
end
@@ -118,7 +118,7 @@ Puppet::Type.type(:mysql_grant).provide(:mysql) do
end
def destroy
- mysql "mysql", "-e", "REVOKE ALL ON '%s'.* FROM '%s@%s'" % [ @resource[:privileges], @resource[:database], @resource[:name], @resource[:host] ]
+ mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-e", "REVOKE ALL ON '%s'.* FROM '%s@%s'" % [ @resource[:privileges], @resource[:database], @resource[:name], @resource[:host] ]
end
def row_exists?
@@ -130,7 +130,7 @@ Puppet::Type.type(:mysql_grant).provide(:mysql) do
if name[:type] == :column
fields << :column
end
- not mysql( "mysql", "-NBe", 'SELECT "1" FROM %s WHERE %s' % [ name[:type], fields.map do |f| "%s = '%s'" % [f, name[f]] end.join(' AND ')]).empty?
+ not mysql("--defaults-extra-file=/root/.my.cnf", "mysql", "-NBe", 'SELECT "1" FROM %s WHERE %s' % [ name[:type], fields.map do |f| "%s = '%s'" % [f, name[f]] end.join(' AND ')]).empty?
end
def all_privs_set?
@@ -156,15 +156,15 @@ Puppet::Type.type(:mysql_grant).provide(:mysql) do
case name[:type]
when :user
- privs = mysql "mysql", "-Be", 'select * from user where user="%s" and host="%s"' % [ name[:user], name[:host] ]
+ privs = mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-Be", 'select * from user where user="%s" and host="%s"' % [ name[:user], name[:host] ]
when :db
- privs = mysql "mysql", "-Be", 'select * from db where user="%s" and host="%s" and db="%s"' % [ name[:user], name[:host], name[:db] ]
+ privs = mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-Be", 'select * from db where user="%s" and host="%s" and db="%s"' % [ name[:user], name[:host], name[:db] ]
when :tables_priv
- privs = mysql "mysql", "-NBe", 'select Table_priv from tables_priv where User="%s" and Host="%s" and Db="%s" and Table_name="%s"' % [ name[:user], name[:host], name[:db], name[:table_name] ]
+ privs = mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-NBe", 'select Table_priv from tables_priv where User="%s" and Host="%s" and Db="%s" and Table_name="%s"' % [ name[:user], name[:host], name[:db], name[:table_name] ]
privs = privs.chomp.downcase
return privs
when :columns
- privs = mysql "mysql", "-Be", 'select * from columns_priv where User="%s" and Host="%s" and Db="%s" and Table_name="%s" and Column_name="%s"' % [ name[:user], name[:host], name[:db], name[:table], name[:column] ]
+ privs = mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-Be", 'select * from columns_priv where User="%s" and Host="%s" and Db="%s" and Table_name="%s" and Column_name="%s"' % [ name[:user], name[:host], name[:db], name[:table], name[:column] ]
end
if privs.match(/^$/)
@@ -213,7 +213,7 @@ Puppet::Type.type(:mysql_grant).provide(:mysql) do
if !revoke.empty?
#puts "Revoking table privs: ", revoke
- mysql "mysql", "-e", "REVOKE %s ON %s.%s FROM '%s'@'%s'" % [ revoke.join(", "), name[:db], name[:table_name], name[:user], name[:host] ]
+ mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-e", "REVOKE %s ON %s.%s FROM '%s'@'%s'" % [ revoke.join(", "), name[:db], name[:table_name], name[:user], name[:host] ]
end
set = privs - currently_set
@@ -245,7 +245,7 @@ Puppet::Type.type(:mysql_grant).provide(:mysql) do
#puts "stmt:", stmt
if !set.empty?
- mysql "mysql", "-Be", stmt
+ mysql "--defaults-extra-file=/root/.my.cnf", "mysql", "-Be", stmt
mysql_flush
end
end