modules/mysql/lib/puppet/provider/mysql_user/mysql.rb in freighthop-0.3.3 vs modules/mysql/lib/puppet/provider/mysql_user/mysql.rb in freighthop-0.4.0

- old
+ new

@@ -2,9 +2,21 @@ Puppet::Type.type(:mysql_user).provide(:mysql, :parent => Puppet::Provider::Mysql) do desc 'manage users for a mysql database.' commands :mysql => 'mysql' + # Optional defaults file + def self.defaults_file + if File.file?("#{Facter.value(:root_home)}/.my.cnf") + "--defaults-file=#{Facter.value(:root_home)}/.my.cnf" + else + nil + end + end + def defaults_file + self.class.defaults_file + end + # Build a property_hash containing all the discovered information about MySQL # users. def self.instances users = mysql([defaults_file, '-NBe', "SELECT CONCAT(User, '@',Host) AS User FROM mysql.user"].compact).split("\n")