From 494241a212d7db9cf576adf9b06c01458e65ecb5 Mon Sep 17 00:00:00 2001 From: drebs Date: Fri, 5 Jun 2015 15:53:26 -0300 Subject: add conf file to provider commands --- lib/puppet/provider/mysql_database/mysql.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/puppet/provider/mysql_database') diff --git a/lib/puppet/provider/mysql_database/mysql.rb b/lib/puppet/provider/mysql_database/mysql.rb index 18b0a5a..fe21b79 100644 --- a/lib/puppet/provider/mysql_database/mysql.rb +++ b/lib/puppet/provider/mysql_database/mysql.rb @@ -11,7 +11,7 @@ Puppet::Type.type(:mysql_database).provide(:mysql, def self.instances dbs = [] - cmd = "#{command(:mysql)} mysql -NBe 'show databases'" + cmd = "#{command(:mysql)} --defaults-extra-file=/root/.my.cnf mysql -NBe 'show databases'" execpipe(cmd) do |process| process.each do |line| dbs << new( { :ensure => :present, :name => line.chomp } ) @@ -26,7 +26,7 @@ Puppet::Type.type(:mysql_database).provide(:mysql, :ensure => :absent } - cmd = "#{command(:mysql)} mysql -NBe 'show databases'" + cmd = "#{command(:mysql)} --defaults-extra-file=/root/.my.cnf mysql -NBe 'show databases'" execpipe(cmd) do |process| process.each do |line| if line.chomp.eql?(@resource[:name]) @@ -38,14 +38,14 @@ Puppet::Type.type(:mysql_database).provide(:mysql, end def create - mysqladmin "create", @resource[:name] + mysqladmin "--defaults-extra-file=/root/.my.cnf", "create", @resource[:name] end def destroy - mysqladmin "-f", "drop", @resource[:name] + mysqladmin "--defaults-extra-file=/root/.my.cnf", "-f", "drop", @resource[:name] end def exists? - if mysql("mysql", "-NBe", "show databases").match(/^#{@resource[:name]}$/) + if mysql("--defaults-extra-file=/root/.my.cnf ", "mysql", "-NBe", "show databases").match(/^#{@resource[:name]}$/) true else false -- cgit v1.2.3