Skip to content

Commit

Permalink
Merge pull request #547 from rayl/master
Browse files Browse the repository at this point in the history
Prevent ERROR 1008 in mysql_database provider
  • Loading branch information
igalic committed Jul 24, 2014
2 parents 70cafdc + 548952a commit 94e488f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/mysql_database/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def create
end

def destroy
mysql([defaults_file, '-NBe', "drop database `#{@resource[:name]}`"].compact)
mysql([defaults_file, '-NBe', "drop database if exists `#{@resource[:name]}`"].compact)

@property_hash.clear
exists? ? (return false) : (return true)
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/provider/mysql_database/mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

describe 'destroy' do
it 'removes a database if present' do
provider.expects(:mysql).with([defaults_file, '-NBe', "drop database `#{resource[:name]}`"])
provider.expects(:mysql).with([defaults_file, '-NBe', "drop database if exists `#{resource[:name]}`"])
provider.expects(:exists?).returns(false)
provider.destroy.should be_truthy
end
Expand Down

0 comments on commit 94e488f

Please sign in to comment.